From 5b40845afe22fb0e2dad84a1dbad5d2dadf009b1 Mon Sep 17 00:00:00 2001 From: Matthew Whitworth Date: Mon, 21 Oct 2019 16:39:03 +0100 Subject: [PATCH 001/648] add test and fix for string literal case (#10578) --- .../src/transformer-legacy.js | 5 +++- .../string-literal-properties/exec.js | 29 +++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 packages/babel-plugin-proposal-decorators/test/fixtures/legacy-class-prototype-properties/string-literal-properties/exec.js diff --git a/packages/babel-plugin-proposal-decorators/src/transformer-legacy.js b/packages/babel-plugin-proposal-decorators/src/transformer-legacy.js index 53cfe47df91d..d6160db14c55 100644 --- a/packages/babel-plugin-proposal-decorators/src/transformer-legacy.js +++ b/packages/babel-plugin-proposal-decorators/src/transformer-legacy.js @@ -281,7 +281,10 @@ export default { path.replaceWith( t.callExpression(state.addHelper("initializerDefineProperty"), [ t.cloneNode(path.get("left.object").node), - t.stringLiteral(path.get("left.property").node.name), + t.stringLiteral( + path.get("left.property").node.name || + path.get("left.property").node.value, + ), t.cloneNode(path.get("right.arguments")[0].node), t.cloneNode(path.get("right.arguments")[1].node), ]), diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/legacy-class-prototype-properties/string-literal-properties/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/legacy-class-prototype-properties/string-literal-properties/exec.js new file mode 100644 index 000000000000..c3e4ca274083 --- /dev/null +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/legacy-class-prototype-properties/string-literal-properties/exec.js @@ -0,0 +1,29 @@ +function dec(target, name, descriptor) { + expect(target).toBeTruthy(); + expect(typeof name).toBe("string"); + expect(typeof descriptor).toBe("object"); + + target.decoratedProps = (target.decoratedProps || []).concat([name]); + + return descriptor; +} + +class Example { + @dec "a-prop"; +} + +let inst = new Example(); + +expect(Example.prototype).toHaveProperty("decoratedProps"); +expect(inst.decoratedProps).toEqual([ + "a-prop" +]); + +expect(inst).toHaveProperty("a-prop"); +expect(inst["a-prop"]).toBeUndefined(); + +const descs = Object.getOwnPropertyDescriptors(inst); + +expect(descs["a-prop"].enumerable).toBeTruthy(); +expect(descs["a-prop"].writable).toBeTruthy(); +expect(descs["a-prop"].configurable).toBeTruthy(); From 1770dace348da8b5833ff793a1f5c92d9f12052c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hu=C3=A1ng=20J=C3=B9nli=C3=A0ng?= Date: Tue, 22 Oct 2019 18:23:20 -0400 Subject: [PATCH 002/648] chore: test against Node.js 13 (#10591) --- .travis.yml | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 4b897a8e1a1a..0fff1345e8ee 100644 --- a/.travis.yml +++ b/.travis.yml @@ -27,8 +27,8 @@ matrix: include: - node_js: "node" env: JOB=lint - # We test the latest version on circleci - - node_js: "11" + # We test the Node.js 12 on circleci + - node_js: "13" # Move `windows` build to be the third since it is slow - os: windows node_js: "node" diff --git a/package.json b/package.json index 1fbd8da7d90c..a420748f1135 100644 --- a/package.json +++ b/package.json @@ -76,7 +76,7 @@ "@lerna/**/@lerna/collect-updates": "https://github.com/babel/lerna.git#babel-collect-updates" }, "engines": { - "node": ">= 6.9.0 < 13.0.0", + "node": ">= 6.9.0 < 14.0.0", "npm": ">= 3.x <= 6.x", "yarn": ">=0.27.5 || >=1.0.0-20170811" }, From 562b6c3bbbebfa3972799bfa871275b80502517f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hu=C3=A1ng=20J=C3=B9nli=C3=A0ng?= Date: Tue, 22 Oct 2019 21:35:02 -0400 Subject: [PATCH 003/648] chore: replace outdated travis-ci.org badges [ci skip] (#10593) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 51315b7a7e12..190b93622139 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ v6 npm Downloads

- Travis Status + Travis Status CircleCI Status Coverage Status Slack Status From fce1b741054ef52d0c9710e6dfd8ec78b3c6e618 Mon Sep 17 00:00:00 2001 From: Brian Ng Date: Thu, 24 Oct 2019 08:28:01 -0500 Subject: [PATCH 004/648] Test node@13 on CircleCI (#10600) --- .circleci/config.yml | 3 +-- .travis.yml | 14 +++++++------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index dfa4bf21bf96..691613f6de4b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -43,7 +43,7 @@ jobs: test: working_directory: ~/babel docker: - - image: circleci/node:12 + - image: circleci/node:13 steps: - checkout - restore-cache: *restore-yarn-cache @@ -107,7 +107,6 @@ jobs: cat ~/test262.tap | $(npm bin)/tap-mocha-reporter spec || true <<: *test262_workdir - workflows: version: 2 test: diff --git a/.travis.yml b/.travis.yml index 0fff1345e8ee..d9fce0df2bd8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -27,16 +27,16 @@ matrix: include: - node_js: "node" env: JOB=lint - # We test the Node.js 12 on circleci - - node_js: "13" - # Move `windows` build to be the third since it is slow + # We test the latest version on circleci + - node_js: "12" + # Move `windows` build to be the third since it is slow - os: windows node_js: "node" env: - - JOB=test - # https://travis-ci.community/t/build-doesnt-finish-after-completing-tests/288/9 - - YARN_GPG=no - # Continue node_js matrix + - JOB=test + # https://travis-ci.community/t/build-doesnt-finish-after-completing-tests/288/9 + - YARN_GPG=no + # Continue node_js matrix - node_js: "6" - node_js: "10" - node_js: "8" From 43065a9e24b42cf34a6da48b62576ab5909dcae2 Mon Sep 17 00:00:00 2001 From: ExE Boss <3889017+ExE-Boss@users.noreply.github.com> Date: Thu, 24 Oct 2019 23:14:44 +0200 Subject: [PATCH 005/648] =?UTF-8?q?fix(babel=E2=80=91helpers/interopRequir?= =?UTF-8?q?eWildcard):=20Avoid=C2=A0double=C2=A0nullis=E2=80=A6=20(#10585)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix(babel‑helpers/interopRequireWildcard): Avoid double nullish check * Update fixtures --- packages/babel-helpers/src/helpers.js | 22 +++++++++---------- .../misc/copy-getters-setters-star/output.js | 2 +- .../output.js | 2 +- .../dynamic-import/modules-amd/output.js | 2 +- .../dynamic-import/modules-cjs/output.js | 2 +- 5 files changed, 14 insertions(+), 16 deletions(-) diff --git a/packages/babel-helpers/src/helpers.js b/packages/babel-helpers/src/helpers.js index 32cbee4fc000..23416e002296 100644 --- a/packages/babel-helpers/src/helpers.js +++ b/packages/babel-helpers/src/helpers.js @@ -630,18 +630,16 @@ helpers.interopRequireWildcard = helper("7.0.0-beta.0")` } var newObj = {}; - if (obj != null) { - var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; - for (var key in obj) { - if (Object.prototype.hasOwnProperty.call(obj, key)) { - var desc = hasPropertyDescriptor - ? Object.getOwnPropertyDescriptor(obj, key) - : null; - if (desc && (desc.get || desc.set)) { - Object.defineProperty(newObj, key, desc); - } else { - newObj[key] = obj[key]; - } + var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) { + var desc = hasPropertyDescriptor + ? Object.getOwnPropertyDescriptor(obj, key) + : null; + if (desc && (desc.get || desc.set)) { + Object.defineProperty(newObj, key, desc); + } else { + newObj[key] = obj[key]; } } } diff --git a/packages/babel-plugin-transform-modules-commonjs/test/fixtures/misc/copy-getters-setters-star/output.js b/packages/babel-plugin-transform-modules-commonjs/test/fixtures/misc/copy-getters-setters-star/output.js index f17e16f9dacf..015566b41f7a 100644 --- a/packages/babel-plugin-transform-modules-commonjs/test/fixtures/misc/copy-getters-setters-star/output.js +++ b/packages/babel-plugin-transform-modules-commonjs/test/fixtures/misc/copy-getters-setters-star/output.js @@ -11,4 +11,4 @@ exports.foo = foo; function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; } -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; if (obj != null) { var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } diff --git a/packages/babel-preset-env/test/fixtures/dynamic-import/auto-esm-unsupported-import-unsupported/output.js b/packages/babel-preset-env/test/fixtures/dynamic-import/auto-esm-unsupported-import-unsupported/output.js index d71f23bfef4b..a7f2edabb858 100644 --- a/packages/babel-preset-env/test/fixtures/dynamic-import/auto-esm-unsupported-import-unsupported/output.js +++ b/packages/babel-preset-env/test/fixtures/dynamic-import/auto-esm-unsupported-import-unsupported/output.js @@ -4,7 +4,7 @@ function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterat function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; } -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; if (obj != null) { var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } Promise.resolve().then(function () { return _interopRequireWildcard(require("foo")); diff --git a/packages/babel-preset-env/test/fixtures/dynamic-import/modules-amd/output.js b/packages/babel-preset-env/test/fixtures/dynamic-import/modules-amd/output.js index 000247047cd4..f1ca949bbcb1 100644 --- a/packages/babel-preset-env/test/fixtures/dynamic-import/modules-amd/output.js +++ b/packages/babel-preset-env/test/fixtures/dynamic-import/modules-amd/output.js @@ -3,7 +3,7 @@ define(["require"], function (_require) { function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; } - function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; if (obj != null) { var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } new Promise(function (_resolve, _reject) { return _require(["foo"], function (imported) { diff --git a/packages/babel-preset-env/test/fixtures/dynamic-import/modules-cjs/output.js b/packages/babel-preset-env/test/fixtures/dynamic-import/modules-cjs/output.js index d71f23bfef4b..a7f2edabb858 100644 --- a/packages/babel-preset-env/test/fixtures/dynamic-import/modules-cjs/output.js +++ b/packages/babel-preset-env/test/fixtures/dynamic-import/modules-cjs/output.js @@ -4,7 +4,7 @@ function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterat function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; } -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; if (obj != null) { var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } Promise.resolve().then(function () { return _interopRequireWildcard(require("foo")); From 9ada30c2078d4e98c275e0e204ddfae64f3eba48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Burzy=C5=84ski?= Date: Sun, 27 Oct 2019 20:09:03 +0100 Subject: [PATCH 006/648] Use .find instead of .filter to get targetPath in ImportInjector (#10608) --- packages/babel-helper-module-imports/src/import-injector.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/babel-helper-module-imports/src/import-injector.js b/packages/babel-helper-module-imports/src/import-injector.js index 0e38f9188ab9..59375b6c9cac 100644 --- a/packages/babel-helper-module-imports/src/import-injector.js +++ b/packages/babel-helper-module-imports/src/import-injector.js @@ -417,10 +417,10 @@ export default class ImportInjector { node._blockHoist = blockHoist; }); - const targetPath = this._programPath.get("body").filter(p => { + const targetPath = this._programPath.get("body").find(p => { const val = p.node._blockHoist; return Number.isFinite(val) && val < 4; - })[0]; + }); if (targetPath) { targetPath.insertBefore(statements); From 01927babe2813daf9cd47c36cd99218b947692c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hu=C3=A1ng=20J=C3=B9nli=C3=A0ng?= Date: Tue, 29 Oct 2019 11:23:59 -0400 Subject: [PATCH 007/648] chore: update web.immediate support fixtures (#10612) --- .../fixtures/debug/entry-corejs3-specific-targets/stdout.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-specific-targets/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-specific-targets/stdout.txt index a1a20c2c2999..cda9f2bec5f3 100644 --- a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-specific-targets/stdout.txt +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-specific-targets/stdout.txt @@ -246,7 +246,7 @@ Using polyfills with `entry` option: es.weak-set { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } web.dom-collections.for-each { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } web.dom-collections.iterator { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - web.immediate { "chrome":"54", "firefox":"49", "ios":"9", "safari":"7" } + web.immediate { "chrome":"54", "edge":"13", "firefox":"49", "ios":"9", "safari":"7" } web.queue-microtask { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } web.url { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } web.url.to-json { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } From b6ef9689b26b54ff9d7ef80780638386f056fbd2 Mon Sep 17 00:00:00 2001 From: gr <13141462+gonzarodriguezt@users.noreply.github.com> Date: Tue, 29 Oct 2019 13:56:05 -0300 Subject: [PATCH 008/648] [parser] Parse only modifiers of actual methods (#10594) * Parse only modifiers of actual methods * Throw question token if is used before the real name --- packages/babel-parser/src/parser/statement.js | 5 + .../class/async-named-properties/input.ts | 4 + .../class/async-named-properties/output.json | 221 ++++++++++++++++++ .../class/optional-async-error/input.js | 4 + .../class/optional-async-error/options.json | 3 + 5 files changed, 237 insertions(+) create mode 100644 packages/babel-parser/test/fixtures/typescript/class/async-named-properties/input.ts create mode 100644 packages/babel-parser/test/fixtures/typescript/class/async-named-properties/output.json create mode 100644 packages/babel-parser/test/fixtures/typescript/class/optional-async-error/input.js create mode 100644 packages/babel-parser/test/fixtures/typescript/class/optional-async-error/options.json diff --git a/packages/babel-parser/src/parser/statement.js b/packages/babel-parser/src/parser/statement.js index 81e310debd7b..d926d51c1ef0 100644 --- a/packages/babel-parser/src/parser/statement.js +++ b/packages/babel-parser/src/parser/statement.js @@ -1348,6 +1348,7 @@ export default class StatementParser extends ExpressionParser { const isPrivate = key.type === "PrivateName"; // Check the key is not a computed expression or string literal. const isSimple = key.type === "Identifier"; + const maybeQuestionTokenStart = this.state.start; this.parsePostMemberNameModifiers(publicMember); @@ -1403,6 +1404,10 @@ export default class StatementParser extends ExpressionParser { // an async method const isGenerator = this.eat(tt.star); + if (publicMember.optional) { + this.unexpected(maybeQuestionTokenStart); + } + method.kind = "method"; // The so-called parsed name would have been "async": get the real name. this.parseClassPropertyName(method); diff --git a/packages/babel-parser/test/fixtures/typescript/class/async-named-properties/input.ts b/packages/babel-parser/test/fixtures/typescript/class/async-named-properties/input.ts new file mode 100644 index 000000000000..1e0af756a626 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/class/async-named-properties/input.ts @@ -0,0 +1,4 @@ +class A { + async?(): void + async?: boolean +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/class/async-named-properties/output.json b/packages/babel-parser/test/fixtures/typescript/class/async-named-properties/output.json new file mode 100644 index 000000000000..e0ac8a5907fa --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/class/async-named-properties/output.json @@ -0,0 +1,221 @@ +{ + "type": "File", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "TSDeclareMethod", + "start": 12, + "end": 26, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "static": false, + "key": { + "type": "Identifier", + "start": 12, + "end": 17, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 7 + }, + "identifierName": "async" + }, + "name": "async" + }, + "computed": false, + "optional": true, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "returnType": { + "type": "TSTypeAnnotation", + "start": 20, + "end": 26, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "typeAnnotation": { + "type": "TSVoidKeyword", + "start": 22, + "end": 26, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 16 + } + } + } + } + }, + { + "type": "ClassProperty", + "start": 29, + "end": 44, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 17 + } + }, + "static": false, + "key": { + "type": "Identifier", + "start": 29, + "end": 34, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 7 + }, + "identifierName": "async" + }, + "name": "async" + }, + "computed": false, + "optional": true, + "typeAnnotation": { + "type": "TSTypeAnnotation", + "start": 35, + "end": 44, + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 17 + } + }, + "typeAnnotation": { + "type": "TSBooleanKeyword", + "start": 37, + "end": 44, + "loc": { + "start": { + "line": 3, + "column": 10 + }, + "end": { + "line": 3, + "column": 17 + } + } + } + }, + "value": null + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/class/optional-async-error/input.js b/packages/babel-parser/test/fixtures/typescript/class/optional-async-error/input.js new file mode 100644 index 000000000000..01d6018a50d2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/class/optional-async-error/input.js @@ -0,0 +1,4 @@ +class B { } +class A extends B { + async? method(val: string): Promise; +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/class/optional-async-error/options.json b/packages/babel-parser/test/fixtures/typescript/class/optional-async-error/options.json new file mode 100644 index 000000000000..8dde42aa3f55 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/class/optional-async-error/options.json @@ -0,0 +1,3 @@ +{ + "throws": "Unexpected token (3:9)" +} \ No newline at end of file From f1bc6c4e18dbff8aad8e0b53d80c787c9dc9870c Mon Sep 17 00:00:00 2001 From: Simen Bekkhus Date: Tue, 29 Oct 2019 18:23:54 +0100 Subject: [PATCH 009/648] =?UTF-8?q?feat:=20if=20code=20frame=20error=20is?= =?UTF-8?q?=20on=20a=20single=20line,=20highlight=20the=20w=E2=80=A6=20(#1?= =?UTF-8?q?0361)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: if code frame error is on a single line, highlight the whole path * flow --- .../src/transformation/file/file.js | 23 +++++++++++++++---- .../src/transformation/plugin-pass.js | 10 ++------ 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/packages/babel-core/src/transformation/file/file.js b/packages/babel-core/src/transformation/file/file.js index 1aa6070c73c2..ed86452c64ff 100644 --- a/packages/babel-core/src/transformation/file/file.js +++ b/packages/babel-core/src/transformation/file/file.js @@ -19,6 +19,17 @@ const errorVisitor = { }, }; +export type NodeLocation = { + loc?: { + end?: { line: number, column: number }, + start: { line: number, column: number }, + }, + _loc?: { + end?: { line: number, column: number }, + start: { line: number, column: number }, + }, +}; + export default class File { _map: Map = new Map(); opts: Object; @@ -250,10 +261,7 @@ export default class File { } buildCodeFrameError( - node: ?{ - loc?: { start: { line: number, column: number } }, - _loc?: { start: { line: number, column: number } }, - }, + node: ?NodeLocation, msg: string, Error: typeof Error = SyntaxError, ): Error { @@ -285,6 +293,13 @@ export default class File { line: loc.start.line, column: loc.start.column + 1, }, + end: + loc.end && loc.start.line === loc.end.line + ? { + line: loc.end.line, + column: loc.end.column + 1, + } + : undefined, }, { highlightCode }, ); diff --git a/packages/babel-core/src/transformation/plugin-pass.js b/packages/babel-core/src/transformation/plugin-pass.js index 6e62c42bc786..e11f97804745 100644 --- a/packages/babel-core/src/transformation/plugin-pass.js +++ b/packages/babel-core/src/transformation/plugin-pass.js @@ -1,6 +1,7 @@ // @flow import type File from "./file/file"; +import type NodeLocation from "./file/file"; export default class PluginPass { _map: Map = new Map(); @@ -47,14 +48,7 @@ export default class PluginPass { return this.file.getModuleName(); } - buildCodeFrameError( - node: ?{ - loc?: { start: { line: number, column: number } }, - _loc?: { start: { line: number, column: number } }, - }, - msg: string, - Error?: typeof Error, - ) { + buildCodeFrameError(node: ?NodeLocation, msg: string, Error?: typeof Error) { return this.file.buildCodeFrameError(node, msg, Error); } } From 1d1fab4ea22ee84703e860dbe9360c94190fe26b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?= Date: Tue, 29 Oct 2019 18:27:54 +0100 Subject: [PATCH 010/648] [parser] Add support for private fields in TypeScript (#10483) * [parser] Add support for private fields in TypeScript * Fix flow --- .../src/plugins/typescript/index.js | 33 +- packages/babel-parser/src/types.js | 9 +- .../fixtures/typescript/class/options.json | 2 +- .../private-fields-modifier-abstract/input.ts | 3 + .../options.json | 3 + .../private-fields-modifier-private/input.ts | 3 + .../options.json | 3 + .../input.ts | 3 + .../options.json | 3 + .../private-fields-modifier-public/input.ts | 3 + .../options.json | 3 + .../private-fields-modifier-readonly/input.ts | 4 + .../output.json | 215 +++++++++ .../class/private-fields-static/input.ts | 4 + .../class/private-fields-static/output.json | 213 +++++++++ .../typescript/class/private-fields/input.ts | 7 + .../class/private-fields/output.json | 424 ++++++++++++++++++ 17 files changed, 931 insertions(+), 4 deletions(-) create mode 100644 packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-abstract/input.ts create mode 100644 packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-abstract/options.json create mode 100644 packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-private/input.ts create mode 100644 packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-private/options.json create mode 100644 packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-protected/input.ts create mode 100644 packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-protected/options.json create mode 100644 packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-public/input.ts create mode 100644 packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-public/options.json create mode 100644 packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-readonly/input.ts create mode 100644 packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-readonly/output.json create mode 100644 packages/babel-parser/test/fixtures/typescript/class/private-fields-static/input.ts create mode 100644 packages/babel-parser/test/fixtures/typescript/class/private-fields-static/output.json create mode 100644 packages/babel-parser/test/fixtures/typescript/class/private-fields/input.ts create mode 100644 packages/babel-parser/test/fixtures/typescript/class/private-fields/output.json diff --git a/packages/babel-parser/src/plugins/typescript/index.js b/packages/babel-parser/src/plugins/typescript/index.js index 8adf82f1568a..187dd540520a 100644 --- a/packages/babel-parser/src/plugins/typescript/index.js +++ b/packages/babel-parser/src/plugins/typescript/index.js @@ -1868,7 +1868,7 @@ export default (superClass: Class): Class => } parsePostMemberNameModifiers( - methodOrProp: N.ClassMethod | N.ClassProperty, + methodOrProp: N.ClassMethod | N.ClassProperty | N.ClassPrivateProperty, ): void { const optional = this.eat(tt.question); if (optional) methodOrProp.optional = true; @@ -2007,16 +2007,45 @@ export default (superClass: Class): Class => if (typeParameters) node.typeParameters = typeParameters; } - parseClassProperty(node: N.ClassProperty): N.ClassProperty { + parseClassPropertyAnnotation( + node: N.ClassProperty | N.ClassPrivateProperty, + ): void { if (!node.optional && this.eat(tt.bang)) { node.definite = true; } const type = this.tsTryParseTypeAnnotation(); if (type) node.typeAnnotation = type; + } + + parseClassProperty(node: N.ClassProperty): N.ClassProperty { + this.parseClassPropertyAnnotation(node); return super.parseClassProperty(node); } + parseClassPrivateProperty( + node: N.ClassPrivateProperty, + ): N.ClassPrivateProperty { + // $FlowIgnore + if (node.abstract) { + this.raise( + node.start, + "Private elements cannot have the 'abstract' modifier.", + ); + } + + // $FlowIgnore + if (node.accessibility) { + this.raise( + node.start, + `Private elements cannot have an accessibility modifier ('${node.accessibility}')`, + ); + } + + this.parseClassPropertyAnnotation(node); + return super.parseClassPrivateProperty(node); + } + pushClassMethod( classBody: N.ClassBody, method: N.ClassMethod, diff --git a/packages/babel-parser/src/types.js b/packages/babel-parser/src/types.js index 8560da3a3f73..f5b34a2db0a3 100644 --- a/packages/babel-parser/src/types.js +++ b/packages/babel-parser/src/types.js @@ -762,7 +762,14 @@ export type ClassPrivateProperty = NodeBase & { value: ?Expression, // TODO: Not in spec that this is nullable. static: boolean, computed: false, - typeAnnotation?: ?TypeAnnotation, // TODO: Not in spec + + // Flow and Typescript + typeAnnotation?: ?TypeAnnotationBase, + + // TypeScript only + optional?: true, + definite?: true, + readonly?: true, }; export type OptClassDeclaration = ClassBase & diff --git a/packages/babel-parser/test/fixtures/typescript/class/options.json b/packages/babel-parser/test/fixtures/typescript/class/options.json index 9f3a0c2c0ff1..fff045d3a491 100644 --- a/packages/babel-parser/test/fixtures/typescript/class/options.json +++ b/packages/babel-parser/test/fixtures/typescript/class/options.json @@ -1,4 +1,4 @@ { "sourceType": "module", - "plugins": ["typescript", "classProperties"] + "plugins": ["typescript", "classProperties", "classPrivateProperties"] } diff --git a/packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-abstract/input.ts b/packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-abstract/input.ts new file mode 100644 index 000000000000..7cf85ea5ec29 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-abstract/input.ts @@ -0,0 +1,3 @@ +abstract class A { + abstract #a; +} diff --git a/packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-abstract/options.json b/packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-abstract/options.json new file mode 100644 index 000000000000..7c4adceba22a --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-abstract/options.json @@ -0,0 +1,3 @@ +{ + "throws": "Private elements cannot have the 'abstract' modifier. (2:2)" +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-private/input.ts b/packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-private/input.ts new file mode 100644 index 000000000000..a4472caceb86 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-private/input.ts @@ -0,0 +1,3 @@ +class A { + private #a; +} diff --git a/packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-private/options.json b/packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-private/options.json new file mode 100644 index 000000000000..a183ce2e7550 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-private/options.json @@ -0,0 +1,3 @@ +{ + "throws": "Private elements cannot have an accessibility modifier ('private') (2:2)" +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-protected/input.ts b/packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-protected/input.ts new file mode 100644 index 000000000000..0f35b844a7be --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-protected/input.ts @@ -0,0 +1,3 @@ +class A { + protected #a; +} diff --git a/packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-protected/options.json b/packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-protected/options.json new file mode 100644 index 000000000000..e6c1bebe1ab9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-protected/options.json @@ -0,0 +1,3 @@ +{ + "throws": "Private elements cannot have an accessibility modifier ('protected') (2:2)" +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-public/input.ts b/packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-public/input.ts new file mode 100644 index 000000000000..59a236000e60 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-public/input.ts @@ -0,0 +1,3 @@ +class A { + public #a; +} diff --git a/packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-public/options.json b/packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-public/options.json new file mode 100644 index 000000000000..7fb90279eae1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-public/options.json @@ -0,0 +1,3 @@ +{ + "throws": "Private elements cannot have an accessibility modifier ('public') (2:2)" +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-readonly/input.ts b/packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-readonly/input.ts new file mode 100644 index 000000000000..355def79b8b7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-readonly/input.ts @@ -0,0 +1,4 @@ +class A { + readonly #a; + readonly #b: string; +} diff --git a/packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-readonly/output.json b/packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-readonly/output.json new file mode 100644 index 000000000000..f883e0b00b2a --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-readonly/output.json @@ -0,0 +1,215 @@ +{ + "type": "File", + "start": 0, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "ClassProperty", + "start": 12, + "end": 24, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "readonly": true, + "static": false, + "key": { + "type": "PrivateName", + "start": 21, + "end": 23, + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 13 + } + }, + "id": { + "type": "Identifier", + "start": 22, + "end": 23, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 13 + }, + "identifierName": "a" + }, + "name": "a" + } + }, + "value": null + }, + { + "type": "ClassProperty", + "start": 27, + "end": 47, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 22 + } + }, + "readonly": true, + "static": false, + "key": { + "type": "PrivateName", + "start": 36, + "end": 38, + "loc": { + "start": { + "line": 3, + "column": 11 + }, + "end": { + "line": 3, + "column": 13 + } + }, + "id": { + "type": "Identifier", + "start": 37, + "end": 38, + "loc": { + "start": { + "line": 3, + "column": 12 + }, + "end": { + "line": 3, + "column": 13 + }, + "identifierName": "b" + }, + "name": "b" + } + }, + "typeAnnotation": { + "type": "TSTypeAnnotation", + "start": 38, + "end": 46, + "loc": { + "start": { + "line": 3, + "column": 13 + }, + "end": { + "line": 3, + "column": 21 + } + }, + "typeAnnotation": { + "type": "TSStringKeyword", + "start": 40, + "end": 46, + "loc": { + "start": { + "line": 3, + "column": 15 + }, + "end": { + "line": 3, + "column": 21 + } + } + } + }, + "value": null + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/class/private-fields-static/input.ts b/packages/babel-parser/test/fixtures/typescript/class/private-fields-static/input.ts new file mode 100644 index 000000000000..4725b09bea74 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/class/private-fields-static/input.ts @@ -0,0 +1,4 @@ +class A { + static #x; + static #y: string; +} diff --git a/packages/babel-parser/test/fixtures/typescript/class/private-fields-static/output.json b/packages/babel-parser/test/fixtures/typescript/class/private-fields-static/output.json new file mode 100644 index 000000000000..dcb6ab198f52 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/class/private-fields-static/output.json @@ -0,0 +1,213 @@ +{ + "type": "File", + "start": 0, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "ClassPrivateProperty", + "start": 12, + "end": 22, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 12 + } + }, + "static": true, + "key": { + "type": "PrivateName", + "start": 19, + "end": 21, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "id": { + "type": "Identifier", + "start": 20, + "end": 21, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "value": null + }, + { + "type": "ClassPrivateProperty", + "start": 25, + "end": 43, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 20 + } + }, + "static": true, + "key": { + "type": "PrivateName", + "start": 32, + "end": 34, + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 11 + } + }, + "id": { + "type": "Identifier", + "start": 33, + "end": 34, + "loc": { + "start": { + "line": 3, + "column": 10 + }, + "end": { + "line": 3, + "column": 11 + }, + "identifierName": "y" + }, + "name": "y" + } + }, + "typeAnnotation": { + "type": "TSTypeAnnotation", + "start": 34, + "end": 42, + "loc": { + "start": { + "line": 3, + "column": 11 + }, + "end": { + "line": 3, + "column": 19 + } + }, + "typeAnnotation": { + "type": "TSStringKeyword", + "start": 36, + "end": 42, + "loc": { + "start": { + "line": 3, + "column": 13 + }, + "end": { + "line": 3, + "column": 19 + } + } + } + }, + "value": null + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/class/private-fields/input.ts b/packages/babel-parser/test/fixtures/typescript/class/private-fields/input.ts new file mode 100644 index 000000000000..30c6024e99ce --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/class/private-fields/input.ts @@ -0,0 +1,7 @@ +class A { + #a: string; + #b?; + #c?: number; + #d!; + #e!: boolean; +} diff --git a/packages/babel-parser/test/fixtures/typescript/class/private-fields/output.json b/packages/babel-parser/test/fixtures/typescript/class/private-fields/output.json new file mode 100644 index 000000000000..67a50c2c16ff --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/class/private-fields/output.json @@ -0,0 +1,424 @@ +{ + "type": "File", + "start": 0, + "end": 70, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 7, + "column": 1 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 70, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 7, + "column": 1 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 70, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 7, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 70, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 7, + "column": 1 + } + }, + "body": [ + { + "type": "ClassPrivateProperty", + "start": 12, + "end": 23, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 13 + } + }, + "static": false, + "key": { + "type": "PrivateName", + "start": 12, + "end": 14, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 4 + } + }, + "id": { + "type": "Identifier", + "start": 13, + "end": 14, + "loc": { + "start": { + "line": 2, + "column": 3 + }, + "end": { + "line": 2, + "column": 4 + }, + "identifierName": "a" + }, + "name": "a" + } + }, + "typeAnnotation": { + "type": "TSTypeAnnotation", + "start": 14, + "end": 22, + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 12 + } + }, + "typeAnnotation": { + "type": "TSStringKeyword", + "start": 16, + "end": 22, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 12 + } + } + } + }, + "value": null + }, + { + "type": "ClassPrivateProperty", + "start": 26, + "end": 30, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 6 + } + }, + "static": false, + "key": { + "type": "PrivateName", + "start": 26, + "end": 28, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 4 + } + }, + "id": { + "type": "Identifier", + "start": 27, + "end": 28, + "loc": { + "start": { + "line": 3, + "column": 3 + }, + "end": { + "line": 3, + "column": 4 + }, + "identifierName": "b" + }, + "name": "b" + } + }, + "optional": true, + "value": null + }, + { + "type": "ClassPrivateProperty", + "start": 33, + "end": 45, + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 4, + "column": 14 + } + }, + "static": false, + "key": { + "type": "PrivateName", + "start": 33, + "end": 35, + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 4, + "column": 4 + } + }, + "id": { + "type": "Identifier", + "start": 34, + "end": 35, + "loc": { + "start": { + "line": 4, + "column": 3 + }, + "end": { + "line": 4, + "column": 4 + }, + "identifierName": "c" + }, + "name": "c" + } + }, + "optional": true, + "typeAnnotation": { + "type": "TSTypeAnnotation", + "start": 36, + "end": 44, + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 13 + } + }, + "typeAnnotation": { + "type": "TSNumberKeyword", + "start": 38, + "end": 44, + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 13 + } + } + } + }, + "value": null + }, + { + "type": "ClassPrivateProperty", + "start": 48, + "end": 52, + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 6 + } + }, + "static": false, + "key": { + "type": "PrivateName", + "start": 48, + "end": 50, + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 4 + } + }, + "id": { + "type": "Identifier", + "start": 49, + "end": 50, + "loc": { + "start": { + "line": 5, + "column": 3 + }, + "end": { + "line": 5, + "column": 4 + }, + "identifierName": "d" + }, + "name": "d" + } + }, + "definite": true, + "value": null + }, + { + "type": "ClassPrivateProperty", + "start": 55, + "end": 68, + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 15 + } + }, + "static": false, + "key": { + "type": "PrivateName", + "start": 55, + "end": 57, + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 4 + } + }, + "id": { + "type": "Identifier", + "start": 56, + "end": 57, + "loc": { + "start": { + "line": 6, + "column": 3 + }, + "end": { + "line": 6, + "column": 4 + }, + "identifierName": "e" + }, + "name": "e" + } + }, + "definite": true, + "typeAnnotation": { + "type": "TSTypeAnnotation", + "start": 58, + "end": 67, + "loc": { + "start": { + "line": 6, + "column": 5 + }, + "end": { + "line": 6, + "column": 14 + } + }, + "typeAnnotation": { + "type": "TSBooleanKeyword", + "start": 60, + "end": 67, + "loc": { + "start": { + "line": 6, + "column": 7 + }, + "end": { + "line": 6, + "column": 14 + } + } + } + }, + "value": null + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file From 4e5ac1fd5c361ea992191c28088a78241d6c9adf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BD=AD=E9=A9=B0?= Date: Wed, 30 Oct 2019 01:28:52 +0800 Subject: [PATCH 011/648] Fix #8326, add back --quiet option. (#10399) * Fix issue #8326, quiet the @babel/cli with --quiet cli option. * --quiet and --verbose options now conflict with each other. --- packages/babel-cli/src/babel/dir.js | 12 +++++++----- packages/babel-cli/src/babel/options.js | 14 +++++++++++++- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/packages/babel-cli/src/babel/dir.js b/packages/babel-cli/src/babel/dir.js index 32136b78f02a..1ce3bfdf2bbd 100644 --- a/packages/babel-cli/src/babel/dir.js +++ b/packages/babel-cli/src/babel/dir.js @@ -129,11 +129,13 @@ export default async function({ compiledFiles += await handle(filename); } - console.log( - `Successfully compiled ${compiledFiles} ${ - compiledFiles !== 1 ? "files" : "file" - } with Babel.`, - ); + if (!cliOptions.quiet) { + console.log( + `Successfully compiled ${compiledFiles} ${ + compiledFiles !== 1 ? "files" : "file" + } with Babel.`, + ); + } } if (cliOptions.watch) { diff --git a/packages/babel-cli/src/babel/options.js b/packages/babel-cli/src/babel/options.js index 897c05ba16da..9425c510b451 100644 --- a/packages/babel-cli/src/babel/options.js +++ b/packages/babel-cli/src/babel/options.js @@ -144,7 +144,14 @@ commander.option( "--include-dotfiles", "Include dotfiles when compiling and copying non-compilable files", ); -commander.option("--verbose", "Log everything"); +commander.option( + "--verbose", + "Log everything. This option conflicts with --quiet", +); +commander.option( + "--quiet", + "Don't log anything. This option conflicts with --verbose", +); commander.option( "--delete-dir-on-start", "Delete the out directory before compilation", @@ -207,6 +214,10 @@ export default function parseArgv(args: Array): CmdOptions | null { errors.push("--delete-dir-on-start requires --out-dir"); } + if (commander.verbose && commander.quiet) { + errors.push("--verbose and --quiet cannot be used together"); + } + if ( !commander.outDir && filenames.length === 0 && @@ -282,6 +293,7 @@ export default function parseArgv(args: Array): CmdOptions | null { copyFiles: opts.copyFiles, includeDotfiles: opts.includeDotfiles, verbose: opts.verbose, + quiet: opts.quiet, deleteDirOnStart: opts.deleteDirOnStart, sourceMapTarget: opts.sourceMapTarget, }, From be0fcaaf49ae2c91700e3d74ac1dbb07b4cc2ab8 Mon Sep 17 00:00:00 2001 From: Bogdan Chadkin Date: Tue, 29 Oct 2019 19:29:45 +0200 Subject: [PATCH 012/648] Make dir for babel --out-file (#8622) * Make dir for babel --out-file Currently there's unexpected regression after upgrade from babel 6. On creating file with any depth like dist/index.js the error about not existing directory is thrown. In this diff I modified babel-cli to create deep directory for out-file command. I also replaced `mkdirp` with more supported `make-dir` package which also have official promise support. * Fix test --- packages/babel-cli/package.json | 2 +- packages/babel-cli/src/babel/dir.js | 4 ++-- packages/babel-cli/src/babel/file.js | 3 +++ .../babel/filename --out-file deep/in-files/script.js | 1 + .../fixtures/babel/filename --out-file deep/options.json | 3 +++ .../out-files/folder/nested/script.js | 5 +++++ packages/babel-register/package.json | 2 +- packages/babel-register/src/cache.js | 4 ++-- 8 files changed, 18 insertions(+), 6 deletions(-) create mode 100644 packages/babel-cli/test/fixtures/babel/filename --out-file deep/in-files/script.js create mode 100644 packages/babel-cli/test/fixtures/babel/filename --out-file deep/options.json create mode 100644 packages/babel-cli/test/fixtures/babel/filename --out-file deep/out-files/folder/nested/script.js diff --git a/packages/babel-cli/package.json b/packages/babel-cli/package.json index 4e42d3ca83e5..7e8de8bcb9c9 100644 --- a/packages/babel-cli/package.json +++ b/packages/babel-cli/package.json @@ -24,7 +24,7 @@ "fs-readdir-recursive": "^1.1.0", "glob": "^7.0.0", "lodash": "^4.17.13", - "mkdirp": "^0.5.1", + "make-dir": "^2.1.0", "output-file-sync": "^2.0.0", "slash": "^2.0.0", "source-map": "^0.5.0" diff --git a/packages/babel-cli/src/babel/dir.js b/packages/babel-cli/src/babel/dir.js index 1ce3bfdf2bbd..094f7806f90a 100644 --- a/packages/babel-cli/src/babel/dir.js +++ b/packages/babel-cli/src/babel/dir.js @@ -2,7 +2,7 @@ import defaults from "lodash/defaults"; import outputFileSync from "output-file-sync"; -import { sync as mkdirpSync } from "mkdirp"; +import { sync as makeDirSync } from "make-dir"; import slash from "slash"; import path from "path"; import fs from "fs"; @@ -122,7 +122,7 @@ export default async function({ util.deleteDir(cliOptions.outDir); } - mkdirpSync(cliOptions.outDir); + makeDirSync(cliOptions.outDir); let compiledFiles = 0; for (const filename of cliOptions.filenames) { diff --git a/packages/babel-cli/src/babel/file.js b/packages/babel-cli/src/babel/file.js index 7c38d3052f3d..23b0307cc884 100644 --- a/packages/babel-cli/src/babel/file.js +++ b/packages/babel-cli/src/babel/file.js @@ -4,6 +4,7 @@ import convertSourceMap from "convert-source-map"; import defaults from "lodash/defaults"; import sourceMap from "source-map"; import slash from "slash"; +import { sync as makeDirSync } from "make-dir"; import path from "path"; import fs from "fs"; @@ -89,6 +90,8 @@ export default async function({ const result = buildResult(fileResults); if (cliOptions.outFile) { + makeDirSync(path.dirname(cliOptions.outFile)); + // we've requested for a sourcemap to be written to disk if (babelOptions.sourceMaps && babelOptions.sourceMaps !== "inline") { const mapLoc = cliOptions.outFile + ".map"; diff --git a/packages/babel-cli/test/fixtures/babel/filename --out-file deep/in-files/script.js b/packages/babel-cli/test/fixtures/babel/filename --out-file deep/in-files/script.js new file mode 100644 index 000000000000..4bc9539528d4 --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/filename --out-file deep/in-files/script.js @@ -0,0 +1 @@ +arr.map(x => x * MULTIPLIER); diff --git a/packages/babel-cli/test/fixtures/babel/filename --out-file deep/options.json b/packages/babel-cli/test/fixtures/babel/filename --out-file deep/options.json new file mode 100644 index 000000000000..d24719ba4a76 --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/filename --out-file deep/options.json @@ -0,0 +1,3 @@ +{ + "args": ["script.js", "--out-file", "folder/nested/script.js"] +} diff --git a/packages/babel-cli/test/fixtures/babel/filename --out-file deep/out-files/folder/nested/script.js b/packages/babel-cli/test/fixtures/babel/filename --out-file deep/out-files/folder/nested/script.js new file mode 100644 index 000000000000..ae4557e57bc3 --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/filename --out-file deep/out-files/folder/nested/script.js @@ -0,0 +1,5 @@ +"use strict"; + +arr.map(function (x) { + return x * MULTIPLIER; +}); diff --git a/packages/babel-register/package.json b/packages/babel-register/package.json index 6a768833622d..466ba1d54523 100644 --- a/packages/babel-register/package.json +++ b/packages/babel-register/package.json @@ -15,7 +15,7 @@ "dependencies": { "find-cache-dir": "^2.0.0", "lodash": "^4.17.13", - "mkdirp": "^0.5.1", + "make-dir": "^2.1.0", "pirates": "^4.0.0", "source-map-support": "^0.5.9" }, diff --git a/packages/babel-register/src/cache.js b/packages/babel-register/src/cache.js index 0a2983b89aa2..b505bb4943c7 100644 --- a/packages/babel-register/src/cache.js +++ b/packages/babel-register/src/cache.js @@ -1,7 +1,7 @@ import path from "path"; import fs from "fs"; import os from "os"; -import { sync as mkdirpSync } from "mkdirp"; +import { sync as makeDirSync } from "make-dir"; import * as babel from "@babel/core"; import findCacheDir from "find-cache-dir"; @@ -39,7 +39,7 @@ export function save() { } try { - mkdirpSync(path.dirname(FILENAME)); + makeDirSync(path.dirname(FILENAME)); fs.writeFileSync(FILENAME, serialised); } catch (e) { switch (e.code) { From f47fbd5f3946e468da0fab95d85dbe2cdfd5d85f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?= Date: Tue, 29 Oct 2019 18:35:15 +0100 Subject: [PATCH 013/648] Nit: Use ?. in the example used by the proposal readme (#10604) --- packages/babel-helper-builder-react-jsx/src/index.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/packages/babel-helper-builder-react-jsx/src/index.js b/packages/babel-helper-builder-react-jsx/src/index.js index 3602ecb8496e..fa68384f1b70 100644 --- a/packages/babel-helper-builder-react-jsx/src/index.js +++ b/packages/babel-helper-builder-react-jsx/src/index.js @@ -91,9 +91,7 @@ You can turn on the 'throwIfNamespace' flag to bypass this warning.`, value.value = value.value.replace(/\n\s+/g, " "); // "raw" JSXText should not be used from a StringLiteral because it needs to be escaped. - if (value.extra && value.extra.raw) { - delete value.extra.raw; - } + delete value.extra?.raw; } if (t.isJSXNamespacedName(node.name)) { From d248e2d1886f7891e6d14f5969d99276a6fd9284 Mon Sep 17 00:00:00 2001 From: Eugene Myunster Date: Tue, 29 Oct 2019 10:44:01 -0700 Subject: [PATCH 014/648] moving proposalNullishCoalescingOperator and proposalOptionalChaining to stage 3 (#10590) --- packages/babel-standalone/src/preset-stage-1.js | 2 -- packages/babel-standalone/src/preset-stage-3.js | 2 ++ 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/babel-standalone/src/preset-stage-1.js b/packages/babel-standalone/src/preset-stage-1.js index 0018a48f4334..4f9d6029912b 100644 --- a/packages/babel-standalone/src/preset-stage-1.js +++ b/packages/babel-standalone/src/preset-stage-1.js @@ -21,9 +21,7 @@ export default (_: any, opts: Object = {}) => { plugins: [ babelPlugins.proposalExportDefaultFrom, babelPlugins.proposalLogicalAssignmentOperators, - [babelPlugins.proposalOptionalChaining, { loose }], [babelPlugins.proposalPipelineOperator, { proposal: pipelineProposal }], - [babelPlugins.proposalNullishCoalescingOperator, { loose }], babelPlugins.proposalDoExpressions, ], }; diff --git a/packages/babel-standalone/src/preset-stage-3.js b/packages/babel-standalone/src/preset-stage-3.js index 6885719f2fd2..11e9c3833b66 100644 --- a/packages/babel-standalone/src/preset-stage-3.js +++ b/packages/babel-standalone/src/preset-stage-3.js @@ -12,6 +12,8 @@ export default (_: any, opts: Object) => { plugins: [ babelPlugins.syntaxDynamicImport, babelPlugins.syntaxImportMeta, + [babelPlugins.proposalOptionalChaining, { loose }], + [babelPlugins.proposalNullishCoalescingOperator, { loose }], [babelPlugins.proposalClassProperties, { loose }], babelPlugins.proposalJsonStrings, [babelPlugins.proposalPrivateMethods, { loose }], From 4cd93ab5f3fa3367f53d526e4de84453307031cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?= Date: Tue, 29 Oct 2019 18:44:32 +0100 Subject: [PATCH 015/648] [parser] Enable "exportNamespaceFrom" by default (#10521) --- packages/babel-parser/src/parser/statement.js | 1 - .../export-ns-from}/ns-and-named/input.js | 0 .../export-ns-from}/ns-and-named/output.json | 0 .../export-ns-from}/ns-default/input.js | 0 .../export-ns-from}/ns-default/output.json | 0 .../export-ns-from/ns}/input.js | 0 .../export-ns-from}/ns/output.json | 0 .../es2020/export-ns-from/options.json | 3 + .../_no-plugin/export-namespace/options.json | 4 - .../default-and-ns/options.json | 2 +- .../ns-and-named/options.json | 4 - .../export-extensions/ns-default/options.json | 4 - .../export-extensions/ns/input.js | 1 - .../export-extensions/ns/options.json | 4 - .../export-star-as/options.json | 2 +- .../type-exports/star-as-from/options.json | 2 +- .../fixtures/placeholders/export/options.json | 2 +- .../export/star-from-2/options.json | 3 +- .../export/star-from-2/output.json | 120 ++++++++++++++++ .../export/star-from-3/options.json | 3 +- .../export/star-from-3/output.json | 133 ++++++++++++++++++ .../babel-parser/typings/babel-parser.d.ts | 2 +- 22 files changed, 263 insertions(+), 27 deletions(-) rename packages/babel-parser/test/fixtures/{experimental/export-extensions => es2020/export-ns-from}/ns-and-named/input.js (100%) rename packages/babel-parser/test/fixtures/{experimental/export-extensions => es2020/export-ns-from}/ns-and-named/output.json (100%) rename packages/babel-parser/test/fixtures/{experimental/export-extensions => es2020/export-ns-from}/ns-default/input.js (100%) rename packages/babel-parser/test/fixtures/{experimental/export-extensions => es2020/export-ns-from}/ns-default/output.json (100%) rename packages/babel-parser/test/fixtures/{experimental/_no-plugin/export-namespace => es2020/export-ns-from/ns}/input.js (100%) rename packages/babel-parser/test/fixtures/{experimental/export-extensions => es2020/export-ns-from}/ns/output.json (100%) create mode 100644 packages/babel-parser/test/fixtures/es2020/export-ns-from/options.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/_no-plugin/export-namespace/options.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/export-extensions/ns-and-named/options.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/export-extensions/ns-default/options.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/export-extensions/ns/input.js delete mode 100644 packages/babel-parser/test/fixtures/experimental/export-extensions/ns/options.json create mode 100644 packages/babel-parser/test/fixtures/placeholders/export/star-from-2/output.json create mode 100644 packages/babel-parser/test/fixtures/placeholders/export/star-from-3/output.json diff --git a/packages/babel-parser/src/parser/statement.js b/packages/babel-parser/src/parser/statement.js index d926d51c1ef0..6a67349b2820 100644 --- a/packages/babel-parser/src/parser/statement.js +++ b/packages/babel-parser/src/parser/statement.js @@ -1719,7 +1719,6 @@ export default class StatementParser extends ExpressionParser { maybeParseExportNamespaceSpecifier(node: N.Node): boolean { if (this.isContextual("as")) { if (!node.specifiers) node.specifiers = []; - this.expectPlugin("exportNamespaceFrom"); const specifier = this.startNodeAt( this.state.lastTokStart, diff --git a/packages/babel-parser/test/fixtures/experimental/export-extensions/ns-and-named/input.js b/packages/babel-parser/test/fixtures/es2020/export-ns-from/ns-and-named/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/export-extensions/ns-and-named/input.js rename to packages/babel-parser/test/fixtures/es2020/export-ns-from/ns-and-named/input.js diff --git a/packages/babel-parser/test/fixtures/experimental/export-extensions/ns-and-named/output.json b/packages/babel-parser/test/fixtures/es2020/export-ns-from/ns-and-named/output.json similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/export-extensions/ns-and-named/output.json rename to packages/babel-parser/test/fixtures/es2020/export-ns-from/ns-and-named/output.json diff --git a/packages/babel-parser/test/fixtures/experimental/export-extensions/ns-default/input.js b/packages/babel-parser/test/fixtures/es2020/export-ns-from/ns-default/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/export-extensions/ns-default/input.js rename to packages/babel-parser/test/fixtures/es2020/export-ns-from/ns-default/input.js diff --git a/packages/babel-parser/test/fixtures/experimental/export-extensions/ns-default/output.json b/packages/babel-parser/test/fixtures/es2020/export-ns-from/ns-default/output.json similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/export-extensions/ns-default/output.json rename to packages/babel-parser/test/fixtures/es2020/export-ns-from/ns-default/output.json diff --git a/packages/babel-parser/test/fixtures/experimental/_no-plugin/export-namespace/input.js b/packages/babel-parser/test/fixtures/es2020/export-ns-from/ns/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/_no-plugin/export-namespace/input.js rename to packages/babel-parser/test/fixtures/es2020/export-ns-from/ns/input.js diff --git a/packages/babel-parser/test/fixtures/experimental/export-extensions/ns/output.json b/packages/babel-parser/test/fixtures/es2020/export-ns-from/ns/output.json similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/export-extensions/ns/output.json rename to packages/babel-parser/test/fixtures/es2020/export-ns-from/ns/output.json diff --git a/packages/babel-parser/test/fixtures/es2020/export-ns-from/options.json b/packages/babel-parser/test/fixtures/es2020/export-ns-from/options.json new file mode 100644 index 000000000000..2104ca43283f --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2020/export-ns-from/options.json @@ -0,0 +1,3 @@ +{ + "sourceType": "module" +} diff --git a/packages/babel-parser/test/fixtures/experimental/_no-plugin/export-namespace/options.json b/packages/babel-parser/test/fixtures/experimental/_no-plugin/export-namespace/options.json deleted file mode 100644 index b8b7c829daad..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/_no-plugin/export-namespace/options.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "throws": "This experimental syntax requires enabling the parser plugin: 'exportNamespaceFrom' (1:9)", - "plugins": [] -} diff --git a/packages/babel-parser/test/fixtures/experimental/export-extensions/default-and-ns/options.json b/packages/babel-parser/test/fixtures/experimental/export-extensions/default-and-ns/options.json index 3bb54891b474..fb17f33a28b5 100644 --- a/packages/babel-parser/test/fixtures/experimental/export-extensions/default-and-ns/options.json +++ b/packages/babel-parser/test/fixtures/experimental/export-extensions/default-and-ns/options.json @@ -1,4 +1,4 @@ { - "plugins": ["exportDefaultFrom", "exportNamespaceFrom"], + "plugins": ["exportDefaultFrom"], "sourceType": "module" } diff --git a/packages/babel-parser/test/fixtures/experimental/export-extensions/ns-and-named/options.json b/packages/babel-parser/test/fixtures/experimental/export-extensions/ns-and-named/options.json deleted file mode 100644 index efa6c457adc3..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/export-extensions/ns-and-named/options.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "sourceType": "module", - "plugins": ["exportNamespaceFrom"] -} diff --git a/packages/babel-parser/test/fixtures/experimental/export-extensions/ns-default/options.json b/packages/babel-parser/test/fixtures/experimental/export-extensions/ns-default/options.json deleted file mode 100644 index e32f18023916..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/export-extensions/ns-default/options.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "plugins": ["exportNamespaceFrom"], - "sourceType": "module" -} diff --git a/packages/babel-parser/test/fixtures/experimental/export-extensions/ns/input.js b/packages/babel-parser/test/fixtures/experimental/export-extensions/ns/input.js deleted file mode 100644 index 27357f4758f9..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/export-extensions/ns/input.js +++ /dev/null @@ -1 +0,0 @@ -export * as A from 'test'; diff --git a/packages/babel-parser/test/fixtures/experimental/export-extensions/ns/options.json b/packages/babel-parser/test/fixtures/experimental/export-extensions/ns/options.json deleted file mode 100644 index e32f18023916..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/export-extensions/ns/options.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "plugins": ["exportNamespaceFrom"], - "sourceType": "module" -} diff --git a/packages/babel-parser/test/fixtures/flow/declare-export/export-star-as/options.json b/packages/babel-parser/test/fixtures/flow/declare-export/export-star-as/options.json index acd5b34be46d..698e7668500f 100644 --- a/packages/babel-parser/test/fixtures/flow/declare-export/export-star-as/options.json +++ b/packages/babel-parser/test/fixtures/flow/declare-export/export-star-as/options.json @@ -1,3 +1,3 @@ { - "plugins": ["jsx", "flow", "exportNamespaceFrom"] + "plugins": ["jsx", "flow"] } diff --git a/packages/babel-parser/test/fixtures/flow/type-exports/star-as-from/options.json b/packages/babel-parser/test/fixtures/flow/type-exports/star-as-from/options.json index d482b18c6cff..6a0cd1358ef1 100644 --- a/packages/babel-parser/test/fixtures/flow/type-exports/star-as-from/options.json +++ b/packages/babel-parser/test/fixtures/flow/type-exports/star-as-from/options.json @@ -1,5 +1,5 @@ { "sourceType": "module", - "plugins": ["flow", "exportNamespaceFrom"], + "plugins": ["flow"], "throws": "Unexpected token (1:14)" } diff --git a/packages/babel-parser/test/fixtures/placeholders/export/options.json b/packages/babel-parser/test/fixtures/placeholders/export/options.json index e7ff26ae7014..14a812b67661 100644 --- a/packages/babel-parser/test/fixtures/placeholders/export/options.json +++ b/packages/babel-parser/test/fixtures/placeholders/export/options.json @@ -1,4 +1,4 @@ { - "plugins": ["placeholders", "exportDefaultFrom", "exportNamespaceFrom"], + "plugins": ["placeholders", "exportDefaultFrom"], "sourceType": "module" } diff --git a/packages/babel-parser/test/fixtures/placeholders/export/star-from-2/options.json b/packages/babel-parser/test/fixtures/placeholders/export/star-from-2/options.json index ec7b8f83c3d7..986e9cefa93e 100644 --- a/packages/babel-parser/test/fixtures/placeholders/export/star-from-2/options.json +++ b/packages/babel-parser/test/fixtures/placeholders/export/star-from-2/options.json @@ -1,5 +1,4 @@ { "plugins": ["placeholders"], - "sourceType": "module", - "throws": "This experimental syntax requires enabling the parser plugin: 'exportNamespaceFrom' (1:9)" + "sourceType": "module" } diff --git a/packages/babel-parser/test/fixtures/placeholders/export/star-from-2/output.json b/packages/babel-parser/test/fixtures/placeholders/export/star-from-2/output.json new file mode 100644 index 000000000000..b89f3e8dec86 --- /dev/null +++ b/packages/babel-parser/test/fixtures/placeholders/export/star-from-2/output.json @@ -0,0 +1,120 @@ +{ + "type": "File", + "start": 0, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start": 0, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "specifiers": [ + { + "type": "ExportNamespaceSpecifier", + "start": 7, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "exported": { + "type": "Placeholder", + "start": 12, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "name": { + "type": "Identifier", + "start": 14, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 18 + }, + "identifierName": "STAR" + }, + "name": "STAR" + }, + "expectedNode": "Identifier" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 26, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "extra": { + "rawValue": "file", + "raw": "\"file\"" + }, + "value": "file" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/placeholders/export/star-from-3/options.json b/packages/babel-parser/test/fixtures/placeholders/export/star-from-3/options.json index ec7b8f83c3d7..986e9cefa93e 100644 --- a/packages/babel-parser/test/fixtures/placeholders/export/star-from-3/options.json +++ b/packages/babel-parser/test/fixtures/placeholders/export/star-from-3/options.json @@ -1,5 +1,4 @@ { "plugins": ["placeholders"], - "sourceType": "module", - "throws": "This experimental syntax requires enabling the parser plugin: 'exportNamespaceFrom' (1:9)" + "sourceType": "module" } diff --git a/packages/babel-parser/test/fixtures/placeholders/export/star-from-3/output.json b/packages/babel-parser/test/fixtures/placeholders/export/star-from-3/output.json new file mode 100644 index 000000000000..2391c0c770d0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/placeholders/export/star-from-3/output.json @@ -0,0 +1,133 @@ +{ + "type": "File", + "start": 0, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start": 0, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "specifiers": [ + { + "type": "ExportNamespaceSpecifier", + "start": 7, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "exported": { + "type": "Placeholder", + "start": 12, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "name": { + "type": "Identifier", + "start": 14, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 18 + }, + "identifierName": "STAR" + }, + "name": "STAR" + }, + "expectedNode": "Identifier" + } + } + ], + "source": { + "type": "Placeholder", + "start": 26, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "name": { + "type": "Identifier", + "start": 28, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 32 + }, + "identifierName": "FILE" + }, + "name": "FILE" + }, + "expectedNode": "StringLiteral" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/typings/babel-parser.d.ts b/packages/babel-parser/typings/babel-parser.d.ts index 371b9a4633da..575843e6d24b 100644 --- a/packages/babel-parser/typings/babel-parser.d.ts +++ b/packages/babel-parser/typings/babel-parser.d.ts @@ -106,7 +106,7 @@ export type ParserPlugin = 'dynamicImport' | 'estree' | 'exportDefaultFrom' | - 'exportNamespaceFrom' | + 'exportNamespaceFrom' | // deprecated 'flow' | 'flowComments' | 'functionBind' | From 38a30631115963a41f7d84ba811c9308301faa50 Mon Sep 17 00:00:00 2001 From: Tan Li Hau Date: Wed, 30 Oct 2019 01:51:33 +0800 Subject: [PATCH 016/648] add assertions signature for TypeScript (#10543) * add asserts predicate * fix flow * babel-generator for typescript assertions * babel-types for typescript assertions * asserts modifier as boolean --- .../src/generators/typescript.js | 14 +- .../arrow-function-assertion/input.js | 2 + .../arrow-function-assertion/output.js | 3 + .../typescript/function-assertion/input.js | 2 + .../typescript/function-assertion/output.js | 3 + .../src/plugins/typescript/index.js | 40 +- .../predicate-types/output.json | 4 +- .../assert-predicate/arrow-function/input.ts | 3 + .../arrow-function/output.json | 610 ++++++++++++++++++ .../asserts-as-identifier/input.ts | 1 + .../asserts-as-identifier/output.json | 166 +++++ .../assert-predicate/asserts-var/input.ts | 1 + .../assert-predicate/asserts-var/output.json | 167 +++++ .../asserts-with-predicate/input.ts | 1 + .../asserts-with-predicate/output.json | 197 ++++++ .../function-declaration/input.ts | 3 + .../function-declaration/output.json | 508 +++++++++++++++ .../function/predicate-types/output.json | 8 +- .../babel-types/src/definitions/typescript.js | 5 +- 19 files changed, 1721 insertions(+), 17 deletions(-) create mode 100644 packages/babel-generator/test/fixtures/typescript/arrow-function-assertion/input.js create mode 100644 packages/babel-generator/test/fixtures/typescript/arrow-function-assertion/output.js create mode 100644 packages/babel-generator/test/fixtures/typescript/function-assertion/input.js create mode 100644 packages/babel-generator/test/fixtures/typescript/function-assertion/output.js create mode 100644 packages/babel-parser/test/fixtures/typescript/assert-predicate/arrow-function/input.ts create mode 100644 packages/babel-parser/test/fixtures/typescript/assert-predicate/arrow-function/output.json create mode 100644 packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-as-identifier/input.ts create mode 100644 packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-as-identifier/output.json create mode 100644 packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-var/input.ts create mode 100644 packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-var/output.json create mode 100644 packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-with-predicate/input.ts create mode 100644 packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-with-predicate/output.json create mode 100644 packages/babel-parser/test/fixtures/typescript/assert-predicate/function-declaration/input.ts create mode 100644 packages/babel-parser/test/fixtures/typescript/assert-predicate/function-declaration/output.json diff --git a/packages/babel-generator/src/generators/typescript.js b/packages/babel-generator/src/generators/typescript.js index 4ff2fe1ad188..aa5e4ce4cde6 100644 --- a/packages/babel-generator/src/generators/typescript.js +++ b/packages/babel-generator/src/generators/typescript.js @@ -197,11 +197,17 @@ export function TSTypeReference(node) { } export function TSTypePredicate(node) { + if (node.assertsModifier) { + this.word("asserts"); + this.space(); + } this.print(node.parameterName); - this.space(); - this.word("is"); - this.space(); - this.print(node.typeAnnotation.typeAnnotation); + if (node.typeAnnotation) { + this.space(); + this.word("is"); + this.space(); + this.print(node.typeAnnotation.typeAnnotation); + } } export function TSTypeQuery(node) { diff --git a/packages/babel-generator/test/fixtures/typescript/arrow-function-assertion/input.js b/packages/babel-generator/test/fixtures/typescript/arrow-function-assertion/input.js new file mode 100644 index 000000000000..67e467cda8ed --- /dev/null +++ b/packages/babel-generator/test/fixtures/typescript/arrow-function-assertion/input.js @@ -0,0 +1,2 @@ +(x: any): asserts x => true; +(x: any): asserts x is boolean => true; \ No newline at end of file diff --git a/packages/babel-generator/test/fixtures/typescript/arrow-function-assertion/output.js b/packages/babel-generator/test/fixtures/typescript/arrow-function-assertion/output.js new file mode 100644 index 000000000000..b0befa69dc24 --- /dev/null +++ b/packages/babel-generator/test/fixtures/typescript/arrow-function-assertion/output.js @@ -0,0 +1,3 @@ +(x: any): asserts x => true; + +(x: any): asserts x is boolean => true; \ No newline at end of file diff --git a/packages/babel-generator/test/fixtures/typescript/function-assertion/input.js b/packages/babel-generator/test/fixtures/typescript/function-assertion/input.js new file mode 100644 index 000000000000..17db65c5a77f --- /dev/null +++ b/packages/babel-generator/test/fixtures/typescript/function-assertion/input.js @@ -0,0 +1,2 @@ +function f(x: any): asserts x {} +(function(x: any): asserts x is boolean {}) diff --git a/packages/babel-generator/test/fixtures/typescript/function-assertion/output.js b/packages/babel-generator/test/fixtures/typescript/function-assertion/output.js new file mode 100644 index 000000000000..b55c84620cc9 --- /dev/null +++ b/packages/babel-generator/test/fixtures/typescript/function-assertion/output.js @@ -0,0 +1,3 @@ +function f(x: any): asserts x {} + +(function (x: any): asserts x is boolean {}); \ No newline at end of file diff --git a/packages/babel-parser/src/plugins/typescript/index.js b/packages/babel-parser/src/plugins/typescript/index.js index 187dd540520a..a47dfac29ba6 100644 --- a/packages/babel-parser/src/plugins/typescript/index.js +++ b/packages/babel-parser/src/plugins/typescript/index.js @@ -904,21 +904,34 @@ export default (superClass: Class): Class => const t: N.TsTypeAnnotation = this.startNode(); this.expect(returnToken); + const assertsModifier = this.tsTryParse( + this.tsParseTypePredicateAssertsModifier.bind(this), + ); + const typePredicateVariable = this.tsIsIdentifier() && this.tsTryParse(this.tsParseTypePredicatePrefix.bind(this)); if (!typePredicateVariable) { - return this.tsParseTypeAnnotation(/* eatColon */ false, t); + if (!assertsModifier) { + // : type + return this.tsParseTypeAnnotation(/* eatColon */ false, t); + } + + // : asserts foo + const node = this.startNodeAtNode(t); + node.parameterName = this.parseIdentifier(); + node.assertsModifier = assertsModifier; + t.typeAnnotation = this.finishNode(node, "TSTypePredicate"); + return this.finishNode(t, "TSTypeAnnotation"); } + // : foo is type const type = this.tsParseTypeAnnotation(/* eatColon */ false); - - const node: N.TsTypePredicate = this.startNodeAtNode( - typePredicateVariable, - ); + const node = this.startNodeAtNode(t); node.parameterName = typePredicateVariable; node.typeAnnotation = type; + node.assertsModifier = assertsModifier; t.typeAnnotation = this.finishNode(node, "TSTypePredicate"); return this.finishNode(t, "TSTypeAnnotation"); }); @@ -946,6 +959,23 @@ export default (superClass: Class): Class => } } + tsParseTypePredicateAssertsModifier(): boolean { + if (!this.tsIsIdentifier()) { + return false; + } + + const id = this.parseIdentifier(); + if ( + id.name !== "asserts" || + this.hasPrecedingLineBreak() || + !this.tsIsIdentifier() + ) { + return false; + } + + return true; + } + tsParseTypeAnnotation( eatColon = true, t: N.TsTypeAnnotation = this.startNode(), diff --git a/packages/babel-parser/test/fixtures/typescript/arrow-function/predicate-types/output.json b/packages/babel-parser/test/fixtures/typescript/arrow-function/predicate-types/output.json index e1f9142855b1..45239b7a0c11 100644 --- a/packages/babel-parser/test/fixtures/typescript/arrow-function/predicate-types/output.json +++ b/packages/babel-parser/test/fixtures/typescript/arrow-function/predicate-types/output.json @@ -73,12 +73,12 @@ }, "typeAnnotation": { "type": "TSTypePredicate", - "start": 10, + "start": 8, "end": 21, "loc": { "start": { "line": 1, - "column": 10 + "column": 8 }, "end": { "line": 1, diff --git a/packages/babel-parser/test/fixtures/typescript/assert-predicate/arrow-function/input.ts b/packages/babel-parser/test/fixtures/typescript/assert-predicate/arrow-function/input.ts new file mode 100644 index 000000000000..5989d8d4f2b4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/assert-predicate/arrow-function/input.ts @@ -0,0 +1,3 @@ +const assert1 = (value: unknown): asserts value is string => {} +const assert2 = (value: unknown): asserts value => {} +const assert3 = (value: unknown): asserts => {} diff --git a/packages/babel-parser/test/fixtures/typescript/assert-predicate/arrow-function/output.json b/packages/babel-parser/test/fixtures/typescript/assert-predicate/arrow-function/output.json new file mode 100644 index 000000000000..e368637de0a9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/assert-predicate/arrow-function/output.json @@ -0,0 +1,610 @@ +{ + "type": "File", + "start": 0, + "end": 165, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 47 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 165, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 47 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 63, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 63 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 6, + "end": 63, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 63 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 13 + }, + "identifierName": "assert1" + }, + "name": "assert1" + }, + "init": { + "type": "ArrowFunctionExpression", + "start": 16, + "end": 63, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 63 + } + }, + "returnType": { + "type": "TSTypeAnnotation", + "start": 32, + "end": 57, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 57 + } + }, + "typeAnnotation": { + "type": "TSTypePredicate", + "start": 32, + "end": 57, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 57 + } + }, + "parameterName": { + "type": "Identifier", + "start": 42, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 42 + }, + "end": { + "line": 1, + "column": 47 + }, + "identifierName": "value" + }, + "name": "value" + }, + "typeAnnotation": { + "type": "TSTypeAnnotation", + "start": 51, + "end": 57, + "loc": { + "start": { + "line": 1, + "column": 51 + }, + "end": { + "line": 1, + "column": 57 + } + }, + "typeAnnotation": { + "type": "TSStringKeyword", + "start": 51, + "end": 57, + "loc": { + "start": { + "line": 1, + "column": 51 + }, + "end": { + "line": 1, + "column": 57 + } + } + } + }, + "assertsModifier": true + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 17, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 31 + }, + "identifierName": "value" + }, + "name": "value", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "start": 22, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "typeAnnotation": { + "type": "TSUnknownKeyword", + "start": 24, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 31 + } + } + } + } + } + ], + "body": { + "type": "BlockStatement", + "start": 61, + "end": 63, + "loc": { + "start": { + "line": 1, + "column": 61 + }, + "end": { + "line": 1, + "column": 63 + } + }, + "body": [], + "directives": [] + } + } + } + ], + "kind": "const" + }, + { + "type": "VariableDeclaration", + "start": 64, + "end": 117, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 53 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 70, + "end": 117, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 53 + } + }, + "id": { + "type": "Identifier", + "start": 70, + "end": 77, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 13 + }, + "identifierName": "assert2" + }, + "name": "assert2" + }, + "init": { + "type": "ArrowFunctionExpression", + "start": 80, + "end": 117, + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 53 + } + }, + "returnType": { + "type": "TSTypeAnnotation", + "start": 96, + "end": 111, + "loc": { + "start": { + "line": 2, + "column": 32 + }, + "end": { + "line": 2, + "column": 47 + } + }, + "typeAnnotation": { + "type": "TSTypePredicate", + "start": 96, + "end": 111, + "loc": { + "start": { + "line": 2, + "column": 32 + }, + "end": { + "line": 2, + "column": 47 + } + }, + "parameterName": { + "type": "Identifier", + "start": 106, + "end": 111, + "loc": { + "start": { + "line": 2, + "column": 42 + }, + "end": { + "line": 2, + "column": 47 + }, + "identifierName": "value" + }, + "name": "value" + }, + "assertsModifier": true + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 81, + "end": 95, + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 31 + }, + "identifierName": "value" + }, + "name": "value", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "start": 86, + "end": 95, + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 31 + } + }, + "typeAnnotation": { + "type": "TSUnknownKeyword", + "start": 88, + "end": 95, + "loc": { + "start": { + "line": 2, + "column": 24 + }, + "end": { + "line": 2, + "column": 31 + } + } + } + } + } + ], + "body": { + "type": "BlockStatement", + "start": 115, + "end": 117, + "loc": { + "start": { + "line": 2, + "column": 51 + }, + "end": { + "line": 2, + "column": 53 + } + }, + "body": [], + "directives": [] + } + } + } + ], + "kind": "const" + }, + { + "type": "VariableDeclaration", + "start": 118, + "end": 165, + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 47 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 124, + "end": 165, + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 47 + } + }, + "id": { + "type": "Identifier", + "start": 124, + "end": 131, + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 13 + }, + "identifierName": "assert3" + }, + "name": "assert3" + }, + "init": { + "type": "ArrowFunctionExpression", + "start": 134, + "end": 165, + "loc": { + "start": { + "line": 3, + "column": 16 + }, + "end": { + "line": 3, + "column": 47 + } + }, + "returnType": { + "type": "TSTypeAnnotation", + "start": 150, + "end": 159, + "loc": { + "start": { + "line": 3, + "column": 32 + }, + "end": { + "line": 3, + "column": 41 + } + }, + "typeAnnotation": { + "type": "TSTypeReference", + "start": 152, + "end": 159, + "loc": { + "start": { + "line": 3, + "column": 34 + }, + "end": { + "line": 3, + "column": 41 + } + }, + "typeName": { + "type": "Identifier", + "start": 152, + "end": 159, + "loc": { + "start": { + "line": 3, + "column": 34 + }, + "end": { + "line": 3, + "column": 41 + }, + "identifierName": "asserts" + }, + "name": "asserts" + } + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 135, + "end": 149, + "loc": { + "start": { + "line": 3, + "column": 17 + }, + "end": { + "line": 3, + "column": 31 + }, + "identifierName": "value" + }, + "name": "value", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "start": 140, + "end": 149, + "loc": { + "start": { + "line": 3, + "column": 22 + }, + "end": { + "line": 3, + "column": 31 + } + }, + "typeAnnotation": { + "type": "TSUnknownKeyword", + "start": 142, + "end": 149, + "loc": { + "start": { + "line": 3, + "column": 24 + }, + "end": { + "line": 3, + "column": 31 + } + } + } + } + } + ], + "body": { + "type": "BlockStatement", + "start": 163, + "end": 165, + "loc": { + "start": { + "line": 3, + "column": 45 + }, + "end": { + "line": 3, + "column": 47 + } + }, + "body": [], + "directives": [] + } + } + } + ], + "kind": "const" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-as-identifier/input.ts b/packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-as-identifier/input.ts new file mode 100644 index 000000000000..d5ee9a42ce01 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-as-identifier/input.ts @@ -0,0 +1 @@ +declare function assertIsString(value: unknown): asserts; diff --git a/packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-as-identifier/output.json b/packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-as-identifier/output.json new file mode 100644 index 000000000000..dc6f8702bdce --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-as-identifier/output.json @@ -0,0 +1,166 @@ +{ + "type": "File", + "start": 0, + "end": 57, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 57 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 57, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 57 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TSDeclareFunction", + "start": 0, + "end": 57, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 57 + } + }, + "id": { + "type": "Identifier", + "start": 17, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 31 + }, + "identifierName": "assertIsString" + }, + "name": "assertIsString" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 32, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 46 + }, + "identifierName": "value" + }, + "name": "value", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "start": 37, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "typeAnnotation": { + "type": "TSUnknownKeyword", + "start": 39, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 39 + }, + "end": { + "line": 1, + "column": 46 + } + } + } + } + } + ], + "returnType": { + "type": "TSTypeAnnotation", + "start": 47, + "end": 56, + "loc": { + "start": { + "line": 1, + "column": 47 + }, + "end": { + "line": 1, + "column": 56 + } + }, + "typeAnnotation": { + "type": "TSTypeReference", + "start": 49, + "end": 56, + "loc": { + "start": { + "line": 1, + "column": 49 + }, + "end": { + "line": 1, + "column": 56 + } + }, + "typeName": { + "type": "Identifier", + "start": 49, + "end": 56, + "loc": { + "start": { + "line": 1, + "column": 49 + }, + "end": { + "line": 1, + "column": 56 + }, + "identifierName": "asserts" + }, + "name": "asserts" + } + } + }, + "declare": true + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-var/input.ts b/packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-var/input.ts new file mode 100644 index 000000000000..63613906e9fd --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-var/input.ts @@ -0,0 +1 @@ +declare function assertIsString(value: unknown): asserts value; diff --git a/packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-var/output.json b/packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-var/output.json new file mode 100644 index 000000000000..a7b32e23d170 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-var/output.json @@ -0,0 +1,167 @@ +{ + "type": "File", + "start": 0, + "end": 63, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 63 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 63, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 63 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TSDeclareFunction", + "start": 0, + "end": 63, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 63 + } + }, + "id": { + "type": "Identifier", + "start": 17, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 31 + }, + "identifierName": "assertIsString" + }, + "name": "assertIsString" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 32, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 46 + }, + "identifierName": "value" + }, + "name": "value", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "start": 37, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "typeAnnotation": { + "type": "TSUnknownKeyword", + "start": 39, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 39 + }, + "end": { + "line": 1, + "column": 46 + } + } + } + } + } + ], + "returnType": { + "type": "TSTypeAnnotation", + "start": 47, + "end": 62, + "loc": { + "start": { + "line": 1, + "column": 47 + }, + "end": { + "line": 1, + "column": 62 + } + }, + "typeAnnotation": { + "type": "TSTypePredicate", + "start": 47, + "end": 62, + "loc": { + "start": { + "line": 1, + "column": 47 + }, + "end": { + "line": 1, + "column": 62 + } + }, + "parameterName": { + "type": "Identifier", + "start": 57, + "end": 62, + "loc": { + "start": { + "line": 1, + "column": 57 + }, + "end": { + "line": 1, + "column": 62 + }, + "identifierName": "value" + }, + "name": "value" + }, + "assertsModifier": true + } + }, + "declare": true + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-with-predicate/input.ts b/packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-with-predicate/input.ts new file mode 100644 index 000000000000..9456a5cb2e50 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-with-predicate/input.ts @@ -0,0 +1 @@ +declare function assertIsString(value: unknown): asserts value is string; diff --git a/packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-with-predicate/output.json b/packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-with-predicate/output.json new file mode 100644 index 000000000000..ca83a725e2d5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-with-predicate/output.json @@ -0,0 +1,197 @@ +{ + "type": "File", + "start": 0, + "end": 73, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 73 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 73, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 73 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TSDeclareFunction", + "start": 0, + "end": 73, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 73 + } + }, + "id": { + "type": "Identifier", + "start": 17, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 31 + }, + "identifierName": "assertIsString" + }, + "name": "assertIsString" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 32, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 46 + }, + "identifierName": "value" + }, + "name": "value", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "start": 37, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "typeAnnotation": { + "type": "TSUnknownKeyword", + "start": 39, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 39 + }, + "end": { + "line": 1, + "column": 46 + } + } + } + } + } + ], + "returnType": { + "type": "TSTypeAnnotation", + "start": 47, + "end": 72, + "loc": { + "start": { + "line": 1, + "column": 47 + }, + "end": { + "line": 1, + "column": 72 + } + }, + "typeAnnotation": { + "type": "TSTypePredicate", + "start": 47, + "end": 72, + "loc": { + "start": { + "line": 1, + "column": 47 + }, + "end": { + "line": 1, + "column": 72 + } + }, + "parameterName": { + "type": "Identifier", + "start": 57, + "end": 62, + "loc": { + "start": { + "line": 1, + "column": 57 + }, + "end": { + "line": 1, + "column": 62 + }, + "identifierName": "value" + }, + "name": "value" + }, + "typeAnnotation": { + "type": "TSTypeAnnotation", + "start": 66, + "end": 72, + "loc": { + "start": { + "line": 1, + "column": 66 + }, + "end": { + "line": 1, + "column": 72 + } + }, + "typeAnnotation": { + "type": "TSStringKeyword", + "start": 66, + "end": 72, + "loc": { + "start": { + "line": 1, + "column": 66 + }, + "end": { + "line": 1, + "column": 72 + } + } + } + }, + "assertsModifier": true + } + }, + "declare": true + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/assert-predicate/function-declaration/input.ts b/packages/babel-parser/test/fixtures/typescript/assert-predicate/function-declaration/input.ts new file mode 100644 index 000000000000..b04da8349ca2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/assert-predicate/function-declaration/input.ts @@ -0,0 +1,3 @@ +function asserts1 (value: unknown): asserts value is string {} +function asserts2 (value: unknown): asserts value {} +function asserts3 (value: unknown): asserts {} diff --git a/packages/babel-parser/test/fixtures/typescript/assert-predicate/function-declaration/output.json b/packages/babel-parser/test/fixtures/typescript/assert-predicate/function-declaration/output.json new file mode 100644 index 000000000000..96aea85b2926 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/assert-predicate/function-declaration/output.json @@ -0,0 +1,508 @@ +{ + "type": "File", + "start": 0, + "end": 163, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 46 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 163, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 46 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 62, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 62 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 17 + }, + "identifierName": "asserts1" + }, + "name": "asserts1" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 19, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 33 + }, + "identifierName": "value" + }, + "name": "value", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "start": 24, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "typeAnnotation": { + "type": "TSUnknownKeyword", + "start": 26, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 33 + } + } + } + } + } + ], + "returnType": { + "type": "TSTypeAnnotation", + "start": 34, + "end": 59, + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 59 + } + }, + "typeAnnotation": { + "type": "TSTypePredicate", + "start": 34, + "end": 59, + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 59 + } + }, + "parameterName": { + "type": "Identifier", + "start": 44, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 44 + }, + "end": { + "line": 1, + "column": 49 + }, + "identifierName": "value" + }, + "name": "value" + }, + "typeAnnotation": { + "type": "TSTypeAnnotation", + "start": 53, + "end": 59, + "loc": { + "start": { + "line": 1, + "column": 53 + }, + "end": { + "line": 1, + "column": 59 + } + }, + "typeAnnotation": { + "type": "TSStringKeyword", + "start": 53, + "end": 59, + "loc": { + "start": { + "line": 1, + "column": 53 + }, + "end": { + "line": 1, + "column": 59 + } + } + } + }, + "assertsModifier": true + } + }, + "body": { + "type": "BlockStatement", + "start": 60, + "end": 62, + "loc": { + "start": { + "line": 1, + "column": 60 + }, + "end": { + "line": 1, + "column": 62 + } + }, + "body": [], + "directives": [] + } + }, + { + "type": "FunctionDeclaration", + "start": 64, + "end": 116, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 52 + } + }, + "id": { + "type": "Identifier", + "start": 73, + "end": 81, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 17 + }, + "identifierName": "asserts2" + }, + "name": "asserts2" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 83, + "end": 97, + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 33 + }, + "identifierName": "value" + }, + "name": "value", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "start": 88, + "end": 97, + "loc": { + "start": { + "line": 2, + "column": 24 + }, + "end": { + "line": 2, + "column": 33 + } + }, + "typeAnnotation": { + "type": "TSUnknownKeyword", + "start": 90, + "end": 97, + "loc": { + "start": { + "line": 2, + "column": 26 + }, + "end": { + "line": 2, + "column": 33 + } + } + } + } + } + ], + "returnType": { + "type": "TSTypeAnnotation", + "start": 98, + "end": 113, + "loc": { + "start": { + "line": 2, + "column": 34 + }, + "end": { + "line": 2, + "column": 49 + } + }, + "typeAnnotation": { + "type": "TSTypePredicate", + "start": 98, + "end": 113, + "loc": { + "start": { + "line": 2, + "column": 34 + }, + "end": { + "line": 2, + "column": 49 + } + }, + "parameterName": { + "type": "Identifier", + "start": 108, + "end": 113, + "loc": { + "start": { + "line": 2, + "column": 44 + }, + "end": { + "line": 2, + "column": 49 + }, + "identifierName": "value" + }, + "name": "value" + }, + "assertsModifier": true + } + }, + "body": { + "type": "BlockStatement", + "start": 114, + "end": 116, + "loc": { + "start": { + "line": 2, + "column": 50 + }, + "end": { + "line": 2, + "column": 52 + } + }, + "body": [], + "directives": [] + } + }, + { + "type": "FunctionDeclaration", + "start": 117, + "end": 163, + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 46 + } + }, + "id": { + "type": "Identifier", + "start": 126, + "end": 134, + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 17 + }, + "identifierName": "asserts3" + }, + "name": "asserts3" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 136, + "end": 150, + "loc": { + "start": { + "line": 3, + "column": 19 + }, + "end": { + "line": 3, + "column": 33 + }, + "identifierName": "value" + }, + "name": "value", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "start": 141, + "end": 150, + "loc": { + "start": { + "line": 3, + "column": 24 + }, + "end": { + "line": 3, + "column": 33 + } + }, + "typeAnnotation": { + "type": "TSUnknownKeyword", + "start": 143, + "end": 150, + "loc": { + "start": { + "line": 3, + "column": 26 + }, + "end": { + "line": 3, + "column": 33 + } + } + } + } + } + ], + "returnType": { + "type": "TSTypeAnnotation", + "start": 151, + "end": 160, + "loc": { + "start": { + "line": 3, + "column": 34 + }, + "end": { + "line": 3, + "column": 43 + } + }, + "typeAnnotation": { + "type": "TSTypeReference", + "start": 153, + "end": 160, + "loc": { + "start": { + "line": 3, + "column": 36 + }, + "end": { + "line": 3, + "column": 43 + } + }, + "typeName": { + "type": "Identifier", + "start": 153, + "end": 160, + "loc": { + "start": { + "line": 3, + "column": 36 + }, + "end": { + "line": 3, + "column": 43 + }, + "identifierName": "asserts" + }, + "name": "asserts" + } + } + }, + "body": { + "type": "BlockStatement", + "start": 161, + "end": 163, + "loc": { + "start": { + "line": 3, + "column": 44 + }, + "end": { + "line": 3, + "column": 46 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/function/predicate-types/output.json b/packages/babel-parser/test/fixtures/typescript/function/predicate-types/output.json index 85ab4987f1c2..90bae5b4ceda 100644 --- a/packages/babel-parser/test/fixtures/typescript/function/predicate-types/output.json +++ b/packages/babel-parser/test/fixtures/typescript/function/predicate-types/output.json @@ -127,12 +127,12 @@ }, "typeAnnotation": { "type": "TSTypePredicate", - "start": 20, + "start": 18, "end": 32, "loc": { "start": { "line": 1, - "column": 20 + "column": 18 }, "end": { "line": 1, @@ -302,12 +302,12 @@ }, "typeAnnotation": { "type": "TSTypePredicate", - "start": 55, + "start": 53, "end": 67, "loc": { "start": { "line": 2, - "column": 19 + "column": 17 }, "end": { "line": 2, diff --git a/packages/babel-types/src/definitions/typescript.js b/packages/babel-types/src/definitions/typescript.js index af34dbfc6255..b20448af8d1e 100644 --- a/packages/babel-types/src/definitions/typescript.js +++ b/packages/babel-types/src/definitions/typescript.js @@ -175,10 +175,11 @@ defineType("TSTypeReference", { defineType("TSTypePredicate", { aliases: ["TSType"], - visitor: ["parameterName", "typeAnnotation"], + visitor: ["parameterName", "typeAnnotation", "assertsModifier"], fields: { parameterName: validateType(["Identifier", "TSThisType"]), - typeAnnotation: validateType("TSTypeAnnotation"), + typeAnnotation: validateOptionalType("TSTypeAnnotation"), + assertsModifier: validate(bool), }, }); From 3a5e8a8dd428bc6240e75ee9aee2ccf2d9443cc6 Mon Sep 17 00:00:00 2001 From: Devon Govett Date: Tue, 29 Oct 2019 11:37:50 -0700 Subject: [PATCH 017/648] Add support for babel.config.json (#10501) * Add support for babel.config.json root config * Throw if multiple configuration files are found * Add tests --- .../src/config/files/configuration.js | 36 ++++++++++++--- packages/babel-core/test/config-chain.js | 46 +++++++++++++++++++ .../babel-config-js-and-json/babel.config.js | 3 ++ .../babel.config.json | 3 ++ .../babel-config-js/babel.config.js | 3 ++ .../babel-config-json/babel.config.json | 3 ++ 6 files changed, 88 insertions(+), 6 deletions(-) create mode 100644 packages/babel-core/test/fixtures/config/config-files/babel-config-js-and-json/babel.config.js create mode 100644 packages/babel-core/test/fixtures/config/config-files/babel-config-js-and-json/babel.config.json create mode 100644 packages/babel-core/test/fixtures/config/config-files/babel-config-js/babel.config.js create mode 100644 packages/babel-core/test/fixtures/config/config-files/babel-config-json/babel.config.json diff --git a/packages/babel-core/src/config/files/configuration.js b/packages/babel-core/src/config/files/configuration.js index ab3353f6fde3..adf26e6c687f 100644 --- a/packages/babel-core/src/config/files/configuration.js +++ b/packages/babel-core/src/config/files/configuration.js @@ -19,6 +19,11 @@ import type { CallerMetadata } from "../validation/options"; const debug = buildDebug("babel:config:loading:files:configuration"); const BABEL_CONFIG_JS_FILENAME = "babel.config.js"; +const BABEL_CONFIG_JSON_FILENAME = "babel.config.json"; +const ROOT_CONFIG_FILENAMES = [ + BABEL_CONFIG_JS_FILENAME, + BABEL_CONFIG_JSON_FILENAME, +]; const BABELRC_FILENAME = ".babelrc"; const BABELRC_JS_FILENAME = ".babelrc.js"; @@ -27,7 +32,10 @@ const BABELIGNORE_FILENAME = ".babelignore"; export function findConfigUpwards(rootDir: string): string | null { let dirname = rootDir; while (true) { - if (fs.existsSync(path.join(dirname, BABEL_CONFIG_JS_FILENAME))) { + if ( + fs.existsSync(path.join(dirname, BABEL_CONFIG_JS_FILENAME)) || + fs.existsSync(path.join(dirname, BABEL_CONFIG_JSON_FILENAME)) + ) { return dirname; } @@ -110,13 +118,29 @@ export function findRootConfig( envName: string, caller: CallerMetadata | void, ): ConfigFile | null { - const filepath = path.resolve(dirname, BABEL_CONFIG_JS_FILENAME); + const config = ROOT_CONFIG_FILENAMES.reduce( + (previousConfig: ConfigFile | null, name) => { + const filepath = path.resolve(dirname, name); + const config = readConfig(filepath, envName, caller); + + if (config && previousConfig) { + throw new Error( + `Multiple configuration files found. Please remove one:\n` + + ` - ${path.basename(previousConfig.filepath)}\n` + + ` - ${name}\n` + + `from ${dirname}`, + ); + } - const conf = readConfig(filepath, envName, caller); - if (conf) { - debug("Found root config %o in %o.", BABEL_CONFIG_JS_FILENAME, dirname); + return config || previousConfig; + }, + null, + ); + + if (config) { + debug("Found configuration %o from %o.", config.filepath, dirname); } - return conf; + return config; } export function loadConfig( diff --git a/packages/babel-core/test/config-chain.js b/packages/babel-core/test/config-chain.js index 32513b1a4519..c5f6e2ebf205 100644 --- a/packages/babel-core/test/config-chain.js +++ b/packages/babel-core/test/config-chain.js @@ -944,6 +944,52 @@ describe("buildConfigChain", function() { } }); + it("should load babel.config.json", () => { + const filename = fixture("config-files", "babel-config-json", "src.js"); + + expect( + loadOptions({ + filename, + cwd: path.dirname(filename), + }), + ).toEqual({ + ...getDefaults(), + filename: filename, + cwd: path.dirname(filename), + root: path.dirname(filename), + comments: true, + }); + }); + + it("should load babel.config.js", () => { + const filename = fixture("config-files", "babel-config-js", "src.js"); + + expect( + loadOptions({ + filename, + cwd: path.dirname(filename), + }), + ).toEqual({ + ...getDefaults(), + filename: filename, + cwd: path.dirname(filename), + root: path.dirname(filename), + comments: true, + }); + }); + + it("should whtow if both babel.config.json and babel.config.js are used", () => { + const filename = fixture( + "config-files", + "babel-config-js-and-json", + "src.js", + ); + + expect(() => + loadOptions({ filename, cwd: path.dirname(filename) }), + ).toThrow(/Multiple configuration files found/); + }); + it("should load .babelrc", () => { const filename = fixture("config-files", "babelrc", "src.js"); diff --git a/packages/babel-core/test/fixtures/config/config-files/babel-config-js-and-json/babel.config.js b/packages/babel-core/test/fixtures/config/config-files/babel-config-js-and-json/babel.config.js new file mode 100644 index 000000000000..409f4a98ac90 --- /dev/null +++ b/packages/babel-core/test/fixtures/config/config-files/babel-config-js-and-json/babel.config.js @@ -0,0 +1,3 @@ +module.exports = { + comments: true +}; diff --git a/packages/babel-core/test/fixtures/config/config-files/babel-config-js-and-json/babel.config.json b/packages/babel-core/test/fixtures/config/config-files/babel-config-js-and-json/babel.config.json new file mode 100644 index 000000000000..4b7be6033f68 --- /dev/null +++ b/packages/babel-core/test/fixtures/config/config-files/babel-config-js-and-json/babel.config.json @@ -0,0 +1,3 @@ +{ + "comments": true +} \ No newline at end of file diff --git a/packages/babel-core/test/fixtures/config/config-files/babel-config-js/babel.config.js b/packages/babel-core/test/fixtures/config/config-files/babel-config-js/babel.config.js new file mode 100644 index 000000000000..409f4a98ac90 --- /dev/null +++ b/packages/babel-core/test/fixtures/config/config-files/babel-config-js/babel.config.js @@ -0,0 +1,3 @@ +module.exports = { + comments: true +}; diff --git a/packages/babel-core/test/fixtures/config/config-files/babel-config-json/babel.config.json b/packages/babel-core/test/fixtures/config/config-files/babel-config-json/babel.config.json new file mode 100644 index 000000000000..4b7be6033f68 --- /dev/null +++ b/packages/babel-core/test/fixtures/config/config-files/babel-config-json/babel.config.json @@ -0,0 +1,3 @@ +{ + "comments": true +} \ No newline at end of file From 63f9a3c94688ab6cb917770cf62831a729185c17 Mon Sep 17 00:00:00 2001 From: Georgii Dolzhykov Date: Tue, 29 Oct 2019 22:25:42 +0200 Subject: [PATCH 018/648] rename `assertsModifier` to `asserts` (#10613) see https://github.com/babel/babel/pull/10543#issuecomment-547571501 --- .../babel-generator/src/generators/typescript.js | 2 +- .../babel-parser/src/plugins/typescript/index.js | 12 ++++++------ .../assert-predicate/arrow-function/output.json | 6 +++--- .../assert-predicate/asserts-var/output.json | 4 ++-- .../asserts-with-predicate/output.json | 4 ++-- .../function-declaration/output.json | 6 +++--- packages/babel-types/src/definitions/typescript.js | 4 ++-- 7 files changed, 19 insertions(+), 19 deletions(-) diff --git a/packages/babel-generator/src/generators/typescript.js b/packages/babel-generator/src/generators/typescript.js index aa5e4ce4cde6..a201a5d5d658 100644 --- a/packages/babel-generator/src/generators/typescript.js +++ b/packages/babel-generator/src/generators/typescript.js @@ -197,7 +197,7 @@ export function TSTypeReference(node) { } export function TSTypePredicate(node) { - if (node.assertsModifier) { + if (node.asserts) { this.word("asserts"); this.space(); } diff --git a/packages/babel-parser/src/plugins/typescript/index.js b/packages/babel-parser/src/plugins/typescript/index.js index a47dfac29ba6..26a6246d59e6 100644 --- a/packages/babel-parser/src/plugins/typescript/index.js +++ b/packages/babel-parser/src/plugins/typescript/index.js @@ -904,8 +904,8 @@ export default (superClass: Class): Class => const t: N.TsTypeAnnotation = this.startNode(); this.expect(returnToken); - const assertsModifier = this.tsTryParse( - this.tsParseTypePredicateAssertsModifier.bind(this), + const asserts = this.tsTryParse( + this.tsParseTypePredicateAsserts.bind(this), ); const typePredicateVariable = @@ -913,7 +913,7 @@ export default (superClass: Class): Class => this.tsTryParse(this.tsParseTypePredicatePrefix.bind(this)); if (!typePredicateVariable) { - if (!assertsModifier) { + if (!asserts) { // : type return this.tsParseTypeAnnotation(/* eatColon */ false, t); } @@ -921,7 +921,7 @@ export default (superClass: Class): Class => // : asserts foo const node = this.startNodeAtNode(t); node.parameterName = this.parseIdentifier(); - node.assertsModifier = assertsModifier; + node.asserts = asserts; t.typeAnnotation = this.finishNode(node, "TSTypePredicate"); return this.finishNode(t, "TSTypeAnnotation"); } @@ -931,7 +931,7 @@ export default (superClass: Class): Class => const node = this.startNodeAtNode(t); node.parameterName = typePredicateVariable; node.typeAnnotation = type; - node.assertsModifier = assertsModifier; + node.asserts = asserts; t.typeAnnotation = this.finishNode(node, "TSTypePredicate"); return this.finishNode(t, "TSTypeAnnotation"); }); @@ -959,7 +959,7 @@ export default (superClass: Class): Class => } } - tsParseTypePredicateAssertsModifier(): boolean { + tsParseTypePredicateAsserts(): boolean { if (!this.tsIsIdentifier()) { return false; } diff --git a/packages/babel-parser/test/fixtures/typescript/assert-predicate/arrow-function/output.json b/packages/babel-parser/test/fixtures/typescript/assert-predicate/arrow-function/output.json index e368637de0a9..f06258409292 100644 --- a/packages/babel-parser/test/fixtures/typescript/assert-predicate/arrow-function/output.json +++ b/packages/babel-parser/test/fixtures/typescript/assert-predicate/arrow-function/output.json @@ -164,7 +164,7 @@ } } }, - "assertsModifier": true + "asserts": true } }, "id": null, @@ -346,7 +346,7 @@ }, "name": "value" }, - "assertsModifier": true + "asserts": true } }, "id": null, @@ -607,4 +607,4 @@ ], "directives": [] } -} \ No newline at end of file +} diff --git a/packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-var/output.json b/packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-var/output.json index a7b32e23d170..62c634c7dc8e 100644 --- a/packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-var/output.json +++ b/packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-var/output.json @@ -156,7 +156,7 @@ }, "name": "value" }, - "assertsModifier": true + "asserts": true } }, "declare": true @@ -164,4 +164,4 @@ ], "directives": [] } -} \ No newline at end of file +} diff --git a/packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-with-predicate/output.json b/packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-with-predicate/output.json index ca83a725e2d5..82cdaebbcf79 100644 --- a/packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-with-predicate/output.json +++ b/packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-with-predicate/output.json @@ -186,7 +186,7 @@ } } }, - "assertsModifier": true + "asserts": true } }, "declare": true @@ -194,4 +194,4 @@ ], "directives": [] } -} \ No newline at end of file +} diff --git a/packages/babel-parser/test/fixtures/typescript/assert-predicate/function-declaration/output.json b/packages/babel-parser/test/fixtures/typescript/assert-predicate/function-declaration/output.json index 96aea85b2926..bea1caf3de2a 100644 --- a/packages/babel-parser/test/fixtures/typescript/assert-predicate/function-declaration/output.json +++ b/packages/babel-parser/test/fixtures/typescript/assert-predicate/function-declaration/output.json @@ -186,7 +186,7 @@ } } }, - "assertsModifier": true + "asserts": true } }, "body": { @@ -334,7 +334,7 @@ }, "name": "value" }, - "assertsModifier": true + "asserts": true } }, "body": { @@ -505,4 +505,4 @@ ], "directives": [] } -} \ No newline at end of file +} diff --git a/packages/babel-types/src/definitions/typescript.js b/packages/babel-types/src/definitions/typescript.js index b20448af8d1e..bba8a5b73c8e 100644 --- a/packages/babel-types/src/definitions/typescript.js +++ b/packages/babel-types/src/definitions/typescript.js @@ -175,11 +175,11 @@ defineType("TSTypeReference", { defineType("TSTypePredicate", { aliases: ["TSType"], - visitor: ["parameterName", "typeAnnotation", "assertsModifier"], + visitor: ["parameterName", "typeAnnotation", "asserts"], fields: { parameterName: validateType(["Identifier", "TSThisType"]), typeAnnotation: validateOptionalType("TSTypeAnnotation"), - assertsModifier: validate(bool), + asserts: validate(bool), }, }); From 143d159982bcbe9a31c758b67a888d948c5ff376 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?= Date: Tue, 29 Oct 2019 22:18:39 +0100 Subject: [PATCH 019/648] Create parser plugin "topLevelAwait" (#10449) * Create parser plugin "topLevelAwait" * Update test262 whitelist * Update ts typings * Fix "sourceType: unambiguous" with TLA * Ambiguous tokens after await * Update await %x(0) * typo [skip ci] * Typo [skip ci] Co-Authored-By: Brian Ng --- packages/babel-parser/src/index.js | 25 +- packages/babel-parser/src/parser/base.js | 1 + .../babel-parser/src/parser/expression.js | 25 + packages/babel-parser/src/parser/statement.js | 6 +- .../top-level-await/export-default/input.js | 1 + .../export-default/options.json | 4 + .../export-default/output.json | 85 ++++ .../top-level-await/for-await-module/input.js | 1 + .../for-await-module/options.json | 4 + .../for-await-module/output.json | 134 +++++ .../top-level-await/for-await-script/input.js | 1 + .../for-await-script/options.json | 5 + .../top-level-await/inside-arrow/input.js | 1 + .../top-level-await/inside-arrow/options.json | 5 + .../top-level-await/inside-block/input.js | 3 + .../top-level-await/inside-block/options.json | 4 + .../top-level-await/inside-block/output.json | 135 +++++ .../top-level-await/inside-function/input.js | 3 + .../inside-function/options.json | 5 + .../top-level-await/top-level-module/input.js | 1 + .../top-level-module/options.json | 4 + .../top-level-module/output.json | 85 ++++ .../top-level-await/top-level-script/input.js | 1 + .../top-level-script/options.json | 5 + .../input.js | 7 + .../options.json | 5 + .../output.json | 388 ++++++++++++++ .../unambiguous-ambiguous-modulo/input.js | 1 + .../unambiguous-ambiguous-modulo/options.json | 4 + .../unambiguous-ambiguous-modulo/output.json | 137 +++++ .../unambiguous-ambiguous-script/input.js | 8 + .../unambiguous-ambiguous-script/options.json | 4 + .../unambiguous-ambiguous-script/output.json | 476 ++++++++++++++++++ .../input.js | 1 + .../options.json | 4 + .../output.json | 137 +++++ .../unambiguous-module/input.js | 7 + .../unambiguous-module/options.json | 4 + .../unambiguous-module/output.json | 388 ++++++++++++++ .../babel-parser/typings/babel-parser.d.ts | 1 + .../test262/run_babel_parser_test262_utils.js | 1 + scripts/tests/test262/test262_whitelist.txt | 452 ----------------- 42 files changed, 2108 insertions(+), 461 deletions(-) create mode 100644 packages/babel-parser/test/fixtures/experimental/top-level-await/export-default/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/top-level-await/export-default/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/top-level-await/export-default/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/top-level-await/for-await-module/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/top-level-await/for-await-module/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/top-level-await/for-await-module/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/top-level-await/for-await-script/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/top-level-await/for-await-script/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/top-level-await/inside-arrow/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/top-level-await/inside-arrow/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/top-level-await/inside-block/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/top-level-await/inside-block/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/top-level-await/inside-block/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/top-level-await/inside-function/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/top-level-await/inside-function/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/top-level-await/top-level-module/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/top-level-await/top-level-module/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/top-level-await/top-level-module/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/top-level-await/top-level-script/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/top-level-await/top-level-script/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-ambiguous-allowAwaitOutsideFunction/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-ambiguous-allowAwaitOutsideFunction/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-ambiguous-allowAwaitOutsideFunction/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-ambiguous-modulo/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-ambiguous-modulo/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-ambiguous-modulo/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-ambiguous-script/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-ambiguous-script/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-ambiguous-script/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-ambiguous-v8intrinsinc/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-ambiguous-v8intrinsinc/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-ambiguous-v8intrinsinc/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-module/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-module/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-module/output.json diff --git a/packages/babel-parser/src/index.js b/packages/babel-parser/src/index.js index d9f812695545..3e9696b858fc 100755 --- a/packages/babel-parser/src/index.js +++ b/packages/babel-parser/src/index.js @@ -25,15 +25,32 @@ export function parse(input: string, options?: Options): File { const parser = getParser(options, input); const ast = parser.parse(); - // Rather than try to parse as a script first, we opt to parse as a module and convert back - // to a script where possible to avoid having to do a full re-parse of the input content. - if (!parser.sawUnambiguousESM) ast.program.sourceType = "script"; + if (parser.sawUnambiguousESM) { + return ast; + } + + if (parser.ambiguousScriptDifferentAst) { + // Top level await introduces code which can be both a valid script and + // a valid module, but which produces different ASTs: + // await + // 0 + // can be parsed either as an AwaitExpression, or as two ExpressionStatements. + try { + options.sourceType = "script"; + return getParser(options, input).parse(); + } catch {} + } else { + // This is both a valid module and a valid script, but + // we parse it as a script by default + ast.program.sourceType = "script"; + } + return ast; } catch (moduleError) { try { options.sourceType = "script"; return getParser(options, input).parse(); - } catch (scriptError) {} + } catch {} throw moduleError; } diff --git a/packages/babel-parser/src/parser/base.js b/packages/babel-parser/src/parser/base.js index 1e451794158c..f4fb9f3b66e0 100644 --- a/packages/babel-parser/src/parser/base.js +++ b/packages/babel-parser/src/parser/base.js @@ -13,6 +13,7 @@ export default class BaseParser { plugins: PluginsMap; filename: ?string; sawUnambiguousESM: boolean = false; + ambiguousScriptDifferentAst: boolean = false; // Initialized by Tokenizer state: State; diff --git a/packages/babel-parser/src/parser/expression.js b/packages/babel-parser/src/parser/expression.js index 556ac6daa7be..04299e439830 100644 --- a/packages/babel-parser/src/parser/expression.js +++ b/packages/babel-parser/src/parser/expression.js @@ -2208,6 +2208,7 @@ export default class ExpressionParser extends LValParser { isAwaitAllowed(): boolean { if (this.scope.inFunction) return this.scope.inAsync; if (this.options.allowAwaitOutsideFunction) return true; + if (this.hasPlugin("topLevelAwait")) return this.inModule; return false; } @@ -2234,9 +2235,33 @@ export default class ExpressionParser extends LValParser { ); } + if (!this.scope.inFunction && !this.options.allowAwaitOutsideFunction) { + if ( + this.hasPrecedingLineBreak() || + // All the following expressions are ambiguous: + // await + 0, await - 0, await ( 0 ), await [ 0 ], await / 0 /u, await `` + this.match(tt.plusMin) || + this.match(tt.parenL) || + this.match(tt.bracketL) || + this.match(tt.backQuote) || + // Sometimes the tokenizer generates tt.slash for regexps, and this is + // handler by parseExprAtom + this.match(tt.regexp) || + this.match(tt.slash) || + // This code could be parsed both as a modulo operator or as an intrinsic: + // await %x(0) + (this.hasPlugin("v8intrinsic") && this.match(tt.modulo)) + ) { + this.ambiguousScriptDifferentAst = true; + } else { + this.sawUnambiguousESM = true; + } + } + if (!this.state.soloAwait) { node.argument = this.parseMaybeUnary(); } + return this.finishNode(node, "AwaitExpression"); } diff --git a/packages/babel-parser/src/parser/statement.js b/packages/babel-parser/src/parser/statement.js index 6a67349b2820..9d87c3d27ed2 100644 --- a/packages/babel-parser/src/parser/statement.js +++ b/packages/babel-parser/src/parser/statement.js @@ -495,11 +495,7 @@ export default class StatementParser extends ExpressionParser { this.state.labels.push(loopLabel); let awaitAt = -1; - if ( - (this.scope.inAsync || - (!this.scope.inFunction && this.options.allowAwaitOutsideFunction)) && - this.eatContextual("await") - ) { + if (this.isAwaitAllowed() && this.eatContextual("await")) { awaitAt = this.state.lastTokStart; } this.scope.enter(SCOPE_OTHER); diff --git a/packages/babel-parser/test/fixtures/experimental/top-level-await/export-default/input.js b/packages/babel-parser/test/fixtures/experimental/top-level-await/export-default/input.js new file mode 100644 index 000000000000..fd1dbe08b03f --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/top-level-await/export-default/input.js @@ -0,0 +1 @@ +export default await 0; \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/top-level-await/export-default/options.json b/packages/babel-parser/test/fixtures/experimental/top-level-await/export-default/options.json new file mode 100644 index 000000000000..4d7a9975be5a --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/top-level-await/export-default/options.json @@ -0,0 +1,4 @@ +{ + "plugins": ["topLevelAwait"], + "sourceType": "module" +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/top-level-await/export-default/output.json b/packages/babel-parser/test/fixtures/experimental/top-level-await/export-default/output.json new file mode 100644 index 000000000000..81e260bd12b2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/top-level-await/export-default/output.json @@ -0,0 +1,85 @@ +{ + "type": "File", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportDefaultDeclaration", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "declaration": { + "type": "AwaitExpression", + "start": 15, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "argument": { + "type": "NumericLiteral", + "start": 21, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/top-level-await/for-await-module/input.js b/packages/babel-parser/test/fixtures/experimental/top-level-await/for-await-module/input.js new file mode 100644 index 000000000000..ac76014a6f83 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/top-level-await/for-await-module/input.js @@ -0,0 +1 @@ +for await (const a of b); \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/top-level-await/for-await-module/options.json b/packages/babel-parser/test/fixtures/experimental/top-level-await/for-await-module/options.json new file mode 100644 index 000000000000..aadc3411ae9b --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/top-level-await/for-await-module/options.json @@ -0,0 +1,4 @@ +{ + "plugins": ["topLevelAwait"], + "sourceType": "module" +} diff --git a/packages/babel-parser/test/fixtures/experimental/top-level-await/for-await-module/output.json b/packages/babel-parser/test/fixtures/experimental/top-level-await/for-await-module/output.json new file mode 100644 index 000000000000..42be5c156ae8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/top-level-await/for-await-module/output.json @@ -0,0 +1,134 @@ +{ + "type": "File", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ForOfStatement", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "await": true, + "left": { + "type": "VariableDeclaration", + "start": 11, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 17, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "id": { + "type": "Identifier", + "start": 17, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + }, + "identifierName": "a" + }, + "name": "a" + }, + "init": null + } + ], + "kind": "const" + }, + "right": { + "type": "Identifier", + "start": 22, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + }, + "identifierName": "b" + }, + "name": "b" + }, + "body": { + "type": "EmptyStatement", + "start": 24, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/top-level-await/for-await-script/input.js b/packages/babel-parser/test/fixtures/experimental/top-level-await/for-await-script/input.js new file mode 100644 index 000000000000..ac76014a6f83 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/top-level-await/for-await-script/input.js @@ -0,0 +1 @@ +for await (const a of b); \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/top-level-await/for-await-script/options.json b/packages/babel-parser/test/fixtures/experimental/top-level-await/for-await-script/options.json new file mode 100644 index 000000000000..ad8783d13faa --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/top-level-await/for-await-script/options.json @@ -0,0 +1,5 @@ +{ + "plugins": ["topLevelAwait"], + "sourceType": "script", + "throws": "Unexpected token, expected \"(\" (1:4)" +} diff --git a/packages/babel-parser/test/fixtures/experimental/top-level-await/inside-arrow/input.js b/packages/babel-parser/test/fixtures/experimental/top-level-await/inside-arrow/input.js new file mode 100644 index 000000000000..bde15d37c8ca --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/top-level-await/inside-arrow/input.js @@ -0,0 +1 @@ +() => await 0; diff --git a/packages/babel-parser/test/fixtures/experimental/top-level-await/inside-arrow/options.json b/packages/babel-parser/test/fixtures/experimental/top-level-await/inside-arrow/options.json new file mode 100644 index 000000000000..95eb740f8dfb --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/top-level-await/inside-arrow/options.json @@ -0,0 +1,5 @@ +{ + "plugins": ["topLevelAwait"], + "sourceType": "module", + "throws": "Can not use keyword 'await' outside an async function (1:6)" +} diff --git a/packages/babel-parser/test/fixtures/experimental/top-level-await/inside-block/input.js b/packages/babel-parser/test/fixtures/experimental/top-level-await/inside-block/input.js new file mode 100644 index 000000000000..f264b0344b3b --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/top-level-await/inside-block/input.js @@ -0,0 +1,3 @@ +if (true) { + await 0; +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/top-level-await/inside-block/options.json b/packages/babel-parser/test/fixtures/experimental/top-level-await/inside-block/options.json new file mode 100644 index 000000000000..aadc3411ae9b --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/top-level-await/inside-block/options.json @@ -0,0 +1,4 @@ +{ + "plugins": ["topLevelAwait"], + "sourceType": "module" +} diff --git a/packages/babel-parser/test/fixtures/experimental/top-level-await/inside-block/output.json b/packages/babel-parser/test/fixtures/experimental/top-level-await/inside-block/output.json new file mode 100644 index 000000000000..b70dffe352c1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/top-level-await/inside-block/output.json @@ -0,0 +1,135 @@ +{ + "type": "File", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "IfStatement", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "test": { + "type": "BooleanLiteral", + "start": 4, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "value": true + }, + "consequent": { + "type": "BlockStatement", + "start": 10, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 14, + "end": 22, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 10 + } + }, + "expression": { + "type": "AwaitExpression", + "start": 14, + "end": 21, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 9 + } + }, + "argument": { + "type": "NumericLiteral", + "start": 20, + "end": 21, + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 9 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + } + } + ], + "directives": [] + }, + "alternate": null + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/top-level-await/inside-function/input.js b/packages/babel-parser/test/fixtures/experimental/top-level-await/inside-function/input.js new file mode 100644 index 000000000000..ced447b77235 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/top-level-await/inside-function/input.js @@ -0,0 +1,3 @@ +function fn() { + await 0; +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/top-level-await/inside-function/options.json b/packages/babel-parser/test/fixtures/experimental/top-level-await/inside-function/options.json new file mode 100644 index 000000000000..d09f3f654766 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/top-level-await/inside-function/options.json @@ -0,0 +1,5 @@ +{ + "plugins": ["topLevelAwait"], + "sourceType": "module", + "throws": "Can not use keyword 'await' outside an async function (2:2)" +} diff --git a/packages/babel-parser/test/fixtures/experimental/top-level-await/top-level-module/input.js b/packages/babel-parser/test/fixtures/experimental/top-level-await/top-level-module/input.js new file mode 100644 index 000000000000..d8ddd6c0ad0b --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/top-level-await/top-level-module/input.js @@ -0,0 +1 @@ +await 0; \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/top-level-await/top-level-module/options.json b/packages/babel-parser/test/fixtures/experimental/top-level-await/top-level-module/options.json new file mode 100644 index 000000000000..aadc3411ae9b --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/top-level-await/top-level-module/options.json @@ -0,0 +1,4 @@ +{ + "plugins": ["topLevelAwait"], + "sourceType": "module" +} diff --git a/packages/babel-parser/test/fixtures/experimental/top-level-await/top-level-module/output.json b/packages/babel-parser/test/fixtures/experimental/top-level-await/top-level-module/output.json new file mode 100644 index 000000000000..02ef8ffabf64 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/top-level-await/top-level-module/output.json @@ -0,0 +1,85 @@ +{ + "type": "File", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "expression": { + "type": "AwaitExpression", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "argument": { + "type": "NumericLiteral", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/top-level-await/top-level-script/input.js b/packages/babel-parser/test/fixtures/experimental/top-level-await/top-level-script/input.js new file mode 100644 index 000000000000..d8ddd6c0ad0b --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/top-level-await/top-level-script/input.js @@ -0,0 +1 @@ +await 0; \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/top-level-await/top-level-script/options.json b/packages/babel-parser/test/fixtures/experimental/top-level-await/top-level-script/options.json new file mode 100644 index 000000000000..c9dc6113fea3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/top-level-await/top-level-script/options.json @@ -0,0 +1,5 @@ +{ + "plugins": ["topLevelAwait"], + "sourceType": "script", + "throws": "Unexpected token, expected \";\" (1:6)" +} diff --git a/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-ambiguous-allowAwaitOutsideFunction/input.js b/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-ambiguous-allowAwaitOutsideFunction/input.js new file mode 100644 index 000000000000..1fa05e429c67 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-ambiguous-allowAwaitOutsideFunction/input.js @@ -0,0 +1,7 @@ +await 0 + +await + 0 +await - 0 +await ( 0 ) +await [ 0 ] +await / 0 /u diff --git a/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-ambiguous-allowAwaitOutsideFunction/options.json b/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-ambiguous-allowAwaitOutsideFunction/options.json new file mode 100644 index 000000000000..aceca10c3d74 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-ambiguous-allowAwaitOutsideFunction/options.json @@ -0,0 +1,5 @@ +{ + "plugins": ["topLevelAwait"], + "sourceType": "unambiguous", + "allowAwaitOutsideFunction": true +} diff --git a/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-ambiguous-allowAwaitOutsideFunction/output.json b/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-ambiguous-allowAwaitOutsideFunction/output.json new file mode 100644 index 000000000000..76e30779fc90 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-ambiguous-allowAwaitOutsideFunction/output.json @@ -0,0 +1,388 @@ +{ + "type": "File", + "start": 0, + "end": 65, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 7, + "column": 12 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 65, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 7, + "column": 12 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "expression": { + "type": "AwaitExpression", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "argument": { + "type": "NumericLiteral", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + } + }, + { + "type": "ExpressionStatement", + "start": 9, + "end": 18, + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 9 + } + }, + "expression": { + "type": "AwaitExpression", + "start": 9, + "end": 18, + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 9 + } + }, + "argument": { + "type": "UnaryExpression", + "start": 15, + "end": 18, + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 9 + } + }, + "operator": "+", + "prefix": true, + "argument": { + "type": "NumericLiteral", + "start": 17, + "end": 18, + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 9 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + } + } + }, + { + "type": "ExpressionStatement", + "start": 19, + "end": 28, + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 9 + } + }, + "expression": { + "type": "AwaitExpression", + "start": 19, + "end": 28, + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 9 + } + }, + "argument": { + "type": "UnaryExpression", + "start": 25, + "end": 28, + "loc": { + "start": { + "line": 4, + "column": 6 + }, + "end": { + "line": 4, + "column": 9 + } + }, + "operator": "-", + "prefix": true, + "argument": { + "type": "NumericLiteral", + "start": 27, + "end": 28, + "loc": { + "start": { + "line": 4, + "column": 8 + }, + "end": { + "line": 4, + "column": 9 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + } + } + }, + { + "type": "ExpressionStatement", + "start": 29, + "end": 40, + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 11 + } + }, + "expression": { + "type": "AwaitExpression", + "start": 29, + "end": 40, + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 11 + } + }, + "argument": { + "type": "NumericLiteral", + "start": 37, + "end": 38, + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 5, + "column": 9 + } + }, + "extra": { + "rawValue": 0, + "raw": "0", + "parenthesized": true, + "parenStart": 35 + }, + "value": 0 + } + } + }, + { + "type": "ExpressionStatement", + "start": 41, + "end": 52, + "loc": { + "start": { + "line": 6, + "column": 0 + }, + "end": { + "line": 6, + "column": 11 + } + }, + "expression": { + "type": "AwaitExpression", + "start": 41, + "end": 52, + "loc": { + "start": { + "line": 6, + "column": 0 + }, + "end": { + "line": 6, + "column": 11 + } + }, + "argument": { + "type": "ArrayExpression", + "start": 47, + "end": 52, + "loc": { + "start": { + "line": 6, + "column": 6 + }, + "end": { + "line": 6, + "column": 11 + } + }, + "elements": [ + { + "type": "NumericLiteral", + "start": 49, + "end": 50, + "loc": { + "start": { + "line": 6, + "column": 8 + }, + "end": { + "line": 6, + "column": 9 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ] + } + } + }, + { + "type": "ExpressionStatement", + "start": 53, + "end": 65, + "loc": { + "start": { + "line": 7, + "column": 0 + }, + "end": { + "line": 7, + "column": 12 + } + }, + "expression": { + "type": "AwaitExpression", + "start": 53, + "end": 65, + "loc": { + "start": { + "line": 7, + "column": 0 + }, + "end": { + "line": 7, + "column": 12 + } + }, + "argument": { + "type": "RegExpLiteral", + "start": 59, + "end": 65, + "loc": { + "start": { + "line": 7, + "column": 6 + }, + "end": { + "line": 7, + "column": 12 + } + }, + "extra": { + "raw": "/ 0 /u" + }, + "pattern": " 0 ", + "flags": "u" + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-ambiguous-modulo/input.js b/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-ambiguous-modulo/input.js new file mode 100644 index 000000000000..735a0162b362 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-ambiguous-modulo/input.js @@ -0,0 +1 @@ +await %x(0) \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-ambiguous-modulo/options.json b/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-ambiguous-modulo/options.json new file mode 100644 index 000000000000..2503b82adf74 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-ambiguous-modulo/options.json @@ -0,0 +1,4 @@ +{ + "plugins": ["topLevelAwait"], + "sourceType": "unambiguous" +} diff --git a/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-ambiguous-modulo/output.json b/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-ambiguous-modulo/output.json new file mode 100644 index 000000000000..5805e3195560 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-ambiguous-modulo/output.json @@ -0,0 +1,137 @@ +{ + "type": "File", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "expression": { + "type": "BinaryExpression", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "left": { + "type": "Identifier", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "await" + }, + "name": "await" + }, + "operator": "%", + "right": { + "type": "CallExpression", + "start": 7, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "callee": { + "type": "Identifier", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + }, + "identifierName": "x" + }, + "name": "x" + }, + "arguments": [ + { + "type": "NumericLiteral", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-ambiguous-script/input.js b/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-ambiguous-script/input.js new file mode 100644 index 000000000000..9fac4af0f0aa --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-ambiguous-script/input.js @@ -0,0 +1,8 @@ +await +0 + +await + 0 +await - 0 +await ( 0 ) +await [ 0 ] +await / 0 /u diff --git a/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-ambiguous-script/options.json b/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-ambiguous-script/options.json new file mode 100644 index 000000000000..2503b82adf74 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-ambiguous-script/options.json @@ -0,0 +1,4 @@ +{ + "plugins": ["topLevelAwait"], + "sourceType": "unambiguous" +} diff --git a/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-ambiguous-script/output.json b/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-ambiguous-script/output.json new file mode 100644 index 000000000000..76a211cbb464 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-ambiguous-script/output.json @@ -0,0 +1,476 @@ +{ + "type": "File", + "start": 0, + "end": 65, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 8, + "column": 12 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 65, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 8, + "column": 12 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "expression": { + "type": "Identifier", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "await" + }, + "name": "await" + } + }, + { + "type": "ExpressionStatement", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 1 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 1 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + }, + { + "type": "ExpressionStatement", + "start": 9, + "end": 18, + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 9 + } + }, + "expression": { + "type": "BinaryExpression", + "start": 9, + "end": 18, + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 9 + } + }, + "left": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 5 + }, + "identifierName": "await" + }, + "name": "await" + }, + "operator": "+", + "right": { + "type": "NumericLiteral", + "start": 17, + "end": 18, + "loc": { + "start": { + "line": 4, + "column": 8 + }, + "end": { + "line": 4, + "column": 9 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + } + }, + { + "type": "ExpressionStatement", + "start": 19, + "end": 28, + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 9 + } + }, + "expression": { + "type": "BinaryExpression", + "start": 19, + "end": 28, + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 9 + } + }, + "left": { + "type": "Identifier", + "start": 19, + "end": 24, + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 5 + }, + "identifierName": "await" + }, + "name": "await" + }, + "operator": "-", + "right": { + "type": "NumericLiteral", + "start": 27, + "end": 28, + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 5, + "column": 9 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + } + }, + { + "type": "ExpressionStatement", + "start": 29, + "end": 40, + "loc": { + "start": { + "line": 6, + "column": 0 + }, + "end": { + "line": 6, + "column": 11 + } + }, + "expression": { + "type": "CallExpression", + "start": 29, + "end": 40, + "loc": { + "start": { + "line": 6, + "column": 0 + }, + "end": { + "line": 6, + "column": 11 + } + }, + "callee": { + "type": "Identifier", + "start": 29, + "end": 34, + "loc": { + "start": { + "line": 6, + "column": 0 + }, + "end": { + "line": 6, + "column": 5 + }, + "identifierName": "await" + }, + "name": "await" + }, + "arguments": [ + { + "type": "NumericLiteral", + "start": 37, + "end": 38, + "loc": { + "start": { + "line": 6, + "column": 8 + }, + "end": { + "line": 6, + "column": 9 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 41, + "end": 52, + "loc": { + "start": { + "line": 7, + "column": 0 + }, + "end": { + "line": 7, + "column": 11 + } + }, + "expression": { + "type": "MemberExpression", + "start": 41, + "end": 52, + "loc": { + "start": { + "line": 7, + "column": 0 + }, + "end": { + "line": 7, + "column": 11 + } + }, + "object": { + "type": "Identifier", + "start": 41, + "end": 46, + "loc": { + "start": { + "line": 7, + "column": 0 + }, + "end": { + "line": 7, + "column": 5 + }, + "identifierName": "await" + }, + "name": "await" + }, + "property": { + "type": "NumericLiteral", + "start": 49, + "end": 50, + "loc": { + "start": { + "line": 7, + "column": 8 + }, + "end": { + "line": 7, + "column": 9 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + }, + "computed": true + } + }, + { + "type": "ExpressionStatement", + "start": 53, + "end": 65, + "loc": { + "start": { + "line": 8, + "column": 0 + }, + "end": { + "line": 8, + "column": 12 + } + }, + "expression": { + "type": "BinaryExpression", + "start": 53, + "end": 65, + "loc": { + "start": { + "line": 8, + "column": 0 + }, + "end": { + "line": 8, + "column": 12 + } + }, + "left": { + "type": "BinaryExpression", + "start": 53, + "end": 62, + "loc": { + "start": { + "line": 8, + "column": 0 + }, + "end": { + "line": 8, + "column": 9 + } + }, + "left": { + "type": "Identifier", + "start": 53, + "end": 58, + "loc": { + "start": { + "line": 8, + "column": 0 + }, + "end": { + "line": 8, + "column": 5 + }, + "identifierName": "await" + }, + "name": "await" + }, + "operator": "/", + "right": { + "type": "NumericLiteral", + "start": 61, + "end": 62, + "loc": { + "start": { + "line": 8, + "column": 8 + }, + "end": { + "line": 8, + "column": 9 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + }, + "operator": "/", + "right": { + "type": "Identifier", + "start": 64, + "end": 65, + "loc": { + "start": { + "line": 8, + "column": 11 + }, + "end": { + "line": 8, + "column": 12 + }, + "identifierName": "u" + }, + "name": "u" + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-ambiguous-v8intrinsinc/input.js b/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-ambiguous-v8intrinsinc/input.js new file mode 100644 index 000000000000..735a0162b362 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-ambiguous-v8intrinsinc/input.js @@ -0,0 +1 @@ +await %x(0) \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-ambiguous-v8intrinsinc/options.json b/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-ambiguous-v8intrinsinc/options.json new file mode 100644 index 000000000000..6732f5f2f093 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-ambiguous-v8intrinsinc/options.json @@ -0,0 +1,4 @@ +{ + "plugins": ["topLevelAwait", "v8intrinsic"], + "sourceType": "unambiguous" +} diff --git a/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-ambiguous-v8intrinsinc/output.json b/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-ambiguous-v8intrinsinc/output.json new file mode 100644 index 000000000000..5805e3195560 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-ambiguous-v8intrinsinc/output.json @@ -0,0 +1,137 @@ +{ + "type": "File", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "expression": { + "type": "BinaryExpression", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "left": { + "type": "Identifier", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "await" + }, + "name": "await" + }, + "operator": "%", + "right": { + "type": "CallExpression", + "start": 7, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "callee": { + "type": "Identifier", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + }, + "identifierName": "x" + }, + "name": "x" + }, + "arguments": [ + { + "type": "NumericLiteral", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-module/input.js b/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-module/input.js new file mode 100644 index 000000000000..1fa05e429c67 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-module/input.js @@ -0,0 +1,7 @@ +await 0 + +await + 0 +await - 0 +await ( 0 ) +await [ 0 ] +await / 0 /u diff --git a/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-module/options.json b/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-module/options.json new file mode 100644 index 000000000000..2503b82adf74 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-module/options.json @@ -0,0 +1,4 @@ +{ + "plugins": ["topLevelAwait"], + "sourceType": "unambiguous" +} diff --git a/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-module/output.json b/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-module/output.json new file mode 100644 index 000000000000..18617474f20a --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/top-level-await/unambiguous-module/output.json @@ -0,0 +1,388 @@ +{ + "type": "File", + "start": 0, + "end": 65, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 7, + "column": 12 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 65, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 7, + "column": 12 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "expression": { + "type": "AwaitExpression", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "argument": { + "type": "NumericLiteral", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + } + }, + { + "type": "ExpressionStatement", + "start": 9, + "end": 18, + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 9 + } + }, + "expression": { + "type": "AwaitExpression", + "start": 9, + "end": 18, + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 9 + } + }, + "argument": { + "type": "UnaryExpression", + "start": 15, + "end": 18, + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 9 + } + }, + "operator": "+", + "prefix": true, + "argument": { + "type": "NumericLiteral", + "start": 17, + "end": 18, + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 9 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + } + } + }, + { + "type": "ExpressionStatement", + "start": 19, + "end": 28, + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 9 + } + }, + "expression": { + "type": "AwaitExpression", + "start": 19, + "end": 28, + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 9 + } + }, + "argument": { + "type": "UnaryExpression", + "start": 25, + "end": 28, + "loc": { + "start": { + "line": 4, + "column": 6 + }, + "end": { + "line": 4, + "column": 9 + } + }, + "operator": "-", + "prefix": true, + "argument": { + "type": "NumericLiteral", + "start": 27, + "end": 28, + "loc": { + "start": { + "line": 4, + "column": 8 + }, + "end": { + "line": 4, + "column": 9 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + } + } + }, + { + "type": "ExpressionStatement", + "start": 29, + "end": 40, + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 11 + } + }, + "expression": { + "type": "AwaitExpression", + "start": 29, + "end": 40, + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 11 + } + }, + "argument": { + "type": "NumericLiteral", + "start": 37, + "end": 38, + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 5, + "column": 9 + } + }, + "extra": { + "rawValue": 0, + "raw": "0", + "parenthesized": true, + "parenStart": 35 + }, + "value": 0 + } + } + }, + { + "type": "ExpressionStatement", + "start": 41, + "end": 52, + "loc": { + "start": { + "line": 6, + "column": 0 + }, + "end": { + "line": 6, + "column": 11 + } + }, + "expression": { + "type": "AwaitExpression", + "start": 41, + "end": 52, + "loc": { + "start": { + "line": 6, + "column": 0 + }, + "end": { + "line": 6, + "column": 11 + } + }, + "argument": { + "type": "ArrayExpression", + "start": 47, + "end": 52, + "loc": { + "start": { + "line": 6, + "column": 6 + }, + "end": { + "line": 6, + "column": 11 + } + }, + "elements": [ + { + "type": "NumericLiteral", + "start": 49, + "end": 50, + "loc": { + "start": { + "line": 6, + "column": 8 + }, + "end": { + "line": 6, + "column": 9 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ] + } + } + }, + { + "type": "ExpressionStatement", + "start": 53, + "end": 65, + "loc": { + "start": { + "line": 7, + "column": 0 + }, + "end": { + "line": 7, + "column": 12 + } + }, + "expression": { + "type": "AwaitExpression", + "start": 53, + "end": 65, + "loc": { + "start": { + "line": 7, + "column": 0 + }, + "end": { + "line": 7, + "column": 12 + } + }, + "argument": { + "type": "RegExpLiteral", + "start": 59, + "end": 65, + "loc": { + "start": { + "line": 7, + "column": 6 + }, + "end": { + "line": 7, + "column": 12 + } + }, + "extra": { + "raw": "/ 0 /u" + }, + "pattern": " 0 ", + "flags": "u" + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/typings/babel-parser.d.ts b/packages/babel-parser/typings/babel-parser.d.ts index 575843e6d24b..40161080996b 100644 --- a/packages/babel-parser/typings/babel-parser.d.ts +++ b/packages/babel-parser/typings/babel-parser.d.ts @@ -123,6 +123,7 @@ export type ParserPlugin = 'pipelineOperator' | 'placeholders' | 'throwExpressions' | + 'topLevelAwait' | 'typescript' | 'v8intrinsic' | ParserPluginWithOptions; diff --git a/scripts/tests/test262/run_babel_parser_test262_utils.js b/scripts/tests/test262/run_babel_parser_test262_utils.js index 1434eedfd629..2c35d0ed5933 100644 --- a/scripts/tests/test262/run_babel_parser_test262_utils.js +++ b/scripts/tests/test262/run_babel_parser_test262_utils.js @@ -123,6 +123,7 @@ const featuresToPlugins = { "import.meta": "importMeta", "numeric-separator-literal": "numericSeparator", "optional-chaining": "optionalChaining", + "top-level-await": "topLevelAwait", }; function getPlugins(features) { diff --git a/scripts/tests/test262/test262_whitelist.txt b/scripts/tests/test262/test262_whitelist.txt index 8ed606443333..1e21dcd228dc 100644 --- a/scripts/tests/test262/test262_whitelist.txt +++ b/scripts/tests/test262/test262_whitelist.txt @@ -98,458 +98,6 @@ language/module-code/privatename-not-valid-earlyerr-module-3.js(default) language/module-code/privatename-not-valid-earlyerr-module-3.js(strict mode) language/module-code/privatename-not-valid-earlyerr-module-4.js(default) language/module-code/privatename-not-valid-earlyerr-module-4.js(strict mode) -language/module-code/top-level-await/await-awaits-thenable-not-callable.js(default) -language/module-code/top-level-await/await-awaits-thenable-not-callable.js(strict mode) -language/module-code/top-level-await/await-awaits-thenables-that-throw.js(default) -language/module-code/top-level-await/await-awaits-thenables-that-throw.js(strict mode) -language/module-code/top-level-await/await-awaits-thenables.js(default) -language/module-code/top-level-await/await-awaits-thenables.js(strict mode) -language/module-code/top-level-await/await-dynamic-import-rejection.js(default) -language/module-code/top-level-await/await-dynamic-import-rejection.js(strict mode) -language/module-code/top-level-await/await-dynamic-import-resolution.js(default) -language/module-code/top-level-await/await-dynamic-import-resolution.js(strict mode) -language/module-code/top-level-await/await-expr-func-expression.js(default) -language/module-code/top-level-await/await-expr-func-expression.js(strict mode) -language/module-code/top-level-await/await-expr-new-expr-reject.js(default) -language/module-code/top-level-await/await-expr-new-expr-reject.js(strict mode) -language/module-code/top-level-await/await-expr-new-expr.js(default) -language/module-code/top-level-await/await-expr-new-expr.js(strict mode) -language/module-code/top-level-await/await-expr-regexp.js(default) -language/module-code/top-level-await/await-expr-regexp.js(strict mode) -language/module-code/top-level-await/await-expr-reject-throws.js(default) -language/module-code/top-level-await/await-expr-reject-throws.js(strict mode) -language/module-code/top-level-await/await-expr-resolution.js(default) -language/module-code/top-level-await/await-expr-resolution.js(strict mode) -language/module-code/top-level-await/await-void-expr.js(default) -language/module-code/top-level-await/await-void-expr.js(strict mode) -language/module-code/top-level-await/if-await-expr.js(default) -language/module-code/top-level-await/if-await-expr.js(strict mode) -language/module-code/top-level-await/module-async-import-async-resolution-ticks.js(default) -language/module-code/top-level-await/module-async-import-async-resolution-ticks.js(strict mode) -language/module-code/top-level-await/module-import-unwrapped.js(default) -language/module-code/top-level-await/module-import-unwrapped.js(strict mode) -language/module-code/top-level-await/module-self-import-async-resolution-ticks.js(default) -language/module-code/top-level-await/module-self-import-async-resolution-ticks.js(strict mode) -language/module-code/top-level-await/syntax/await-expr-dyn-import.js(default) -language/module-code/top-level-await/syntax/await-expr-dyn-import.js(strict mode) -language/module-code/top-level-await/syntax/block-await-expr-array-literal.js(default) -language/module-code/top-level-await/syntax/block-await-expr-array-literal.js(strict mode) -language/module-code/top-level-await/syntax/block-await-expr-func-expression.js(default) -language/module-code/top-level-await/syntax/block-await-expr-func-expression.js(strict mode) -language/module-code/top-level-await/syntax/block-await-expr-identifier.js(default) -language/module-code/top-level-await/syntax/block-await-expr-identifier.js(strict mode) -language/module-code/top-level-await/syntax/block-await-expr-literal-number.js(default) -language/module-code/top-level-await/syntax/block-await-expr-literal-number.js(strict mode) -language/module-code/top-level-await/syntax/block-await-expr-literal-string.js(default) -language/module-code/top-level-await/syntax/block-await-expr-literal-string.js(strict mode) -language/module-code/top-level-await/syntax/block-await-expr-nested.js(default) -language/module-code/top-level-await/syntax/block-await-expr-nested.js(strict mode) -language/module-code/top-level-await/syntax/block-await-expr-new-expr.js(default) -language/module-code/top-level-await/syntax/block-await-expr-new-expr.js(strict mode) -language/module-code/top-level-await/syntax/block-await-expr-null.js(default) -language/module-code/top-level-await/syntax/block-await-expr-null.js(strict mode) -language/module-code/top-level-await/syntax/block-await-expr-obj-literal.js(default) -language/module-code/top-level-await/syntax/block-await-expr-obj-literal.js(strict mode) -language/module-code/top-level-await/syntax/block-await-expr-regexp.js(default) -language/module-code/top-level-await/syntax/block-await-expr-regexp.js(strict mode) -language/module-code/top-level-await/syntax/block-await-expr-template-literal.js(default) -language/module-code/top-level-await/syntax/block-await-expr-template-literal.js(strict mode) -language/module-code/top-level-await/syntax/block-await-expr-this.js(default) -language/module-code/top-level-await/syntax/block-await-expr-this.js(strict mode) -language/module-code/top-level-await/syntax/catch-parameter.js(default) -language/module-code/top-level-await/syntax/catch-parameter.js(strict mode) -language/module-code/top-level-await/syntax/export-class-decl-await-expr-array-literal.js(default) -language/module-code/top-level-await/syntax/export-class-decl-await-expr-array-literal.js(strict mode) -language/module-code/top-level-await/syntax/export-class-decl-await-expr-func-expression.js(default) -language/module-code/top-level-await/syntax/export-class-decl-await-expr-func-expression.js(strict mode) -language/module-code/top-level-await/syntax/export-class-decl-await-expr-identifier.js(default) -language/module-code/top-level-await/syntax/export-class-decl-await-expr-identifier.js(strict mode) -language/module-code/top-level-await/syntax/export-class-decl-await-expr-literal-number.js(default) -language/module-code/top-level-await/syntax/export-class-decl-await-expr-literal-number.js(strict mode) -language/module-code/top-level-await/syntax/export-class-decl-await-expr-literal-string.js(default) -language/module-code/top-level-await/syntax/export-class-decl-await-expr-literal-string.js(strict mode) -language/module-code/top-level-await/syntax/export-class-decl-await-expr-nested.js(default) -language/module-code/top-level-await/syntax/export-class-decl-await-expr-nested.js(strict mode) -language/module-code/top-level-await/syntax/export-class-decl-await-expr-new-expr.js(default) -language/module-code/top-level-await/syntax/export-class-decl-await-expr-new-expr.js(strict mode) -language/module-code/top-level-await/syntax/export-class-decl-await-expr-null.js(default) -language/module-code/top-level-await/syntax/export-class-decl-await-expr-null.js(strict mode) -language/module-code/top-level-await/syntax/export-class-decl-await-expr-obj-literal.js(default) -language/module-code/top-level-await/syntax/export-class-decl-await-expr-obj-literal.js(strict mode) -language/module-code/top-level-await/syntax/export-class-decl-await-expr-regexp.js(default) -language/module-code/top-level-await/syntax/export-class-decl-await-expr-regexp.js(strict mode) -language/module-code/top-level-await/syntax/export-class-decl-await-expr-template-literal.js(default) -language/module-code/top-level-await/syntax/export-class-decl-await-expr-template-literal.js(strict mode) -language/module-code/top-level-await/syntax/export-class-decl-await-expr-this.js(default) -language/module-code/top-level-await/syntax/export-class-decl-await-expr-this.js(strict mode) -language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-array-literal.js(default) -language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-array-literal.js(strict mode) -language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-func-expression.js(default) -language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-func-expression.js(strict mode) -language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-identifier.js(default) -language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-identifier.js(strict mode) -language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-literal-number.js(default) -language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-literal-number.js(strict mode) -language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-literal-string.js(default) -language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-literal-string.js(strict mode) -language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-nested.js(default) -language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-nested.js(strict mode) -language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-new-expr.js(default) -language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-new-expr.js(strict mode) -language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-null.js(default) -language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-null.js(strict mode) -language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-obj-literal.js(default) -language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-obj-literal.js(strict mode) -language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-regexp.js(default) -language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-regexp.js(strict mode) -language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-template-literal.js(default) -language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-template-literal.js(strict mode) -language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-this.js(default) -language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-this.js(strict mode) -language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-array-literal.js(default) -language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-array-literal.js(strict mode) -language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-func-expression.js(default) -language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-func-expression.js(strict mode) -language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-identifier.js(default) -language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-identifier.js(strict mode) -language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-literal-number.js(default) -language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-literal-number.js(strict mode) -language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-literal-string.js(default) -language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-literal-string.js(strict mode) -language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-nested.js(default) -language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-nested.js(strict mode) -language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-new-expr.js(default) -language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-new-expr.js(strict mode) -language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-null.js(default) -language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-null.js(strict mode) -language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-obj-literal.js(default) -language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-obj-literal.js(strict mode) -language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-regexp.js(default) -language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-regexp.js(strict mode) -language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-template-literal.js(default) -language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-template-literal.js(strict mode) -language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-this.js(default) -language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-this.js(strict mode) -language/module-code/top-level-await/syntax/export-lex-decl-await-expr-array-literal.js(default) -language/module-code/top-level-await/syntax/export-lex-decl-await-expr-array-literal.js(strict mode) -language/module-code/top-level-await/syntax/export-lex-decl-await-expr-func-expression.js(default) -language/module-code/top-level-await/syntax/export-lex-decl-await-expr-func-expression.js(strict mode) -language/module-code/top-level-await/syntax/export-lex-decl-await-expr-identifier.js(default) -language/module-code/top-level-await/syntax/export-lex-decl-await-expr-identifier.js(strict mode) -language/module-code/top-level-await/syntax/export-lex-decl-await-expr-literal-number.js(default) -language/module-code/top-level-await/syntax/export-lex-decl-await-expr-literal-number.js(strict mode) -language/module-code/top-level-await/syntax/export-lex-decl-await-expr-literal-string.js(default) -language/module-code/top-level-await/syntax/export-lex-decl-await-expr-literal-string.js(strict mode) -language/module-code/top-level-await/syntax/export-lex-decl-await-expr-nested.js(default) -language/module-code/top-level-await/syntax/export-lex-decl-await-expr-nested.js(strict mode) -language/module-code/top-level-await/syntax/export-lex-decl-await-expr-new-expr.js(default) -language/module-code/top-level-await/syntax/export-lex-decl-await-expr-new-expr.js(strict mode) -language/module-code/top-level-await/syntax/export-lex-decl-await-expr-null.js(default) -language/module-code/top-level-await/syntax/export-lex-decl-await-expr-null.js(strict mode) -language/module-code/top-level-await/syntax/export-lex-decl-await-expr-obj-literal.js(default) -language/module-code/top-level-await/syntax/export-lex-decl-await-expr-obj-literal.js(strict mode) -language/module-code/top-level-await/syntax/export-lex-decl-await-expr-regexp.js(default) -language/module-code/top-level-await/syntax/export-lex-decl-await-expr-regexp.js(strict mode) -language/module-code/top-level-await/syntax/export-lex-decl-await-expr-template-literal.js(default) -language/module-code/top-level-await/syntax/export-lex-decl-await-expr-template-literal.js(strict mode) -language/module-code/top-level-await/syntax/export-lex-decl-await-expr-this.js(default) -language/module-code/top-level-await/syntax/export-lex-decl-await-expr-this.js(strict mode) -language/module-code/top-level-await/syntax/export-var-await-expr-array-literal.js(default) -language/module-code/top-level-await/syntax/export-var-await-expr-array-literal.js(strict mode) -language/module-code/top-level-await/syntax/export-var-await-expr-func-expression.js(default) -language/module-code/top-level-await/syntax/export-var-await-expr-func-expression.js(strict mode) -language/module-code/top-level-await/syntax/export-var-await-expr-identifier.js(default) -language/module-code/top-level-await/syntax/export-var-await-expr-identifier.js(strict mode) -language/module-code/top-level-await/syntax/export-var-await-expr-literal-number.js(default) -language/module-code/top-level-await/syntax/export-var-await-expr-literal-number.js(strict mode) -language/module-code/top-level-await/syntax/export-var-await-expr-literal-string.js(default) -language/module-code/top-level-await/syntax/export-var-await-expr-literal-string.js(strict mode) -language/module-code/top-level-await/syntax/export-var-await-expr-nested.js(default) -language/module-code/top-level-await/syntax/export-var-await-expr-nested.js(strict mode) -language/module-code/top-level-await/syntax/export-var-await-expr-new-expr.js(default) -language/module-code/top-level-await/syntax/export-var-await-expr-new-expr.js(strict mode) -language/module-code/top-level-await/syntax/export-var-await-expr-null.js(default) -language/module-code/top-level-await/syntax/export-var-await-expr-null.js(strict mode) -language/module-code/top-level-await/syntax/export-var-await-expr-obj-literal.js(default) -language/module-code/top-level-await/syntax/export-var-await-expr-obj-literal.js(strict mode) -language/module-code/top-level-await/syntax/export-var-await-expr-regexp.js(default) -language/module-code/top-level-await/syntax/export-var-await-expr-regexp.js(strict mode) -language/module-code/top-level-await/syntax/export-var-await-expr-template-literal.js(default) -language/module-code/top-level-await/syntax/export-var-await-expr-template-literal.js(strict mode) -language/module-code/top-level-await/syntax/export-var-await-expr-this.js(default) -language/module-code/top-level-await/syntax/export-var-await-expr-this.js(strict mode) -language/module-code/top-level-await/syntax/for-await-await-expr-array-literal.js(default) -language/module-code/top-level-await/syntax/for-await-await-expr-array-literal.js(strict mode) -language/module-code/top-level-await/syntax/for-await-await-expr-func-expression.js(default) -language/module-code/top-level-await/syntax/for-await-await-expr-func-expression.js(strict mode) -language/module-code/top-level-await/syntax/for-await-await-expr-identifier.js(default) -language/module-code/top-level-await/syntax/for-await-await-expr-identifier.js(strict mode) -language/module-code/top-level-await/syntax/for-await-await-expr-literal-number.js(default) -language/module-code/top-level-await/syntax/for-await-await-expr-literal-number.js(strict mode) -language/module-code/top-level-await/syntax/for-await-await-expr-literal-string.js(default) -language/module-code/top-level-await/syntax/for-await-await-expr-literal-string.js(strict mode) -language/module-code/top-level-await/syntax/for-await-await-expr-nested.js(default) -language/module-code/top-level-await/syntax/for-await-await-expr-nested.js(strict mode) -language/module-code/top-level-await/syntax/for-await-await-expr-new-expr.js(default) -language/module-code/top-level-await/syntax/for-await-await-expr-new-expr.js(strict mode) -language/module-code/top-level-await/syntax/for-await-await-expr-null.js(default) -language/module-code/top-level-await/syntax/for-await-await-expr-null.js(strict mode) -language/module-code/top-level-await/syntax/for-await-await-expr-obj-literal.js(default) -language/module-code/top-level-await/syntax/for-await-await-expr-obj-literal.js(strict mode) -language/module-code/top-level-await/syntax/for-await-await-expr-regexp.js(default) -language/module-code/top-level-await/syntax/for-await-await-expr-regexp.js(strict mode) -language/module-code/top-level-await/syntax/for-await-await-expr-template-literal.js(default) -language/module-code/top-level-await/syntax/for-await-await-expr-template-literal.js(strict mode) -language/module-code/top-level-await/syntax/for-await-await-expr-this.js(default) -language/module-code/top-level-await/syntax/for-await-await-expr-this.js(strict mode) -language/module-code/top-level-await/syntax/for-await-expr-array-literal.js(default) -language/module-code/top-level-await/syntax/for-await-expr-array-literal.js(strict mode) -language/module-code/top-level-await/syntax/for-await-expr-func-expression.js(default) -language/module-code/top-level-await/syntax/for-await-expr-func-expression.js(strict mode) -language/module-code/top-level-await/syntax/for-await-expr-identifier.js(default) -language/module-code/top-level-await/syntax/for-await-expr-identifier.js(strict mode) -language/module-code/top-level-await/syntax/for-await-expr-literal-number.js(default) -language/module-code/top-level-await/syntax/for-await-expr-literal-number.js(strict mode) -language/module-code/top-level-await/syntax/for-await-expr-literal-string.js(default) -language/module-code/top-level-await/syntax/for-await-expr-literal-string.js(strict mode) -language/module-code/top-level-await/syntax/for-await-expr-nested.js(default) -language/module-code/top-level-await/syntax/for-await-expr-nested.js(strict mode) -language/module-code/top-level-await/syntax/for-await-expr-new-expr.js(default) -language/module-code/top-level-await/syntax/for-await-expr-new-expr.js(strict mode) -language/module-code/top-level-await/syntax/for-await-expr-null.js(default) -language/module-code/top-level-await/syntax/for-await-expr-null.js(strict mode) -language/module-code/top-level-await/syntax/for-await-expr-obj-literal.js(default) -language/module-code/top-level-await/syntax/for-await-expr-obj-literal.js(strict mode) -language/module-code/top-level-await/syntax/for-await-expr-regexp.js(default) -language/module-code/top-level-await/syntax/for-await-expr-regexp.js(strict mode) -language/module-code/top-level-await/syntax/for-await-expr-template-literal.js(default) -language/module-code/top-level-await/syntax/for-await-expr-template-literal.js(strict mode) -language/module-code/top-level-await/syntax/for-await-expr-this.js(default) -language/module-code/top-level-await/syntax/for-await-expr-this.js(strict mode) -language/module-code/top-level-await/syntax/for-in-await-expr-array-literal.js(default) -language/module-code/top-level-await/syntax/for-in-await-expr-array-literal.js(strict mode) -language/module-code/top-level-await/syntax/for-in-await-expr-func-expression.js(default) -language/module-code/top-level-await/syntax/for-in-await-expr-func-expression.js(strict mode) -language/module-code/top-level-await/syntax/for-in-await-expr-identifier.js(default) -language/module-code/top-level-await/syntax/for-in-await-expr-identifier.js(strict mode) -language/module-code/top-level-await/syntax/for-in-await-expr-literal-number.js(default) -language/module-code/top-level-await/syntax/for-in-await-expr-literal-number.js(strict mode) -language/module-code/top-level-await/syntax/for-in-await-expr-literal-string.js(default) -language/module-code/top-level-await/syntax/for-in-await-expr-literal-string.js(strict mode) -language/module-code/top-level-await/syntax/for-in-await-expr-nested.js(default) -language/module-code/top-level-await/syntax/for-in-await-expr-nested.js(strict mode) -language/module-code/top-level-await/syntax/for-in-await-expr-new-expr.js(default) -language/module-code/top-level-await/syntax/for-in-await-expr-new-expr.js(strict mode) -language/module-code/top-level-await/syntax/for-in-await-expr-null.js(default) -language/module-code/top-level-await/syntax/for-in-await-expr-null.js(strict mode) -language/module-code/top-level-await/syntax/for-in-await-expr-obj-literal.js(default) -language/module-code/top-level-await/syntax/for-in-await-expr-obj-literal.js(strict mode) -language/module-code/top-level-await/syntax/for-in-await-expr-regexp.js(default) -language/module-code/top-level-await/syntax/for-in-await-expr-regexp.js(strict mode) -language/module-code/top-level-await/syntax/for-in-await-expr-template-literal.js(default) -language/module-code/top-level-await/syntax/for-in-await-expr-template-literal.js(strict mode) -language/module-code/top-level-await/syntax/for-in-await-expr-this.js(default) -language/module-code/top-level-await/syntax/for-in-await-expr-this.js(strict mode) -language/module-code/top-level-await/syntax/for-of-await-expr-array-literal.js(default) -language/module-code/top-level-await/syntax/for-of-await-expr-array-literal.js(strict mode) -language/module-code/top-level-await/syntax/for-of-await-expr-func-expression.js(default) -language/module-code/top-level-await/syntax/for-of-await-expr-func-expression.js(strict mode) -language/module-code/top-level-await/syntax/for-of-await-expr-identifier.js(default) -language/module-code/top-level-await/syntax/for-of-await-expr-identifier.js(strict mode) -language/module-code/top-level-await/syntax/for-of-await-expr-literal-number.js(default) -language/module-code/top-level-await/syntax/for-of-await-expr-literal-number.js(strict mode) -language/module-code/top-level-await/syntax/for-of-await-expr-literal-string.js(default) -language/module-code/top-level-await/syntax/for-of-await-expr-literal-string.js(strict mode) -language/module-code/top-level-await/syntax/for-of-await-expr-nested.js(default) -language/module-code/top-level-await/syntax/for-of-await-expr-nested.js(strict mode) -language/module-code/top-level-await/syntax/for-of-await-expr-new-expr.js(default) -language/module-code/top-level-await/syntax/for-of-await-expr-new-expr.js(strict mode) -language/module-code/top-level-await/syntax/for-of-await-expr-null.js(default) -language/module-code/top-level-await/syntax/for-of-await-expr-null.js(strict mode) -language/module-code/top-level-await/syntax/for-of-await-expr-obj-literal.js(default) -language/module-code/top-level-await/syntax/for-of-await-expr-obj-literal.js(strict mode) -language/module-code/top-level-await/syntax/for-of-await-expr-regexp.js(default) -language/module-code/top-level-await/syntax/for-of-await-expr-regexp.js(strict mode) -language/module-code/top-level-await/syntax/for-of-await-expr-template-literal.js(default) -language/module-code/top-level-await/syntax/for-of-await-expr-template-literal.js(strict mode) -language/module-code/top-level-await/syntax/for-of-await-expr-this.js(default) -language/module-code/top-level-await/syntax/for-of-await-expr-this.js(strict mode) -language/module-code/top-level-await/syntax/if-block-await-expr-array-literal.js(default) -language/module-code/top-level-await/syntax/if-block-await-expr-array-literal.js(strict mode) -language/module-code/top-level-await/syntax/if-block-await-expr-func-expression.js(default) -language/module-code/top-level-await/syntax/if-block-await-expr-func-expression.js(strict mode) -language/module-code/top-level-await/syntax/if-block-await-expr-identifier.js(default) -language/module-code/top-level-await/syntax/if-block-await-expr-identifier.js(strict mode) -language/module-code/top-level-await/syntax/if-block-await-expr-literal-number.js(default) -language/module-code/top-level-await/syntax/if-block-await-expr-literal-number.js(strict mode) -language/module-code/top-level-await/syntax/if-block-await-expr-literal-string.js(default) -language/module-code/top-level-await/syntax/if-block-await-expr-literal-string.js(strict mode) -language/module-code/top-level-await/syntax/if-block-await-expr-nested.js(default) -language/module-code/top-level-await/syntax/if-block-await-expr-nested.js(strict mode) -language/module-code/top-level-await/syntax/if-block-await-expr-new-expr.js(default) -language/module-code/top-level-await/syntax/if-block-await-expr-new-expr.js(strict mode) -language/module-code/top-level-await/syntax/if-block-await-expr-null.js(default) -language/module-code/top-level-await/syntax/if-block-await-expr-null.js(strict mode) -language/module-code/top-level-await/syntax/if-block-await-expr-obj-literal.js(default) -language/module-code/top-level-await/syntax/if-block-await-expr-obj-literal.js(strict mode) -language/module-code/top-level-await/syntax/if-block-await-expr-regexp.js(default) -language/module-code/top-level-await/syntax/if-block-await-expr-regexp.js(strict mode) -language/module-code/top-level-await/syntax/if-block-await-expr-template-literal.js(default) -language/module-code/top-level-await/syntax/if-block-await-expr-template-literal.js(strict mode) -language/module-code/top-level-await/syntax/if-block-await-expr-this.js(default) -language/module-code/top-level-await/syntax/if-block-await-expr-this.js(strict mode) -language/module-code/top-level-await/syntax/if-expr-await-expr-array-literal.js(default) -language/module-code/top-level-await/syntax/if-expr-await-expr-array-literal.js(strict mode) -language/module-code/top-level-await/syntax/if-expr-await-expr-func-expression.js(default) -language/module-code/top-level-await/syntax/if-expr-await-expr-func-expression.js(strict mode) -language/module-code/top-level-await/syntax/if-expr-await-expr-identifier.js(default) -language/module-code/top-level-await/syntax/if-expr-await-expr-identifier.js(strict mode) -language/module-code/top-level-await/syntax/if-expr-await-expr-literal-number.js(default) -language/module-code/top-level-await/syntax/if-expr-await-expr-literal-number.js(strict mode) -language/module-code/top-level-await/syntax/if-expr-await-expr-literal-string.js(default) -language/module-code/top-level-await/syntax/if-expr-await-expr-literal-string.js(strict mode) -language/module-code/top-level-await/syntax/if-expr-await-expr-nested.js(default) -language/module-code/top-level-await/syntax/if-expr-await-expr-nested.js(strict mode) -language/module-code/top-level-await/syntax/if-expr-await-expr-new-expr.js(default) -language/module-code/top-level-await/syntax/if-expr-await-expr-new-expr.js(strict mode) -language/module-code/top-level-await/syntax/if-expr-await-expr-null.js(default) -language/module-code/top-level-await/syntax/if-expr-await-expr-null.js(strict mode) -language/module-code/top-level-await/syntax/if-expr-await-expr-obj-literal.js(default) -language/module-code/top-level-await/syntax/if-expr-await-expr-obj-literal.js(strict mode) -language/module-code/top-level-await/syntax/if-expr-await-expr-regexp.js(default) -language/module-code/top-level-await/syntax/if-expr-await-expr-regexp.js(strict mode) -language/module-code/top-level-await/syntax/if-expr-await-expr-template-literal.js(default) -language/module-code/top-level-await/syntax/if-expr-await-expr-template-literal.js(strict mode) -language/module-code/top-level-await/syntax/if-expr-await-expr-this.js(default) -language/module-code/top-level-await/syntax/if-expr-await-expr-this.js(strict mode) -language/module-code/top-level-await/syntax/top-level-await-expr-array-literal.js(default) -language/module-code/top-level-await/syntax/top-level-await-expr-array-literal.js(strict mode) -language/module-code/top-level-await/syntax/top-level-await-expr-func-expression.js(default) -language/module-code/top-level-await/syntax/top-level-await-expr-func-expression.js(strict mode) -language/module-code/top-level-await/syntax/top-level-await-expr-identifier.js(default) -language/module-code/top-level-await/syntax/top-level-await-expr-identifier.js(strict mode) -language/module-code/top-level-await/syntax/top-level-await-expr-literal-number.js(default) -language/module-code/top-level-await/syntax/top-level-await-expr-literal-number.js(strict mode) -language/module-code/top-level-await/syntax/top-level-await-expr-literal-string.js(default) -language/module-code/top-level-await/syntax/top-level-await-expr-literal-string.js(strict mode) -language/module-code/top-level-await/syntax/top-level-await-expr-nested.js(default) -language/module-code/top-level-await/syntax/top-level-await-expr-nested.js(strict mode) -language/module-code/top-level-await/syntax/top-level-await-expr-new-expr.js(default) -language/module-code/top-level-await/syntax/top-level-await-expr-new-expr.js(strict mode) -language/module-code/top-level-await/syntax/top-level-await-expr-null.js(default) -language/module-code/top-level-await/syntax/top-level-await-expr-null.js(strict mode) -language/module-code/top-level-await/syntax/top-level-await-expr-obj-literal.js(default) -language/module-code/top-level-await/syntax/top-level-await-expr-obj-literal.js(strict mode) -language/module-code/top-level-await/syntax/top-level-await-expr-regexp.js(default) -language/module-code/top-level-await/syntax/top-level-await-expr-regexp.js(strict mode) -language/module-code/top-level-await/syntax/top-level-await-expr-template-literal.js(default) -language/module-code/top-level-await/syntax/top-level-await-expr-template-literal.js(strict mode) -language/module-code/top-level-await/syntax/top-level-await-expr-this.js(default) -language/module-code/top-level-await/syntax/top-level-await-expr-this.js(strict mode) -language/module-code/top-level-await/syntax/try-await-expr-array-literal.js(default) -language/module-code/top-level-await/syntax/try-await-expr-array-literal.js(strict mode) -language/module-code/top-level-await/syntax/try-await-expr-func-expression.js(default) -language/module-code/top-level-await/syntax/try-await-expr-func-expression.js(strict mode) -language/module-code/top-level-await/syntax/try-await-expr-identifier.js(default) -language/module-code/top-level-await/syntax/try-await-expr-identifier.js(strict mode) -language/module-code/top-level-await/syntax/try-await-expr-literal-number.js(default) -language/module-code/top-level-await/syntax/try-await-expr-literal-number.js(strict mode) -language/module-code/top-level-await/syntax/try-await-expr-literal-string.js(default) -language/module-code/top-level-await/syntax/try-await-expr-literal-string.js(strict mode) -language/module-code/top-level-await/syntax/try-await-expr-nested.js(default) -language/module-code/top-level-await/syntax/try-await-expr-nested.js(strict mode) -language/module-code/top-level-await/syntax/try-await-expr-new-expr.js(default) -language/module-code/top-level-await/syntax/try-await-expr-new-expr.js(strict mode) -language/module-code/top-level-await/syntax/try-await-expr-null.js(default) -language/module-code/top-level-await/syntax/try-await-expr-null.js(strict mode) -language/module-code/top-level-await/syntax/try-await-expr-obj-literal.js(default) -language/module-code/top-level-await/syntax/try-await-expr-obj-literal.js(strict mode) -language/module-code/top-level-await/syntax/try-await-expr-regexp.js(default) -language/module-code/top-level-await/syntax/try-await-expr-regexp.js(strict mode) -language/module-code/top-level-await/syntax/try-await-expr-template-literal.js(default) -language/module-code/top-level-await/syntax/try-await-expr-template-literal.js(strict mode) -language/module-code/top-level-await/syntax/try-await-expr-this.js(default) -language/module-code/top-level-await/syntax/try-await-expr-this.js(strict mode) -language/module-code/top-level-await/syntax/typeof-await-expr-array-literal.js(default) -language/module-code/top-level-await/syntax/typeof-await-expr-array-literal.js(strict mode) -language/module-code/top-level-await/syntax/typeof-await-expr-func-expression.js(default) -language/module-code/top-level-await/syntax/typeof-await-expr-func-expression.js(strict mode) -language/module-code/top-level-await/syntax/typeof-await-expr-identifier.js(default) -language/module-code/top-level-await/syntax/typeof-await-expr-identifier.js(strict mode) -language/module-code/top-level-await/syntax/typeof-await-expr-literal-number.js(default) -language/module-code/top-level-await/syntax/typeof-await-expr-literal-number.js(strict mode) -language/module-code/top-level-await/syntax/typeof-await-expr-literal-string.js(default) -language/module-code/top-level-await/syntax/typeof-await-expr-literal-string.js(strict mode) -language/module-code/top-level-await/syntax/typeof-await-expr-nested.js(default) -language/module-code/top-level-await/syntax/typeof-await-expr-nested.js(strict mode) -language/module-code/top-level-await/syntax/typeof-await-expr-new-expr.js(default) -language/module-code/top-level-await/syntax/typeof-await-expr-new-expr.js(strict mode) -language/module-code/top-level-await/syntax/typeof-await-expr-null.js(default) -language/module-code/top-level-await/syntax/typeof-await-expr-null.js(strict mode) -language/module-code/top-level-await/syntax/typeof-await-expr-obj-literal.js(default) -language/module-code/top-level-await/syntax/typeof-await-expr-obj-literal.js(strict mode) -language/module-code/top-level-await/syntax/typeof-await-expr-regexp.js(default) -language/module-code/top-level-await/syntax/typeof-await-expr-regexp.js(strict mode) -language/module-code/top-level-await/syntax/typeof-await-expr-template-literal.js(default) -language/module-code/top-level-await/syntax/typeof-await-expr-template-literal.js(strict mode) -language/module-code/top-level-await/syntax/typeof-await-expr-this.js(default) -language/module-code/top-level-await/syntax/typeof-await-expr-this.js(strict mode) -language/module-code/top-level-await/syntax/void-await-expr-array-literal.js(default) -language/module-code/top-level-await/syntax/void-await-expr-array-literal.js(strict mode) -language/module-code/top-level-await/syntax/void-await-expr-func-expression.js(default) -language/module-code/top-level-await/syntax/void-await-expr-func-expression.js(strict mode) -language/module-code/top-level-await/syntax/void-await-expr-identifier.js(default) -language/module-code/top-level-await/syntax/void-await-expr-identifier.js(strict mode) -language/module-code/top-level-await/syntax/void-await-expr-literal-number.js(default) -language/module-code/top-level-await/syntax/void-await-expr-literal-number.js(strict mode) -language/module-code/top-level-await/syntax/void-await-expr-literal-string.js(default) -language/module-code/top-level-await/syntax/void-await-expr-literal-string.js(strict mode) -language/module-code/top-level-await/syntax/void-await-expr-nested.js(default) -language/module-code/top-level-await/syntax/void-await-expr-nested.js(strict mode) -language/module-code/top-level-await/syntax/void-await-expr-new-expr.js(default) -language/module-code/top-level-await/syntax/void-await-expr-new-expr.js(strict mode) -language/module-code/top-level-await/syntax/void-await-expr-null.js(default) -language/module-code/top-level-await/syntax/void-await-expr-null.js(strict mode) -language/module-code/top-level-await/syntax/void-await-expr-obj-literal.js(default) -language/module-code/top-level-await/syntax/void-await-expr-obj-literal.js(strict mode) -language/module-code/top-level-await/syntax/void-await-expr-regexp.js(default) -language/module-code/top-level-await/syntax/void-await-expr-regexp.js(strict mode) -language/module-code/top-level-await/syntax/void-await-expr-template-literal.js(default) -language/module-code/top-level-await/syntax/void-await-expr-template-literal.js(strict mode) -language/module-code/top-level-await/syntax/void-await-expr-this.js(default) -language/module-code/top-level-await/syntax/void-await-expr-this.js(strict mode) -language/module-code/top-level-await/syntax/while-await-expr-array-literal.js(default) -language/module-code/top-level-await/syntax/while-await-expr-array-literal.js(strict mode) -language/module-code/top-level-await/syntax/while-await-expr-func-expression.js(default) -language/module-code/top-level-await/syntax/while-await-expr-func-expression.js(strict mode) -language/module-code/top-level-await/syntax/while-await-expr-identifier.js(default) -language/module-code/top-level-await/syntax/while-await-expr-identifier.js(strict mode) -language/module-code/top-level-await/syntax/while-await-expr-literal-number.js(default) -language/module-code/top-level-await/syntax/while-await-expr-literal-number.js(strict mode) -language/module-code/top-level-await/syntax/while-await-expr-literal-string.js(default) -language/module-code/top-level-await/syntax/while-await-expr-literal-string.js(strict mode) -language/module-code/top-level-await/syntax/while-await-expr-nested.js(default) -language/module-code/top-level-await/syntax/while-await-expr-nested.js(strict mode) -language/module-code/top-level-await/syntax/while-await-expr-new-expr.js(default) -language/module-code/top-level-await/syntax/while-await-expr-new-expr.js(strict mode) -language/module-code/top-level-await/syntax/while-await-expr-null.js(default) -language/module-code/top-level-await/syntax/while-await-expr-null.js(strict mode) -language/module-code/top-level-await/syntax/while-await-expr-obj-literal.js(default) -language/module-code/top-level-await/syntax/while-await-expr-obj-literal.js(strict mode) -language/module-code/top-level-await/syntax/while-await-expr-regexp.js(default) -language/module-code/top-level-await/syntax/while-await-expr-regexp.js(strict mode) -language/module-code/top-level-await/syntax/while-await-expr-template-literal.js(default) -language/module-code/top-level-await/syntax/while-await-expr-template-literal.js(strict mode) -language/module-code/top-level-await/syntax/while-await-expr-this.js(default) -language/module-code/top-level-await/syntax/while-await-expr-this.js(strict mode) -language/module-code/top-level-await/top-level-ticks-2.js(default) -language/module-code/top-level-await/top-level-ticks-2.js(strict mode) -language/module-code/top-level-await/top-level-ticks.js(default) -language/module-code/top-level-await/top-level-ticks.js(strict mode) -language/module-code/top-level-await/void-await-expr.js(default) -language/module-code/top-level-await/void-await-expr.js(strict mode) -language/module-code/top-level-await/while-dynamic-evaluation.js(default) -language/module-code/top-level-await/while-dynamic-evaluation.js(strict mode) language/statements/class/elements/fields-duplicate-privatenames.js(default) language/statements/class/elements/fields-duplicate-privatenames.js(strict mode) language/statements/class/elements/privatename-not-valid-earlyerr-script-1.js(default) From 198b4a0fbd809c218603d3c54d122c769b2b18ff Mon Sep 17 00:00:00 2001 From: Micah Zoltu Date: Wed, 30 Oct 2019 05:19:49 +0800 Subject: [PATCH 020/648] =?UTF-8?q?Changes=20UMD=20callsite=20to=20be=20mo?= =?UTF-8?q?re=20likely=20to=20pass=20in=20the=20intended=E2=80=A6=20(#1047?= =?UTF-8?q?7)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Changes UMD callsite to be more likely to pass in the intended object. Fixes #10476 Note: This PR should be considered pseudocode and used as an illustration of the proposed fix. I do not know nearly enough about this project to know if this is an appropriate solution to the problem, nor do I have the confidence to update the tests appropriately. * Update tests --- .../export-default-arrow-renaming-module-umd/output.js | 2 +- packages/babel-plugin-transform-modules-umd/src/index.js | 6 +++++- .../test/fixtures/loose/export-default-10/output.js | 2 +- .../test/fixtures/loose/export-default-11/output.js | 2 +- .../test/fixtures/loose/export-default-2/output.js | 2 +- .../test/fixtures/loose/export-default-3/output.js | 2 +- .../test/fixtures/loose/export-default-4/output.js | 2 +- .../test/fixtures/loose/export-default-5/output.js | 2 +- .../test/fixtures/loose/export-default-6/output.js | 2 +- .../test/fixtures/loose/export-default-7/output.js | 2 +- .../test/fixtures/loose/export-default-8/output.js | 2 +- .../test/fixtures/loose/export-default-9/output.js | 2 +- .../test/fixtures/loose/export-default/output.js | 2 +- .../test/fixtures/loose/export-from-2/output.js | 2 +- .../test/fixtures/loose/export-from-3/output.js | 2 +- .../test/fixtures/loose/export-from-4/output.js | 2 +- .../test/fixtures/loose/export-from-5/output.js | 2 +- .../test/fixtures/loose/export-from-6/output.js | 2 +- .../test/fixtures/loose/export-from/output.js | 2 +- .../test/fixtures/loose/export-named-2/output.js | 2 +- .../test/fixtures/loose/export-named-3/output.js | 2 +- .../test/fixtures/loose/export-named-4/output.js | 2 +- .../test/fixtures/loose/export-named-5/output.js | 2 +- .../test/fixtures/loose/export-named/output.js | 2 +- .../test/fixtures/loose/exports-variable/output.js | 2 +- .../test/fixtures/loose/get-module-name-option/output.js | 2 +- .../test/fixtures/loose/hoist-function-exports/output.js | 2 +- .../test/fixtures/loose/imports-default/output.js | 2 +- .../imports-exact-globals-false-with-overrides/output.js | 2 +- .../fixtures/loose/imports-exact-globals-false/output.js | 2 +- .../imports-exact-globals-true-with-overrides/output.js | 2 +- .../fixtures/loose/imports-exact-globals-true/output.js | 2 +- .../test/fixtures/loose/imports-glob/output.js | 2 +- .../test/fixtures/loose/imports-mixing/output.js | 2 +- .../test/fixtures/loose/imports-named/output.js | 2 +- .../test/fixtures/loose/imports/output.js | 2 +- .../module-id-with-overridden-global-in-namespace/output.js | 2 +- .../output.js | 2 +- .../loose/module-id-with-overridden-global/output.js | 2 +- .../test/fixtures/loose/module-id/output.js | 2 +- .../loose/module-name-with-overridden-global/output.js | 2 +- .../test/fixtures/loose/module-name/output.js | 2 +- .../test/fixtures/loose/non-default-imports/output.js | 2 +- .../test/fixtures/loose/override-export-name/output.js | 2 +- .../test/fixtures/loose/override-import-name/output.js | 2 +- .../test/fixtures/loose/overview/output.js | 2 +- .../test/fixtures/loose/remap/output.js | 2 +- .../test/fixtures/regression/4192/output.js | 2 +- .../test/fixtures/umd/export-default-10/output.js | 2 +- .../test/fixtures/umd/export-default-11/output.js | 2 +- .../test/fixtures/umd/export-default-2/output.js | 2 +- .../test/fixtures/umd/export-default-3/output.js | 2 +- .../test/fixtures/umd/export-default-4/output.js | 2 +- .../test/fixtures/umd/export-default-5/output.js | 2 +- .../test/fixtures/umd/export-default-6/output.js | 2 +- .../test/fixtures/umd/export-default-7/output.js | 2 +- .../test/fixtures/umd/export-default-8/output.js | 2 +- .../test/fixtures/umd/export-default-9/output.js | 2 +- .../test/fixtures/umd/export-default/output.js | 2 +- .../test/fixtures/umd/export-from-2/output.js | 2 +- .../test/fixtures/umd/export-from-3/output.js | 2 +- .../test/fixtures/umd/export-from-4/output.js | 2 +- .../test/fixtures/umd/export-from-5/output.js | 2 +- .../test/fixtures/umd/export-from-6/output.js | 2 +- .../test/fixtures/umd/export-from/output.js | 2 +- .../test/fixtures/umd/export-named-2/output.js | 2 +- .../test/fixtures/umd/export-named-3/output.js | 2 +- .../test/fixtures/umd/export-named-4/output.js | 2 +- .../test/fixtures/umd/export-named-5/output.js | 2 +- .../test/fixtures/umd/export-named/output.js | 2 +- .../test/fixtures/umd/exports-variable/output.js | 2 +- .../test/fixtures/umd/get-module-name-option/output.js | 2 +- .../test/fixtures/umd/hoist-function-exports/output.js | 2 +- .../test/fixtures/umd/imports-default/output.js | 2 +- .../imports-exact-globals-false-with-overrides/output.js | 2 +- .../test/fixtures/umd/imports-exact-globals-false/output.js | 2 +- .../umd/imports-exact-globals-true-with-overrides/output.js | 2 +- .../test/fixtures/umd/imports-exact-globals-true/output.js | 2 +- .../test/fixtures/umd/imports-glob/output.js | 2 +- .../test/fixtures/umd/imports-mixing/output.js | 2 +- .../test/fixtures/umd/imports-named/output.js | 2 +- .../test/fixtures/umd/imports/output.js | 2 +- .../module-id-with-overridden-global-in-namespace/output.js | 2 +- .../output.js | 2 +- .../fixtures/umd/module-id-with-overridden-global/output.js | 2 +- .../test/fixtures/umd/module-id/output.js | 2 +- .../umd/module-name-with-overridden-global/output.js | 2 +- .../test/fixtures/umd/module-name/output.js | 2 +- .../test/fixtures/umd/non-default-imports/output.js | 2 +- .../test/fixtures/umd/override-export-name/output.js | 2 +- .../test/fixtures/umd/override-import-name/output.js | 2 +- .../test/fixtures/umd/overview/output.js | 2 +- .../test/fixtures/umd/remap/output.js | 2 +- .../test/fixtures/dynamic-import/modules-umd/output.js | 4 +++- .../test/fixtures/modules/modules-umd/output.js | 4 +++- 95 files changed, 103 insertions(+), 95 deletions(-) diff --git a/packages/babel-plugin-transform-function-name/test/fixtures/function-name/export-default-arrow-renaming-module-umd/output.js b/packages/babel-plugin-transform-function-name/test/fixtures/function-name/export-default-arrow-renaming-module-umd/output.js index 318c2544cd52..aca80143342e 100644 --- a/packages/babel-plugin-transform-function-name/test/fixtures/function-name/export-default-arrow-renaming-module-umd/output.js +++ b/packages/babel-plugin-transform-function-name/test/fixtures/function-name/export-default-arrow-renaming-module-umd/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/src/index.js b/packages/babel-plugin-transform-modules-umd/src/index.js index cd8000febb85..037c70f2b45b 100644 --- a/packages/babel-plugin-transform-modules-umd/src/index.js +++ b/packages/babel-plugin-transform-modules-umd/src/index.js @@ -27,7 +27,11 @@ const buildWrapper = template(` GLOBAL_TO_ASSIGN; } - })(this, function(IMPORT_NAMES) { + })( + typeof globalThis === "object" ? globalThis + : typeof self === "object" ? self + : this, + function(IMPORT_NAMES) { }) `); diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-10/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-10/output.js index f8e0cb66efbf..32501cb4319b 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-10/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-10/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-11/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-11/output.js index 44e4e41f1697..0633fe90d0a0 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-11/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-11/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-2/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-2/output.js index 690c27a48c25..34e8e2fa3d82 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-2/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-2/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-3/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-3/output.js index 956a4b228e56..aa3b89c8d714 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-3/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-3/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-4/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-4/output.js index dcc999f2fb2b..7e144092f4e7 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-4/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-4/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-5/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-5/output.js index 255345ddc41e..6766df086135 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-5/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-5/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-6/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-6/output.js index c10daf42709d..4fd6be58e8d3 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-6/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-6/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-7/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-7/output.js index 7cfc99ccd16c..fa009a30d6df 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-7/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-7/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-8/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-8/output.js index 605b6c2762f8..f221e56a8ccd 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-8/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-8/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-9/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-9/output.js index 493509da29c4..f840c25e6f78 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-9/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-9/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default/output.js index 406ad75ef7dc..5b666da90d2f 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-from-2/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-from-2/output.js index b03b7b38d0f8..14961ba262e8 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-from-2/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-from-2/output.js @@ -10,7 +10,7 @@ factory(mod.exports, global.foo); global.input = mod.exports; } -})(this, function (_exports, _foo) { +})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports, _foo) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-from-3/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-from-3/output.js index 99cc2cff28f4..fb7da87c3f20 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-from-3/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-from-3/output.js @@ -10,7 +10,7 @@ factory(mod.exports, global.foo); global.input = mod.exports; } -})(this, function (_exports, _foo) { +})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports, _foo) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-from-4/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-from-4/output.js index 36925b451778..dc7a24f5f4c5 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-from-4/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-from-4/output.js @@ -10,7 +10,7 @@ factory(mod.exports, global.foo); global.input = mod.exports; } -})(this, function (_exports, _foo) { +})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports, _foo) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-from-5/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-from-5/output.js index eaa85ea93a42..2e900d34ed1a 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-from-5/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-from-5/output.js @@ -10,7 +10,7 @@ factory(mod.exports, global.foo); global.input = mod.exports; } -})(this, function (_exports, _foo) { +})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports, _foo) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-from-6/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-from-6/output.js index b7d54d8219b9..feaf9c4c81a1 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-from-6/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-from-6/output.js @@ -10,7 +10,7 @@ factory(mod.exports, global.foo); global.input = mod.exports; } -})(this, function (_exports, _foo) { +})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports, _foo) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-from/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-from/output.js index cde17ba82168..c9634daa1bc9 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-from/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-from/output.js @@ -10,7 +10,7 @@ factory(mod.exports, global.foo); global.input = mod.exports; } -})(this, function (_exports, _foo) { +})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports, _foo) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-named-2/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-named-2/output.js index 493509da29c4..f840c25e6f78 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-named-2/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-named-2/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-named-3/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-named-3/output.js index c0e16dfcdfd3..d8434b638462 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-named-3/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-named-3/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-named-4/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-named-4/output.js index b612eb59ae64..9f6a74975f35 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-named-4/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-named-4/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-named-5/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-named-5/output.js index 37b7013b6631..60d36f6a310e 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-named-5/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-named-5/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-named/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-named/output.js index e1e04041f87f..e12b16c662f8 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-named/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-named/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/exports-variable/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/exports-variable/output.js index 5606fe898c1a..34f0969295f0 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/exports-variable/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/exports-variable/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/get-module-name-option/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/get-module-name-option/output.js index d5c94066201a..9ef9726b81db 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/get-module-name-option/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/get-module-name-option/output.js @@ -10,6 +10,6 @@ factory(); global.myCustomModuleName = mod.exports; } -})(this, function () { +})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function () { "use strict"; }); diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/hoist-function-exports/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/hoist-function-exports/output.js index 87e3e0226890..3894e1d6357b 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/hoist-function-exports/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/hoist-function-exports/output.js @@ -10,7 +10,7 @@ factory(mod.exports, global.evens); global.input = mod.exports; } -})(this, function (_exports, _evens) { +})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports, _evens) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-default/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-default/output.js index bdc895976fd3..733966a5af62 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-default/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-default/output.js @@ -10,7 +10,7 @@ factory(global.foo); global.input = mod.exports; } -})(this, function (_foo) { +})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_foo) { "use strict"; _foo = babelHelpers.interopRequireDefault(_foo); diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-exact-globals-false-with-overrides/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-exact-globals-false-with-overrides/output.js index 79531c289ced..9d38e1ce05a6 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-exact-globals-false-with-overrides/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-exact-globals-false-with-overrides/output.js @@ -10,7 +10,7 @@ factory(global.fooBAR, global.fooBAR, global.fizzBuzz); global.input = mod.exports; } -})(this, function (_fooBar, _fooBar2, _fizzbuzz) { +})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_fooBar, _fooBar2, _fizzbuzz) { "use strict"; _fooBar = babelHelpers.interopRequireDefault(_fooBar); diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-exact-globals-false/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-exact-globals-false/output.js index 72d8bf864d29..18307048ec1b 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-exact-globals-false/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-exact-globals-false/output.js @@ -10,7 +10,7 @@ factory(global.fooBar, global.fooBar, global.fizzbuzz); global.input = mod.exports; } -})(this, function (_fooBar, _fooBar2, _fizzbuzz) { +})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_fooBar, _fooBar2, _fizzbuzz) { "use strict"; _fooBar = babelHelpers.interopRequireDefault(_fooBar); diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-exact-globals-true-with-overrides/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-exact-globals-true-with-overrides/output.js index bd083836e425..05b85cc76366 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-exact-globals-true-with-overrides/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-exact-globals-true-with-overrides/output.js @@ -10,7 +10,7 @@ factory(global.fooBAR, global.mylib.fooBar, global.fizz.buzz); global.input = mod.exports; } -})(this, function (_fooBar, _fooBar2, _fizzbuzz) { +})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_fooBar, _fooBar2, _fizzbuzz) { "use strict"; _fooBar = babelHelpers.interopRequireDefault(_fooBar); diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-exact-globals-true/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-exact-globals-true/output.js index c16c74d6d69c..baea395d1471 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-exact-globals-true/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-exact-globals-true/output.js @@ -10,7 +10,7 @@ factory(global.fooBar, global.mylibFooBar, global.fizzbuzz); global.input = mod.exports; } -})(this, function (_fooBar, _fooBar2, _fizzbuzz) { +})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_fooBar, _fooBar2, _fizzbuzz) { "use strict"; _fooBar = babelHelpers.interopRequireDefault(_fooBar); diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-glob/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-glob/output.js index 3f403ba8ad4a..2820bf461f2a 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-glob/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-glob/output.js @@ -10,7 +10,7 @@ factory(global.foo); global.input = mod.exports; } -})(this, function (foo) { +})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (foo) { "use strict"; foo = babelHelpers.interopRequireWildcard(foo); diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-mixing/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-mixing/output.js index f51c2d99aefa..37b9f152bef7 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-mixing/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-mixing/output.js @@ -10,7 +10,7 @@ factory(global.foo); global.input = mod.exports; } -})(this, function (_foo) { +})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_foo) { "use strict"; _foo = babelHelpers.interopRequireWildcard(_foo); diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-named/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-named/output.js index d0629b1666d4..f8fb2a0217cb 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-named/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-named/output.js @@ -10,7 +10,7 @@ factory(global.foo); global.input = mod.exports; } -})(this, function (_foo) { +})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_foo) { "use strict"; _foo.bar; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports/output.js index c625f2ad0f13..0e773a28c17e 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports/output.js @@ -10,6 +10,6 @@ factory(global.foo, global.fooBar, global.fooBar); global.input = mod.exports; } -})(this, function (_foo, _fooBar, _fooBar2) { +})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_foo, _fooBar, _fooBar2) { "use strict"; }); diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-id-with-overridden-global-in-namespace/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-id-with-overridden-global-in-namespace/output.js index b1b88602b1d5..5c79efde0967 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-id-with-overridden-global-in-namespace/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-id-with-overridden-global-in-namespace/output.js @@ -11,7 +11,7 @@ global.foo = global.foo || {}; global.foo.bar = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-id-with-overridden-global-in-very-nested-namespace/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-id-with-overridden-global-in-very-nested-namespace/output.js index bcae91ef8031..55ebfb1b8c30 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-id-with-overridden-global-in-very-nested-namespace/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-id-with-overridden-global-in-very-nested-namespace/output.js @@ -13,7 +13,7 @@ global.foo.bar.baz = global.foo.bar.baz || {}; global.foo.bar.baz.qux = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-id-with-overridden-global/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-id-with-overridden-global/output.js index e643ca1729cf..0085a705c53a 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-id-with-overridden-global/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-id-with-overridden-global/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.baz = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-id/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-id/output.js index 2e8e731219b9..7dc12234cdb4 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-id/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-id/output.js @@ -10,7 +10,7 @@ factory(); global.MyLib = mod.exports; } -})(this, function () { +})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function () { "use strict"; foobar(); diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-name-with-overridden-global/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-name-with-overridden-global/output.js index 516c1e9a10c0..db9e9b200d7c 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-name-with-overridden-global/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-name-with-overridden-global/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.looseModuleNameWithOverriddenGlobalInput = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-name/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-name/output.js index 37b367916622..01c2ce86f9d3 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-name/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-name/output.js @@ -10,7 +10,7 @@ factory(); global.looseModuleNameInput = mod.exports; } -})(this, function () { +})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function () { "use strict"; foobar(); diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/non-default-imports/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/non-default-imports/output.js index a9273b54d4ba..10c4c15c9b6a 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/non-default-imports/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/non-default-imports/output.js @@ -10,6 +10,6 @@ factory(global.render); global.input = mod.exports; } -})(this, function (_render) { +})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_render) { "use strict"; }); diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/override-export-name/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/override-export-name/output.js index 406ad75ef7dc..5b666da90d2f 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/override-export-name/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/override-export-name/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/override-import-name/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/override-import-name/output.js index 21f8cbe8bd64..c6850dc1ab1a 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/override-import-name/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/override-import-name/output.js @@ -10,6 +10,6 @@ factory(global.Promise); global.input = mod.exports; } -})(this, function (_es6Promise) { +})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_es6Promise) { "use strict"; }); diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/overview/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/overview/output.js index b66382de9469..0ec5e6cb6d88 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/overview/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/overview/output.js @@ -10,7 +10,7 @@ factory(mod.exports, global.foo, global.fooBar, global.fooBar); global.input = mod.exports; } -})(this, function (_exports, foo2, _fooBar, _fooBar2) { +})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports, foo2, _fooBar, _fooBar2) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/remap/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/remap/output.js index 32e24f80c89b..a8503bc29b96 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/remap/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/remap/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/regression/4192/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/regression/4192/output.js index 83495f9586e8..f0c22802cb37 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/regression/4192/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/regression/4192/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-10/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-10/output.js index b4d81f7d48c9..49e75d5bc965 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-10/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-10/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-11/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-11/output.js index 053cce392d75..5447cc116b68 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-11/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-11/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-2/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-2/output.js index 91736c0197c2..04d3f90de328 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-2/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-2/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-3/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-3/output.js index 3ca1ff7d7423..6579e72a0bdd 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-3/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-3/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-4/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-4/output.js index 006b7c28772a..5478384d3bde 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-4/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-4/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-5/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-5/output.js index e9d30703b26f..ae92ef86e76d 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-5/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-5/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-6/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-6/output.js index 7fdc39f6adf3..38bb552b8f92 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-6/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-6/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-7/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-7/output.js index 15cad508a21a..b5b988ee2090 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-7/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-7/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-8/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-8/output.js index c92a85338f1b..a9d3a15498cd 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-8/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-8/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-9/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-9/output.js index b6a052ac6671..e0c54835f5f6 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-9/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-9/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default/output.js index 3f5a188475c0..3650a0e70afd 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-from-2/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-from-2/output.js index fe946f300c70..24f7b0cac307 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-from-2/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-from-2/output.js @@ -10,7 +10,7 @@ factory(mod.exports, global.foo); global.input = mod.exports; } -})(this, function (_exports, _foo) { +})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports, _foo) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-from-3/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-from-3/output.js index 126e1be461b0..5d59222a6acc 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-from-3/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-from-3/output.js @@ -10,7 +10,7 @@ factory(mod.exports, global.foo); global.input = mod.exports; } -})(this, function (_exports, _foo) { +})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports, _foo) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-from-4/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-from-4/output.js index dc6f562b4e3a..a71a3dc3afa1 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-from-4/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-from-4/output.js @@ -10,7 +10,7 @@ factory(mod.exports, global.foo); global.input = mod.exports; } -})(this, function (_exports, _foo) { +})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports, _foo) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-from-5/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-from-5/output.js index f0381a2ddba0..c5806681062b 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-from-5/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-from-5/output.js @@ -10,7 +10,7 @@ factory(mod.exports, global.foo); global.input = mod.exports; } -})(this, function (_exports, _foo) { +})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports, _foo) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-from-6/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-from-6/output.js index ec9180133584..69ed1878b92c 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-from-6/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-from-6/output.js @@ -10,7 +10,7 @@ factory(mod.exports, global.foo); global.input = mod.exports; } -})(this, function (_exports, _foo) { +})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports, _foo) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-from/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-from/output.js index 116bc257736a..3f4e37cb955c 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-from/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-from/output.js @@ -10,7 +10,7 @@ factory(mod.exports, global.foo); global.input = mod.exports; } -})(this, function (_exports, _foo) { +})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports, _foo) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-named-2/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-named-2/output.js index b6a052ac6671..e0c54835f5f6 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-named-2/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-named-2/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-named-3/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-named-3/output.js index 7263e5f91f48..0174dbf05c23 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-named-3/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-named-3/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-named-4/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-named-4/output.js index 14c4273fdc06..b39c6551907e 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-named-4/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-named-4/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-named-5/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-named-5/output.js index 0ac1f5a990cc..ea7c9ea47720 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-named-5/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-named-5/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-named/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-named/output.js index 009aedbfef27..ba76f746df69 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-named/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-named/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/exports-variable/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/exports-variable/output.js index 90292c4609f7..116ca5633a54 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/exports-variable/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/exports-variable/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/get-module-name-option/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/get-module-name-option/output.js index d5c94066201a..9ef9726b81db 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/get-module-name-option/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/get-module-name-option/output.js @@ -10,6 +10,6 @@ factory(); global.myCustomModuleName = mod.exports; } -})(this, function () { +})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function () { "use strict"; }); diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/hoist-function-exports/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/hoist-function-exports/output.js index f5427d448fd1..6b33b55fddfb 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/hoist-function-exports/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/hoist-function-exports/output.js @@ -10,7 +10,7 @@ factory(mod.exports, global.evens); global.input = mod.exports; } -})(this, function (_exports, _evens) { +})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports, _evens) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-default/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-default/output.js index bdc895976fd3..733966a5af62 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-default/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-default/output.js @@ -10,7 +10,7 @@ factory(global.foo); global.input = mod.exports; } -})(this, function (_foo) { +})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_foo) { "use strict"; _foo = babelHelpers.interopRequireDefault(_foo); diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-exact-globals-false-with-overrides/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-exact-globals-false-with-overrides/output.js index 79531c289ced..9d38e1ce05a6 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-exact-globals-false-with-overrides/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-exact-globals-false-with-overrides/output.js @@ -10,7 +10,7 @@ factory(global.fooBAR, global.fooBAR, global.fizzBuzz); global.input = mod.exports; } -})(this, function (_fooBar, _fooBar2, _fizzbuzz) { +})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_fooBar, _fooBar2, _fizzbuzz) { "use strict"; _fooBar = babelHelpers.interopRequireDefault(_fooBar); diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-exact-globals-false/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-exact-globals-false/output.js index 72d8bf864d29..18307048ec1b 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-exact-globals-false/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-exact-globals-false/output.js @@ -10,7 +10,7 @@ factory(global.fooBar, global.fooBar, global.fizzbuzz); global.input = mod.exports; } -})(this, function (_fooBar, _fooBar2, _fizzbuzz) { +})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_fooBar, _fooBar2, _fizzbuzz) { "use strict"; _fooBar = babelHelpers.interopRequireDefault(_fooBar); diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-exact-globals-true-with-overrides/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-exact-globals-true-with-overrides/output.js index bd083836e425..05b85cc76366 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-exact-globals-true-with-overrides/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-exact-globals-true-with-overrides/output.js @@ -10,7 +10,7 @@ factory(global.fooBAR, global.mylib.fooBar, global.fizz.buzz); global.input = mod.exports; } -})(this, function (_fooBar, _fooBar2, _fizzbuzz) { +})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_fooBar, _fooBar2, _fizzbuzz) { "use strict"; _fooBar = babelHelpers.interopRequireDefault(_fooBar); diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-exact-globals-true/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-exact-globals-true/output.js index c16c74d6d69c..baea395d1471 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-exact-globals-true/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-exact-globals-true/output.js @@ -10,7 +10,7 @@ factory(global.fooBar, global.mylibFooBar, global.fizzbuzz); global.input = mod.exports; } -})(this, function (_fooBar, _fooBar2, _fizzbuzz) { +})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_fooBar, _fooBar2, _fizzbuzz) { "use strict"; _fooBar = babelHelpers.interopRequireDefault(_fooBar); diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-glob/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-glob/output.js index 3f403ba8ad4a..2820bf461f2a 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-glob/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-glob/output.js @@ -10,7 +10,7 @@ factory(global.foo); global.input = mod.exports; } -})(this, function (foo) { +})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (foo) { "use strict"; foo = babelHelpers.interopRequireWildcard(foo); diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-mixing/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-mixing/output.js index f51c2d99aefa..37b9f152bef7 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-mixing/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-mixing/output.js @@ -10,7 +10,7 @@ factory(global.foo); global.input = mod.exports; } -})(this, function (_foo) { +})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_foo) { "use strict"; _foo = babelHelpers.interopRequireWildcard(_foo); diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-named/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-named/output.js index d0629b1666d4..f8fb2a0217cb 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-named/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-named/output.js @@ -10,7 +10,7 @@ factory(global.foo); global.input = mod.exports; } -})(this, function (_foo) { +})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_foo) { "use strict"; _foo.bar; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports/output.js index c625f2ad0f13..0e773a28c17e 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports/output.js @@ -10,6 +10,6 @@ factory(global.foo, global.fooBar, global.fooBar); global.input = mod.exports; } -})(this, function (_foo, _fooBar, _fooBar2) { +})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_foo, _fooBar, _fooBar2) { "use strict"; }); diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-id-with-overridden-global-in-namespace/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-id-with-overridden-global-in-namespace/output.js index 3f43c9478122..b45744b06497 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-id-with-overridden-global-in-namespace/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-id-with-overridden-global-in-namespace/output.js @@ -11,7 +11,7 @@ global.foo = global.foo || {}; global.foo.bar = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-id-with-overridden-global-in-very-nested-namespace/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-id-with-overridden-global-in-very-nested-namespace/output.js index 1ddcae34725f..0b358a9b2079 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-id-with-overridden-global-in-very-nested-namespace/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-id-with-overridden-global-in-very-nested-namespace/output.js @@ -13,7 +13,7 @@ global.foo.bar.baz = global.foo.bar.baz || {}; global.foo.bar.baz.qux = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-id-with-overridden-global/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-id-with-overridden-global/output.js index a9feedf65627..3a3fb1a0cb30 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-id-with-overridden-global/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-id-with-overridden-global/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.baz = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-id/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-id/output.js index 2e8e731219b9..7dc12234cdb4 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-id/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-id/output.js @@ -10,7 +10,7 @@ factory(); global.MyLib = mod.exports; } -})(this, function () { +})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function () { "use strict"; foobar(); diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-name-with-overridden-global/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-name-with-overridden-global/output.js index b17d582429ed..1d76a5b0d621 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-name-with-overridden-global/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-name-with-overridden-global/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.umdModuleNameWithOverriddenGlobalInput = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-name/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-name/output.js index 3967f520001c..07c787a92f28 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-name/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-name/output.js @@ -10,7 +10,7 @@ factory(); global.umdModuleNameInput = mod.exports; } -})(this, function () { +})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function () { "use strict"; foobar(); diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/non-default-imports/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/non-default-imports/output.js index a9273b54d4ba..10c4c15c9b6a 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/non-default-imports/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/non-default-imports/output.js @@ -10,6 +10,6 @@ factory(global.render); global.input = mod.exports; } -})(this, function (_render) { +})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_render) { "use strict"; }); diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/override-export-name/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/override-export-name/output.js index 3f5a188475c0..3650a0e70afd 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/override-export-name/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/override-export-name/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/override-import-name/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/override-import-name/output.js index 21f8cbe8bd64..c6850dc1ab1a 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/override-import-name/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/override-import-name/output.js @@ -10,6 +10,6 @@ factory(global.Promise); global.input = mod.exports; } -})(this, function (_es6Promise) { +})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_es6Promise) { "use strict"; }); diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/overview/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/overview/output.js index e60dd5dcb0e2..4d7a91b32231 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/overview/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/overview/output.js @@ -10,7 +10,7 @@ factory(mod.exports, global.foo, global.fooBar, global.fooBar); global.input = mod.exports; } -})(this, function (_exports, foo2, _fooBar, _fooBar2) { +})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports, foo2, _fooBar, _fooBar2) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/remap/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/remap/output.js index e5d904ca9981..c374f3aa7925 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/remap/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/remap/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(this, function (_exports) { +})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-preset-env/test/fixtures/dynamic-import/modules-umd/output.js b/packages/babel-preset-env/test/fixtures/dynamic-import/modules-umd/output.js index f66adb1fb317..8e25ad450629 100644 --- a/packages/babel-preset-env/test/fixtures/dynamic-import/modules-umd/output.js +++ b/packages/babel-preset-env/test/fixtures/dynamic-import/modules-umd/output.js @@ -1,3 +1,5 @@ +function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + (function (global, factory) { if (typeof define === "function" && define.amd) { define([], factory); @@ -10,7 +12,7 @@ factory(); global.input = mod.exports; } -})(this, function () { +})((typeof globalThis === "undefined" ? "undefined" : _typeof(globalThis)) === "object" ? globalThis : (typeof self === "undefined" ? "undefined" : _typeof(self)) === "object" ? self : this, function () { "use strict"; import("foo"); // warns diff --git a/packages/babel-preset-env/test/fixtures/modules/modules-umd/output.js b/packages/babel-preset-env/test/fixtures/modules/modules-umd/output.js index 231614902dde..5f1d193f306f 100644 --- a/packages/babel-preset-env/test/fixtures/modules/modules-umd/output.js +++ b/packages/babel-preset-env/test/fixtures/modules/modules-umd/output.js @@ -1,3 +1,5 @@ +function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + (function (global, factory) { if (typeof define === "function" && define.amd) { define(["a"], factory); @@ -10,7 +12,7 @@ factory(global.a); global.input = mod.exports; } -})(this, function (_a) { +})((typeof globalThis === "undefined" ? "undefined" : _typeof(globalThis)) === "object" ? globalThis : (typeof self === "undefined" ? "undefined" : _typeof(self)) === "object" ? self : this, function (_a) { "use strict"; _a = _interopRequireDefault(_a); From 4b3a19ea9f61d557e589dfdef21da02e752dad21 Mon Sep 17 00:00:00 2001 From: Vivek Nayyar Date: Wed, 30 Oct 2019 03:02:02 +0530 Subject: [PATCH 021/648] fixed missing errors on assignment pattern in object expression (#10607) * :bug: fixed missing errors on assignment pattern in object expression * :recycle: remove a non-needed comment * :bug: missed adding comma in the test input * :bug: fixed the failing valid-property-initializer test --- .../babel-parser/src/parser/expression.js | 5 +- .../invalid-property-initializer-1/input.js | 4 + .../options.json | 3 + .../invalid-property-initializer/input.js | 4 + .../invalid-property-initializer/options.json | 3 + .../valid-property-initializer/input.js | 4 + .../valid-property-initializer/output.json | 425 ++++++++++++++++++ 7 files changed, 447 insertions(+), 1 deletion(-) create mode 100644 packages/babel-parser/test/fixtures/core/object/invalid-property-initializer-1/input.js create mode 100644 packages/babel-parser/test/fixtures/core/object/invalid-property-initializer-1/options.json create mode 100644 packages/babel-parser/test/fixtures/core/object/invalid-property-initializer/input.js create mode 100644 packages/babel-parser/test/fixtures/core/object/invalid-property-initializer/options.json create mode 100644 packages/babel-parser/test/fixtures/core/object/valid-property-initializer/input.js create mode 100644 packages/babel-parser/test/fixtures/core/object/valid-property-initializer/output.json diff --git a/packages/babel-parser/src/parser/expression.js b/packages/babel-parser/src/parser/expression.js index 04299e439830..79abd269e184 100644 --- a/packages/babel-parser/src/parser/expression.js +++ b/packages/babel-parser/src/parser/expression.js @@ -204,7 +204,10 @@ export default class ExpressionParser extends LValParser { node.left = this.match(tt.eq) ? this.toAssignable(left, undefined, "assignment expression") : left; - refShorthandDefaultPos.start = 0; // reset because shorthand default was used correctly + + if (refShorthandDefaultPos.start >= node.left.start) { + refShorthandDefaultPos.start = 0; // reset because shorthand default was used correctly + } this.checkLVal(left, undefined, undefined, "assignment expression"); diff --git a/packages/babel-parser/test/fixtures/core/object/invalid-property-initializer-1/input.js b/packages/babel-parser/test/fixtures/core/object/invalid-property-initializer-1/input.js new file mode 100644 index 000000000000..9538075c50c3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/object/invalid-property-initializer-1/input.js @@ -0,0 +1,4 @@ +const obj = { + bar: x = 123, + foo = 123 +}; diff --git a/packages/babel-parser/test/fixtures/core/object/invalid-property-initializer-1/options.json b/packages/babel-parser/test/fixtures/core/object/invalid-property-initializer-1/options.json new file mode 100644 index 000000000000..e92fc4e28742 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/object/invalid-property-initializer-1/options.json @@ -0,0 +1,3 @@ +{ + "throws": "Unexpected token (3:6)" +} diff --git a/packages/babel-parser/test/fixtures/core/object/invalid-property-initializer/input.js b/packages/babel-parser/test/fixtures/core/object/invalid-property-initializer/input.js new file mode 100644 index 000000000000..868f237838df --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/object/invalid-property-initializer/input.js @@ -0,0 +1,4 @@ +const obj = { + foo = 123, + bar: x = 123 +}; diff --git a/packages/babel-parser/test/fixtures/core/object/invalid-property-initializer/options.json b/packages/babel-parser/test/fixtures/core/object/invalid-property-initializer/options.json new file mode 100644 index 000000000000..9660494a29ea --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/object/invalid-property-initializer/options.json @@ -0,0 +1,3 @@ +{ + "throws": "Unexpected token (2:6)" +} diff --git a/packages/babel-parser/test/fixtures/core/object/valid-property-initializer/input.js b/packages/babel-parser/test/fixtures/core/object/valid-property-initializer/input.js new file mode 100644 index 000000000000..0cd0f5146c8d --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/object/valid-property-initializer/input.js @@ -0,0 +1,4 @@ +const obj = { + foo = 123, + bar: x = 123, +} = { foo: 24, bar: 45 }; diff --git a/packages/babel-parser/test/fixtures/core/object/valid-property-initializer/output.json b/packages/babel-parser/test/fixtures/core/object/valid-property-initializer/output.json new file mode 100644 index 000000000000..7b1a47d91e7a --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/object/valid-property-initializer/output.json @@ -0,0 +1,425 @@ +{ + "type": "File", + "start": 0, + "end": 68, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 25 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 68, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 25 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 68, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 25 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 6, + "end": 67, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 4, + "column": 24 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + }, + "identifierName": "obj" + }, + "name": "obj" + }, + "init": { + "type": "AssignmentExpression", + "start": 12, + "end": 67, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 4, + "column": 24 + } + }, + "operator": "=", + "left": { + "type": "ObjectPattern", + "start": 12, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 16, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 16, + "end": 19, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 5 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "AssignmentPattern", + "start": 16, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "left": { + "type": "Identifier", + "start": 16, + "end": 19, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 5 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "right": { + "type": "NumericLiteral", + "start": 22, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "extra": { + "rawValue": 123, + "raw": "123" + }, + "value": 123 + } + }, + "extra": { + "shorthand": true + } + }, + { + "type": "ObjectProperty", + "start": 29, + "end": 41, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 14 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 29, + "end": 32, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 5 + }, + "identifierName": "bar" + }, + "name": "bar" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "AssignmentPattern", + "start": 34, + "end": 41, + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 14 + } + }, + "left": { + "type": "Identifier", + "start": 34, + "end": 35, + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 8 + }, + "identifierName": "x" + }, + "name": "x" + }, + "right": { + "type": "NumericLiteral", + "start": 38, + "end": 41, + "loc": { + "start": { + "line": 3, + "column": 11 + }, + "end": { + "line": 3, + "column": 14 + } + }, + "extra": { + "rawValue": 123, + "raw": "123" + }, + "value": 123 + } + } + } + ], + "extra": { + "trailingComma": 41 + } + }, + "right": { + "type": "ObjectExpression", + "start": 47, + "end": 67, + "loc": { + "start": { + "line": 4, + "column": 4 + }, + "end": { + "line": 4, + "column": 24 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 49, + "end": 56, + "loc": { + "start": { + "line": 4, + "column": 6 + }, + "end": { + "line": 4, + "column": 13 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 49, + "end": 52, + "loc": { + "start": { + "line": 4, + "column": 6 + }, + "end": { + "line": 4, + "column": 9 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "NumericLiteral", + "start": 54, + "end": 56, + "loc": { + "start": { + "line": 4, + "column": 11 + }, + "end": { + "line": 4, + "column": 13 + } + }, + "extra": { + "rawValue": 24, + "raw": "24" + }, + "value": 24 + } + }, + { + "type": "ObjectProperty", + "start": 58, + "end": 65, + "loc": { + "start": { + "line": 4, + "column": 15 + }, + "end": { + "line": 4, + "column": 22 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 58, + "end": 61, + "loc": { + "start": { + "line": 4, + "column": 15 + }, + "end": { + "line": 4, + "column": 18 + }, + "identifierName": "bar" + }, + "name": "bar" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "NumericLiteral", + "start": 63, + "end": 65, + "loc": { + "start": { + "line": 4, + "column": 20 + }, + "end": { + "line": 4, + "column": 22 + } + }, + "extra": { + "rawValue": 45, + "raw": "45" + }, + "value": 45 + } + } + ] + } + } + } + ], + "kind": "const" + } + ], + "directives": [] + } +} \ No newline at end of file From ec3345bb57f6e50244ef569a001b1f5e5feab3ec Mon Sep 17 00:00:00 2001 From: George Zahariev Date: Tue, 29 Oct 2019 14:55:12 -0700 Subject: [PATCH 022/648] Flow enums parsing (#10344) * Flow enums parsing * Parse exporting enums * Enums parsing remove lookahead, other improvements * Enums: add EnumBody and EnumMember aliases, change boolean members to use BooleaLiteral value * Fix enum member init flow type, now that boolean members have a BooleanLiteral value * Flow enums: use contextual utils, change members length checks to use logic operators, remove reserved word logic modification * Flow enums: remove unnecessary code in generator, fix error message --- .../babel-generator/src/generators/flow.js | 86 ++++ .../fixtures/flow/enum-declaration/input.js | 36 ++ .../flow/enum-declaration/options.json | 3 + .../fixtures/flow/enum-declaration/output.js | 36 ++ packages/babel-parser/src/plugins/flow.js | 456 +++++++++++++++++- .../boolean-explicit/input.js | 4 + .../boolean-explicit/output.json | 181 +++++++ .../boolean-implicit/input.js | 4 + .../boolean-implicit/output.json | 181 +++++++ .../input.js | 3 + .../options.json | 4 + .../input.js | 4 + .../options.json | 4 + .../duplicate-member-name/input.js | 4 + .../duplicate-member-name/options.json | 4 + .../flow/enum-declaration/empty/input.js | 1 + .../flow/enum-declaration/empty/output.json | 84 ++++ .../enum-declaration/end-of-file/input.js | 1 + .../enum-declaration/end-of-file/options.json | 4 + .../flow/enum-declaration/enum-name/input.js | 2 + .../enum-declaration/enum-name/output.json | 84 ++++ .../flow/enum-declaration/export/input.js | 3 + .../flow/enum-declaration/export/options.json | 11 + .../flow/enum-declaration/export/output.json | 166 +++++++ .../input.js | 5 + .../options.json | 4 + .../input.js | 4 + .../options.json | 4 + .../invalid-explicit-type-expression/input.js | 2 + .../options.json | 4 + .../invalid-explicit-type-identifier/input.js | 2 + .../options.json | 4 + .../input.js | 3 + .../options.json | 4 + .../input.js | 3 + .../options.json | 4 + .../input.js | 3 + .../options.json | 4 + .../input.js | 3 + .../options.json | 4 + .../input.js | 3 + .../options.json | 4 + .../input.js | 3 + .../options.json | 4 + .../input.js | 3 + .../options.json | 4 + .../input.js | 3 + .../options.json | 4 + .../input.js | 3 + .../options.json | 4 + .../input.js | 3 + .../options.json | 4 + .../input.js | 3 + .../options.json | 4 + .../input.js | 3 + .../options.json | 4 + .../invalid-member-name/input.js | 4 + .../invalid-member-name/options.json | 4 + .../no-trailing-comma/input.js | 3 + .../no-trailing-comma/output.json | 117 +++++ .../enum-declaration/number-explicit/input.js | 4 + .../number-explicit/output.json | 189 ++++++++ .../enum-declaration/number-implicit/input.js | 4 + .../number-implicit/output.json | 189 ++++++++ .../input.js | 3 + .../options.json | 4 + .../input.js | 4 + .../options.json | 4 + .../flow/enum-declaration/options.json | 3 + .../reserved-word-enum-name/input.js | 2 + .../reserved-word-enum-name/options.json | 4 + .../string-explicit-defaulted/input.js | 4 + .../string-explicit-defaulted/output.json | 149 ++++++ .../string-explicit-initialized/input.js | 4 + .../string-explicit-initialized/output.json | 189 ++++++++ .../string-implicit-defaulted/input.js | 4 + .../string-implicit-defaulted/output.json | 149 ++++++ .../string-implicit-initialized/input.js | 4 + .../string-implicit-initialized/output.json | 189 ++++++++ .../input.js | 5 + .../options.json | 4 + .../input.js | 5 + .../options.json | 4 + .../flow/enum-declaration/symbol/input.js | 4 + .../flow/enum-declaration/symbol/output.json | 148 ++++++ .../legacy-regression/10264/options.json | 2 +- .../babel-plugin-syntax-flow/src/index.js | 8 +- .../src/asserts/generated/index.js | 39 ++ .../src/builders/generated/index.js | 36 ++ .../src/constants/generated/index.js | 2 + packages/babel-types/src/definitions/flow.js | 86 ++++ .../src/validators/generated/index.js | 166 +++++++ 92 files changed, 3213 insertions(+), 5 deletions(-) create mode 100644 packages/babel-generator/test/fixtures/flow/enum-declaration/input.js create mode 100644 packages/babel-generator/test/fixtures/flow/enum-declaration/options.json create mode 100644 packages/babel-generator/test/fixtures/flow/enum-declaration/output.js create mode 100644 packages/babel-parser/test/fixtures/flow/enum-declaration/boolean-explicit/input.js create mode 100644 packages/babel-parser/test/fixtures/flow/enum-declaration/boolean-explicit/output.json create mode 100644 packages/babel-parser/test/fixtures/flow/enum-declaration/boolean-implicit/input.js create mode 100644 packages/babel-parser/test/fixtures/flow/enum-declaration/boolean-implicit/output.json create mode 100644 packages/babel-parser/test/fixtures/flow/enum-declaration/boolean-member-not-initialized-explicit/input.js create mode 100644 packages/babel-parser/test/fixtures/flow/enum-declaration/boolean-member-not-initialized-explicit/options.json create mode 100644 packages/babel-parser/test/fixtures/flow/enum-declaration/boolean-member-not-initialized-implicit/input.js create mode 100644 packages/babel-parser/test/fixtures/flow/enum-declaration/boolean-member-not-initialized-implicit/options.json create mode 100644 packages/babel-parser/test/fixtures/flow/enum-declaration/duplicate-member-name/input.js create mode 100644 packages/babel-parser/test/fixtures/flow/enum-declaration/duplicate-member-name/options.json create mode 100644 packages/babel-parser/test/fixtures/flow/enum-declaration/empty/input.js create mode 100644 packages/babel-parser/test/fixtures/flow/enum-declaration/empty/output.json create mode 100644 packages/babel-parser/test/fixtures/flow/enum-declaration/end-of-file/input.js create mode 100644 packages/babel-parser/test/fixtures/flow/enum-declaration/end-of-file/options.json create mode 100644 packages/babel-parser/test/fixtures/flow/enum-declaration/enum-name/input.js create mode 100644 packages/babel-parser/test/fixtures/flow/enum-declaration/enum-name/output.json create mode 100644 packages/babel-parser/test/fixtures/flow/enum-declaration/export/input.js create mode 100644 packages/babel-parser/test/fixtures/flow/enum-declaration/export/options.json create mode 100644 packages/babel-parser/test/fixtures/flow/enum-declaration/export/output.json create mode 100644 packages/babel-parser/test/fixtures/flow/enum-declaration/inconsistent-member-values-majority-defaulted/input.js create mode 100644 packages/babel-parser/test/fixtures/flow/enum-declaration/inconsistent-member-values-majority-defaulted/options.json create mode 100644 packages/babel-parser/test/fixtures/flow/enum-declaration/inconsistent-member-values-mixed-initializers/input.js create mode 100644 packages/babel-parser/test/fixtures/flow/enum-declaration/inconsistent-member-values-mixed-initializers/options.json create mode 100644 packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-explicit-type-expression/input.js create mode 100644 packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-explicit-type-expression/options.json create mode 100644 packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-explicit-type-identifier/input.js create mode 100644 packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-explicit-type-identifier/options.json create mode 100644 packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-boolean-explicit-string/input.js create mode 100644 packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-boolean-explicit-string/options.json create mode 100644 packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-expression-explicit-boolean/input.js create mode 100644 packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-expression-explicit-boolean/options.json create mode 100644 packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-expression-explicit-number/input.js create mode 100644 packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-expression-explicit-number/options.json create mode 100644 packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-expression-explicit-string/input.js create mode 100644 packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-expression-explicit-string/options.json create mode 100644 packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-expression-explicit-symbol/input.js create mode 100644 packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-expression-explicit-symbol/options.json create mode 100644 packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-expression-implicit/input.js create mode 100644 packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-expression-implicit/options.json create mode 100644 packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-literal-explicit-symbol/input.js create mode 100644 packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-literal-explicit-symbol/options.json create mode 100644 packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-number-explicit-boolean/input.js create mode 100644 packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-number-explicit-boolean/options.json create mode 100644 packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-number-explicit-string/input.js create mode 100644 packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-number-explicit-string/options.json create mode 100644 packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-parenthesized/input.js create mode 100644 packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-parenthesized/options.json create mode 100644 packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-string-explicit-boolean/input.js create mode 100644 packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-string-explicit-boolean/options.json create mode 100644 packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-string-explicit-number/input.js create mode 100644 packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-string-explicit-number/options.json create mode 100644 packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-name/input.js create mode 100644 packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-name/options.json create mode 100644 packages/babel-parser/test/fixtures/flow/enum-declaration/no-trailing-comma/input.js create mode 100644 packages/babel-parser/test/fixtures/flow/enum-declaration/no-trailing-comma/output.json create mode 100644 packages/babel-parser/test/fixtures/flow/enum-declaration/number-explicit/input.js create mode 100644 packages/babel-parser/test/fixtures/flow/enum-declaration/number-explicit/output.json create mode 100644 packages/babel-parser/test/fixtures/flow/enum-declaration/number-implicit/input.js create mode 100644 packages/babel-parser/test/fixtures/flow/enum-declaration/number-implicit/output.json create mode 100644 packages/babel-parser/test/fixtures/flow/enum-declaration/number-member-not-initialized-explicit/input.js create mode 100644 packages/babel-parser/test/fixtures/flow/enum-declaration/number-member-not-initialized-explicit/options.json create mode 100644 packages/babel-parser/test/fixtures/flow/enum-declaration/number-member-not-initialized-implicit/input.js create mode 100644 packages/babel-parser/test/fixtures/flow/enum-declaration/number-member-not-initialized-implicit/options.json create mode 100644 packages/babel-parser/test/fixtures/flow/enum-declaration/options.json create mode 100644 packages/babel-parser/test/fixtures/flow/enum-declaration/reserved-word-enum-name/input.js create mode 100644 packages/babel-parser/test/fixtures/flow/enum-declaration/reserved-word-enum-name/options.json create mode 100644 packages/babel-parser/test/fixtures/flow/enum-declaration/string-explicit-defaulted/input.js create mode 100644 packages/babel-parser/test/fixtures/flow/enum-declaration/string-explicit-defaulted/output.json create mode 100644 packages/babel-parser/test/fixtures/flow/enum-declaration/string-explicit-initialized/input.js create mode 100644 packages/babel-parser/test/fixtures/flow/enum-declaration/string-explicit-initialized/output.json create mode 100644 packages/babel-parser/test/fixtures/flow/enum-declaration/string-implicit-defaulted/input.js create mode 100644 packages/babel-parser/test/fixtures/flow/enum-declaration/string-implicit-defaulted/output.json create mode 100644 packages/babel-parser/test/fixtures/flow/enum-declaration/string-implicit-initialized/input.js create mode 100644 packages/babel-parser/test/fixtures/flow/enum-declaration/string-implicit-initialized/output.json create mode 100644 packages/babel-parser/test/fixtures/flow/enum-declaration/string-member-inconsistently-initialized-majority-defaulted/input.js create mode 100644 packages/babel-parser/test/fixtures/flow/enum-declaration/string-member-inconsistently-initialized-majority-defaulted/options.json create mode 100644 packages/babel-parser/test/fixtures/flow/enum-declaration/string-member-inconsistently-initialized-majority-initialized/input.js create mode 100644 packages/babel-parser/test/fixtures/flow/enum-declaration/string-member-inconsistently-initialized-majority-initialized/options.json create mode 100644 packages/babel-parser/test/fixtures/flow/enum-declaration/symbol/input.js create mode 100644 packages/babel-parser/test/fixtures/flow/enum-declaration/symbol/output.json diff --git a/packages/babel-generator/src/generators/flow.js b/packages/babel-generator/src/generators/flow.js index 225428b00801..9a8441ba827c 100644 --- a/packages/babel-generator/src/generators/flow.js +++ b/packages/babel-generator/src/generators/flow.js @@ -134,6 +134,92 @@ export function DeclareExportAllDeclaration(/*node: Object*/) { ExportAllDeclaration.apply(this, arguments); } +export function EnumDeclaration(node: Object) { + const { id, body } = node; + this.word("enum"); + this.space(); + this.print(id, node); + this.print(body, node); +} + +function enumExplicitType( + context: Object, + name: string, + hasExplicitType: boolean, +) { + if (hasExplicitType) { + context.space(); + context.word("of"); + context.space(); + context.word(name); + } + context.space(); +} + +function enumBody(context: Object, node: Object) { + const { members } = node; + context.token("{"); + context.indent(); + context.newline(); + for (const member of members) { + context.print(member, node); + context.newline(); + } + context.dedent(); + context.token("}"); +} + +export function EnumBooleanBody(node: Object) { + const { explicitType } = node; + enumExplicitType(this, "boolean", explicitType); + enumBody(this, node); +} + +export function EnumNumberBody(node: Object) { + const { explicitType } = node; + enumExplicitType(this, "number", explicitType); + enumBody(this, node); +} + +export function EnumStringBody(node: Object) { + const { explicitType } = node; + enumExplicitType(this, "string", explicitType); + enumBody(this, node); +} + +export function EnumSymbolBody(node: Object) { + enumExplicitType(this, "symbol", true); + enumBody(this, node); +} + +export function EnumDefaultedMember(node: Object) { + const { id } = node; + this.print(id, node); + this.token(","); +} + +function enumInitializedMember(context: Object, node: Object) { + const { id, init } = node; + context.print(id, node); + context.space(); + context.token("="); + context.space(); + context.print(init, node); + context.token(","); +} + +export function EnumBooleanMember(node: Object) { + enumInitializedMember(this, node); +} + +export function EnumNumberMember(node: Object) { + enumInitializedMember(this, node); +} + +export function EnumStringMember(node: Object) { + enumInitializedMember(this, node); +} + function FlowExportDeclaration(node: Object) { if (node.declaration) { const declar = node.declaration; diff --git a/packages/babel-generator/test/fixtures/flow/enum-declaration/input.js b/packages/babel-generator/test/fixtures/flow/enum-declaration/input.js new file mode 100644 index 000000000000..f59944f78e18 --- /dev/null +++ b/packages/babel-generator/test/fixtures/flow/enum-declaration/input.js @@ -0,0 +1,36 @@ +enum E { + A = true, + B = false, +} +enum E of boolean { + A = true, + B = false, +} +enum E { + A = 1, + B = 2, +} +enum E of number { + A = 1, + B = 2, +} +enum E { + A, + B, +} +enum E of string { + A, + B, +} +enum E { + A = "a", + B = "b", +} +enum E of string { + A = "a", + B = "b", +} +enum E of symbol { + A, + B, +} diff --git a/packages/babel-generator/test/fixtures/flow/enum-declaration/options.json b/packages/babel-generator/test/fixtures/flow/enum-declaration/options.json new file mode 100644 index 000000000000..53fd48c051cb --- /dev/null +++ b/packages/babel-generator/test/fixtures/flow/enum-declaration/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["flow", { "enums": true }]] +} diff --git a/packages/babel-generator/test/fixtures/flow/enum-declaration/output.js b/packages/babel-generator/test/fixtures/flow/enum-declaration/output.js new file mode 100644 index 000000000000..f59944f78e18 --- /dev/null +++ b/packages/babel-generator/test/fixtures/flow/enum-declaration/output.js @@ -0,0 +1,36 @@ +enum E { + A = true, + B = false, +} +enum E of boolean { + A = true, + B = false, +} +enum E { + A = 1, + B = 2, +} +enum E of number { + A = 1, + B = 2, +} +enum E { + A, + B, +} +enum E of string { + A, + B, +} +enum E { + A = "a", + B = "b", +} +enum E of string { + A = "a", + B = "b", +} +enum E of symbol { + A, + B, +} diff --git a/packages/babel-parser/src/plugins/flow.js b/packages/babel-parser/src/plugins/flow.js index 867c31243010..d4c815d38b45 100644 --- a/packages/babel-parser/src/plugins/flow.js +++ b/packages/babel-parser/src/plugins/flow.js @@ -81,6 +81,20 @@ function partition( const FLOW_PRAGMA_REGEX = /\*?\s*@((?:no)?flow)\b/; +// Flow enums types +type EnumExplicitType = null | "boolean" | "number" | "string" | "symbol"; +type EnumContext = {| + enumName: string, + explicitType: EnumExplicitType, + memberName: string, +|}; +type EnumMemberInit = + | {| type: "number", pos: number, value: N.Node |} + | {| type: "string", pos: number, value: N.Node |} + | {| type: "boolean", pos: number, value: N.Node |} + | {| type: "invalid", pos: number |} + | {| type: "none", pos: number |}; + export default (superClass: Class): Class => class extends superClass { // The value of the @flow/@noflow pragma. Initially undefined, transitions @@ -97,6 +111,10 @@ export default (superClass: Class): Class => return this.getPluginOption("flow", "all") || this.flowPragma === "flow"; } + shouldParseEnums(): boolean { + return !!this.getPluginOption("flow", "enums"); + } + finishToken(type: TokenType, val: any): void { if ( type !== tt.string && @@ -1604,7 +1622,7 @@ export default (superClass: Class): Class => super.parseFunctionBodyAndFinish(node, type, isMethod); } - // interfaces + // interfaces and enums parseStatement(context: ?string, topLevel?: boolean): N.Statement { // strict mode handling of `interface` since it's a reserved word if ( @@ -1615,6 +1633,10 @@ export default (superClass: Class): Class => const node = this.startNode(); this.next(); return this.flowParseInterface(node); + } else if (this.shouldParseEnums() && this.isContextual("enum")) { + const node = this.startNode(); + this.next(); + return this.flowParseEnumDeclaration(node); } else { const stmt = super.parseStatement(context, topLevel); // We will parse a flow pragma in any comment before the first statement. @@ -1661,6 +1683,7 @@ export default (superClass: Class): Class => this.isContextual("type") || this.isContextual("interface") || this.isContextual("opaque") || + (this.shouldParseEnums() && this.isContextual("enum")) || super.shouldParseExportDeclaration() ); } @@ -1670,7 +1693,8 @@ export default (superClass: Class): Class => this.match(tt.name) && (this.state.value === "type" || this.state.value === "interface" || - this.state.value === "opaque") + this.state.value === "opaque" || + (this.shouldParseEnums() && this.state.value === "enum")) ) { return false; } @@ -1678,6 +1702,15 @@ export default (superClass: Class): Class => return super.isExportDefaultSpecifier(); } + parseExportDefaultExpression(): N.Expression | N.Declaration { + if (this.shouldParseEnums() && this.isContextual("enum")) { + const node = this.startNode(); + this.next(); + return this.flowParseEnumDeclaration(node); + } + return super.parseExportDefaultExpression(); + } + parseConditional( expr: N.Expression, noIn: ?boolean, @@ -1935,6 +1968,11 @@ export default (superClass: Class): Class => const declarationNode = this.startNode(); this.next(); return this.flowParseInterface(declarationNode); + } else if (this.shouldParseEnums() && this.isContextual("enum")) { + node.exportKind = "value"; + const declarationNode = this.startNode(); + this.next(); + return this.flowParseEnumDeclaration(declarationNode); } else { return super.parseExportDeclaration(node); } @@ -2839,4 +2877,418 @@ export default (superClass: Class): Class => this.raise(this.state.pos, "Unterminated comment"); } } + + // Flow enum parsing + + flowEnumErrorBooleanMemberNotInitialized( + pos: number, + { enumName, memberName }: { enumName: string, memberName: string }, + ): void { + this.raise( + pos, + `Boolean enum members need to be initialized. Use either \`${memberName} = true,\` ` + + `or \`${memberName} = false,\` in enum \`${enumName}\`.`, + ); + } + + flowEnumErrorInvalidMemberName( + pos: number, + { enumName, memberName }: { enumName: string, memberName: string }, + ): void { + const suggestion = memberName[0].toUpperCase() + memberName.slice(1); + this.raise( + pos, + `Enum member names cannot start with lowercase 'a' through 'z'. Instead of using ` + + `\`${memberName}\`, consider using \`${suggestion}\`, in enum \`${enumName}\`.`, + ); + } + + flowEnumErrorDuplicateMemberName( + pos: number, + { enumName, memberName }: { enumName: string, memberName: string }, + ): void { + this.raise( + pos, + `Enum member names need to be unique, but the name \`${memberName}\` has already been used ` + + `before in enum \`${enumName}\`.`, + ); + } + + flowEnumErrorInconsistentMemberValues( + pos: number, + { enumName }: { enumName: string }, + ): void { + this.raise( + pos, + `Enum \`${enumName}\` has inconsistent member initializers. Either use no initializers, or ` + + `consistently use literals (either booleans, numbers, or strings) for all member initializers.`, + ); + } + + flowEnumErrorInvalidExplicitType( + pos: number, + { + enumName, + suppliedType, + }: { enumName: string, suppliedType: null | string }, + ): void { + const suggestion = + `Use one of \`boolean\`, \`number\`, \`string\`, or \`symbol\` in ` + + `enum \`${enumName}\`.`; + const message = + suppliedType === null + ? `Supplied enum type is not valid. ${suggestion}` + : `Enum type \`${suppliedType}\` is not valid. ${suggestion}`; + this.raise(pos, message); + } + + flowEnumErrorInvalidMemberInitializer( + pos: number, + { enumName, explicitType, memberName }: EnumContext, + ): void { + let message = null; + switch (explicitType) { + case "boolean": + case "number": + case "string": + message = + `Enum \`${enumName}\` has type \`${explicitType}\`, so the initializer of ` + + `\`${memberName}\` needs to be a ${explicitType} literal.`; + break; + case "symbol": + message = + `Symbol enum members cannot be initialized. Use \`${memberName},\` in ` + + `enum \`${enumName}\`.`; + break; + default: + // null + message = + `The enum member initializer for \`${memberName}\` needs to be a literal (either ` + + `a boolean, number, or string) in enum \`${enumName}\`.`; + } + this.raise(pos, message); + } + + flowEnumErrorNumberMemberNotInitialized( + pos: number, + { enumName, memberName }: { enumName: string, memberName: string }, + ): void { + this.raise( + pos, + `Number enum members need to be initialized, e.g. \`${memberName} = 1\` in enum \`${enumName}\`.`, + ); + } + + flowEnumErrorStringMemberInconsistentlyInitailized( + pos: number, + { enumName }: { enumName: string }, + ): void { + this.raise( + pos, + `String enum members need to consistently either all use initializers, or use no initializers, ` + + `in enum \`${enumName}\`.`, + ); + } + + flowEnumMemberInit(): EnumMemberInit { + const startPos = this.state.start; + const endOfInit = () => this.match(tt.comma) || this.match(tt.braceR); + switch (this.state.type) { + case tt.num: { + const literal = this.parseLiteral(this.state.value, "NumericLiteral"); + if (endOfInit()) { + return { type: "number", pos: literal.start, value: literal }; + } + return { type: "invalid", pos: startPos }; + } + case tt.string: { + const literal = this.parseLiteral(this.state.value, "StringLiteral"); + if (endOfInit()) { + return { type: "string", pos: literal.start, value: literal }; + } + return { type: "invalid", pos: startPos }; + } + case tt._true: + case tt._false: { + const literal = this.parseBooleanLiteral(); + if (endOfInit()) { + return { + type: "boolean", + pos: literal.start, + value: literal, + }; + } + return { type: "invalid", pos: startPos }; + } + default: + return { type: "invalid", pos: startPos }; + } + } + + flowEnumMemberRaw(): { id: N.Node, init: EnumMemberInit } { + const pos = this.state.start; + const id = this.parseIdentifier(true); + const init = this.eat(tt.eq) + ? this.flowEnumMemberInit() + : { type: "none", pos }; + return { id, init }; + } + + flowEnumCheckExplicitTypeMismatch( + pos: number, + context: EnumContext, + expectedType: EnumExplicitType, + ): void { + const { explicitType } = context; + if (explicitType === null) { + return; + } + if (explicitType !== expectedType) { + this.flowEnumErrorInvalidMemberInitializer(pos, context); + } + } + + flowEnumMembers({ + enumName, + explicitType, + }: { + enumName: string, + explicitType: EnumExplicitType, + }): {| + booleanMembers: Array, + numberMembers: Array, + stringMembers: Array, + defaultedMembers: Array, + |} { + const seenNames = new Set(); + const members = { + booleanMembers: [], + numberMembers: [], + stringMembers: [], + defaultedMembers: [], + }; + while (!this.match(tt.braceR)) { + const memberNode = this.startNode(); + const { id, init } = this.flowEnumMemberRaw(); + const memberName = id.name; + if (memberName === "") { + continue; + } + if (/^[a-z]/.test(memberName)) { + this.flowEnumErrorInvalidMemberName(id.start, { + enumName, + memberName, + }); + } + if (seenNames.has(memberName)) { + this.flowEnumErrorDuplicateMemberName(id.start, { + enumName, + memberName, + }); + } + seenNames.add(memberName); + const context = { enumName, explicitType, memberName }; + memberNode.id = id; + switch (init.type) { + case "boolean": { + this.flowEnumCheckExplicitTypeMismatch( + init.pos, + context, + "boolean", + ); + memberNode.init = init.value; + members.booleanMembers.push( + this.finishNode(memberNode, "EnumBooleanMember"), + ); + break; + } + case "number": { + this.flowEnumCheckExplicitTypeMismatch(init.pos, context, "number"); + memberNode.init = init.value; + members.numberMembers.push( + this.finishNode(memberNode, "EnumNumberMember"), + ); + break; + } + case "string": { + this.flowEnumCheckExplicitTypeMismatch(init.pos, context, "string"); + memberNode.init = init.value; + members.stringMembers.push( + this.finishNode(memberNode, "EnumStringMember"), + ); + break; + } + case "invalid": { + this.flowEnumErrorInvalidMemberInitializer(init.pos, context); + break; + } + case "none": { + switch (explicitType) { + case "boolean": + this.flowEnumErrorBooleanMemberNotInitialized( + init.pos, + context, + ); + break; + case "number": + this.flowEnumErrorNumberMemberNotInitialized(init.pos, context); + break; + default: + members.defaultedMembers.push( + this.finishNode(memberNode, "EnumDefaultedMember"), + ); + } + } + } + + if (!this.match(tt.braceR)) { + this.expect(tt.comma); + } + } + return members; + } + + flowEnumStringBody( + bodyNode: N.Node, + initializedMembers: Array, + defaultedMembers: Array, + { enumName }: { enumName: string }, + ): N.Node { + if (initializedMembers.length === 0) { + bodyNode.members = defaultedMembers; + } else if (defaultedMembers.length === 0) { + bodyNode.members = initializedMembers; + } else if (defaultedMembers.length > initializedMembers.length) { + bodyNode.members = defaultedMembers; + for (const member of initializedMembers) { + this.flowEnumErrorStringMemberInconsistentlyInitailized( + member.start, + { enumName }, + ); + } + } else { + bodyNode.members = initializedMembers; + for (const member of defaultedMembers) { + this.flowEnumErrorStringMemberInconsistentlyInitailized( + member.start, + { enumName }, + ); + } + } + return this.finishNode(bodyNode, "EnumStringBody"); + } + + flowEnumParseExplicitType({ + enumName, + }: { + enumName: string, + }): EnumExplicitType { + if (this.eatContextual("of")) { + if (this.match(tt.name)) { + switch (this.state.value) { + case "boolean": + case "number": + case "string": + case "symbol": { + const explicitType = this.state.value; + this.next(); + return explicitType; + } + default: + this.flowEnumErrorInvalidExplicitType(this.state.start, { + enumName, + suppliedType: this.state.value, + }); + } + } else { + this.flowEnumErrorInvalidExplicitType(this.state.start, { + enumName, + suppliedType: null, + }); + } + } + return null; + } + + flowParseEnumDeclaration(node: N.Node): N.Node { + const id = this.parseIdentifier(); + node.id = id; + const enumName = id.name; + const explicitType = this.flowEnumParseExplicitType({ enumName }); + this.expect(tt.braceL); + const bodyNode = this.startNode(); + const members = this.flowEnumMembers({ enumName, explicitType }); + + switch (explicitType) { + case "boolean": + bodyNode.explicitType = true; + bodyNode.members = members.booleanMembers; + node.body = this.finishNode(bodyNode, "EnumBooleanBody"); + break; + case "number": + bodyNode.explicitType = true; + bodyNode.members = members.numberMembers; + node.body = this.finishNode(bodyNode, "EnumNumberBody"); + break; + case "string": + bodyNode.explicitType = true; + node.body = this.flowEnumStringBody( + bodyNode, + members.stringMembers, + members.defaultedMembers, + { enumName }, + ); + break; + case "symbol": + bodyNode.members = members.defaultedMembers; + node.body = this.finishNode(bodyNode, "EnumSymbolBody"); + break; + default: { + // null + const empty = () => { + bodyNode.members = []; + return this.finishNode(bodyNode, "EnumStringBody"); + }; + bodyNode.explicitType = false; + const boolsLen = members.booleanMembers.length; + const numsLen = members.numberMembers.length; + const strsLen = members.stringMembers.length; + const defaultedLen = members.defaultedMembers.length; + + if (!boolsLen && !numsLen && !strsLen && !defaultedLen) { + node.body = empty(); + } else if (!boolsLen && !numsLen) { + node.body = this.flowEnumStringBody( + bodyNode, + members.stringMembers, + members.defaultedMembers, + { enumName }, + ); + } else if (!numsLen && !strsLen && boolsLen >= defaultedLen) { + bodyNode.members = members.booleanMembers; + node.body = this.finishNode(bodyNode, "EnumBooleanBody"); + for (const member of members.defaultedMembers) { + this.flowEnumErrorBooleanMemberNotInitialized(member.start, { + enumName, + memberName: member.id.name, + }); + } + } else if (!boolsLen && !strsLen && numsLen >= defaultedLen) { + bodyNode.members = members.numberMembers; + node.body = this.finishNode(bodyNode, "EnumNumberBody"); + for (const member of members.defaultedMembers) { + this.flowEnumErrorNumberMemberNotInitialized(member.start, { + enumName, + memberName: member.id.name, + }); + } + } else { + node.body = empty(); + this.flowEnumErrorInconsistentMemberValues(id.start, { enumName }); + } + } + } + this.expect(tt.braceR); + return this.finishNode(node, "EnumDeclaration"); + } }; diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/boolean-explicit/input.js b/packages/babel-parser/test/fixtures/flow/enum-declaration/boolean-explicit/input.js new file mode 100644 index 000000000000..7b63f4eb2962 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/boolean-explicit/input.js @@ -0,0 +1,4 @@ +enum E of boolean { + A = true, + B = false, +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/boolean-explicit/output.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/boolean-explicit/output.json new file mode 100644 index 000000000000..df48f24b108b --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/boolean-explicit/output.json @@ -0,0 +1,181 @@ +{ + "type": "File", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "EnumDeclaration", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "E" + }, + "name": "E" + }, + "body": { + "type": "EnumBooleanBody", + "start": 22, + "end": 44, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 3, + "column": 12 + } + }, + "explicitType": true, + "members": [ + { + "type": "EnumBooleanMember", + "start": 22, + "end": 30, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 10 + } + }, + "id": { + "type": "Identifier", + "start": 22, + "end": 23, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 3 + }, + "identifierName": "A" + }, + "name": "A" + }, + "init": { + "type": "BooleanLiteral", + "start": 26, + "end": 30, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 10 + } + }, + "value": true + } + }, + { + "type": "EnumBooleanMember", + "start": 34, + "end": 43, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 11 + } + }, + "id": { + "type": "Identifier", + "start": 34, + "end": 35, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 3 + }, + "identifierName": "B" + }, + "name": "B" + }, + "init": { + "type": "BooleanLiteral", + "start": 38, + "end": 43, + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 11 + } + }, + "value": false + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/boolean-implicit/input.js b/packages/babel-parser/test/fixtures/flow/enum-declaration/boolean-implicit/input.js new file mode 100644 index 000000000000..6ab49ea7b2b8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/boolean-implicit/input.js @@ -0,0 +1,4 @@ +enum E { + A = true, + B = false, +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/boolean-implicit/output.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/boolean-implicit/output.json new file mode 100644 index 000000000000..d7d3bae2e7c4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/boolean-implicit/output.json @@ -0,0 +1,181 @@ +{ + "type": "File", + "start": 0, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "EnumDeclaration", + "start": 0, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "E" + }, + "name": "E" + }, + "body": { + "type": "EnumBooleanBody", + "start": 11, + "end": 33, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 3, + "column": 12 + } + }, + "explicitType": false, + "members": [ + { + "type": "EnumBooleanMember", + "start": 11, + "end": 19, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 10 + } + }, + "id": { + "type": "Identifier", + "start": 11, + "end": 12, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 3 + }, + "identifierName": "A" + }, + "name": "A" + }, + "init": { + "type": "BooleanLiteral", + "start": 15, + "end": 19, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 10 + } + }, + "value": true + } + }, + { + "type": "EnumBooleanMember", + "start": 23, + "end": 32, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 11 + } + }, + "id": { + "type": "Identifier", + "start": 23, + "end": 24, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 3 + }, + "identifierName": "B" + }, + "name": "B" + }, + "init": { + "type": "BooleanLiteral", + "start": 27, + "end": 32, + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 11 + } + }, + "value": false + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/boolean-member-not-initialized-explicit/input.js b/packages/babel-parser/test/fixtures/flow/enum-declaration/boolean-member-not-initialized-explicit/input.js new file mode 100644 index 000000000000..4fecb537fb2e --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/boolean-member-not-initialized-explicit/input.js @@ -0,0 +1,3 @@ +enum E of boolean { + A, +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/boolean-member-not-initialized-explicit/options.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/boolean-member-not-initialized-explicit/options.json new file mode 100644 index 000000000000..b3b5dfd8b08f --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/boolean-member-not-initialized-explicit/options.json @@ -0,0 +1,4 @@ +{ + "plugins": [["flow", { "enums": true }]], + "throws": "Boolean enum members need to be initialized. Use either `A = true,` or `A = false,` in enum `E`. (2:2)" +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/boolean-member-not-initialized-implicit/input.js b/packages/babel-parser/test/fixtures/flow/enum-declaration/boolean-member-not-initialized-implicit/input.js new file mode 100644 index 000000000000..73704345dc4b --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/boolean-member-not-initialized-implicit/input.js @@ -0,0 +1,4 @@ +enum E { + A, + B = true, +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/boolean-member-not-initialized-implicit/options.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/boolean-member-not-initialized-implicit/options.json new file mode 100644 index 000000000000..b3b5dfd8b08f --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/boolean-member-not-initialized-implicit/options.json @@ -0,0 +1,4 @@ +{ + "plugins": [["flow", { "enums": true }]], + "throws": "Boolean enum members need to be initialized. Use either `A = true,` or `A = false,` in enum `E`. (2:2)" +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/duplicate-member-name/input.js b/packages/babel-parser/test/fixtures/flow/enum-declaration/duplicate-member-name/input.js new file mode 100644 index 000000000000..c9fde50253ac --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/duplicate-member-name/input.js @@ -0,0 +1,4 @@ +enum E { + A, + A, +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/duplicate-member-name/options.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/duplicate-member-name/options.json new file mode 100644 index 000000000000..d769b33ba2c2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/duplicate-member-name/options.json @@ -0,0 +1,4 @@ +{ + "plugins": [["flow", { "enums": true }]], + "throws": "Enum member names need to be unique, but the name `A` has already been used before in enum `E`. (3:2)" +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/empty/input.js b/packages/babel-parser/test/fixtures/flow/enum-declaration/empty/input.js new file mode 100644 index 000000000000..714f607bf333 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/empty/input.js @@ -0,0 +1 @@ +enum E { } diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/empty/output.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/empty/output.json new file mode 100644 index 000000000000..336475b12dd5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/empty/output.json @@ -0,0 +1,84 @@ +{ + "type": "File", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "EnumDeclaration", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "E" + }, + "name": "E" + }, + "body": { + "type": "EnumStringBody", + "start": 9, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "explicitType": false, + "members": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/end-of-file/input.js b/packages/babel-parser/test/fixtures/flow/enum-declaration/end-of-file/input.js new file mode 100644 index 000000000000..e3caefb45c49 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/end-of-file/input.js @@ -0,0 +1 @@ +enum diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/end-of-file/options.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/end-of-file/options.json new file mode 100644 index 000000000000..030f339842d5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/end-of-file/options.json @@ -0,0 +1,4 @@ +{ + "plugins": [["flow", { "enums": true }]], + "throws": "Unexpected token (1:4)" +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/enum-name/input.js b/packages/babel-parser/test/fixtures/flow/enum-declaration/enum-name/input.js new file mode 100644 index 000000000000..8d057902fa7e --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/enum-name/input.js @@ -0,0 +1,2 @@ +enum type { +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/enum-name/output.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/enum-name/output.json new file mode 100644 index 000000000000..57bea3fab460 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/enum-name/output.json @@ -0,0 +1,84 @@ +{ + "type": "File", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 1 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "EnumDeclaration", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 9 + }, + "identifierName": "type" + }, + "name": "type" + }, + "body": { + "type": "EnumStringBody", + "start": 12, + "end": 11, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "explicitType": false, + "members": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/export/input.js b/packages/babel-parser/test/fixtures/flow/enum-declaration/export/input.js new file mode 100644 index 000000000000..ebdc5a4a8bb8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/export/input.js @@ -0,0 +1,3 @@ +export enum A {} + +export default enum B {} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/export/options.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/export/options.json new file mode 100644 index 000000000000..f17ece27cf57 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/export/options.json @@ -0,0 +1,11 @@ +{ + "plugins": [ + [ + "flow", + { + "enums": true + } + ] + ], + "sourceType": "module" +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/export/output.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/export/output.json new file mode 100644 index 000000000000..5762ca30b575 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/export/output.json @@ -0,0 +1,166 @@ +{ + "type": "File", + "start": 0, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 24 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 24 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start": 0, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "specifiers": [], + "source": null, + "exportKind": "value", + "declaration": { + "type": "EnumDeclaration", + "start": 7, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "id": { + "type": "Identifier", + "start": 12, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + }, + "identifierName": "A" + }, + "name": "A" + }, + "body": { + "type": "EnumStringBody", + "start": 15, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "explicitType": false, + "members": [] + } + } + }, + { + "type": "ExportDefaultDeclaration", + "start": 18, + "end": 42, + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 24 + } + }, + "declaration": { + "type": "EnumDeclaration", + "start": 33, + "end": 42, + "loc": { + "start": { + "line": 3, + "column": 15 + }, + "end": { + "line": 3, + "column": 24 + } + }, + "id": { + "type": "Identifier", + "start": 38, + "end": 39, + "loc": { + "start": { + "line": 3, + "column": 20 + }, + "end": { + "line": 3, + "column": 21 + }, + "identifierName": "B" + }, + "name": "B" + }, + "body": { + "type": "EnumStringBody", + "start": 41, + "end": 41, + "loc": { + "start": { + "line": 3, + "column": 23 + }, + "end": { + "line": 3, + "column": 23 + } + }, + "explicitType": false, + "members": [] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/inconsistent-member-values-majority-defaulted/input.js b/packages/babel-parser/test/fixtures/flow/enum-declaration/inconsistent-member-values-majority-defaulted/input.js new file mode 100644 index 000000000000..5a639f107119 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/inconsistent-member-values-majority-defaulted/input.js @@ -0,0 +1,5 @@ +enum E { + A, + B, + C = 3, +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/inconsistent-member-values-majority-defaulted/options.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/inconsistent-member-values-majority-defaulted/options.json new file mode 100644 index 000000000000..3dbe8477d0ab --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/inconsistent-member-values-majority-defaulted/options.json @@ -0,0 +1,4 @@ +{ + "plugins": [["flow", { "enums": true }]], + "throws": "Enum `E` has inconsistent member initializers. Either use no initializers, or consistently use literals (either booleans, numbers, or strings) for all member initializers. (1:5)" +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/inconsistent-member-values-mixed-initializers/input.js b/packages/babel-parser/test/fixtures/flow/enum-declaration/inconsistent-member-values-mixed-initializers/input.js new file mode 100644 index 000000000000..b0b10ec4d43a --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/inconsistent-member-values-mixed-initializers/input.js @@ -0,0 +1,4 @@ +enum E { + A = 1, + B = true, +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/inconsistent-member-values-mixed-initializers/options.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/inconsistent-member-values-mixed-initializers/options.json new file mode 100644 index 000000000000..3dbe8477d0ab --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/inconsistent-member-values-mixed-initializers/options.json @@ -0,0 +1,4 @@ +{ + "plugins": [["flow", { "enums": true }]], + "throws": "Enum `E` has inconsistent member initializers. Either use no initializers, or consistently use literals (either booleans, numbers, or strings) for all member initializers. (1:5)" +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-explicit-type-expression/input.js b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-explicit-type-expression/input.js new file mode 100644 index 000000000000..e3353ef78879 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-explicit-type-expression/input.js @@ -0,0 +1,2 @@ +enum E of [] { +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-explicit-type-expression/options.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-explicit-type-expression/options.json new file mode 100644 index 000000000000..9916e88639b9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-explicit-type-expression/options.json @@ -0,0 +1,4 @@ +{ + "plugins": [["flow", { "enums": true }]], + "throws": "Supplied enum type is not valid. Use one of `boolean`, `number`, `string`, or `symbol` in enum `E`. (1:10)" +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-explicit-type-identifier/input.js b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-explicit-type-identifier/input.js new file mode 100644 index 000000000000..25bbeb7024e8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-explicit-type-identifier/input.js @@ -0,0 +1,2 @@ +enum E of xxx { +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-explicit-type-identifier/options.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-explicit-type-identifier/options.json new file mode 100644 index 000000000000..7684531c52f1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-explicit-type-identifier/options.json @@ -0,0 +1,4 @@ +{ + "plugins": [["flow", { "enums": true }]], + "throws": "Enum type `xxx` is not valid. Use one of `boolean`, `number`, `string`, or `symbol` in enum `E`. (1:10)" +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-boolean-explicit-string/input.js b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-boolean-explicit-string/input.js new file mode 100644 index 000000000000..31e79ef9f119 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-boolean-explicit-string/input.js @@ -0,0 +1,3 @@ +enum E of string { + A = true, +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-boolean-explicit-string/options.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-boolean-explicit-string/options.json new file mode 100644 index 000000000000..1587909dd62e --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-boolean-explicit-string/options.json @@ -0,0 +1,4 @@ +{ + "plugins": [["flow", { "enums": true }]], + "throws": "Enum `E` has type `string`, so the initializer of `A` needs to be a string literal. (2:6)" +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-expression-explicit-boolean/input.js b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-expression-explicit-boolean/input.js new file mode 100644 index 000000000000..d4f1afa92f09 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-expression-explicit-boolean/input.js @@ -0,0 +1,3 @@ +enum E of boolean { + A = 1 + 2, +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-expression-explicit-boolean/options.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-expression-explicit-boolean/options.json new file mode 100644 index 000000000000..14ed173defa0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-expression-explicit-boolean/options.json @@ -0,0 +1,4 @@ +{ + "plugins": [["flow", { "enums": true }]], + "throws": "Enum `E` has type `boolean`, so the initializer of `A` needs to be a boolean literal. (2:6)" +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-expression-explicit-number/input.js b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-expression-explicit-number/input.js new file mode 100644 index 000000000000..a6f7ed2152c2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-expression-explicit-number/input.js @@ -0,0 +1,3 @@ +enum E of number { + A = 1 + 2, +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-expression-explicit-number/options.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-expression-explicit-number/options.json new file mode 100644 index 000000000000..7a8a81f75442 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-expression-explicit-number/options.json @@ -0,0 +1,4 @@ +{ + "plugins": [["flow", { "enums": true }]], + "throws": "Enum `E` has type `number`, so the initializer of `A` needs to be a number literal. (2:6)" +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-expression-explicit-string/input.js b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-expression-explicit-string/input.js new file mode 100644 index 000000000000..704efcf615b5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-expression-explicit-string/input.js @@ -0,0 +1,3 @@ +enum E of string { + A = 1 + 2, +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-expression-explicit-string/options.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-expression-explicit-string/options.json new file mode 100644 index 000000000000..1587909dd62e --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-expression-explicit-string/options.json @@ -0,0 +1,4 @@ +{ + "plugins": [["flow", { "enums": true }]], + "throws": "Enum `E` has type `string`, so the initializer of `A` needs to be a string literal. (2:6)" +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-expression-explicit-symbol/input.js b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-expression-explicit-symbol/input.js new file mode 100644 index 000000000000..d4acb6dfd235 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-expression-explicit-symbol/input.js @@ -0,0 +1,3 @@ +enum E of symbol { + A = 1 + 2, +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-expression-explicit-symbol/options.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-expression-explicit-symbol/options.json new file mode 100644 index 000000000000..e9b2692f126a --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-expression-explicit-symbol/options.json @@ -0,0 +1,4 @@ +{ + "plugins": [["flow", { "enums": true }]], + "throws": "Symbol enum members cannot be initialized. Use `A,` in enum `E`. (2:6)" +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-expression-implicit/input.js b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-expression-implicit/input.js new file mode 100644 index 000000000000..bed31f7fdc1c --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-expression-implicit/input.js @@ -0,0 +1,3 @@ +enum E { + A = 1 + 2, +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-expression-implicit/options.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-expression-implicit/options.json new file mode 100644 index 000000000000..282f44e03ab4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-expression-implicit/options.json @@ -0,0 +1,4 @@ +{ + "plugins": [["flow", { "enums": true }]], + "throws": "The enum member initializer for `A` needs to be a literal (either a boolean, number, or string) in enum `E`. (2:6)" +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-literal-explicit-symbol/input.js b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-literal-explicit-symbol/input.js new file mode 100644 index 000000000000..dc8429b75342 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-literal-explicit-symbol/input.js @@ -0,0 +1,3 @@ +enum E of symbol { + A = 1, +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-literal-explicit-symbol/options.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-literal-explicit-symbol/options.json new file mode 100644 index 000000000000..e9b2692f126a --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-literal-explicit-symbol/options.json @@ -0,0 +1,4 @@ +{ + "plugins": [["flow", { "enums": true }]], + "throws": "Symbol enum members cannot be initialized. Use `A,` in enum `E`. (2:6)" +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-number-explicit-boolean/input.js b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-number-explicit-boolean/input.js new file mode 100644 index 000000000000..81e1097efdd9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-number-explicit-boolean/input.js @@ -0,0 +1,3 @@ +enum E of boolean { + A = 1, +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-number-explicit-boolean/options.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-number-explicit-boolean/options.json new file mode 100644 index 000000000000..14ed173defa0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-number-explicit-boolean/options.json @@ -0,0 +1,4 @@ +{ + "plugins": [["flow", { "enums": true }]], + "throws": "Enum `E` has type `boolean`, so the initializer of `A` needs to be a boolean literal. (2:6)" +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-number-explicit-string/input.js b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-number-explicit-string/input.js new file mode 100644 index 000000000000..708914906e1d --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-number-explicit-string/input.js @@ -0,0 +1,3 @@ +enum E of string { + A = 1, +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-number-explicit-string/options.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-number-explicit-string/options.json new file mode 100644 index 000000000000..1587909dd62e --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-number-explicit-string/options.json @@ -0,0 +1,4 @@ +{ + "plugins": [["flow", { "enums": true }]], + "throws": "Enum `E` has type `string`, so the initializer of `A` needs to be a string literal. (2:6)" +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-parenthesized/input.js b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-parenthesized/input.js new file mode 100644 index 000000000000..92cc2012d905 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-parenthesized/input.js @@ -0,0 +1,3 @@ +enum E { + A = (1), +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-parenthesized/options.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-parenthesized/options.json new file mode 100644 index 000000000000..282f44e03ab4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-parenthesized/options.json @@ -0,0 +1,4 @@ +{ + "plugins": [["flow", { "enums": true }]], + "throws": "The enum member initializer for `A` needs to be a literal (either a boolean, number, or string) in enum `E`. (2:6)" +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-string-explicit-boolean/input.js b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-string-explicit-boolean/input.js new file mode 100644 index 000000000000..86674e7f2053 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-string-explicit-boolean/input.js @@ -0,0 +1,3 @@ +enum E of boolean { + A = "hi", +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-string-explicit-boolean/options.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-string-explicit-boolean/options.json new file mode 100644 index 000000000000..14ed173defa0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-string-explicit-boolean/options.json @@ -0,0 +1,4 @@ +{ + "plugins": [["flow", { "enums": true }]], + "throws": "Enum `E` has type `boolean`, so the initializer of `A` needs to be a boolean literal. (2:6)" +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-string-explicit-number/input.js b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-string-explicit-number/input.js new file mode 100644 index 000000000000..5b0a7937af0a --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-string-explicit-number/input.js @@ -0,0 +1,3 @@ +enum E of number { + A = "hi", +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-string-explicit-number/options.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-string-explicit-number/options.json new file mode 100644 index 000000000000..7a8a81f75442 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-string-explicit-number/options.json @@ -0,0 +1,4 @@ +{ + "plugins": [["flow", { "enums": true }]], + "throws": "Enum `E` has type `number`, so the initializer of `A` needs to be a number literal. (2:6)" +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-name/input.js b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-name/input.js new file mode 100644 index 000000000000..3604a85bb2d4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-name/input.js @@ -0,0 +1,4 @@ +enum E { + foo, + bar, +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-name/options.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-name/options.json new file mode 100644 index 000000000000..3a3974fd4b9d --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-name/options.json @@ -0,0 +1,4 @@ +{ + "plugins": [["flow", { "enums": true }]], + "throws": "Enum member names cannot start with lowercase 'a' through 'z'. Instead of using `foo`, consider using `Foo`, in enum `E`. (2:2)" +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/no-trailing-comma/input.js b/packages/babel-parser/test/fixtures/flow/enum-declaration/no-trailing-comma/input.js new file mode 100644 index 000000000000..228a928299de --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/no-trailing-comma/input.js @@ -0,0 +1,3 @@ +enum E { + A +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/no-trailing-comma/output.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/no-trailing-comma/output.json new file mode 100644 index 000000000000..ed614a856575 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/no-trailing-comma/output.json @@ -0,0 +1,117 @@ +{ + "type": "File", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "EnumDeclaration", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "E" + }, + "name": "E" + }, + "body": { + "type": "EnumStringBody", + "start": 11, + "end": 12, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 3 + } + }, + "explicitType": false, + "members": [ + { + "type": "EnumDefaultedMember", + "start": 11, + "end": 12, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 3 + } + }, + "id": { + "type": "Identifier", + "start": 11, + "end": 12, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 3 + }, + "identifierName": "A" + }, + "name": "A" + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/number-explicit/input.js b/packages/babel-parser/test/fixtures/flow/enum-declaration/number-explicit/input.js new file mode 100644 index 000000000000..f597c5898aa0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/number-explicit/input.js @@ -0,0 +1,4 @@ +enum E of number { + A = 1, + B = 2, +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/number-explicit/output.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/number-explicit/output.json new file mode 100644 index 000000000000..4f5a6f26c614 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/number-explicit/output.json @@ -0,0 +1,189 @@ +{ + "type": "File", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "EnumDeclaration", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "E" + }, + "name": "E" + }, + "body": { + "type": "EnumNumberBody", + "start": 21, + "end": 36, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 3, + "column": 8 + } + }, + "explicitType": true, + "members": [ + { + "type": "EnumNumberMember", + "start": 21, + "end": 26, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 7 + } + }, + "id": { + "type": "Identifier", + "start": 21, + "end": 22, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 3 + }, + "identifierName": "A" + }, + "name": "A" + }, + "init": { + "type": "NumericLiteral", + "start": 25, + "end": 26, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 7 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + }, + { + "type": "EnumNumberMember", + "start": 30, + "end": 35, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 7 + } + }, + "id": { + "type": "Identifier", + "start": 30, + "end": 31, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 3 + }, + "identifierName": "B" + }, + "name": "B" + }, + "init": { + "type": "NumericLiteral", + "start": 34, + "end": 35, + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 7 + } + }, + "extra": { + "rawValue": 2, + "raw": "2" + }, + "value": 2 + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/number-implicit/input.js b/packages/babel-parser/test/fixtures/flow/enum-declaration/number-implicit/input.js new file mode 100644 index 000000000000..1b99bb7ff34a --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/number-implicit/input.js @@ -0,0 +1,4 @@ +enum E { + A = 1, + B = 2, +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/number-implicit/output.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/number-implicit/output.json new file mode 100644 index 000000000000..862a8bc5691b --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/number-implicit/output.json @@ -0,0 +1,189 @@ +{ + "type": "File", + "start": 0, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "EnumDeclaration", + "start": 0, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "E" + }, + "name": "E" + }, + "body": { + "type": "EnumNumberBody", + "start": 11, + "end": 26, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 3, + "column": 8 + } + }, + "explicitType": false, + "members": [ + { + "type": "EnumNumberMember", + "start": 11, + "end": 16, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 7 + } + }, + "id": { + "type": "Identifier", + "start": 11, + "end": 12, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 3 + }, + "identifierName": "A" + }, + "name": "A" + }, + "init": { + "type": "NumericLiteral", + "start": 15, + "end": 16, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 7 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + }, + { + "type": "EnumNumberMember", + "start": 20, + "end": 25, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 7 + } + }, + "id": { + "type": "Identifier", + "start": 20, + "end": 21, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 3 + }, + "identifierName": "B" + }, + "name": "B" + }, + "init": { + "type": "NumericLiteral", + "start": 24, + "end": 25, + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 7 + } + }, + "extra": { + "rawValue": 2, + "raw": "2" + }, + "value": 2 + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/number-member-not-initialized-explicit/input.js b/packages/babel-parser/test/fixtures/flow/enum-declaration/number-member-not-initialized-explicit/input.js new file mode 100644 index 000000000000..7f4f9cb05bbf --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/number-member-not-initialized-explicit/input.js @@ -0,0 +1,3 @@ +enum E of number { + A, +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/number-member-not-initialized-explicit/options.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/number-member-not-initialized-explicit/options.json new file mode 100644 index 000000000000..b668cbc42536 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/number-member-not-initialized-explicit/options.json @@ -0,0 +1,4 @@ +{ + "plugins": [["flow", { "enums": true }]], + "throws": "Number enum members need to be initialized, e.g. `A = 1` in enum `E`. (2:2)" +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/number-member-not-initialized-implicit/input.js b/packages/babel-parser/test/fixtures/flow/enum-declaration/number-member-not-initialized-implicit/input.js new file mode 100644 index 000000000000..a435e44e3da9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/number-member-not-initialized-implicit/input.js @@ -0,0 +1,4 @@ +enum E { + A, + B = 1, +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/number-member-not-initialized-implicit/options.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/number-member-not-initialized-implicit/options.json new file mode 100644 index 000000000000..b668cbc42536 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/number-member-not-initialized-implicit/options.json @@ -0,0 +1,4 @@ +{ + "plugins": [["flow", { "enums": true }]], + "throws": "Number enum members need to be initialized, e.g. `A = 1` in enum `E`. (2:2)" +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/options.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/options.json new file mode 100644 index 000000000000..53fd48c051cb --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["flow", { "enums": true }]] +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/reserved-word-enum-name/input.js b/packages/babel-parser/test/fixtures/flow/enum-declaration/reserved-word-enum-name/input.js new file mode 100644 index 000000000000..95350dba2f86 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/reserved-word-enum-name/input.js @@ -0,0 +1,2 @@ +enum class { +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/reserved-word-enum-name/options.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/reserved-word-enum-name/options.json new file mode 100644 index 000000000000..50d57cc99e4d --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/reserved-word-enum-name/options.json @@ -0,0 +1,4 @@ +{ + "plugins": [["flow", { "enums": true }]], + "throws": "Unexpected keyword 'class' (1:5)" +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/string-explicit-defaulted/input.js b/packages/babel-parser/test/fixtures/flow/enum-declaration/string-explicit-defaulted/input.js new file mode 100644 index 000000000000..0d3f7fed8378 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/string-explicit-defaulted/input.js @@ -0,0 +1,4 @@ +enum E of string { + A, + B, +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/string-explicit-defaulted/output.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/string-explicit-defaulted/output.json new file mode 100644 index 000000000000..57cc928ec552 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/string-explicit-defaulted/output.json @@ -0,0 +1,149 @@ +{ + "type": "File", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "EnumDeclaration", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "E" + }, + "name": "E" + }, + "body": { + "type": "EnumStringBody", + "start": 21, + "end": 28, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 3, + "column": 4 + } + }, + "explicitType": true, + "members": [ + { + "type": "EnumDefaultedMember", + "start": 21, + "end": 22, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 3 + } + }, + "id": { + "type": "Identifier", + "start": 21, + "end": 22, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 3 + }, + "identifierName": "A" + }, + "name": "A" + } + }, + { + "type": "EnumDefaultedMember", + "start": 26, + "end": 27, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 3 + } + }, + "id": { + "type": "Identifier", + "start": 26, + "end": 27, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 3 + }, + "identifierName": "B" + }, + "name": "B" + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/string-explicit-initialized/input.js b/packages/babel-parser/test/fixtures/flow/enum-declaration/string-explicit-initialized/input.js new file mode 100644 index 000000000000..4d27120ac56a --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/string-explicit-initialized/input.js @@ -0,0 +1,4 @@ +enum E of string { + A = "a", + B = "b", +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/string-explicit-initialized/output.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/string-explicit-initialized/output.json new file mode 100644 index 000000000000..1ab361d41977 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/string-explicit-initialized/output.json @@ -0,0 +1,189 @@ +{ + "type": "File", + "start": 0, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "EnumDeclaration", + "start": 0, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "E" + }, + "name": "E" + }, + "body": { + "type": "EnumStringBody", + "start": 21, + "end": 40, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 3, + "column": 10 + } + }, + "explicitType": true, + "members": [ + { + "type": "EnumStringMember", + "start": 21, + "end": 28, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 9 + } + }, + "id": { + "type": "Identifier", + "start": 21, + "end": 22, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 3 + }, + "identifierName": "A" + }, + "name": "A" + }, + "init": { + "type": "StringLiteral", + "start": 25, + "end": 28, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 9 + } + }, + "extra": { + "rawValue": "a", + "raw": "\"a\"" + }, + "value": "a" + } + }, + { + "type": "EnumStringMember", + "start": 32, + "end": 39, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 9 + } + }, + "id": { + "type": "Identifier", + "start": 32, + "end": 33, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 3 + }, + "identifierName": "B" + }, + "name": "B" + }, + "init": { + "type": "StringLiteral", + "start": 36, + "end": 39, + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 9 + } + }, + "extra": { + "rawValue": "b", + "raw": "\"b\"" + }, + "value": "b" + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/string-implicit-defaulted/input.js b/packages/babel-parser/test/fixtures/flow/enum-declaration/string-implicit-defaulted/input.js new file mode 100644 index 000000000000..b74648fd612c --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/string-implicit-defaulted/input.js @@ -0,0 +1,4 @@ +enum E { + A, + B, +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/string-implicit-defaulted/output.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/string-implicit-defaulted/output.json new file mode 100644 index 000000000000..b14d096085c2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/string-implicit-defaulted/output.json @@ -0,0 +1,149 @@ +{ + "type": "File", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "EnumDeclaration", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "E" + }, + "name": "E" + }, + "body": { + "type": "EnumStringBody", + "start": 11, + "end": 18, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 3, + "column": 4 + } + }, + "explicitType": false, + "members": [ + { + "type": "EnumDefaultedMember", + "start": 11, + "end": 12, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 3 + } + }, + "id": { + "type": "Identifier", + "start": 11, + "end": 12, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 3 + }, + "identifierName": "A" + }, + "name": "A" + } + }, + { + "type": "EnumDefaultedMember", + "start": 16, + "end": 17, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 3 + } + }, + "id": { + "type": "Identifier", + "start": 16, + "end": 17, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 3 + }, + "identifierName": "B" + }, + "name": "B" + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/string-implicit-initialized/input.js b/packages/babel-parser/test/fixtures/flow/enum-declaration/string-implicit-initialized/input.js new file mode 100644 index 000000000000..d1b1c29fc8a8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/string-implicit-initialized/input.js @@ -0,0 +1,4 @@ +enum E { + A = "a", + B = "b", +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/string-implicit-initialized/output.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/string-implicit-initialized/output.json new file mode 100644 index 000000000000..8f3e4e6eb48a --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/string-implicit-initialized/output.json @@ -0,0 +1,189 @@ +{ + "type": "File", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "EnumDeclaration", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "E" + }, + "name": "E" + }, + "body": { + "type": "EnumStringBody", + "start": 11, + "end": 30, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 3, + "column": 10 + } + }, + "explicitType": false, + "members": [ + { + "type": "EnumStringMember", + "start": 11, + "end": 18, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 9 + } + }, + "id": { + "type": "Identifier", + "start": 11, + "end": 12, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 3 + }, + "identifierName": "A" + }, + "name": "A" + }, + "init": { + "type": "StringLiteral", + "start": 15, + "end": 18, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 9 + } + }, + "extra": { + "rawValue": "a", + "raw": "\"a\"" + }, + "value": "a" + } + }, + { + "type": "EnumStringMember", + "start": 22, + "end": 29, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 9 + } + }, + "id": { + "type": "Identifier", + "start": 22, + "end": 23, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 3 + }, + "identifierName": "B" + }, + "name": "B" + }, + "init": { + "type": "StringLiteral", + "start": 26, + "end": 29, + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 9 + } + }, + "extra": { + "rawValue": "b", + "raw": "\"b\"" + }, + "value": "b" + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/string-member-inconsistently-initialized-majority-defaulted/input.js b/packages/babel-parser/test/fixtures/flow/enum-declaration/string-member-inconsistently-initialized-majority-defaulted/input.js new file mode 100644 index 000000000000..279605f466c4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/string-member-inconsistently-initialized-majority-defaulted/input.js @@ -0,0 +1,5 @@ +enum E of string { + A = "a", + B, + C, +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/string-member-inconsistently-initialized-majority-defaulted/options.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/string-member-inconsistently-initialized-majority-defaulted/options.json new file mode 100644 index 000000000000..71e396752a2e --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/string-member-inconsistently-initialized-majority-defaulted/options.json @@ -0,0 +1,4 @@ +{ + "plugins": [["flow", { "enums": true }]], + "throws": "String enum members need to consistently either all use initializers, or use no initializers, in enum `E`. (2:2)" +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/string-member-inconsistently-initialized-majority-initialized/input.js b/packages/babel-parser/test/fixtures/flow/enum-declaration/string-member-inconsistently-initialized-majority-initialized/input.js new file mode 100644 index 000000000000..e8db50effe4d --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/string-member-inconsistently-initialized-majority-initialized/input.js @@ -0,0 +1,5 @@ +enum E of string { + A, + B = "b", + C = "c", +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/string-member-inconsistently-initialized-majority-initialized/options.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/string-member-inconsistently-initialized-majority-initialized/options.json new file mode 100644 index 000000000000..71e396752a2e --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/string-member-inconsistently-initialized-majority-initialized/options.json @@ -0,0 +1,4 @@ +{ + "plugins": [["flow", { "enums": true }]], + "throws": "String enum members need to consistently either all use initializers, or use no initializers, in enum `E`. (2:2)" +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/symbol/input.js b/packages/babel-parser/test/fixtures/flow/enum-declaration/symbol/input.js new file mode 100644 index 000000000000..26e5377f5e71 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/symbol/input.js @@ -0,0 +1,4 @@ +enum E of symbol { + A, + B, +} diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/symbol/output.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/symbol/output.json new file mode 100644 index 000000000000..6f5ba3e152c1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/symbol/output.json @@ -0,0 +1,148 @@ +{ + "type": "File", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "EnumDeclaration", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "E" + }, + "name": "E" + }, + "body": { + "type": "EnumSymbolBody", + "start": 21, + "end": 28, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 3, + "column": 4 + } + }, + "members": [ + { + "type": "EnumDefaultedMember", + "start": 21, + "end": 22, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 3 + } + }, + "id": { + "type": "Identifier", + "start": 21, + "end": 22, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 3 + }, + "identifierName": "A" + }, + "name": "A" + } + }, + { + "type": "EnumDefaultedMember", + "start": 26, + "end": 27, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 3 + } + }, + "id": { + "type": "Identifier", + "start": 26, + "end": 27, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 3 + }, + "identifierName": "B" + }, + "name": "B" + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/legacy-regression/10264/options.json b/packages/babel-plugin-proposal-decorators/test/fixtures/legacy-regression/10264/options.json index 51aa897d2c31..ee996d3cfc6f 100644 --- a/packages/babel-plugin-proposal-decorators/test/fixtures/legacy-regression/10264/options.json +++ b/packages/babel-plugin-proposal-decorators/test/fixtures/legacy-regression/10264/options.json @@ -1,6 +1,6 @@ { "plugins": [ "transform-typescript", - [ "proposal-decorators", { "legacy": true } ] + ["proposal-decorators", { "legacy": true }] ] } diff --git a/packages/babel-plugin-syntax-flow/src/index.js b/packages/babel-plugin-syntax-flow/src/index.js index 0062dbee50e6..72fb7dc60b95 100644 --- a/packages/babel-plugin-syntax-flow/src/index.js +++ b/packages/babel-plugin-syntax-flow/src/index.js @@ -5,12 +5,16 @@ export default declare((api, options) => { // When enabled and plugins includes flow, all files should be parsed as if // the @flow pragma was provided. - const { all } = options; + const { all, enums } = options; if (typeof all !== "boolean" && typeof all !== "undefined") { throw new Error(".all must be a boolean, or undefined"); } + if (typeof enums !== "boolean" && typeof enums !== "undefined") { + throw new Error(".enums must be a boolean, or undefined"); + } + return { name: "syntax-flow", @@ -25,7 +29,7 @@ export default declare((api, options) => { return; } - parserOpts.plugins.push(["flow", { all }]); + parserOpts.plugins.push(["flow", { all, enums }]); }, }; }); diff --git a/packages/babel-types/src/asserts/generated/index.js b/packages/babel-types/src/asserts/generated/index.js index 60a91b88178d..4fb0fd754a15 100644 --- a/packages/babel-types/src/asserts/generated/index.js +++ b/packages/babel-types/src/asserts/generated/index.js @@ -584,6 +584,39 @@ export function assertVoidTypeAnnotation( ): void { assert("VoidTypeAnnotation", node, opts); } +export function assertEnumDeclaration(node: Object, opts?: Object = {}): void { + assert("EnumDeclaration", node, opts); +} +export function assertEnumBooleanBody(node: Object, opts?: Object = {}): void { + assert("EnumBooleanBody", node, opts); +} +export function assertEnumNumberBody(node: Object, opts?: Object = {}): void { + assert("EnumNumberBody", node, opts); +} +export function assertEnumStringBody(node: Object, opts?: Object = {}): void { + assert("EnumStringBody", node, opts); +} +export function assertEnumSymbolBody(node: Object, opts?: Object = {}): void { + assert("EnumSymbolBody", node, opts); +} +export function assertEnumBooleanMember( + node: Object, + opts?: Object = {}, +): void { + assert("EnumBooleanMember", node, opts); +} +export function assertEnumNumberMember(node: Object, opts?: Object = {}): void { + assert("EnumNumberMember", node, opts); +} +export function assertEnumStringMember(node: Object, opts?: Object = {}): void { + assert("EnumStringMember", node, opts); +} +export function assertEnumDefaultedMember( + node: Object, + opts?: Object = {}, +): void { + assert("EnumDefaultedMember", node, opts); +} export function assertJSXAttribute(node: Object, opts?: Object = {}): void { assert("JSXAttribute", node, opts); } @@ -1139,6 +1172,12 @@ export function assertFlowDeclaration(node: Object, opts?: Object = {}): void { export function assertFlowPredicate(node: Object, opts?: Object = {}): void { assert("FlowPredicate", node, opts); } +export function assertEnumBody(node: Object, opts?: Object = {}): void { + assert("EnumBody", node, opts); +} +export function assertEnumMember(node: Object, opts?: Object = {}): void { + assert("EnumMember", node, opts); +} export function assertJSX(node: Object, opts?: Object = {}): void { assert("JSX", node, opts); } diff --git a/packages/babel-types/src/builders/generated/index.js b/packages/babel-types/src/builders/generated/index.js index 2cb9d5490c9d..fe7f320d028a 100644 --- a/packages/babel-types/src/builders/generated/index.js +++ b/packages/babel-types/src/builders/generated/index.js @@ -517,6 +517,42 @@ export function VoidTypeAnnotation(...args: Array): Object { return builder("VoidTypeAnnotation", ...args); } export { VoidTypeAnnotation as voidTypeAnnotation }; +export function EnumDeclaration(...args: Array): Object { + return builder("EnumDeclaration", ...args); +} +export { EnumDeclaration as enumDeclaration }; +export function EnumBooleanBody(...args: Array): Object { + return builder("EnumBooleanBody", ...args); +} +export { EnumBooleanBody as enumBooleanBody }; +export function EnumNumberBody(...args: Array): Object { + return builder("EnumNumberBody", ...args); +} +export { EnumNumberBody as enumNumberBody }; +export function EnumStringBody(...args: Array): Object { + return builder("EnumStringBody", ...args); +} +export { EnumStringBody as enumStringBody }; +export function EnumSymbolBody(...args: Array): Object { + return builder("EnumSymbolBody", ...args); +} +export { EnumSymbolBody as enumSymbolBody }; +export function EnumBooleanMember(...args: Array): Object { + return builder("EnumBooleanMember", ...args); +} +export { EnumBooleanMember as enumBooleanMember }; +export function EnumNumberMember(...args: Array): Object { + return builder("EnumNumberMember", ...args); +} +export { EnumNumberMember as enumNumberMember }; +export function EnumStringMember(...args: Array): Object { + return builder("EnumStringMember", ...args); +} +export { EnumStringMember as enumStringMember }; +export function EnumDefaultedMember(...args: Array): Object { + return builder("EnumDefaultedMember", ...args); +} +export { EnumDefaultedMember as enumDefaultedMember }; export function JSXAttribute(...args: Array): Object { return builder("JSXAttribute", ...args); } diff --git a/packages/babel-types/src/constants/generated/index.js b/packages/babel-types/src/constants/generated/index.js index eedb7038ed28..1f4b576a87b6 100644 --- a/packages/babel-types/src/constants/generated/index.js +++ b/packages/babel-types/src/constants/generated/index.js @@ -45,6 +45,8 @@ export const FLOWBASEANNOTATION_TYPES = FLIPPED_ALIAS_KEYS["FlowBaseAnnotation"]; export const FLOWDECLARATION_TYPES = FLIPPED_ALIAS_KEYS["FlowDeclaration"]; export const FLOWPREDICATE_TYPES = FLIPPED_ALIAS_KEYS["FlowPredicate"]; +export const ENUMBODY_TYPES = FLIPPED_ALIAS_KEYS["EnumBody"]; +export const ENUMMEMBER_TYPES = FLIPPED_ALIAS_KEYS["EnumMember"]; export const JSX_TYPES = FLIPPED_ALIAS_KEYS["JSX"]; export const PRIVATE_TYPES = FLIPPED_ALIAS_KEYS["Private"]; export const TSTYPEELEMENT_TYPES = FLIPPED_ALIAS_KEYS["TSTypeElement"]; diff --git a/packages/babel-types/src/definitions/flow.js b/packages/babel-types/src/definitions/flow.js index 75f6c8801966..68560582605f 100644 --- a/packages/babel-types/src/definitions/flow.js +++ b/packages/babel-types/src/definitions/flow.js @@ -4,6 +4,7 @@ import defineType, { assertOneOf, assertValueType, validate, + validateArrayOfType, validateOptional, validateOptionalType, validateType, @@ -464,3 +465,88 @@ defineType("Variance", { defineType("VoidTypeAnnotation", { aliases: ["Flow", "FlowType", "FlowBaseAnnotation"], }); + +// Enums +defineType("EnumDeclaration", { + alises: ["Declaration"], + visitor: ["id", "body"], + fields: { + id: validateType("Identifier"), + body: validateType([ + "EnumBooleanBody", + "EnumNumberBody", + "EnumStringBody", + "EnumSymbolBody", + ]), + }, +}); + +defineType("EnumBooleanBody", { + aliases: ["EnumBody"], + visitor: ["members"], + fields: { + explicit: validate(assertValueType("boolean")), + members: validateArrayOfType("EnumBooleanMember"), + }, +}); + +defineType("EnumNumberBody", { + aliases: ["EnumBody"], + visitor: ["members"], + fields: { + explicit: validate(assertValueType("boolean")), + members: validateArrayOfType("EnumNumberMember"), + }, +}); + +defineType("EnumStringBody", { + aliases: ["EnumBody"], + visitor: ["members"], + fields: { + explicit: validate(assertValueType("boolean")), + members: validateArrayOfType(["EnumStringMember", "EnumDefaultedMember"]), + }, +}); + +defineType("EnumSymbolBody", { + aliases: ["EnumBody"], + visitor: ["members"], + fields: { + members: validateArrayOfType("EnumDefaultedMember"), + }, +}); + +defineType("EnumBooleanMember", { + aliases: ["EnumMember"], + visitor: ["id"], + fields: { + id: validateType("Identifier"), + init: validateType("BooleanLiteral"), + }, +}); + +defineType("EnumNumberMember", { + aliases: ["EnumMember"], + visitor: ["id", "init"], + fields: { + id: validateType("Identifier"), + init: validateType("NumericLiteral"), + }, +}); + +defineType("EnumStringMember", { + aliases: ["EnumMember"], + visitor: ["id", "init"], + fields: { + id: validateType("Identifier"), + init: validateType("StringLiteral"), + }, +}); + +defineType("EnumDefaultedMember", { + aliases: ["EnumMember"], + visitor: ["id"], + fields: { + id: validateType("Identifier"), + }, +}); diff --git a/packages/babel-types/src/validators/generated/index.js b/packages/babel-types/src/validators/generated/index.js index 84f44ef882cd..13ac0be73ac4 100644 --- a/packages/babel-types/src/validators/generated/index.js +++ b/packages/babel-types/src/validators/generated/index.js @@ -1866,6 +1866,132 @@ export function isVoidTypeAnnotation(node: ?Object, opts?: Object): boolean { return false; } +export function isEnumDeclaration(node: ?Object, opts?: Object): boolean { + if (!node) return false; + + const nodeType = node.type; + if (nodeType === "EnumDeclaration") { + if (typeof opts === "undefined") { + return true; + } else { + return shallowEqual(node, opts); + } + } + + return false; +} +export function isEnumBooleanBody(node: ?Object, opts?: Object): boolean { + if (!node) return false; + + const nodeType = node.type; + if (nodeType === "EnumBooleanBody") { + if (typeof opts === "undefined") { + return true; + } else { + return shallowEqual(node, opts); + } + } + + return false; +} +export function isEnumNumberBody(node: ?Object, opts?: Object): boolean { + if (!node) return false; + + const nodeType = node.type; + if (nodeType === "EnumNumberBody") { + if (typeof opts === "undefined") { + return true; + } else { + return shallowEqual(node, opts); + } + } + + return false; +} +export function isEnumStringBody(node: ?Object, opts?: Object): boolean { + if (!node) return false; + + const nodeType = node.type; + if (nodeType === "EnumStringBody") { + if (typeof opts === "undefined") { + return true; + } else { + return shallowEqual(node, opts); + } + } + + return false; +} +export function isEnumSymbolBody(node: ?Object, opts?: Object): boolean { + if (!node) return false; + + const nodeType = node.type; + if (nodeType === "EnumSymbolBody") { + if (typeof opts === "undefined") { + return true; + } else { + return shallowEqual(node, opts); + } + } + + return false; +} +export function isEnumBooleanMember(node: ?Object, opts?: Object): boolean { + if (!node) return false; + + const nodeType = node.type; + if (nodeType === "EnumBooleanMember") { + if (typeof opts === "undefined") { + return true; + } else { + return shallowEqual(node, opts); + } + } + + return false; +} +export function isEnumNumberMember(node: ?Object, opts?: Object): boolean { + if (!node) return false; + + const nodeType = node.type; + if (nodeType === "EnumNumberMember") { + if (typeof opts === "undefined") { + return true; + } else { + return shallowEqual(node, opts); + } + } + + return false; +} +export function isEnumStringMember(node: ?Object, opts?: Object): boolean { + if (!node) return false; + + const nodeType = node.type; + if (nodeType === "EnumStringMember") { + if (typeof opts === "undefined") { + return true; + } else { + return shallowEqual(node, opts); + } + } + + return false; +} +export function isEnumDefaultedMember(node: ?Object, opts?: Object): boolean { + if (!node) return false; + + const nodeType = node.type; + if (nodeType === "EnumDefaultedMember") { + if (typeof opts === "undefined") { + return true; + } else { + return shallowEqual(node, opts); + } + } + + return false; +} export function isJSXAttribute(node: ?Object, opts?: Object): boolean { if (!node) return false; @@ -4276,6 +4402,46 @@ export function isFlowPredicate(node: ?Object, opts?: Object): boolean { return false; } +export function isEnumBody(node: ?Object, opts?: Object): boolean { + if (!node) return false; + + const nodeType = node.type; + if ( + nodeType === "EnumBody" || + "EnumBooleanBody" === nodeType || + "EnumNumberBody" === nodeType || + "EnumStringBody" === nodeType || + "EnumSymbolBody" === nodeType + ) { + if (typeof opts === "undefined") { + return true; + } else { + return shallowEqual(node, opts); + } + } + + return false; +} +export function isEnumMember(node: ?Object, opts?: Object): boolean { + if (!node) return false; + + const nodeType = node.type; + if ( + nodeType === "EnumMember" || + "EnumBooleanMember" === nodeType || + "EnumNumberMember" === nodeType || + "EnumStringMember" === nodeType || + "EnumDefaultedMember" === nodeType + ) { + if (typeof opts === "undefined") { + return true; + } else { + return shallowEqual(node, opts); + } + } + + return false; +} export function isJSX(node: ?Object, opts?: Object): boolean { if (!node) return false; From 8ffca0475a82ac577907529ba225a96460b112fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hu=C3=A1ng=20J=C3=B9nli=C3=A0ng?= Date: Tue, 29 Oct 2019 17:58:04 -0400 Subject: [PATCH 023/648] Merge multiple regex transform plugin (#10447) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: implement create-regexp-features-plugin * fix: test input is not effective * refactor: leverage create-regexp-features-plugin * test: add more test cases * test: update test fixture * chore: add type annotation to features * test: add regression test for issue 9892 * add regression test for issue 9199 * address review comments from Nicolò * address review comments from Brian * small tweaks * Enable dotAllFlag when flags includes u --- .../.npmignore | 3 + .../README.md | 19 ++++ .../package.json | 31 ++++++ .../src/features.js | 27 ++++++ .../src/index.js | 96 +++++++++++++++++++ .../src/util.js | 56 +++++++++++ .../input.mjs | 1 + .../options.json | 6 ++ .../output.mjs | 1 + .../runtime-false-not-overwritten/input.mjs | 1 + .../options.json | 6 ++ .../runtime-false-not-overwritten/output.mjs | 1 + .../test/index.js | 3 + .../package.json | 5 +- .../src/index.js | 26 ++--- .../with-unicode-flag/unicode-12/input.js | 2 +- .../package.json | 8 +- .../src/index.js | 23 +---- .../with-unicode-property-escape/input.js | 2 + .../with-unicode-property-escape/options.json | 3 + .../with-unicode-property-escape/output.js | 2 + .../package.json | 2 +- .../src/index.js | 55 ++--------- .../test/fixtures/runtime/issue-10601/exec.js | 7 ++ .../fixtures/runtime/issue-10601/options.json | 3 + .../looks-like-a-group-unicode/input.js | 1 + .../looks-like-a-group-unicode/options.json | 7 ++ .../looks-like-a-group-unicode/output.js | 1 + .../wrapper/looks-like-a-group/output.js | 2 +- .../package.json | 5 +- .../src/index.js | 17 +--- .../plugins-integration/issue-8951/exec.js | 3 + .../issue-8951/options.json | 4 + .../plugins-integration/issue-9892/exec.js | 1 + .../issue-9892/options.json | 4 + .../unicode-property-regex-chrome-49/input.js | 1 + .../options.json | 10 ++ .../output.js | 1 + 38 files changed, 333 insertions(+), 113 deletions(-) create mode 100644 packages/babel-helper-create-regexp-features-plugin/.npmignore create mode 100644 packages/babel-helper-create-regexp-features-plugin/README.md create mode 100644 packages/babel-helper-create-regexp-features-plugin/package.json create mode 100644 packages/babel-helper-create-regexp-features-plugin/src/features.js create mode 100644 packages/babel-helper-create-regexp-features-plugin/src/index.js create mode 100644 packages/babel-helper-create-regexp-features-plugin/src/util.js create mode 100644 packages/babel-helper-create-regexp-features-plugin/test/fixtures/plugin-proposal-unicode-property-regex/use-unicode-flag-false-not-overwritten/input.mjs create mode 100644 packages/babel-helper-create-regexp-features-plugin/test/fixtures/plugin-proposal-unicode-property-regex/use-unicode-flag-false-not-overwritten/options.json create mode 100644 packages/babel-helper-create-regexp-features-plugin/test/fixtures/plugin-proposal-unicode-property-regex/use-unicode-flag-false-not-overwritten/output.mjs create mode 100644 packages/babel-helper-create-regexp-features-plugin/test/fixtures/plugin-transform-named-capturing-groups-regex/runtime-false-not-overwritten/input.mjs create mode 100644 packages/babel-helper-create-regexp-features-plugin/test/fixtures/plugin-transform-named-capturing-groups-regex/runtime-false-not-overwritten/options.json create mode 100644 packages/babel-helper-create-regexp-features-plugin/test/fixtures/plugin-transform-named-capturing-groups-regex/runtime-false-not-overwritten/output.mjs create mode 100644 packages/babel-helper-create-regexp-features-plugin/test/index.js create mode 100644 packages/babel-plugin-transform-dotall-regex/test/fixtures/dotall-regex/with-unicode-property-escape/input.js create mode 100644 packages/babel-plugin-transform-dotall-regex/test/fixtures/dotall-regex/with-unicode-property-escape/options.json create mode 100644 packages/babel-plugin-transform-dotall-regex/test/fixtures/dotall-regex/with-unicode-property-escape/output.js create mode 100644 packages/babel-plugin-transform-named-capturing-groups-regex/test/fixtures/runtime/issue-10601/exec.js create mode 100644 packages/babel-plugin-transform-named-capturing-groups-regex/test/fixtures/runtime/issue-10601/options.json create mode 100644 packages/babel-plugin-transform-named-capturing-groups-regex/test/fixtures/wrapper/looks-like-a-group-unicode/input.js create mode 100644 packages/babel-plugin-transform-named-capturing-groups-regex/test/fixtures/wrapper/looks-like-a-group-unicode/options.json create mode 100644 packages/babel-plugin-transform-named-capturing-groups-regex/test/fixtures/wrapper/looks-like-a-group-unicode/output.js create mode 100644 packages/babel-preset-env/test/fixtures/plugins-integration/issue-8951/exec.js create mode 100644 packages/babel-preset-env/test/fixtures/plugins-integration/issue-8951/options.json create mode 100644 packages/babel-preset-env/test/fixtures/plugins-integration/issue-9892/exec.js create mode 100644 packages/babel-preset-env/test/fixtures/plugins-integration/issue-9892/options.json create mode 100644 packages/babel-preset-env/test/fixtures/preset-options/unicode-property-regex-chrome-49/input.js create mode 100644 packages/babel-preset-env/test/fixtures/preset-options/unicode-property-regex-chrome-49/options.json create mode 100644 packages/babel-preset-env/test/fixtures/preset-options/unicode-property-regex-chrome-49/output.js diff --git a/packages/babel-helper-create-regexp-features-plugin/.npmignore b/packages/babel-helper-create-regexp-features-plugin/.npmignore new file mode 100644 index 000000000000..f9806945836e --- /dev/null +++ b/packages/babel-helper-create-regexp-features-plugin/.npmignore @@ -0,0 +1,3 @@ +src +test +*.log diff --git a/packages/babel-helper-create-regexp-features-plugin/README.md b/packages/babel-helper-create-regexp-features-plugin/README.md new file mode 100644 index 000000000000..69f661bd987e --- /dev/null +++ b/packages/babel-helper-create-regexp-features-plugin/README.md @@ -0,0 +1,19 @@ +# @babel/helper-create-regexp-features-plugin + +> Compile ESNext Regular Expressions to ES5 + +See our website [@babel/helper-create-regexp-features-plugin](https://babeljs.io/docs/en/next/babel-helper-create-regexp-features-plugin.html) for more information. + +## Install + +Using npm: + +```sh +npm install --save-dev @babel/helper-create-regexp-features-plugin +``` + +or using yarn: + +```sh +yarn add @babel/helper-create-regexp-features-plugin --dev +``` diff --git a/packages/babel-helper-create-regexp-features-plugin/package.json b/packages/babel-helper-create-regexp-features-plugin/package.json new file mode 100644 index 000000000000..7d49d45d507b --- /dev/null +++ b/packages/babel-helper-create-regexp-features-plugin/package.json @@ -0,0 +1,31 @@ +{ + "name": "@babel/helper-create-regexp-features-plugin", + "version": "7.6.0", + "author": "The Babel Team (https://babeljs.io/team)", + "license": "MIT", + "description": "Compile ESNext Regular Expressions to ES5", + "repository": { + "type": "git", + "repository": "https://github.com/babel/babel", + "directory": "packages/babel-helper-create-regexp-features-plugin" + }, + "main": "lib/index.js", + "publishConfig": { + "access": "public" + }, + "keywords": [ + "babel", + "babel-plugin" + ], + "dependencies": { + "@babel/helper-regex": "^7.4.4", + "regexpu-core": "^4.6.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + }, + "devDependencies": { + "@babel/core": "^7.6.0", + "@babel/helper-plugin-test-runner": "^7.0.0" + } +} diff --git a/packages/babel-helper-create-regexp-features-plugin/src/features.js b/packages/babel-helper-create-regexp-features-plugin/src/features.js new file mode 100644 index 000000000000..8e82b1342e88 --- /dev/null +++ b/packages/babel-helper-create-regexp-features-plugin/src/features.js @@ -0,0 +1,27 @@ +// @flow +export const FEATURES = Object.freeze({ + unicodeFlag: 1 << 0, + dotAllFlag: 1 << 1, + unicodePropertyEscape: 1 << 2, + namedCaptureGroups: 1 << 3, +}); + +// We can't use a symbol because this needs to always be the same, even if +// this package isn't deduped by npm. e.g. +// - node_modules/ +// - @babel/plugin-regexp-features +// - @babel/plugin-proposal-unicode-property-regex +// - node_modules +// - @babel-plugin-regexp-features +export const featuresKey = "@babel/plugin-regexp-features/featuresKey"; +export const runtimeKey = "@babel/plugin-regexp-features/runtimeKey"; + +type FeatureType = $Values; + +export function enableFeature(features: number, feature: FeatureType): number { + return features | feature; +} + +export function hasFeature(features: number, feature: FeatureType) { + return !!(features & feature); +} diff --git a/packages/babel-helper-create-regexp-features-plugin/src/index.js b/packages/babel-helper-create-regexp-features-plugin/src/index.js new file mode 100644 index 000000000000..49554be42ad2 --- /dev/null +++ b/packages/babel-helper-create-regexp-features-plugin/src/index.js @@ -0,0 +1,96 @@ +import rewritePattern from "regexpu-core"; +import { + featuresKey, + FEATURES, + enableFeature, + runtimeKey, + hasFeature, +} from "./features"; +import { generateRegexpuOptions } from "./util"; + +import pkg from "../package.json"; +import { types as t } from "@babel/core"; +import { pullFlag } from "@babel/helper-regex"; + +// Note: Versions are represented as an integer. e.g. 7.1.5 is represented +// as 70000100005. This method is easier than using a semver-parsing +// package, but it breaks if we release x.y.z where x, y or z are +// greater than 99_999. +const version = pkg.version.split(".").reduce((v, x) => v * 1e5 + +x, 0); +const versionKey = "@babel/plugin-regexp-features/version"; + +export function createRegExpFeaturePlugin({ name, feature, options = {} }) { + return { + name, + pre() { + const { file } = this; + const features = file.get(featuresKey) ?? 0; + let newFeatures = enableFeature(features, FEATURES[feature]); + + const { useUnicodeFlag, runtime = true } = options; + if (useUnicodeFlag === false) { + newFeatures = enableFeature(newFeatures, FEATURES.unicodeFlag); + } + if (newFeatures !== features) { + file.set(featuresKey, newFeatures); + } + + if (!runtime) { + file.set(runtimeKey, false); + } + + if (!file.has(versionKey) || file.get(versionKey) < version) { + file.set(versionKey, version); + } + }, + + visitor: { + RegExpLiteral(path) { + const { node } = path; + const { file } = this; + const features = file.get(featuresKey); + const runtime = file.get(runtimeKey) ?? true; + const regexpuOptions = generateRegexpuOptions(node, features); + if (regexpuOptions === null) { + return; + } + const namedCaptureGroups = {}; + if (regexpuOptions.namedGroup) { + regexpuOptions.onNamedGroup = (name, index) => { + namedCaptureGroups[name] = index; + }; + } + node.pattern = rewritePattern(node.pattern, node.flags, regexpuOptions); + + if ( + regexpuOptions.namedGroup && + Object.keys(namedCaptureGroups).length > 0 && + runtime && + !isRegExpTest(path) + ) { + path.replaceWith( + t.callExpression(this.addHelper("wrapRegExp"), [ + node, + t.valueToNode(namedCaptureGroups), + ]), + ); + } + if (hasFeature(features, FEATURES.unicodeFlag)) { + pullFlag(node, "u"); + } + if (hasFeature(features, FEATURES.dotAllFlag)) { + pullFlag(node, "s"); + } + }, + }, + }; +} + +function isRegExpTest(path) { + return ( + path.parentPath.isMemberExpression({ + object: path.node, + computed: false, + }) && path.parentPath.get("property").isIdentifier({ name: "test" }) + ); +} diff --git a/packages/babel-helper-create-regexp-features-plugin/src/util.js b/packages/babel-helper-create-regexp-features-plugin/src/util.js new file mode 100644 index 000000000000..bc6f89dcebce --- /dev/null +++ b/packages/babel-helper-create-regexp-features-plugin/src/util.js @@ -0,0 +1,56 @@ +import { FEATURES, hasFeature } from "./features"; + +export function generateRegexpuOptions(node, features) { + let useUnicodeFlag = false, + dotAllFlag = false, + unicodePropertyEscape = false, + namedGroup = false; + const { flags, pattern } = node; + const flagsIncludesU = flags.includes("u"); + + if (flagsIncludesU) { + if (!hasFeature(features, FEATURES.unicodeFlag)) { + useUnicodeFlag = true; + } + if ( + hasFeature(features, FEATURES.unicodePropertyEscape) && + /\\[pP]{/.test(pattern) + ) { + unicodePropertyEscape = true; + } + } + + if (hasFeature(features, FEATURES.dotAllFlag) && flags.indexOf("s") >= 0) { + dotAllFlag = true; + } + if ( + hasFeature(features, FEATURES.namedCaptureGroups) && + /\(\?<(?![=!])/.test(pattern) + ) { + namedGroup = true; + } + if ( + !namedGroup && + !unicodePropertyEscape && + !dotAllFlag && + (!flagsIncludesU || useUnicodeFlag) + ) { + return null; + } + // Now we have to feed regexpu-core the regex + if (flagsIncludesU && flags.indexOf("s") >= 0) { + // When flags includes u, `config.unicode` will be enabled even if `u` is supported natively. + // In this case we have to enable dotAllFlag, otherwise `rewritePattern(/./su)` will return + // incorrect result + // https://github.com/mathiasbynens/regexpu-core/blob/v4.6.0/rewrite-pattern.js#L191 + dotAllFlag = true; + } + return { + useUnicodeFlag, + onNamedGroup: () => {}, + namedGroup, + unicodePropertyEscape, + dotAllFlag, + lookbehind: true, + }; +} diff --git a/packages/babel-helper-create-regexp-features-plugin/test/fixtures/plugin-proposal-unicode-property-regex/use-unicode-flag-false-not-overwritten/input.mjs b/packages/babel-helper-create-regexp-features-plugin/test/fixtures/plugin-proposal-unicode-property-regex/use-unicode-flag-false-not-overwritten/input.mjs new file mode 100644 index 000000000000..f972b98245a9 --- /dev/null +++ b/packages/babel-helper-create-regexp-features-plugin/test/fixtures/plugin-proposal-unicode-property-regex/use-unicode-flag-false-not-overwritten/input.mjs @@ -0,0 +1 @@ +/\p{Script_Extensions=Wancho}/u diff --git a/packages/babel-helper-create-regexp-features-plugin/test/fixtures/plugin-proposal-unicode-property-regex/use-unicode-flag-false-not-overwritten/options.json b/packages/babel-helper-create-regexp-features-plugin/test/fixtures/plugin-proposal-unicode-property-regex/use-unicode-flag-false-not-overwritten/options.json new file mode 100644 index 000000000000..d1c7bd8740ad --- /dev/null +++ b/packages/babel-helper-create-regexp-features-plugin/test/fixtures/plugin-proposal-unicode-property-regex/use-unicode-flag-false-not-overwritten/options.json @@ -0,0 +1,6 @@ +{ + "plugins": [ + ["proposal-unicode-property-regex", { "useUnicodeFlag": false }, "name 1"], + ["proposal-unicode-property-regex", { "useUnicodeFlag": true }, "name 2"] + ] +} diff --git a/packages/babel-helper-create-regexp-features-plugin/test/fixtures/plugin-proposal-unicode-property-regex/use-unicode-flag-false-not-overwritten/output.mjs b/packages/babel-helper-create-regexp-features-plugin/test/fixtures/plugin-proposal-unicode-property-regex/use-unicode-flag-false-not-overwritten/output.mjs new file mode 100644 index 000000000000..f43a80b8405b --- /dev/null +++ b/packages/babel-helper-create-regexp-features-plugin/test/fixtures/plugin-proposal-unicode-property-regex/use-unicode-flag-false-not-overwritten/output.mjs @@ -0,0 +1 @@ +/(?:\uD838[\uDEC0-\uDEF9\uDEFF])/; diff --git a/packages/babel-helper-create-regexp-features-plugin/test/fixtures/plugin-transform-named-capturing-groups-regex/runtime-false-not-overwritten/input.mjs b/packages/babel-helper-create-regexp-features-plugin/test/fixtures/plugin-transform-named-capturing-groups-regex/runtime-false-not-overwritten/input.mjs new file mode 100644 index 000000000000..3d7f5b1517b5 --- /dev/null +++ b/packages/babel-helper-create-regexp-features-plugin/test/fixtures/plugin-transform-named-capturing-groups-regex/runtime-false-not-overwritten/input.mjs @@ -0,0 +1 @@ +/(?\d{4})/ diff --git a/packages/babel-helper-create-regexp-features-plugin/test/fixtures/plugin-transform-named-capturing-groups-regex/runtime-false-not-overwritten/options.json b/packages/babel-helper-create-regexp-features-plugin/test/fixtures/plugin-transform-named-capturing-groups-regex/runtime-false-not-overwritten/options.json new file mode 100644 index 000000000000..ca279789330b --- /dev/null +++ b/packages/babel-helper-create-regexp-features-plugin/test/fixtures/plugin-transform-named-capturing-groups-regex/runtime-false-not-overwritten/options.json @@ -0,0 +1,6 @@ +{ + "plugins": [ + ["transform-named-capturing-groups-regex", { "runtime": false }, "name 1"], + ["transform-named-capturing-groups-regex", { "runtime": true }, "name 2"] + ] +} diff --git a/packages/babel-helper-create-regexp-features-plugin/test/fixtures/plugin-transform-named-capturing-groups-regex/runtime-false-not-overwritten/output.mjs b/packages/babel-helper-create-regexp-features-plugin/test/fixtures/plugin-transform-named-capturing-groups-regex/runtime-false-not-overwritten/output.mjs new file mode 100644 index 000000000000..f47a50b38088 --- /dev/null +++ b/packages/babel-helper-create-regexp-features-plugin/test/fixtures/plugin-transform-named-capturing-groups-regex/runtime-false-not-overwritten/output.mjs @@ -0,0 +1 @@ +/([0-9]{4})/; diff --git a/packages/babel-helper-create-regexp-features-plugin/test/index.js b/packages/babel-helper-create-regexp-features-plugin/test/index.js new file mode 100644 index 000000000000..1b534b8fc64a --- /dev/null +++ b/packages/babel-helper-create-regexp-features-plugin/test/index.js @@ -0,0 +1,3 @@ +import runner from "@babel/helper-plugin-test-runner"; + +runner(__dirname); diff --git a/packages/babel-plugin-proposal-unicode-property-regex/package.json b/packages/babel-plugin-proposal-unicode-property-regex/package.json index 2fe4510857d1..cfb844aeb1bc 100644 --- a/packages/babel-plugin-proposal-unicode-property-regex/package.json +++ b/packages/babel-plugin-proposal-unicode-property-regex/package.json @@ -22,9 +22,8 @@ "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-proposal-unicode-property-regex", "bugs": "https://github.com/babel/babel/issues", "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0", - "@babel/helper-regex": "^7.4.4", - "regexpu-core": "^4.6.0" + "@babel/helper-create-regexp-features-plugin": "^7.6.0", + "@babel/helper-plugin-utils": "^7.0.0" }, "peerDependencies": { "@babel/core": "^7.0.0-0" diff --git a/packages/babel-plugin-proposal-unicode-property-regex/src/index.js b/packages/babel-plugin-proposal-unicode-property-regex/src/index.js index b0245892311f..bf76031cbf12 100644 --- a/packages/babel-plugin-proposal-unicode-property-regex/src/index.js +++ b/packages/babel-plugin-proposal-unicode-property-regex/src/index.js @@ -1,6 +1,6 @@ +/* eslint-disable @babel/development/plugin-name */ +import { createRegExpFeaturePlugin } from "@babel/helper-create-regexp-features-plugin"; import { declare } from "@babel/helper-plugin-utils"; -import rewritePattern from "regexpu-core"; -import * as regex from "@babel/helper-regex"; export default declare((api, options) => { api.assertVersion(7); @@ -10,23 +10,9 @@ export default declare((api, options) => { throw new Error(".useUnicodeFlag must be a boolean, or undefined"); } - return { + return createRegExpFeaturePlugin({ name: "proposal-unicode-property-regex", - - visitor: { - RegExpLiteral(path) { - const node = path.node; - if (!regex.is(node, "u")) { - return; - } - node.pattern = rewritePattern(node.pattern, node.flags, { - unicodePropertyEscape: true, - useUnicodeFlag, - }); - if (!useUnicodeFlag) { - regex.pullFlag(node, "u"); - } - }, - }, - }; + feature: "unicodePropertyEscape", + options: { useUnicodeFlag }, + }); }); diff --git a/packages/babel-plugin-proposal-unicode-property-regex/test/fixtures/with-unicode-flag/unicode-12/input.js b/packages/babel-plugin-proposal-unicode-property-regex/test/fixtures/with-unicode-flag/unicode-12/input.js index 711dde943b3c..e50ab9eb68e0 100644 --- a/packages/babel-plugin-proposal-unicode-property-regex/test/fixtures/with-unicode-flag/unicode-12/input.js +++ b/packages/babel-plugin-proposal-unicode-property-regex/test/fixtures/with-unicode-flag/unicode-12/input.js @@ -1 +1 @@ -var regex = /[\u{1E2C0}-\u{1E2F9}\u{1E2FF}]/u; +var regex = /[\p{Script_Extensions=Wancho}]/u; diff --git a/packages/babel-plugin-transform-dotall-regex/package.json b/packages/babel-plugin-transform-dotall-regex/package.json index 106ce8056802..4ace562398ab 100644 --- a/packages/babel-plugin-transform-dotall-regex/package.json +++ b/packages/babel-plugin-transform-dotall-regex/package.json @@ -8,9 +8,6 @@ "access": "public" }, "main": "lib/index.js", - "engines": { - "node": ">=4" - }, "keywords": [ "babel-plugin", "regex", @@ -21,9 +18,8 @@ "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-dotall-regex", "bugs": "https://github.com/babel/babel/issues", "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0", - "@babel/helper-regex": "^7.4.4", - "regexpu-core": "^4.6.0" + "@babel/helper-create-regexp-features-plugin": "^7.6.0", + "@babel/helper-plugin-utils": "^7.0.0" }, "peerDependencies": { "@babel/core": "^7.0.0-0" diff --git a/packages/babel-plugin-transform-dotall-regex/src/index.js b/packages/babel-plugin-transform-dotall-regex/src/index.js index af11660ea05e..a41961076922 100644 --- a/packages/babel-plugin-transform-dotall-regex/src/index.js +++ b/packages/babel-plugin-transform-dotall-regex/src/index.js @@ -1,25 +1,12 @@ +/* eslint-disable @babel/development/plugin-name */ +import { createRegExpFeaturePlugin } from "@babel/helper-create-regexp-features-plugin"; import { declare } from "@babel/helper-plugin-utils"; -import rewritePattern from "regexpu-core"; -import * as regex from "@babel/helper-regex"; export default declare(api => { api.assertVersion(7); - return { + return createRegExpFeaturePlugin({ name: "transform-dotall-regex", - - visitor: { - RegExpLiteral(path) { - const node = path.node; - if (!regex.is(node, "s")) { - return; - } - node.pattern = rewritePattern(node.pattern, node.flags, { - dotAllFlag: true, - useUnicodeFlag: regex.is(node, "u"), - }); - regex.pullFlag(node, "s"); - }, - }, - }; + feature: "dotAllFlag", + }); }); diff --git a/packages/babel-plugin-transform-dotall-regex/test/fixtures/dotall-regex/with-unicode-property-escape/input.js b/packages/babel-plugin-transform-dotall-regex/test/fixtures/dotall-regex/with-unicode-property-escape/input.js new file mode 100644 index 000000000000..dc74dbc0d615 --- /dev/null +++ b/packages/babel-plugin-transform-dotall-regex/test/fixtures/dotall-regex/with-unicode-property-escape/input.js @@ -0,0 +1,2 @@ +var a = /\p{Unified_Ideograph}./u; +var b = /\p{Unified_Ideograph}./su; diff --git a/packages/babel-plugin-transform-dotall-regex/test/fixtures/dotall-regex/with-unicode-property-escape/options.json b/packages/babel-plugin-transform-dotall-regex/test/fixtures/dotall-regex/with-unicode-property-escape/options.json new file mode 100644 index 000000000000..2078653dce15 --- /dev/null +++ b/packages/babel-plugin-transform-dotall-regex/test/fixtures/dotall-regex/with-unicode-property-escape/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["transform-dotall-regex", "proposal-unicode-property-regex"] +} diff --git a/packages/babel-plugin-transform-dotall-regex/test/fixtures/dotall-regex/with-unicode-property-escape/output.js b/packages/babel-plugin-transform-dotall-regex/test/fixtures/dotall-regex/with-unicode-property-escape/output.js new file mode 100644 index 000000000000..a8ddf757d926 --- /dev/null +++ b/packages/babel-plugin-transform-dotall-regex/test/fixtures/dotall-regex/with-unicode-property-escape/output.js @@ -0,0 +1,2 @@ +var a = /[\u3400-\u4DB5\u4E00-\u9FEF\uFA0E\uFA0F\uFA11\uFA13\uFA14\uFA1F\uFA21\uFA23\uFA24\uFA27-\uFA29\u{20000}-\u{2A6D6}\u{2A700}-\u{2B734}\u{2B740}-\u{2B81D}\u{2B820}-\u{2CEA1}\u{2CEB0}-\u{2EBE0}][\0-\t\x0B\f\x0E-\u2027\u202A-\u{10FFFF}]/u; +var b = /[\u3400-\u4DB5\u4E00-\u9FEF\uFA0E\uFA0F\uFA11\uFA13\uFA14\uFA1F\uFA21\uFA23\uFA24\uFA27-\uFA29\u{20000}-\u{2A6D6}\u{2A700}-\u{2B734}\u{2B740}-\u{2B81D}\u{2B820}-\u{2CEA1}\u{2CEB0}-\u{2EBE0}][\0-\u{10FFFF}]/u; diff --git a/packages/babel-plugin-transform-named-capturing-groups-regex/package.json b/packages/babel-plugin-transform-named-capturing-groups-regex/package.json index 679aa4396f52..3d1b894fc89a 100644 --- a/packages/babel-plugin-transform-named-capturing-groups-regex/package.json +++ b/packages/babel-plugin-transform-named-capturing-groups-regex/package.json @@ -21,7 +21,7 @@ }, "bugs": "https://github.com/babel/babel/issues", "dependencies": { - "regexpu-core": "^4.6.0" + "@babel/helper-create-regexp-features-plugin": "^7.6.0" }, "peerDependencies": { "@babel/core": "^7.0.0" diff --git a/packages/babel-plugin-transform-named-capturing-groups-regex/src/index.js b/packages/babel-plugin-transform-named-capturing-groups-regex/src/index.js index 148da9e99a55..2cc0193310fd 100644 --- a/packages/babel-plugin-transform-named-capturing-groups-regex/src/index.js +++ b/packages/babel-plugin-transform-named-capturing-groups-regex/src/index.js @@ -1,56 +1,15 @@ -import rewritePattern from "regexpu-core"; +/* eslint-disable @babel/development/plugin-name */ +import { createRegExpFeaturePlugin } from "@babel/helper-create-regexp-features-plugin"; -export default function({ types: t }, options) { +export default function(core, options) { const { runtime = true } = options; if (typeof runtime !== "boolean") { throw new Error("The 'runtime' option must be boolean"); } - return { + return createRegExpFeaturePlugin({ name: "transform-named-capturing-groups-regex", - - visitor: { - RegExpLiteral(path) { - const node = path.node; - if (!/\(\?<(?![=!])/.test(node.pattern)) { - // Return early if there are no named groups. - // The .indexOf check may have false positives (e.g. /\(? 0) { - node.pattern = result; - - if (runtime && !isRegExpTest(path)) { - path.replaceWith( - t.callExpression(this.addHelper("wrapRegExp"), [ - node, - t.valueToNode(namedCapturingGroups), - ]), - ); - } - } - }, - }, - }; -} - -function isRegExpTest(path) { - return ( - path.parentPath.isMemberExpression({ - object: path.node, - computed: false, - }) && path.parentPath.get("property").isIdentifier({ name: "test" }) - ); + feature: "namedCaptureGroups", + options: { runtime }, + }); } diff --git a/packages/babel-plugin-transform-named-capturing-groups-regex/test/fixtures/runtime/issue-10601/exec.js b/packages/babel-plugin-transform-named-capturing-groups-regex/test/fixtures/runtime/issue-10601/exec.js new file mode 100644 index 000000000000..21136a48f1ac --- /dev/null +++ b/packages/babel-plugin-transform-named-capturing-groups-regex/test/fixtures/runtime/issue-10601/exec.js @@ -0,0 +1,7 @@ +const regex = /<(?\d)+>.*?<\/\k>/su; + +const result = regex.exec('<0>xxx\nyyy'); + +expect(result.groups).toEqual({ + tag: "0" +}); diff --git a/packages/babel-plugin-transform-named-capturing-groups-regex/test/fixtures/runtime/issue-10601/options.json b/packages/babel-plugin-transform-named-capturing-groups-regex/test/fixtures/runtime/issue-10601/options.json new file mode 100644 index 000000000000..2454c2169cf8 --- /dev/null +++ b/packages/babel-plugin-transform-named-capturing-groups-regex/test/fixtures/runtime/issue-10601/options.json @@ -0,0 +1,3 @@ +{ + "minNodeVersion": "8.0.0" +} diff --git a/packages/babel-plugin-transform-named-capturing-groups-regex/test/fixtures/wrapper/looks-like-a-group-unicode/input.js b/packages/babel-plugin-transform-named-capturing-groups-regex/test/fixtures/wrapper/looks-like-a-group-unicode/input.js new file mode 100644 index 000000000000..00a7c78b9344 --- /dev/null +++ b/packages/babel-plugin-transform-named-capturing-groups-regex/test/fixtures/wrapper/looks-like-a-group-unicode/input.js @@ -0,0 +1 @@ +/no-groups-\(?looks\)\u{10000}/u; diff --git a/packages/babel-plugin-transform-named-capturing-groups-regex/test/fixtures/wrapper/looks-like-a-group-unicode/options.json b/packages/babel-plugin-transform-named-capturing-groups-regex/test/fixtures/wrapper/looks-like-a-group-unicode/options.json new file mode 100644 index 000000000000..1832df9cd6ad --- /dev/null +++ b/packages/babel-plugin-transform-named-capturing-groups-regex/test/fixtures/wrapper/looks-like-a-group-unicode/options.json @@ -0,0 +1,7 @@ +{ + "plugins": [ + ["external-helpers", { "helperVersion": "7.1000.0" }], + "transform-named-capturing-groups-regex", + "transform-unicode-regex" + ] +} diff --git a/packages/babel-plugin-transform-named-capturing-groups-regex/test/fixtures/wrapper/looks-like-a-group-unicode/output.js b/packages/babel-plugin-transform-named-capturing-groups-regex/test/fixtures/wrapper/looks-like-a-group-unicode/output.js new file mode 100644 index 000000000000..af299f8fceaf --- /dev/null +++ b/packages/babel-plugin-transform-named-capturing-groups-regex/test/fixtures/wrapper/looks-like-a-group-unicode/output.js @@ -0,0 +1 @@ +/no\x2Dgroups\x2D\(?looks\)(?:\uD800\uDC00)/; diff --git a/packages/babel-plugin-transform-named-capturing-groups-regex/test/fixtures/wrapper/looks-like-a-group/output.js b/packages/babel-plugin-transform-named-capturing-groups-regex/test/fixtures/wrapper/looks-like-a-group/output.js index 4c55ef0dbe17..6fe7c2ef533c 100644 --- a/packages/babel-plugin-transform-named-capturing-groups-regex/test/fixtures/wrapper/looks-like-a-group/output.js +++ b/packages/babel-plugin-transform-named-capturing-groups-regex/test/fixtures/wrapper/looks-like-a-group/output.js @@ -1 +1 @@ -/no-groups-\(?looks\)/; +/no\x2Dgroups\x2D\(?looks\)/; diff --git a/packages/babel-plugin-transform-unicode-regex/package.json b/packages/babel-plugin-transform-unicode-regex/package.json index a3a534041774..647fb228ce30 100644 --- a/packages/babel-plugin-transform-unicode-regex/package.json +++ b/packages/babel-plugin-transform-unicode-regex/package.json @@ -12,9 +12,8 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0", - "@babel/helper-regex": "^7.4.4", - "regexpu-core": "^4.6.0" + "@babel/helper-create-regexp-features-plugin": "^7.6.0", + "@babel/helper-plugin-utils": "^7.0.0" }, "peerDependencies": { "@babel/core": "^7.0.0-0" diff --git a/packages/babel-plugin-transform-unicode-regex/src/index.js b/packages/babel-plugin-transform-unicode-regex/src/index.js index 88593e055917..cfc4cd8a40f2 100644 --- a/packages/babel-plugin-transform-unicode-regex/src/index.js +++ b/packages/babel-plugin-transform-unicode-regex/src/index.js @@ -1,19 +1,12 @@ +/* eslint-disable @babel/development/plugin-name */ +import { createRegExpFeaturePlugin } from "@babel/helper-create-regexp-features-plugin"; import { declare } from "@babel/helper-plugin-utils"; -import rewritePattern from "regexpu-core"; -import * as regex from "@babel/helper-regex"; export default declare(api => { api.assertVersion(7); - return { + return createRegExpFeaturePlugin({ name: "transform-unicode-regex", - - visitor: { - RegExpLiteral({ node }) { - if (!regex.is(node, "u")) return; - node.pattern = rewritePattern(node.pattern, node.flags); - regex.pullFlag(node, "u"); - }, - }, - }; + feature: "unicodeFlag", + }); }); diff --git a/packages/babel-preset-env/test/fixtures/plugins-integration/issue-8951/exec.js b/packages/babel-preset-env/test/fixtures/plugins-integration/issue-8951/exec.js new file mode 100644 index 000000000000..0372fa5d04ee --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/plugins-integration/issue-8951/exec.js @@ -0,0 +1,3 @@ +expect(/.(?\p{ASCII})/su.exec("\nA").groups).toEqual({ + code: "A" +}); diff --git a/packages/babel-preset-env/test/fixtures/plugins-integration/issue-8951/options.json b/packages/babel-preset-env/test/fixtures/plugins-integration/issue-8951/options.json new file mode 100644 index 000000000000..26bf537b2805 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/plugins-integration/issue-8951/options.json @@ -0,0 +1,4 @@ +{ + "plugins": [], + "presets": ["../../../../lib"] +} diff --git a/packages/babel-preset-env/test/fixtures/plugins-integration/issue-9892/exec.js b/packages/babel-preset-env/test/fixtures/plugins-integration/issue-9892/exec.js new file mode 100644 index 000000000000..dad5dc1ba34f --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/plugins-integration/issue-9892/exec.js @@ -0,0 +1 @@ +expect(/[\p{L}\d_]+/u.test('ŁŻŹĆ')).toBe(true); diff --git a/packages/babel-preset-env/test/fixtures/plugins-integration/issue-9892/options.json b/packages/babel-preset-env/test/fixtures/plugins-integration/issue-9892/options.json new file mode 100644 index 000000000000..26bf537b2805 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/plugins-integration/issue-9892/options.json @@ -0,0 +1,4 @@ +{ + "plugins": [], + "presets": ["../../../../lib"] +} diff --git a/packages/babel-preset-env/test/fixtures/preset-options/unicode-property-regex-chrome-49/input.js b/packages/babel-preset-env/test/fixtures/preset-options/unicode-property-regex-chrome-49/input.js new file mode 100644 index 000000000000..4dc88814e7a9 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/preset-options/unicode-property-regex-chrome-49/input.js @@ -0,0 +1 @@ +/\p{Script_Extensions=Greek}/u; diff --git a/packages/babel-preset-env/test/fixtures/preset-options/unicode-property-regex-chrome-49/options.json b/packages/babel-preset-env/test/fixtures/preset-options/unicode-property-regex-chrome-49/options.json new file mode 100644 index 000000000000..0594e8b2ce13 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/preset-options/unicode-property-regex-chrome-49/options.json @@ -0,0 +1,10 @@ +{ + "presets": [ + [ + "../../../../lib", + { + "targets": "chrome 49" + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/preset-options/unicode-property-regex-chrome-49/output.js b/packages/babel-preset-env/test/fixtures/preset-options/unicode-property-regex-chrome-49/output.js new file mode 100644 index 000000000000..ca4cbfc0fb21 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/preset-options/unicode-property-regex-chrome-49/output.js @@ -0,0 +1 @@ +/(?:[\u0342\u0345\u0370-\u0373\u0375-\u0377\u037A-\u037D\u037F\u0384\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03E1\u03F0-\u03FF\u1D26-\u1D2A\u1D5D-\u1D61\u1D66-\u1D6A\u1DBF-\u1DC1\u1F00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FC4\u1FC6-\u1FD3\u1FD6-\u1FDB\u1FDD-\u1FEF\u1FF2-\u1FF4\u1FF6-\u1FFE\u2126\uAB65]|\uD800[\uDD40-\uDD8E\uDDA0]|\uD834[\uDE00-\uDE45])/; From 3d2f3650745d981127109871b8ffdbd34e28d87c Mon Sep 17 00:00:00 2001 From: Ivan Medina Date: Tue, 29 Oct 2019 16:02:53 -0600 Subject: [PATCH 024/648] [transform-react-jsx] Add useSpread option to transform JSX (#10572) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [transform-react-jsx] Add useSpread option to transform JSX * Add validation for default option * Add error when using useSpread and useBuiltIns at the same time * Move useSpread to convertAttribute helper function * Add useSpread option to presect-react * Remove casting useSpread to boolean in preset-react option. Co-Authored-By: Nicolò Ribaudo --- .../src/index.js | 24 +++++++++++++++++++ .../assignment-invalid-option/input.js | 1 + .../assignment-invalid-option/options.json | 4 ++++ .../useSpread/assignment-use-builtin/input.js | 1 + .../assignment-use-builtin/options.json | 6 +++++ .../fixtures/useSpread/assignment/input.js | 1 + .../fixtures/useSpread/assignment/output.js | 3 +++ .../test/fixtures/useSpread/options.json | 3 +++ packages/babel-preset-react/src/index.js | 3 ++- 9 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 packages/babel-plugin-transform-react-jsx/test/fixtures/useSpread/assignment-invalid-option/input.js create mode 100644 packages/babel-plugin-transform-react-jsx/test/fixtures/useSpread/assignment-invalid-option/options.json create mode 100644 packages/babel-plugin-transform-react-jsx/test/fixtures/useSpread/assignment-use-builtin/input.js create mode 100644 packages/babel-plugin-transform-react-jsx/test/fixtures/useSpread/assignment-use-builtin/options.json create mode 100644 packages/babel-plugin-transform-react-jsx/test/fixtures/useSpread/assignment/input.js create mode 100644 packages/babel-plugin-transform-react-jsx/test/fixtures/useSpread/assignment/output.js create mode 100644 packages/babel-plugin-transform-react-jsx/test/fixtures/useSpread/options.json diff --git a/packages/babel-helper-builder-react-jsx/src/index.js b/packages/babel-helper-builder-react-jsx/src/index.js index fa68384f1b70..64b136923f45 100644 --- a/packages/babel-helper-builder-react-jsx/src/index.js +++ b/packages/babel-helper-builder-react-jsx/src/index.js @@ -87,6 +87,10 @@ You can turn on the 'throwIfNamespace' flag to bypass this warning.`, function convertAttribute(node) { const value = convertAttributeValue(node.value || t.booleanLiteral(true)); + if (t.isJSXSpreadAttribute(node)) { + return t.spreadElement(node.argument); + } + if (t.isStringLiteral(value) && !t.isJSXExpressionContainer(node.value)) { value.value = value.value.replace(/\n\s+/g, " "); @@ -170,6 +174,14 @@ You can turn on the 'throwIfNamespace' flag to bypass this warning.`, let _props = []; const objs = []; + const { useSpread = false } = file.opts; + if (typeof useSpread !== "boolean") { + throw new Error( + "transform-react-jsx currently only accepts a boolean option for " + + "useSpread (defaults to false)", + ); + } + const useBuiltIns = file.opts.useBuiltIns || false; if (typeof useBuiltIns !== "boolean") { throw new Error( @@ -178,6 +190,18 @@ You can turn on the 'throwIfNamespace' flag to bypass this warning.`, ); } + if (useSpread && useBuiltIns) { + throw new Error( + "transform-react-jsx currently only accepts useBuiltIns or useSpread " + + "but not both", + ); + } + + if (useSpread) { + const props = attribs.map(convertAttribute); + return t.objectExpression(props); + } + while (attribs.length) { const prop = attribs.shift(); if (t.isJSXSpreadAttribute(prop)) { diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/useSpread/assignment-invalid-option/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/useSpread/assignment-invalid-option/input.js new file mode 100644 index 000000000000..4caacb6aa17d --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/useSpread/assignment-invalid-option/input.js @@ -0,0 +1 @@ +var div = diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/useSpread/assignment-invalid-option/options.json b/packages/babel-plugin-transform-react-jsx/test/fixtures/useSpread/assignment-invalid-option/options.json new file mode 100644 index 000000000000..ff6406c9a4e2 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/useSpread/assignment-invalid-option/options.json @@ -0,0 +1,4 @@ +{ + "plugins": [["transform-react-jsx", { "useSpread": 0 }]], + "throws": "transform-react-jsx currently only accepts a boolean option for useSpread (defaults to false)" +} diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/useSpread/assignment-use-builtin/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/useSpread/assignment-use-builtin/input.js new file mode 100644 index 000000000000..4caacb6aa17d --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/useSpread/assignment-use-builtin/input.js @@ -0,0 +1 @@ +var div = diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/useSpread/assignment-use-builtin/options.json b/packages/babel-plugin-transform-react-jsx/test/fixtures/useSpread/assignment-use-builtin/options.json new file mode 100644 index 000000000000..eab6051daa03 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/useSpread/assignment-use-builtin/options.json @@ -0,0 +1,6 @@ +{ + "plugins": [ + ["transform-react-jsx", { "useSpread": true, "useBuiltIns": true }] + ], + "throws": "transform-react-jsx currently only accepts useBuiltIns or useSpread but not both" +} diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/useSpread/assignment/input.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/useSpread/assignment/input.js new file mode 100644 index 000000000000..4caacb6aa17d --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/useSpread/assignment/input.js @@ -0,0 +1 @@ +var div = diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/useSpread/assignment/output.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/useSpread/assignment/output.js new file mode 100644 index 000000000000..6d3c49132173 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/useSpread/assignment/output.js @@ -0,0 +1,3 @@ +var div = React.createElement(Component, { ...props, + foo: "bar" +}); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/useSpread/options.json b/packages/babel-plugin-transform-react-jsx/test/fixtures/useSpread/options.json new file mode 100644 index 000000000000..7e0d5fcba0f3 --- /dev/null +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/useSpread/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["transform-react-jsx", { "useSpread": true }]] +} diff --git a/packages/babel-preset-react/src/index.js b/packages/babel-preset-react/src/index.js index f99fe36e0b1c..aaf358ea5979 100644 --- a/packages/babel-preset-react/src/index.js +++ b/packages/babel-preset-react/src/index.js @@ -13,6 +13,7 @@ export default declare((api, opts) => { opts.throwIfNamespace === undefined ? true : !!opts.throwIfNamespace; const development = !!opts.development; const useBuiltIns = !!opts.useBuiltIns; + const { useSpread } = opts; if (typeof development !== "boolean") { throw new Error( @@ -24,7 +25,7 @@ export default declare((api, opts) => { plugins: [ [ transformReactJSX, - { pragma, pragmaFrag, throwIfNamespace, useBuiltIns }, + { pragma, pragmaFrag, throwIfNamespace, useBuiltIns, useSpread }, ], transformReactDisplayName, From 4e6a4b08bba1c46cc4b01d168e300c1408c68076 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?= Date: Tue, 29 Oct 2019 23:27:56 +0100 Subject: [PATCH 025/648] Create @babel/plugin-syntax-top-level-await (#10573) --- .../.npmignore | 3 +++ .../README.md | 19 +++++++++++++++ .../package.json | 23 +++++++++++++++++++ .../src/index.js | 13 +++++++++++ packages/babel-preset-env/package.json | 1 + .../babel-preset-env/src/available-plugins.js | 1 + packages/babel-preset-env/src/index.js | 12 ++++++++++ .../top-level-await/supported/input.mjs | 1 + .../top-level-await/supported/options.json | 8 +++++++ .../top-level-await/supported/output.mjs | 1 + .../top-level-await/unsupported/input.mjs | 1 + .../top-level-await/unsupported/options.json | 9 ++++++++ 12 files changed, 92 insertions(+) create mode 100644 packages/babel-plugin-syntax-top-level-await/.npmignore create mode 100644 packages/babel-plugin-syntax-top-level-await/README.md create mode 100644 packages/babel-plugin-syntax-top-level-await/package.json create mode 100644 packages/babel-plugin-syntax-top-level-await/src/index.js create mode 100644 packages/babel-preset-env/test/fixtures/top-level-await/supported/input.mjs create mode 100644 packages/babel-preset-env/test/fixtures/top-level-await/supported/options.json create mode 100644 packages/babel-preset-env/test/fixtures/top-level-await/supported/output.mjs create mode 100644 packages/babel-preset-env/test/fixtures/top-level-await/unsupported/input.mjs create mode 100644 packages/babel-preset-env/test/fixtures/top-level-await/unsupported/options.json diff --git a/packages/babel-plugin-syntax-top-level-await/.npmignore b/packages/babel-plugin-syntax-top-level-await/.npmignore new file mode 100644 index 000000000000..cace0d6ddcdd --- /dev/null +++ b/packages/babel-plugin-syntax-top-level-await/.npmignore @@ -0,0 +1,3 @@ +node_modules +*.log +src diff --git a/packages/babel-plugin-syntax-top-level-await/README.md b/packages/babel-plugin-syntax-top-level-await/README.md new file mode 100644 index 000000000000..476cb27d6bbb --- /dev/null +++ b/packages/babel-plugin-syntax-top-level-await/README.md @@ -0,0 +1,19 @@ +# @babel/plugin-syntax-top-level-await + +> Allow parsing of top-level await in modules + +See our website [@babel/plugin-syntax-top-level-await](https://babeljs.io/docs/en/next/babel-plugin-syntax-top-level-await.html) for more information. + +## Install + +Using npm: + +```sh +npm install --save-dev @babel/plugin-syntax-top-level-await +``` + +or using yarn: + +```sh +yarn add @babel/plugin-syntax-top-level-await --dev +``` diff --git a/packages/babel-plugin-syntax-top-level-await/package.json b/packages/babel-plugin-syntax-top-level-await/package.json new file mode 100644 index 000000000000..8411ce39f938 --- /dev/null +++ b/packages/babel-plugin-syntax-top-level-await/package.json @@ -0,0 +1,23 @@ +{ + "name": "@babel/plugin-syntax-top-level-await", + "version": "7.6.4", + "description": "Allow parsing of top-level await in modules", + "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-syntax-top-level-await", + "license": "MIT", + "publishConfig": { + "access": "public" + }, + "main": "lib/index.js", + "keywords": [ + "babel-plugin" + ], + "dependencies": { + "@babel/helper-plugin-utils": "^7.0.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + }, + "devDependencies": { + "@babel/core": "^7.4.4" + } +} diff --git a/packages/babel-plugin-syntax-top-level-await/src/index.js b/packages/babel-plugin-syntax-top-level-await/src/index.js new file mode 100644 index 000000000000..2429b8ead657 --- /dev/null +++ b/packages/babel-plugin-syntax-top-level-await/src/index.js @@ -0,0 +1,13 @@ +import { declare } from "@babel/helper-plugin-utils"; + +export default declare(api => { + api.assertVersion(7); + + return { + name: "syntax-top-level-await", + + manipulateOptions(opts, parserOpts) { + parserOpts.plugins.push("topLevelAwait"); + }, + }; +}); diff --git a/packages/babel-preset-env/package.json b/packages/babel-preset-env/package.json index 740beedde749..5cfecce86f6b 100644 --- a/packages/babel-preset-env/package.json +++ b/packages/babel-preset-env/package.json @@ -27,6 +27,7 @@ "@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-syntax-top-level-await": "^7.6.4", "@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", diff --git a/packages/babel-preset-env/src/available-plugins.js b/packages/babel-preset-env/src/available-plugins.js index 77da4ff02cf0..8ce0c72f1aa0 100644 --- a/packages/babel-preset-env/src/available-plugins.js +++ b/packages/babel-preset-env/src/available-plugins.js @@ -6,6 +6,7 @@ export default { "syntax-json-strings": require("@babel/plugin-syntax-json-strings"), "syntax-object-rest-spread": require("@babel/plugin-syntax-object-rest-spread"), "syntax-optional-catch-binding": require("@babel/plugin-syntax-optional-catch-binding"), + "syntax-top-level-await": require("@babel/plugin-syntax-top-level-await"), "transform-async-to-generator": require("@babel/plugin-transform-async-to-generator"), "proposal-async-generator-functions": require("@babel/plugin-proposal-async-generator-functions"), "proposal-dynamic-import": require("@babel/plugin-proposal-dynamic-import"), diff --git a/packages/babel-preset-env/src/index.js b/packages/babel-preset-env/src/index.js index 76f11ebcb934..b1d335e5527a 100644 --- a/packages/babel-preset-env/src/index.js +++ b/packages/babel-preset-env/src/index.js @@ -65,11 +65,13 @@ export const getModulesPluginNames = ({ transformations, shouldTransformESM, shouldTransformDynamicImport, + shouldParseTopLevelAwait, }: { modules: ModuleOption, transformations: ModuleTransformationsType, shouldTransformESM: boolean, shouldTransformDynamicImport: boolean, + shouldParseTopLevelAwait: boolean, }) => { const modulesPluginNames = []; if (modules !== false && transformations[modules]) { @@ -95,6 +97,11 @@ export const getModulesPluginNames = ({ } else { modulesPluginNames.push("syntax-dynamic-import"); } + + if (shouldParseTopLevelAwait) { + modulesPluginNames.push("syntax-top-level-await"); + } + return modulesPluginNames; }; @@ -165,6 +172,10 @@ function supportsDynamicImport(caller) { return !!(caller && caller.supportsDynamicImport); } +function supportsTopLevelAwait(caller) { + return !!(caller && caller.supportsTopLevelAwait); +} + export default declare((api, opts) => { api.assertVersion(7); @@ -225,6 +236,7 @@ export default declare((api, opts) => { modules !== "auto" || !api.caller || !api.caller(supportsStaticESM), shouldTransformDynamicImport: modules !== "auto" || !api.caller || !api.caller(supportsDynamicImport), + shouldParseTopLevelAwait: api.caller(supportsTopLevelAwait), }); const pluginNames = filterItems( diff --git a/packages/babel-preset-env/test/fixtures/top-level-await/supported/input.mjs b/packages/babel-preset-env/test/fixtures/top-level-await/supported/input.mjs new file mode 100644 index 000000000000..d8ddd6c0ad0b --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/top-level-await/supported/input.mjs @@ -0,0 +1 @@ +await 0; \ No newline at end of file diff --git a/packages/babel-preset-env/test/fixtures/top-level-await/supported/options.json b/packages/babel-preset-env/test/fixtures/top-level-await/supported/options.json new file mode 100644 index 000000000000..9307569540d9 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/top-level-await/supported/options.json @@ -0,0 +1,8 @@ +{ + "caller": { + "name": "test-fixture", + "supportsStaticESM": true, + "supportsTopLevelAwait": true + }, + "presets": ["env"] +} diff --git a/packages/babel-preset-env/test/fixtures/top-level-await/supported/output.mjs b/packages/babel-preset-env/test/fixtures/top-level-await/supported/output.mjs new file mode 100644 index 000000000000..0a5e432fc91c --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/top-level-await/supported/output.mjs @@ -0,0 +1 @@ +await 0; diff --git a/packages/babel-preset-env/test/fixtures/top-level-await/unsupported/input.mjs b/packages/babel-preset-env/test/fixtures/top-level-await/unsupported/input.mjs new file mode 100644 index 000000000000..d8ddd6c0ad0b --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/top-level-await/unsupported/input.mjs @@ -0,0 +1 @@ +await 0; \ No newline at end of file diff --git a/packages/babel-preset-env/test/fixtures/top-level-await/unsupported/options.json b/packages/babel-preset-env/test/fixtures/top-level-await/unsupported/options.json new file mode 100644 index 000000000000..65ac70b9a5f7 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/top-level-await/unsupported/options.json @@ -0,0 +1,9 @@ +{ + "caller": { + "name": "test-fixture", + "supportsStaticESM": true, + "supportsTopLevelAwait": false + }, + "presets": ["env"], + "throws": "Can not use keyword 'await' outside an async function (1:0)" +} From e419e5fe42eba840738a78115a84584b24468f67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hu=C3=A1ng=20J=C3=B9nli=C3=A0ng?= Date: Tue, 29 Oct 2019 19:19:16 -0400 Subject: [PATCH 026/648] chore: bump source-map-support to 0.5.14 (#10614) --- packages/babel-register/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/babel-register/package.json b/packages/babel-register/package.json index 466ba1d54523..3c5f11fa6f77 100644 --- a/packages/babel-register/package.json +++ b/packages/babel-register/package.json @@ -17,7 +17,7 @@ "lodash": "^4.17.13", "make-dir": "^2.1.0", "pirates": "^4.0.0", - "source-map-support": "^0.5.9" + "source-map-support": "^0.5.14" }, "peerDependencies": { "@babel/core": "^7.0.0-0" From 0b0edc3e3d1f4bf07f19b7023f776e7e6ac45407 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Linus=20Unneb=C3=A4ck?= Date: Wed, 30 Oct 2019 12:56:52 +0100 Subject: [PATCH 027/648] chore: bump source-map-support to 0.5.16 (#10615) --- packages/babel-register/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/babel-register/package.json b/packages/babel-register/package.json index 3c5f11fa6f77..397c70c64f87 100644 --- a/packages/babel-register/package.json +++ b/packages/babel-register/package.json @@ -17,7 +17,7 @@ "lodash": "^4.17.13", "make-dir": "^2.1.0", "pirates": "^4.0.0", - "source-map-support": "^0.5.14" + "source-map-support": "^0.5.16" }, "peerDependencies": { "@babel/core": "^7.0.0-0" From a2b5437b012e47b63d3517bc784b5108f3fb9c9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hu=C3=A1ng=20J=C3=B9nli=C3=A0ng?= Date: Thu, 31 Oct 2019 14:51:36 -0400 Subject: [PATCH 028/648] chore: remove output-file-sync dependency (#10619) --- packages/babel-cli/package.json | 1 - packages/babel-cli/src/babel/dir.js | 6 +++++- packages/babel-cli/test/index.js | 7 ++++++- packages/babel-node/package.json | 2 +- packages/babel-node/test/index.js | 7 ++++++- 5 files changed, 18 insertions(+), 5 deletions(-) diff --git a/packages/babel-cli/package.json b/packages/babel-cli/package.json index 7e8de8bcb9c9..843c7c3c8787 100644 --- a/packages/babel-cli/package.json +++ b/packages/babel-cli/package.json @@ -25,7 +25,6 @@ "glob": "^7.0.0", "lodash": "^4.17.13", "make-dir": "^2.1.0", - "output-file-sync": "^2.0.0", "slash": "^2.0.0", "source-map": "^0.5.0" }, diff --git a/packages/babel-cli/src/babel/dir.js b/packages/babel-cli/src/babel/dir.js index 094f7806f90a..c6790d5acea7 100644 --- a/packages/babel-cli/src/babel/dir.js +++ b/packages/babel-cli/src/babel/dir.js @@ -1,7 +1,6 @@ // @flow import defaults from "lodash/defaults"; -import outputFileSync from "output-file-sync"; import { sync as makeDirSync } from "make-dir"; import slash from "slash"; import path from "path"; @@ -10,6 +9,11 @@ import fs from "fs"; import * as util from "./util"; import { type CmdOptions } from "./options"; +function outputFileSync(filePath: string, data: string | Buffer): void { + makeDirSync(path.dirname(filePath)); + fs.writeFileSync(filePath, data); +} + export default async function({ cliOptions, babelOptions, diff --git a/packages/babel-cli/test/index.js b/packages/babel-cli/test/index.js index 7aa457b00fb8..88d596740133 100644 --- a/packages/babel-cli/test/index.js +++ b/packages/babel-cli/test/index.js @@ -1,7 +1,7 @@ const readdir = require("fs-readdir-recursive"); const helper = require("@babel/helper-fixtures"); const rimraf = require("rimraf"); -const outputFileSync = require("output-file-sync"); +const { sync: makeDirSync } = require("make-dir"); const child = require("child_process"); const merge = require("lodash/merge"); const path = require("path"); @@ -14,6 +14,11 @@ const fileFilter = function(x) { return x !== ".DS_Store"; }; +const outputFileSync = function(filePath, data) { + makeDirSync(path.dirname(filePath)); + fs.writeFileSync(filePath, data); +}; + const presetLocs = [path.join(__dirname, "../../babel-preset-react")]; const pluginLocs = [ diff --git a/packages/babel-node/package.json b/packages/babel-node/package.json index f2b77567c4fb..737f8eadf884 100644 --- a/packages/babel-node/package.json +++ b/packages/babel-node/package.json @@ -34,7 +34,7 @@ "@babel/core": "^7.6.3", "@babel/helper-fixtures": "^7.6.3", "fs-readdir-recursive": "^1.0.0", - "output-file-sync": "^2.0.0" + "make-dir": "^2.1.0" }, "bin": { "babel-node": "./bin/babel-node.js" diff --git a/packages/babel-node/test/index.js b/packages/babel-node/test/index.js index 45283de76957..97ee54c02450 100644 --- a/packages/babel-node/test/index.js +++ b/packages/babel-node/test/index.js @@ -2,7 +2,7 @@ const includes = require("lodash/includes"); const readdir = require("fs-readdir-recursive"); const helper = require("@babel/helper-fixtures"); const rimraf = require("rimraf"); -const outputFileSync = require("output-file-sync"); +const { sync: makeDirSync } = require("make-dir"); const child = require("child_process"); const merge = require("lodash/merge"); const path = require("path"); @@ -15,6 +15,11 @@ const fileFilter = function(x) { return x !== ".DS_Store"; }; +const outputFileSync = function(filePath, data) { + makeDirSync(path.dirname(filePath)); + fs.writeFileSync(filePath, data); +}; + const presetLocs = [ path.join(__dirname, "../../babel-preset-env"), path.join(__dirname, "../../babel-preset-react"), From d08702c9d2b2880e2a9adc922a491e046bdda831 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hu=C3=A1ng=20J=C3=B9nli=C3=A0ng?= Date: Thu, 31 Oct 2019 16:12:44 -0400 Subject: [PATCH 029/648] inputSourceMap should work when it is in an external file (#10623) * fix: construct comment block for fromMapFileComment * add test * small tweak: redundant capturing group --- packages/babel-core/src/transformation/normalize-file.js | 5 +++-- .../source-maps/input-source-map-external/input.js | 5 +++++ .../source-maps/input-source-map-external/input.js.map | 1 + .../source-maps/input-source-map-external/options.json | 3 +++ .../source-maps/input-source-map-external/output.js | 3 +++ .../source-maps/input-source-map-external/source-map.json | 7 +++++++ 6 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 packages/babel-core/test/fixtures/transformation/source-maps/input-source-map-external/input.js create mode 100644 packages/babel-core/test/fixtures/transformation/source-maps/input-source-map-external/input.js.map create mode 100644 packages/babel-core/test/fixtures/transformation/source-maps/input-source-map-external/options.json create mode 100644 packages/babel-core/test/fixtures/transformation/source-maps/input-source-map-external/output.js create mode 100644 packages/babel-core/test/fixtures/transformation/source-maps/input-source-map-external/source-map.json diff --git a/packages/babel-core/src/transformation/normalize-file.js b/packages/babel-core/src/transformation/normalize-file.js index 6326dd385e66..cc7db60a5478 100644 --- a/packages/babel-core/src/transformation/normalize-file.js +++ b/packages/babel-core/src/transformation/normalize-file.js @@ -65,7 +65,8 @@ export default function normalizeFile( if (typeof options.filename === "string" && lastComment) { try { inputMap = convertSourceMap.fromMapFileComment( - lastComment, + // fromMapFileComment requires the whole comment block + `//${lastComment}`, path.dirname(options.filename), ); } catch (err) { @@ -156,7 +157,7 @@ function parser( // eslint-disable-next-line max-len const INLINE_SOURCEMAP_REGEX = /^[@#]\s+sourceMappingURL=data:(?:application|text)\/json;(?:charset[:=]\S+?;)?base64,(?:.*)$/; -const EXTERNAL_SOURCEMAP_REGEX = /^[@#][ \t]+sourceMappingURL=([^\s'"`]+?)[ \t]*$/; +const EXTERNAL_SOURCEMAP_REGEX = /^[@#][ \t]+sourceMappingURL=(?:[^\s'"`]+?)[ \t]*$/; function extractCommentsFromList(regex, comments, lastComment) { if (comments) { diff --git a/packages/babel-core/test/fixtures/transformation/source-maps/input-source-map-external/input.js b/packages/babel-core/test/fixtures/transformation/source-maps/input-source-map-external/input.js new file mode 100644 index 000000000000..f7250b67d0b4 --- /dev/null +++ b/packages/babel-core/test/fixtures/transformation/source-maps/input-source-map-external/input.js @@ -0,0 +1,5 @@ +var foo = function () { + return 4; +}; + +//# sourceMappingURL=input.js.map diff --git a/packages/babel-core/test/fixtures/transformation/source-maps/input-source-map-external/input.js.map b/packages/babel-core/test/fixtures/transformation/source-maps/input-source-map-external/input.js.map new file mode 100644 index 000000000000..cb88961ebdc0 --- /dev/null +++ b/packages/babel-core/test/fixtures/transformation/source-maps/input-source-map-external/input.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["original.js"],"names":[],"mappings":"AAAA,UAAU,Y;SAAM,C;CAAC","sourcesContent":["var foo = () => 4;"]} diff --git a/packages/babel-core/test/fixtures/transformation/source-maps/input-source-map-external/options.json b/packages/babel-core/test/fixtures/transformation/source-maps/input-source-map-external/options.json new file mode 100644 index 000000000000..0e6084f210d8 --- /dev/null +++ b/packages/babel-core/test/fixtures/transformation/source-maps/input-source-map-external/options.json @@ -0,0 +1,3 @@ +{ + "inputSourceMap": true +} diff --git a/packages/babel-core/test/fixtures/transformation/source-maps/input-source-map-external/output.js b/packages/babel-core/test/fixtures/transformation/source-maps/input-source-map-external/output.js new file mode 100644 index 000000000000..cf3efeceb306 --- /dev/null +++ b/packages/babel-core/test/fixtures/transformation/source-maps/input-source-map-external/output.js @@ -0,0 +1,3 @@ +var foo = function () { + return 4; +}; diff --git a/packages/babel-core/test/fixtures/transformation/source-maps/input-source-map-external/source-map.json b/packages/babel-core/test/fixtures/transformation/source-maps/input-source-map-external/source-map.json new file mode 100644 index 000000000000..63c01db5fede --- /dev/null +++ b/packages/babel-core/test/fixtures/transformation/source-maps/input-source-map-external/source-map.json @@ -0,0 +1,7 @@ +{ + "mappings": "AAAA,IAAA,GAAA,GAAU,Y;SAAM,C;AAAC,CAAjB", + "names": [], + "sources": ["original.js"], + "sourcesContent": ["var foo = () => 4;"], + "version": 3 +} From c7d8b8a37752f42163128cf4d5e8b54c2637cec4 Mon Sep 17 00:00:00 2001 From: Martin Forsgren Date: Sat, 2 Nov 2019 12:04:16 +0100 Subject: [PATCH 030/648] throw a TypeError if identifier validation fails (#10621) * throw a TypeError if Identifier validation fails * Relax identifier validation, reserved words are ok --- packages/babel-types/src/definitions/core.js | 6 +++--- packages/babel-types/src/index.js | 1 + packages/babel-types/src/validators/isIdentifierName.js | 9 +++++++++ 3 files changed, 13 insertions(+), 3 deletions(-) create mode 100644 packages/babel-types/src/validators/isIdentifierName.js diff --git a/packages/babel-types/src/definitions/core.js b/packages/babel-types/src/definitions/core.js index 09c41c9119a9..2b7802096cd9 100644 --- a/packages/babel-types/src/definitions/core.js +++ b/packages/babel-types/src/definitions/core.js @@ -1,5 +1,5 @@ // @flow -import isValidIdentifier from "../validators/isValidIdentifier"; +import isIdentifierName from "../validators/isIdentifierName"; import { BINARY_OPERATORS, @@ -406,8 +406,8 @@ defineType("Identifier", { ...patternLikeCommon, name: { validate: chain(function(node, key, val) { - if (!isValidIdentifier(val)) { - // throw new TypeError(`"${val}" is not a valid identifer name`); + if (!isIdentifierName(val)) { + throw new TypeError(`"${val}" is not a valid identifer name`); } }, assertValueType("string")), }, diff --git a/packages/babel-types/src/index.js b/packages/babel-types/src/index.js index d3311dfc9f2f..a34588c85c06 100644 --- a/packages/babel-types/src/index.js +++ b/packages/babel-types/src/index.js @@ -109,6 +109,7 @@ export { default as isValidES3Identifier, } from "./validators/isValidES3Identifier"; export { default as isValidIdentifier } from "./validators/isValidIdentifier"; +export { default as isIdentifierName } from "./validators/isIdentifierName"; export { default as isVar } from "./validators/isVar"; export { default as matchesPattern } from "./validators/matchesPattern"; export { default as validate } from "./validators/validate"; diff --git a/packages/babel-types/src/validators/isIdentifierName.js b/packages/babel-types/src/validators/isIdentifierName.js new file mode 100644 index 000000000000..9cae809217cf --- /dev/null +++ b/packages/babel-types/src/validators/isIdentifierName.js @@ -0,0 +1,9 @@ +// @flow +import esutils from "esutils"; + +/** + * Check if the input `name` is a valid identifier name. + */ +export default function isIdentifierName(name: string): boolean { + return esutils.keyword.isIdentifierNameES6(name); +} From 58a646be595115d5cf80d6a252d0f6c51c7022ac Mon Sep 17 00:00:00 2001 From: Mohammad Ahmadi Date: Mon, 4 Nov 2019 02:54:00 +0330 Subject: [PATCH 031/648] corrected the grammar of option descriptions (#10589) * corrected the grammar of option descriptions * added comment --- packages/babel-cli/src/babel/options.js | 57 +++++++++++++------------ 1 file changed, 29 insertions(+), 28 deletions(-) diff --git a/packages/babel-cli/src/babel/options.js b/packages/babel-cli/src/babel/options.js index 9425c510b451..04a648c1fd5a 100644 --- a/packages/babel-cli/src/babel/options.js +++ b/packages/babel-cli/src/babel/options.js @@ -12,19 +12,19 @@ import pkg from "../../package.json"; // Standard Babel input configs. commander.option( "-f, --filename [filename]", - "filename to use when reading from stdin - this will be used in source-maps, errors etc", + "The filename to use when reading from stdin. This will be used in source-maps, errors etc.", ); commander.option( "--presets [list]", - "comma-separated list of preset names", + "A comma-separated list of preset names.", collect, ); commander.option( "--plugins [list]", - "comma-separated list of plugin names", + "A comma-separated list of plugin names.", collect, ); -commander.option("--config-file [path]", "Path to a .babelrc file to use"); +commander.option("--config-file [path]", "Path to a .babelrc file to use."); commander.option( "--env-name [name]", "The name of the 'env' to use when loading configs and plugins. " + @@ -40,97 +40,98 @@ commander.option( commander.option("--source-type [script|module]", ""); commander.option( "--no-babelrc", - "Whether or not to look up .babelrc and .babelignore files", + "Whether or not to look up .babelrc and .babelignore files.", ); commander.option( "--ignore [list]", - "list of glob paths to **not** compile", + "List of glob paths to **not** compile.", collect, ); commander.option( "--only [list]", - "list of glob paths to **only** compile", + "List of glob paths to **only** compile.", collect, ); // Misc babel config. commander.option( "--no-highlight-code", - "enable/disable ANSI syntax highlighting of code frames (on by default)", + "Enable or disable ANSI syntax highlighting of code frames. (on by default)", ); // General output formatting. commander.option( "--no-comments", - "write comments to generated output (true by default)", + "Write comments to generated output. (true by default)", ); commander.option( "--retain-lines", - "retain line numbers - will result in really ugly code", + "Retain line numbers. This will result in really ugly code.", ); commander.option( "--compact [true|false|auto]", - "do not include superfluous whitespace characters and line terminators", + "Do not include superfluous whitespace characters and line terminators.", booleanify, ); commander.option("--minified", "save as much bytes when printing [true|false]"); commander.option( "--auxiliary-comment-before [string]", - "print a comment before any injected non-user code", + "Print a comment before any injected non-user code.", ); commander.option( "--auxiliary-comment-after [string]", - "print a comment after any injected non-user code", + "Print a comment after any injected non-user code.", ); // General source map formatting. commander.option("-s, --source-maps [true|false|inline|both]", "", booleanify); commander.option( "--source-map-target [string]", - "set `file` on returned source map", + "Set `file` on returned source map.", ); commander.option( "--source-file-name [string]", - "set `sources[0]` on returned source map", + "Set `sources[0]` on returned source map.", ); commander.option( "--source-root [filename]", - "the root from which all sources are relative", + "The root from which all sources are relative.", ); // Config params for certain module output formats. commander.option( "--module-root [filename]", - "optional prefix for the AMD module formatter that will be prepend to the filename on module definitions", + // eslint-disable-next-line max-len + "Optional prefix for the AMD module formatter that will be prepended to the filename on module definitions.", ); -commander.option("-M, --module-ids", "insert an explicit id for modules"); +commander.option("-M, --module-ids", "Insert an explicit id for modules."); commander.option( "--module-id [string]", - "specify a custom name for module ids", + "Specify a custom name for module ids.", ); // "babel" command specific arguments that are not passed to @babel/core. commander.option( "-x, --extensions [extensions]", - "List of extensions to compile when a directory has been input [.es6,.js,.es,.jsx,.mjs]", + "List of extensions to compile when a directory has been the input. [.es6,.js,.es,.jsx,.mjs]", collect, ); commander.option( "--keep-file-extension", - "Preserve the file extensions of the input files", + "Preserve the file extensions of the input files.", ); -commander.option("-w, --watch", "Recompile files on changes"); +commander.option("-w, --watch", "Recompile files on changes."); commander.option( "--skip-initial-build", - "Do not compile files before watching", + "Do not compile files before watching.", ); commander.option( "-o, --out-file [out]", - "Compile all input files into a single file", + "Compile all input files into a single file.", ); commander.option( "-d, --out-dir [out]", - "Compile an input directory of modules into an output directory", + "Compile an input directory of modules into an output directory.", ); commander.option( "--relative", @@ -138,11 +139,11 @@ commander.option( ); commander.option( "-D, --copy-files", - "When compiling a directory copy over non-compilable files", + "When compiling a directory copy over non-compilable files.", ); commander.option( "--include-dotfiles", - "Include dotfiles when compiling and copying non-compilable files", + "Include dotfiles when compiling and copying non-compilable files.", ); commander.option( "--verbose", @@ -154,7 +155,7 @@ commander.option( ); commander.option( "--delete-dir-on-start", - "Delete the out directory before compilation", + "Delete the out directory before compilation.", ); commander.version(pkg.version + " (@babel/core " + version + ")"); From bea1b0d0af7ebe09df2d98dfbaff561d57e7dfe9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?= Date: Mon, 4 Nov 2019 00:24:44 +0100 Subject: [PATCH 032/648] Add support for .cjs config files (#10599) * Remove duplicate config loading logic and errors * Add support for .cjs config files * Add tests * [tests] Fallback for fs.promises on node 6 --- .../src/config/files/configuration.js | 108 +++---- packages/babel-core/test/config-chain.js | 281 ++++++++++-------- .../.babelrc} | 2 +- .../.babelrc.cjs} | 0 .../.babelrc.js} | 0 .../babel.config.cjs} | 2 +- .../config-files-templates/babel.config.js | 3 + .../babel.config.json | 0 .../package.json | 0 .../babelrc-cjs-error/.babelrc.cjs | 3 + .../config/config-files/babelrc/.babelrc | 3 - .../config/config-files/both-babelrc/.babelrc | 1 - .../config-files/both-babelrc/.babelrc.js | 1 - .../config-files/pkg-babelrc-js/.babelrc.js | 1 - .../config-files/pkg-babelrc-js/package.json | 3 - .../config/config-files/pkg-babelrc/.babelrc | 1 - .../config-files/pkg-babelrc/package.json | 3 - 17 files changed, 198 insertions(+), 214 deletions(-) rename packages/babel-core/test/fixtures/config/{config-files/babel-config-json/babel.config.json => config-files-templates/.babelrc} (91%) rename packages/babel-core/test/fixtures/config/{config-files/babel-config-js-and-json/babel.config.js => config-files-templates/.babelrc.cjs} (100%) rename packages/babel-core/test/fixtures/config/{config-files/babel-config-js/babel.config.js => config-files-templates/.babelrc.js} (100%) rename packages/babel-core/test/fixtures/config/{config-files/babelrc-js/.babelrc.js => config-files-templates/babel.config.cjs} (55%) create mode 100644 packages/babel-core/test/fixtures/config/config-files-templates/babel.config.js rename packages/babel-core/test/fixtures/config/{config-files/babel-config-js-and-json => config-files-templates}/babel.config.json (100%) rename packages/babel-core/test/fixtures/config/{config-files/pkg => config-files-templates}/package.json (100%) create mode 100644 packages/babel-core/test/fixtures/config/config-files/babelrc-cjs-error/.babelrc.cjs delete mode 100644 packages/babel-core/test/fixtures/config/config-files/babelrc/.babelrc delete mode 100644 packages/babel-core/test/fixtures/config/config-files/both-babelrc/.babelrc delete mode 100644 packages/babel-core/test/fixtures/config/config-files/both-babelrc/.babelrc.js delete mode 100644 packages/babel-core/test/fixtures/config/config-files/pkg-babelrc-js/.babelrc.js delete mode 100644 packages/babel-core/test/fixtures/config/config-files/pkg-babelrc-js/package.json delete mode 100644 packages/babel-core/test/fixtures/config/config-files/pkg-babelrc/.babelrc delete mode 100644 packages/babel-core/test/fixtures/config/config-files/pkg-babelrc/package.json diff --git a/packages/babel-core/src/config/files/configuration.js b/packages/babel-core/src/config/files/configuration.js index adf26e6c687f..515171ceba94 100644 --- a/packages/babel-core/src/config/files/configuration.js +++ b/packages/babel-core/src/config/files/configuration.js @@ -18,26 +18,22 @@ import type { CallerMetadata } from "../validation/options"; const debug = buildDebug("babel:config:loading:files:configuration"); -const BABEL_CONFIG_JS_FILENAME = "babel.config.js"; -const BABEL_CONFIG_JSON_FILENAME = "babel.config.json"; const ROOT_CONFIG_FILENAMES = [ - BABEL_CONFIG_JS_FILENAME, - BABEL_CONFIG_JSON_FILENAME, + "babel.config.js", + "babel.config.cjs", + "babel.config.json", ]; +const RELATIVE_CONFIG_FILENAMES = [".babelrc", ".babelrc.js", ".babelrc.cjs"]; -const BABELRC_FILENAME = ".babelrc"; -const BABELRC_JS_FILENAME = ".babelrc.js"; const BABELIGNORE_FILENAME = ".babelignore"; export function findConfigUpwards(rootDir: string): string | null { let dirname = rootDir; while (true) { - if ( - fs.existsSync(path.join(dirname, BABEL_CONFIG_JS_FILENAME)) || - fs.existsSync(path.join(dirname, BABEL_CONFIG_JSON_FILENAME)) - ) { - return dirname; - } + const configFileFound = ROOT_CONFIG_FILENAMES.some(filename => + fs.existsSync(path.join(dirname, filename)), + ); + if (configFileFound) return dirname; const nextDir = path.dirname(dirname); if (dirname === nextDir) break; @@ -59,45 +55,15 @@ export function findRelativeConfig( for (const loc of packageData.directories) { if (!config) { - config = [BABELRC_FILENAME, BABELRC_JS_FILENAME].reduce( - (previousConfig: ConfigFile | null, name) => { - const filepath = path.join(loc, name); - const config = readConfig(filepath, envName, caller); - - if (config && previousConfig) { - throw new Error( - `Multiple configuration files found. Please remove one:\n` + - ` - ${path.basename(previousConfig.filepath)}\n` + - ` - ${name}\n` + - `from ${loc}`, - ); - } - - return config || previousConfig; - }, - null, - ); - - const pkgConfig = + config = loadOneConfig( + RELATIVE_CONFIG_FILENAMES, + loc, + envName, + caller, packageData.pkg && packageData.pkg.dirname === loc ? packageToBabelConfig(packageData.pkg) - : null; - - if (pkgConfig) { - if (config) { - throw new Error( - `Multiple configuration files found. Please remove one:\n` + - ` - ${path.basename(pkgConfig.filepath)}#babel\n` + - ` - ${path.basename(config.filepath)}\n` + - `from ${loc}`, - ); - } - config = pkgConfig; - } - - if (config) { - debug("Found configuration %o from %o.", config.filepath, dirname); - } + : null, + ); } if (!ignore) { @@ -118,24 +84,31 @@ export function findRootConfig( envName: string, caller: CallerMetadata | void, ): ConfigFile | null { - const config = ROOT_CONFIG_FILENAMES.reduce( - (previousConfig: ConfigFile | null, name) => { - const filepath = path.resolve(dirname, name); - const config = readConfig(filepath, envName, caller); - - if (config && previousConfig) { - throw new Error( - `Multiple configuration files found. Please remove one:\n` + - ` - ${path.basename(previousConfig.filepath)}\n` + - ` - ${name}\n` + - `from ${dirname}`, - ); - } + return loadOneConfig(ROOT_CONFIG_FILENAMES, dirname, envName, caller); +} + +function loadOneConfig( + names: string[], + dirname: string, + envName: string, + caller: CallerMetadata | void, + previousConfig?: ConfigFile | null = null, +): ConfigFile | null { + const config = names.reduce((previousConfig: ConfigFile | null, name) => { + const filepath = path.resolve(dirname, name); + const config = readConfig(filepath, envName, caller); + + if (config && previousConfig) { + throw new Error( + `Multiple configuration files found. Please remove one:\n` + + ` - ${path.basename(previousConfig.filepath)}\n` + + ` - ${name}\n` + + `from ${dirname}`, + ); + } - return config || previousConfig; - }, - null, - ); + return config || previousConfig; + }, previousConfig); if (config) { debug("Found configuration %o from %o.", config.filepath, dirname); @@ -165,7 +138,8 @@ export function loadConfig( * throw if there are parsing errors while loading a config. */ function readConfig(filepath, envName, caller): ConfigFile | null { - return path.extname(filepath) === ".js" + const ext = path.extname(filepath); + return ext === ".js" || ext === ".cjs" ? readConfigJS(filepath, { envName, caller }) : readConfigJSON5(filepath); } diff --git a/packages/babel-core/test/config-chain.js b/packages/babel-core/test/config-chain.js index c5f6e2ebf205..078cd91dce97 100644 --- a/packages/babel-core/test/config-chain.js +++ b/packages/babel-core/test/config-chain.js @@ -1,8 +1,44 @@ import fs from "fs"; +import os from "os"; import path from "path"; import escapeRegExp from "lodash/escapeRegExp"; import { loadOptions as loadOptionsOrig } from "../lib"; +// TODO: In Babel 8, we can directly uses fs.promises which is supported by +// node 8+ +const pfs = + fs.promises ?? + new Proxy(fs, { + get(target, name) { + if (name === "copyFile") { + // fs.copyFile is only supported since node 8.5 + // https://stackoverflow.com/a/30405105/2359289 + return function copyFile(source, target) { + const rd = fs.createReadStream(source); + const wr = fs.createWriteStream(target); + return new Promise(function(resolve, reject) { + rd.on("error", reject); + wr.on("error", reject); + wr.on("finish", resolve); + rd.pipe(wr); + }).catch(function(error) { + rd.destroy(); + wr.end(); + throw error; + }); + }; + } + + return (...args) => + new Promise((resolve, reject) => + target[name](...args, (error, result) => { + if (error) reject(error); + else resolve(result); + }), + ); + }, + }); + function fixture(...args) { return path.join(__dirname, "fixtures", "config", ...args); } @@ -14,6 +50,24 @@ function loadOptions(opts) { }); } +function pairs(items) { + const pairs = []; + for (let i = 0; i < items.length - 1; i++) { + for (let j = i + 1; j < items.length; j++) { + pairs.push([items[i], items[j]]); + } + } + return pairs; +} + +async function getTemp(name) { + const cwd = await pfs.mkdtemp(os.tmpdir() + path.sep + name); + const tmp = name => path.join(cwd, name); + const config = name => + pfs.copyFile(fixture("config-files-templates", name), tmp(name)); + return { cwd, tmp, config }; +} + describe("buildConfigChain", function() { describe("test", () => { describe("single", () => { @@ -944,157 +998,120 @@ describe("buildConfigChain", function() { } }); - it("should load babel.config.json", () => { - const filename = fixture("config-files", "babel-config-json", "src.js"); + describe("root", () => { + test.each(["babel.config.json", "babel.config.js", "babel.config.cjs"])( + "should load %s", + async name => { + const { cwd, tmp, config } = await getTemp( + `babel-test-load-config-${name}`, + ); + const filename = tmp("src.js"); + + await config(name); + + expect( + loadOptions({ + filename, + cwd, + }), + ).toEqual({ + ...getDefaults(), + filename, + cwd, + root: cwd, + comments: true, + }); + }, + ); - expect( - loadOptions({ - filename, - cwd: path.dirname(filename), - }), - ).toEqual({ - ...getDefaults(), - filename: filename, - cwd: path.dirname(filename), - root: path.dirname(filename), - comments: true, - }); - }); + test.each( + pairs(["babel.config.json", "babel.config.js", "babel.config.cjs"]), + )("should throw if both %s and %s are used", async (name1, name2) => { + const { cwd, tmp, config } = await getTemp( + `babel-test-dup-config-${name1}-${name2}`, + ); - it("should load babel.config.js", () => { - const filename = fixture("config-files", "babel-config-js", "src.js"); + await Promise.all([config(name1), config(name2)]); - expect( - loadOptions({ - filename, - cwd: path.dirname(filename), - }), - ).toEqual({ - ...getDefaults(), - filename: filename, - cwd: path.dirname(filename), - root: path.dirname(filename), - comments: true, + expect(() => loadOptions({ filename: tmp("src.js"), cwd })).toThrow( + /Multiple configuration files found/, + ); }); }); - it("should whtow if both babel.config.json and babel.config.js are used", () => { - const filename = fixture( - "config-files", - "babel-config-js-and-json", - "src.js", + describe("relative", () => { + test.each(["package.json", ".babelrc", ".babelrc.js", ".babelrc.cjs"])( + "should load %s", + async name => { + const { cwd, tmp, config } = await getTemp( + `babel-test-load-config-${name}`, + ); + const filename = tmp("src.js"); + + await config(name); + + expect( + loadOptions({ + filename, + cwd, + }), + ).toEqual({ + ...getDefaults(), + filename, + cwd, + root: cwd, + comments: true, + }); + }, ); - expect(() => - loadOptions({ filename, cwd: path.dirname(filename) }), - ).toThrow(/Multiple configuration files found/); - }); - - it("should load .babelrc", () => { - const filename = fixture("config-files", "babelrc", "src.js"); + it("should load .babelignore", () => { + const filename = fixture("config-files", "babelignore", "src.js"); - expect( - loadOptions({ - filename, - cwd: path.dirname(filename), - }), - ).toEqual({ - ...getDefaults(), - filename: filename, - cwd: path.dirname(filename), - root: path.dirname(filename), - comments: true, + expect( + loadOptions({ filename, cwd: path.dirname(filename) }), + ).toBeNull(); }); - }); - - it("should load .babelrc.js", () => { - const filename = fixture("config-files", "babelrc-js", "src.js"); - expect(loadOptions({ filename, cwd: path.dirname(filename) })).toEqual({ - ...getDefaults(), - filename: filename, - cwd: path.dirname(filename), - root: path.dirname(filename), - comments: true, - }); - }); + test.each( + pairs(["package.json", ".babelrc", ".babelrc.js", ".babelrc.cjs"]), + )("should throw if both %s and %s are used", async (name1, name2) => { + const { cwd, tmp, config } = await getTemp( + `babel-test-dup-config-${name1}-${name2}`, + ); - it("should load package.json#babel", () => { - const filename = fixture("config-files", "pkg", "src.js"); + await Promise.all([config(name1), config(name2)]); - expect(loadOptions({ filename, cwd: path.dirname(filename) })).toEqual({ - ...getDefaults(), - filename: filename, - cwd: path.dirname(filename), - root: path.dirname(filename), - comments: true, + expect(() => loadOptions({ filename: tmp("src.js"), cwd })).toThrow( + /Multiple configuration files found/, + ); }); - }); - - it("should load .babelignore", () => { - const filename = fixture("config-files", "babelignore", "src.js"); - - expect(loadOptions({ filename, cwd: path.dirname(filename) })).toBeNull(); - }); - - it("should throw if there are both .babelrc and .babelrc.js", () => { - const filename = fixture("config-files", "both-babelrc", "src.js"); - - expect(() => - loadOptions({ filename, cwd: path.dirname(filename) }), - ).toThrow(/Multiple configuration files found/); - }); - - it("should throw if there are both .babelrc and package.json", () => { - const filename = fixture("config-files", "pkg-babelrc", "src.js"); - - expect(() => - loadOptions({ filename, cwd: path.dirname(filename) }), - ).toThrow(/Multiple configuration files found/); - }); - it("should throw if there are both .babelrc.js and package.json", () => { - const filename = fixture("config-files", "pkg-babelrc-js", "src.js"); + it("should ignore package.json without a 'babel' property", () => { + const filename = fixture("config-files", "pkg-ignored", "src.js"); - expect(() => - loadOptions({ filename, cwd: path.dirname(filename) }), - ).toThrow(/Multiple configuration files found/); - }); - - it("should ignore package.json without a 'babel' property", () => { - const filename = fixture("config-files", "pkg-ignored", "src.js"); - - expect(loadOptions({ filename, cwd: path.dirname(filename) })).toEqual({ - ...getDefaults(), - filename: filename, - cwd: path.dirname(filename), - root: path.dirname(filename), - comments: true, + expect(loadOptions({ filename, cwd: path.dirname(filename) })).toEqual({ + ...getDefaults(), + filename: filename, + cwd: path.dirname(filename), + root: path.dirname(filename), + comments: true, + }); }); - }); - it("should show helpful errors for .babelrc", () => { - const filename = fixture("config-files", "babelrc-error", "src.js"); + test.each` + config | dir | error + ${".babelrc"} | ${"babelrc-error"} | ${/Error while parsing config - /} + ${".babelrc.js"} | ${"babelrc-js-error"} | ${/Babelrc threw an error/} + ${".babelrc.cjs"} | ${"babelrc-cjs-error"} | ${/Babelrc threw an error/} + ${"package.json"} | ${"pkg-error"} | ${/Error while parsing JSON - /} + `("should show helpful errors for $config", ({ dir, error }) => { + const filename = fixture("config-files", dir, "src.js"); - expect(() => - loadOptions({ filename, cwd: path.dirname(filename) }), - ).toThrow(/Error while parsing config - /); - }); - - it("should show helpful errors for .babelrc.js", () => { - const filename = fixture("config-files", "babelrc-js-error", "src.js"); - - expect(() => - loadOptions({ filename, cwd: path.dirname(filename) }), - ).toThrow(/Babelrc threw an error/); - }); - - it("should show helpful errors for package.json", () => { - const filename = fixture("config-files", "pkg-error", "src.js"); - - expect(() => - loadOptions({ filename, cwd: path.dirname(filename) }), - ).toThrow(/Error while parsing JSON - /); + expect(() => + loadOptions({ filename, cwd: path.dirname(filename) }), + ).toThrow(error); + }); }); it("should throw when `test` presents but `filename` is not passed", () => { diff --git a/packages/babel-core/test/fixtures/config/config-files/babel-config-json/babel.config.json b/packages/babel-core/test/fixtures/config/config-files-templates/.babelrc similarity index 91% rename from packages/babel-core/test/fixtures/config/config-files/babel-config-json/babel.config.json rename to packages/babel-core/test/fixtures/config/config-files-templates/.babelrc index 4b7be6033f68..b445e5d66381 100644 --- a/packages/babel-core/test/fixtures/config/config-files/babel-config-json/babel.config.json +++ b/packages/babel-core/test/fixtures/config/config-files-templates/.babelrc @@ -1,3 +1,3 @@ { "comments": true -} \ No newline at end of file +} diff --git a/packages/babel-core/test/fixtures/config/config-files/babel-config-js-and-json/babel.config.js b/packages/babel-core/test/fixtures/config/config-files-templates/.babelrc.cjs similarity index 100% rename from packages/babel-core/test/fixtures/config/config-files/babel-config-js-and-json/babel.config.js rename to packages/babel-core/test/fixtures/config/config-files-templates/.babelrc.cjs diff --git a/packages/babel-core/test/fixtures/config/config-files/babel-config-js/babel.config.js b/packages/babel-core/test/fixtures/config/config-files-templates/.babelrc.js similarity index 100% rename from packages/babel-core/test/fixtures/config/config-files/babel-config-js/babel.config.js rename to packages/babel-core/test/fixtures/config/config-files-templates/.babelrc.js diff --git a/packages/babel-core/test/fixtures/config/config-files/babelrc-js/.babelrc.js b/packages/babel-core/test/fixtures/config/config-files-templates/babel.config.cjs similarity index 55% rename from packages/babel-core/test/fixtures/config/config-files/babelrc-js/.babelrc.js rename to packages/babel-core/test/fixtures/config/config-files-templates/babel.config.cjs index 37622f0ad309..409f4a98ac90 100644 --- a/packages/babel-core/test/fixtures/config/config-files/babelrc-js/.babelrc.js +++ b/packages/babel-core/test/fixtures/config/config-files-templates/babel.config.cjs @@ -1,3 +1,3 @@ module.exports = { - comments: true, + comments: true }; diff --git a/packages/babel-core/test/fixtures/config/config-files-templates/babel.config.js b/packages/babel-core/test/fixtures/config/config-files-templates/babel.config.js new file mode 100644 index 000000000000..409f4a98ac90 --- /dev/null +++ b/packages/babel-core/test/fixtures/config/config-files-templates/babel.config.js @@ -0,0 +1,3 @@ +module.exports = { + comments: true +}; diff --git a/packages/babel-core/test/fixtures/config/config-files/babel-config-js-and-json/babel.config.json b/packages/babel-core/test/fixtures/config/config-files-templates/babel.config.json similarity index 100% rename from packages/babel-core/test/fixtures/config/config-files/babel-config-js-and-json/babel.config.json rename to packages/babel-core/test/fixtures/config/config-files-templates/babel.config.json diff --git a/packages/babel-core/test/fixtures/config/config-files/pkg/package.json b/packages/babel-core/test/fixtures/config/config-files-templates/package.json similarity index 100% rename from packages/babel-core/test/fixtures/config/config-files/pkg/package.json rename to packages/babel-core/test/fixtures/config/config-files-templates/package.json diff --git a/packages/babel-core/test/fixtures/config/config-files/babelrc-cjs-error/.babelrc.cjs b/packages/babel-core/test/fixtures/config/config-files/babelrc-cjs-error/.babelrc.cjs new file mode 100644 index 000000000000..accbe7c461f1 --- /dev/null +++ b/packages/babel-core/test/fixtures/config/config-files/babelrc-cjs-error/.babelrc.cjs @@ -0,0 +1,3 @@ +module.exports = function() { + throw new Error("Babelrc threw an error"); +}; diff --git a/packages/babel-core/test/fixtures/config/config-files/babelrc/.babelrc b/packages/babel-core/test/fixtures/config/config-files/babelrc/.babelrc deleted file mode 100644 index 2f6b10872c8d..000000000000 --- a/packages/babel-core/test/fixtures/config/config-files/babelrc/.babelrc +++ /dev/null @@ -1,3 +0,0 @@ -{ - comments: true, -} diff --git a/packages/babel-core/test/fixtures/config/config-files/both-babelrc/.babelrc b/packages/babel-core/test/fixtures/config/config-files/both-babelrc/.babelrc deleted file mode 100644 index 0967ef424bce..000000000000 --- a/packages/babel-core/test/fixtures/config/config-files/both-babelrc/.babelrc +++ /dev/null @@ -1 +0,0 @@ -{} diff --git a/packages/babel-core/test/fixtures/config/config-files/both-babelrc/.babelrc.js b/packages/babel-core/test/fixtures/config/config-files/both-babelrc/.babelrc.js deleted file mode 100644 index f053ebf7976e..000000000000 --- a/packages/babel-core/test/fixtures/config/config-files/both-babelrc/.babelrc.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = {}; diff --git a/packages/babel-core/test/fixtures/config/config-files/pkg-babelrc-js/.babelrc.js b/packages/babel-core/test/fixtures/config/config-files/pkg-babelrc-js/.babelrc.js deleted file mode 100644 index f053ebf7976e..000000000000 --- a/packages/babel-core/test/fixtures/config/config-files/pkg-babelrc-js/.babelrc.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = {}; diff --git a/packages/babel-core/test/fixtures/config/config-files/pkg-babelrc-js/package.json b/packages/babel-core/test/fixtures/config/config-files/pkg-babelrc-js/package.json deleted file mode 100644 index e25be3ecd260..000000000000 --- a/packages/babel-core/test/fixtures/config/config-files/pkg-babelrc-js/package.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "babel": {} -} diff --git a/packages/babel-core/test/fixtures/config/config-files/pkg-babelrc/.babelrc b/packages/babel-core/test/fixtures/config/config-files/pkg-babelrc/.babelrc deleted file mode 100644 index 0967ef424bce..000000000000 --- a/packages/babel-core/test/fixtures/config/config-files/pkg-babelrc/.babelrc +++ /dev/null @@ -1 +0,0 @@ -{} diff --git a/packages/babel-core/test/fixtures/config/config-files/pkg-babelrc/package.json b/packages/babel-core/test/fixtures/config/config-files/pkg-babelrc/package.json deleted file mode 100644 index e25be3ecd260..000000000000 --- a/packages/babel-core/test/fixtures/config/config-files/pkg-babelrc/package.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "babel": {} -} From 5c0d8a9de7c64fc309dbdf666c67f779b5dd439a Mon Sep 17 00:00:00 2001 From: Chris Garrett Date: Mon, 4 Nov 2019 10:05:42 -0800 Subject: [PATCH 033/648] add legacy decorators support to strict class fields (#10616) This PR allows legacy decorators to work with strict class fields, which are now stage 3 and have shipped in a number of browsers. Allowing this will allow users of the legacy transform (which is currently recommended by the champions of the decorator proposal) to use the proper class field semantics for non-decorated fields, which should help prevent breakage later on. This change is not a breaking change, since users had to explicitly opt into loose mode in class fields before. This just gives them the option to remove that opt-in. --- packages/babel-helpers/src/helpers.js | 4 +- .../local-define-property/input.js | 12 ++++++ .../local-define-property/options.json | 7 ++++ .../local-define-property/output.js | 40 +++++++++++++++++++ .../decorators-legacy-interop/loose/input.js | 9 +++++ .../loose/options.json | 7 ++++ .../decorators-legacy-interop/loose/output.js | 35 ++++++++++++++++ .../decorators-legacy-interop/strict/input.js | 9 +++++ .../strict/options.json | 7 ++++ .../strict/output.js | 37 +++++++++++++++++ .../decorator-interop/output.js | 2 +- .../src/transformer-legacy.js | 20 ++++++++++ .../output.mjs | 2 +- 13 files changed, 186 insertions(+), 5 deletions(-) create mode 100644 packages/babel-plugin-proposal-class-properties/test/fixtures/decorators-legacy-interop/local-define-property/input.js create mode 100644 packages/babel-plugin-proposal-class-properties/test/fixtures/decorators-legacy-interop/local-define-property/options.json create mode 100644 packages/babel-plugin-proposal-class-properties/test/fixtures/decorators-legacy-interop/local-define-property/output.js create mode 100644 packages/babel-plugin-proposal-class-properties/test/fixtures/decorators-legacy-interop/loose/input.js create mode 100644 packages/babel-plugin-proposal-class-properties/test/fixtures/decorators-legacy-interop/loose/options.json create mode 100644 packages/babel-plugin-proposal-class-properties/test/fixtures/decorators-legacy-interop/loose/output.js create mode 100644 packages/babel-plugin-proposal-class-properties/test/fixtures/decorators-legacy-interop/strict/input.js create mode 100644 packages/babel-plugin-proposal-class-properties/test/fixtures/decorators-legacy-interop/strict/options.json create mode 100644 packages/babel-plugin-proposal-class-properties/test/fixtures/decorators-legacy-interop/strict/output.js diff --git a/packages/babel-helpers/src/helpers.js b/packages/babel-helpers/src/helpers.js index 23416e002296..8fb04a895307 100644 --- a/packages/babel-helpers/src/helpers.js +++ b/packages/babel-helpers/src/helpers.js @@ -1040,9 +1040,7 @@ helpers.initializerWarningHelper = helper("7.0.0-beta.0")` export default function _initializerWarningHelper(descriptor, context){ throw new Error( 'Decorating class property failed. Please ensure that ' + - 'proposal-class-properties is enabled and set to use loose mode. ' + - 'To use proposal-class-properties in spec mode with decorators, wait for ' + - 'the next major version of decorators in stage 2.' + 'proposal-class-properties is enabled and runs after the decorators transform.' ); } `; diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/decorators-legacy-interop/local-define-property/input.js b/packages/babel-plugin-proposal-class-properties/test/fixtures/decorators-legacy-interop/local-define-property/input.js new file mode 100644 index 000000000000..f939e63b3b71 --- /dev/null +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/decorators-legacy-interop/local-define-property/input.js @@ -0,0 +1,12 @@ +function dec() {} + +// Create a local function binding so babel has to change the name of the helper +function _defineProperty() {} + +class A { + @dec a; + + @dec b = 123; + + c = 456; +} diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/decorators-legacy-interop/local-define-property/options.json b/packages/babel-plugin-proposal-class-properties/test/fixtures/decorators-legacy-interop/local-define-property/options.json new file mode 100644 index 000000000000..6f03cd7aad03 --- /dev/null +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/decorators-legacy-interop/local-define-property/options.json @@ -0,0 +1,7 @@ +{ + "plugins": [ + ["proposal-decorators", { "legacy": true }], + ["proposal-class-properties"], + "transform-classes" + ] +} diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/decorators-legacy-interop/local-define-property/output.js b/packages/babel-plugin-proposal-class-properties/test/fixtures/decorators-legacy-interop/local-define-property/output.js new file mode 100644 index 000000000000..641307b44d0d --- /dev/null +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/decorators-legacy-interop/local-define-property/output.js @@ -0,0 +1,40 @@ +var _class, _descriptor, _descriptor2, _temp; + +function _initializerDefineProperty(target, property, descriptor, context) { if (!descriptor) return; Object.defineProperty(target, property, { enumerable: descriptor.enumerable, configurable: descriptor.configurable, writable: descriptor.writable, value: descriptor.initializer ? descriptor.initializer.call(context) : void 0 }); } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _defineProperty2(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } + +function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) { var desc = {}; Object.keys(descriptor).forEach(function (key) { desc[key] = descriptor[key]; }); desc.enumerable = !!desc.enumerable; desc.configurable = !!desc.configurable; if ('value' in desc || desc.initializer) { desc.writable = true; } desc = decorators.slice().reverse().reduce(function (desc, decorator) { return decorator(target, property, desc) || desc; }, desc); if (context && desc.initializer !== void 0) { desc.value = desc.initializer ? desc.initializer.call(context) : void 0; desc.initializer = undefined; } if (desc.initializer === void 0) { Object.defineProperty(target, property, desc); desc = null; } return desc; } + +function _initializerWarningHelper(descriptor, context) { throw new Error('Decorating class property failed. Please ensure that ' + 'proposal-class-properties is enabled and runs after the decorators transform.'); } + +function dec() {} // Create a local function binding so babel has to change the name of the helper + + +function _defineProperty() {} + +let A = (_class = (_temp = function A() { + "use strict"; + + _classCallCheck(this, A); + + _initializerDefineProperty(this, "a", _descriptor, this); + + _initializerDefineProperty(this, "b", _descriptor2, this); + + _defineProperty2(this, "c", 456); +}, _temp), (_descriptor = _applyDecoratedDescriptor(_class.prototype, "a", [dec], { + configurable: true, + enumerable: true, + writable: true, + initializer: null +}), _descriptor2 = _applyDecoratedDescriptor(_class.prototype, "b", [dec], { + configurable: true, + enumerable: true, + writable: true, + initializer: function () { + return 123; + } +})), _class); diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/decorators-legacy-interop/loose/input.js b/packages/babel-plugin-proposal-class-properties/test/fixtures/decorators-legacy-interop/loose/input.js new file mode 100644 index 000000000000..92298f2eb49b --- /dev/null +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/decorators-legacy-interop/loose/input.js @@ -0,0 +1,9 @@ +function dec() {} + +class A { + @dec a; + + @dec b = 123; + + c = 456; +} diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/decorators-legacy-interop/loose/options.json b/packages/babel-plugin-proposal-class-properties/test/fixtures/decorators-legacy-interop/loose/options.json new file mode 100644 index 000000000000..8c831989533b --- /dev/null +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/decorators-legacy-interop/loose/options.json @@ -0,0 +1,7 @@ +{ + "plugins": [ + ["proposal-decorators", { "legacy": true }], + ["proposal-class-properties", { "loose": true }], + "transform-classes" + ] +} diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/decorators-legacy-interop/loose/output.js b/packages/babel-plugin-proposal-class-properties/test/fixtures/decorators-legacy-interop/loose/output.js new file mode 100644 index 000000000000..0a25e2b1023c --- /dev/null +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/decorators-legacy-interop/loose/output.js @@ -0,0 +1,35 @@ +var _class, _descriptor, _descriptor2, _temp; + +function _initializerDefineProperty(target, property, descriptor, context) { if (!descriptor) return; Object.defineProperty(target, property, { enumerable: descriptor.enumerable, configurable: descriptor.configurable, writable: descriptor.writable, value: descriptor.initializer ? descriptor.initializer.call(context) : void 0 }); } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) { var desc = {}; Object.keys(descriptor).forEach(function (key) { desc[key] = descriptor[key]; }); desc.enumerable = !!desc.enumerable; desc.configurable = !!desc.configurable; if ('value' in desc || desc.initializer) { desc.writable = true; } desc = decorators.slice().reverse().reduce(function (desc, decorator) { return decorator(target, property, desc) || desc; }, desc); if (context && desc.initializer !== void 0) { desc.value = desc.initializer ? desc.initializer.call(context) : void 0; desc.initializer = undefined; } if (desc.initializer === void 0) { Object.defineProperty(target, property, desc); desc = null; } return desc; } + +function _initializerWarningHelper(descriptor, context) { throw new Error('Decorating class property failed. Please ensure that ' + 'proposal-class-properties is enabled and runs after the decorators transform.'); } + +function dec() {} + +let A = (_class = (_temp = function A() { + "use strict"; + + _classCallCheck(this, A); + + _initializerDefineProperty(this, "a", _descriptor, this); + + _initializerDefineProperty(this, "b", _descriptor2, this); + + this.c = 456; +}, _temp), (_descriptor = _applyDecoratedDescriptor(_class.prototype, "a", [dec], { + configurable: true, + enumerable: true, + writable: true, + initializer: null +}), _descriptor2 = _applyDecoratedDescriptor(_class.prototype, "b", [dec], { + configurable: true, + enumerable: true, + writable: true, + initializer: function () { + return 123; + } +})), _class); diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/decorators-legacy-interop/strict/input.js b/packages/babel-plugin-proposal-class-properties/test/fixtures/decorators-legacy-interop/strict/input.js new file mode 100644 index 000000000000..92298f2eb49b --- /dev/null +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/decorators-legacy-interop/strict/input.js @@ -0,0 +1,9 @@ +function dec() {} + +class A { + @dec a; + + @dec b = 123; + + c = 456; +} diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/decorators-legacy-interop/strict/options.json b/packages/babel-plugin-proposal-class-properties/test/fixtures/decorators-legacy-interop/strict/options.json new file mode 100644 index 000000000000..6f03cd7aad03 --- /dev/null +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/decorators-legacy-interop/strict/options.json @@ -0,0 +1,7 @@ +{ + "plugins": [ + ["proposal-decorators", { "legacy": true }], + ["proposal-class-properties"], + "transform-classes" + ] +} diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/decorators-legacy-interop/strict/output.js b/packages/babel-plugin-proposal-class-properties/test/fixtures/decorators-legacy-interop/strict/output.js new file mode 100644 index 000000000000..11cce4ac923d --- /dev/null +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/decorators-legacy-interop/strict/output.js @@ -0,0 +1,37 @@ +var _class, _descriptor, _descriptor2, _temp; + +function _initializerDefineProperty(target, property, descriptor, context) { if (!descriptor) return; Object.defineProperty(target, property, { enumerable: descriptor.enumerable, configurable: descriptor.configurable, writable: descriptor.writable, value: descriptor.initializer ? descriptor.initializer.call(context) : void 0 }); } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } + +function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) { var desc = {}; Object.keys(descriptor).forEach(function (key) { desc[key] = descriptor[key]; }); desc.enumerable = !!desc.enumerable; desc.configurable = !!desc.configurable; if ('value' in desc || desc.initializer) { desc.writable = true; } desc = decorators.slice().reverse().reduce(function (desc, decorator) { return decorator(target, property, desc) || desc; }, desc); if (context && desc.initializer !== void 0) { desc.value = desc.initializer ? desc.initializer.call(context) : void 0; desc.initializer = undefined; } if (desc.initializer === void 0) { Object.defineProperty(target, property, desc); desc = null; } return desc; } + +function _initializerWarningHelper(descriptor, context) { throw new Error('Decorating class property failed. Please ensure that ' + 'proposal-class-properties is enabled and runs after the decorators transform.'); } + +function dec() {} + +let A = (_class = (_temp = function A() { + "use strict"; + + _classCallCheck(this, A); + + _initializerDefineProperty(this, "a", _descriptor, this); + + _initializerDefineProperty(this, "b", _descriptor2, this); + + _defineProperty(this, "c", 456); +}, _temp), (_descriptor = _applyDecoratedDescriptor(_class.prototype, "a", [dec], { + configurable: true, + enumerable: true, + writable: true, + initializer: null +}), _descriptor2 = _applyDecoratedDescriptor(_class.prototype, "b", [dec], { + configurable: true, + enumerable: true, + writable: true, + initializer: function () { + return 123; + } +})), _class); diff --git a/packages/babel-plugin-proposal-class-properties/test/fixtures/static-property-tdz/decorator-interop/output.js b/packages/babel-plugin-proposal-class-properties/test/fixtures/static-property-tdz/decorator-interop/output.js index 2cd978b722c9..9a71c175287f 100644 --- a/packages/babel-plugin-proposal-class-properties/test/fixtures/static-property-tdz/decorator-interop/output.js +++ b/packages/babel-plugin-proposal-class-properties/test/fixtures/static-property-tdz/decorator-interop/output.js @@ -12,7 +12,7 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) { var desc = {}; Object.keys(descriptor).forEach(function (key) { desc[key] = descriptor[key]; }); desc.enumerable = !!desc.enumerable; desc.configurable = !!desc.configurable; if ('value' in desc || desc.initializer) { desc.writable = true; } desc = decorators.slice().reverse().reduce(function (desc, decorator) { return decorator(target, property, desc) || desc; }, desc); if (context && desc.initializer !== void 0) { desc.value = desc.initializer ? desc.initializer.call(context) : void 0; desc.initializer = undefined; } if (desc.initializer === void 0) { Object.defineProperty(target, property, desc); desc = null; } return desc; } -function _initializerWarningHelper(descriptor, context) { throw new Error('Decorating class property failed. Please ensure that ' + 'proposal-class-properties is enabled and set to use loose mode. ' + 'To use proposal-class-properties in spec mode with decorators, wait for ' + 'the next major version of decorators in stage 2.'); } +function _initializerWarningHelper(descriptor, context) { throw new Error('Decorating class property failed. Please ensure that ' + 'proposal-class-properties is enabled and runs after the decorators transform.'); } function dec() {} diff --git a/packages/babel-plugin-proposal-decorators/src/transformer-legacy.js b/packages/babel-plugin-proposal-decorators/src/transformer-legacy.js index d6160db14c55..ca23bad24824 100644 --- a/packages/babel-plugin-proposal-decorators/src/transformer-legacy.js +++ b/packages/babel-plugin-proposal-decorators/src/transformer-legacy.js @@ -290,4 +290,24 @@ export default { ]), ); }, + + CallExpression(path, state) { + if (path.node.arguments.length !== 3) return; + if (!WARNING_CALLS.has(path.node.arguments[2])) return; + + // If the class properties plugin isn't enabled, this line will add an unused helper + // to the code. It's not ideal, but it's ok since the configuration is not valid anyway. + if (path.node.callee.name !== state.addHelper("defineProperty").name) { + return; + } + + path.replaceWith( + t.callExpression(state.addHelper("initializerDefineProperty"), [ + t.cloneNode(path.get("arguments")[0].node), + t.cloneNode(path.get("arguments")[1].node), + t.cloneNode(path.get("arguments.2.arguments")[0].node), + t.cloneNode(path.get("arguments.2.arguments")[1].node), + ]), + ); + }, }; diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/class/abstract-class-decorated-parameter/output.mjs b/packages/babel-plugin-transform-typescript/test/fixtures/class/abstract-class-decorated-parameter/output.mjs index e8982550efbf..58aa80d516ec 100644 --- a/packages/babel-plugin-transform-typescript/test/fixtures/class/abstract-class-decorated-parameter/output.mjs +++ b/packages/babel-plugin-transform-typescript/test/fixtures/class/abstract-class-decorated-parameter/output.mjs @@ -2,7 +2,7 @@ var _class, _descriptor; function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) { var desc = {}; Object.keys(descriptor).forEach(function (key) { desc[key] = descriptor[key]; }); desc.enumerable = !!desc.enumerable; desc.configurable = !!desc.configurable; if ('value' in desc || desc.initializer) { desc.writable = true; } desc = decorators.slice().reverse().reduce(function (desc, decorator) { return decorator(target, property, desc) || desc; }, desc); if (context && desc.initializer !== void 0) { desc.value = desc.initializer ? desc.initializer.call(context) : void 0; desc.initializer = undefined; } if (desc.initializer === void 0) { Object.defineProperty(target, property, desc); desc = null; } return desc; } -function _initializerWarningHelper(descriptor, context) { throw new Error('Decorating class property failed. Please ensure that ' + 'proposal-class-properties is enabled and set to use loose mode. ' + 'To use proposal-class-properties in spec mode with decorators, wait for ' + 'the next major version of decorators in stage 2.'); } +function _initializerWarningHelper(descriptor, context) { throw new Error('Decorating class property failed. Please ensure that ' + 'proposal-class-properties is enabled and runs after the decorators transform.'); } import { observable } from 'mobx'; let Foo = (_class = class Foo { From abce0ef49d4f3b204b9d570b763839101772a56a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?= Date: Mon, 4 Nov 2019 19:22:49 +0100 Subject: [PATCH 034/648] [TS] Correctly transform computed strings and templates in enums (#10555) * [TS] Correctly transform computed strings and templates in enums * Typo [skip ci] --- packages/babel-plugin-transform-typescript/src/enum.js | 10 +++++++--- .../test/fixtures/enum/string-value-template/input.ts | 3 +++ .../test/fixtures/enum/string-value-template/output.js | 5 +++++ .../enum/{string-values => string-value}/input.ts | 0 .../enum/{string-values => string-value}/output.js | 0 .../test/fixtures/enum/string-values-computed/input.ts | 1 - .../fixtures/enum/string-values-computed/output.js | 3 +-- 7 files changed, 16 insertions(+), 6 deletions(-) create mode 100644 packages/babel-plugin-transform-typescript/test/fixtures/enum/string-value-template/input.ts create mode 100644 packages/babel-plugin-transform-typescript/test/fixtures/enum/string-value-template/output.js rename packages/babel-plugin-transform-typescript/test/fixtures/enum/{string-values => string-value}/input.ts (100%) rename packages/babel-plugin-transform-typescript/test/fixtures/enum/{string-values => string-value}/output.js (100%) diff --git a/packages/babel-plugin-transform-typescript/src/enum.js b/packages/babel-plugin-transform-typescript/src/enum.js index 11c7b5376d83..3b604e2e8fab 100644 --- a/packages/babel-plugin-transform-typescript/src/enum.js +++ b/packages/babel-plugin-transform-typescript/src/enum.js @@ -144,13 +144,12 @@ function evaluate( expr, seen: PreviousEnumMembers, ): number | string | typeof undefined { - if (expr.type === "StringLiteral") { - return expr.value; - } return evalConstant(expr); function evalConstant(expr): number | typeof undefined { switch (expr.type) { + case "StringLiteral": + return expr.value; case "UnaryExpression": return evalUnaryExpression(expr); case "BinaryExpression": @@ -161,6 +160,11 @@ function evaluate( return evalConstant(expr.expression); case "Identifier": return seen[expr.name]; + case "TemplateLiteral": + if (expr.quasis.length === 1) { + return expr.quasis[0].value.cooked; + } + /* falls through */ default: return undefined; } diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/enum/string-value-template/input.ts b/packages/babel-plugin-transform-typescript/test/fixtures/enum/string-value-template/input.ts new file mode 100644 index 000000000000..01086419eaff --- /dev/null +++ b/packages/babel-plugin-transform-typescript/test/fixtures/enum/string-value-template/input.ts @@ -0,0 +1,3 @@ +enum E { + A = `Hey` +} diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/enum/string-value-template/output.js b/packages/babel-plugin-transform-typescript/test/fixtures/enum/string-value-template/output.js new file mode 100644 index 000000000000..dfc0f72fcd49 --- /dev/null +++ b/packages/babel-plugin-transform-typescript/test/fixtures/enum/string-value-template/output.js @@ -0,0 +1,5 @@ +var E; + +(function (E) { + E["A"] = "Hey"; +})(E || (E = {})); diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/enum/string-values/input.ts b/packages/babel-plugin-transform-typescript/test/fixtures/enum/string-value/input.ts similarity index 100% rename from packages/babel-plugin-transform-typescript/test/fixtures/enum/string-values/input.ts rename to packages/babel-plugin-transform-typescript/test/fixtures/enum/string-value/input.ts diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/enum/string-values/output.js b/packages/babel-plugin-transform-typescript/test/fixtures/enum/string-value/output.js similarity index 100% rename from packages/babel-plugin-transform-typescript/test/fixtures/enum/string-values/output.js rename to packages/babel-plugin-transform-typescript/test/fixtures/enum/string-value/output.js diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/enum/string-values-computed/input.ts b/packages/babel-plugin-transform-typescript/test/fixtures/enum/string-values-computed/input.ts index ac52806fb927..06e9b00f0682 100644 --- a/packages/babel-plugin-transform-typescript/test/fixtures/enum/string-values-computed/input.ts +++ b/packages/babel-plugin-transform-typescript/test/fixtures/enum/string-values-computed/input.ts @@ -1,4 +1,3 @@ -// Not type-correct code enum E { A = "HALLO" + "WERLD" } diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/enum/string-values-computed/output.js b/packages/babel-plugin-transform-typescript/test/fixtures/enum/string-values-computed/output.js index e449a1ca233d..a0f3ea2ca81f 100644 --- a/packages/babel-plugin-transform-typescript/test/fixtures/enum/string-values-computed/output.js +++ b/packages/babel-plugin-transform-typescript/test/fixtures/enum/string-values-computed/output.js @@ -1,6 +1,5 @@ -// Not type-correct code var E; (function (E) { - E[E["A"] = "HALLO" + "WERLD"] = "A"; + E["A"] = "HALLOWERLD"; })(E || (E = {})); From d023e105b729ab7f8634d32733c3029ca199346a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?= Date: Mon, 4 Nov 2019 19:25:15 +0100 Subject: [PATCH 035/648] [TS] Parse calls with type args in optional chains (#10631) * [TS] Parse calls with type args in optional chains * Test output --- .../babel-parser/src/parser/expression.js | 32 +-- packages/babel-parser/src/plugins/flow.js | 12 +- .../src/plugins/typescript/index.js | 2 +- .../optional-chaining/type-arguments/input.ts | 1 + .../type-arguments/options.json | 4 + .../type-arguments/output.json | 182 ++++++++++++++++++ 6 files changed, 204 insertions(+), 29 deletions(-) create mode 100644 packages/babel-parser/test/fixtures/typescript/optional-chaining/type-arguments/input.ts create mode 100644 packages/babel-parser/test/fixtures/typescript/optional-chaining/type-arguments/options.json create mode 100644 packages/babel-parser/test/fixtures/typescript/optional-chaining/type-arguments/output.json diff --git a/packages/babel-parser/src/parser/expression.js b/packages/babel-parser/src/parser/expression.js index 79abd269e184..eb7952a3e8d9 100644 --- a/packages/babel-parser/src/parser/expression.js +++ b/packages/babel-parser/src/parser/expression.js @@ -628,7 +628,7 @@ export default class ExpressionParser extends LValParser { node.callee = base; node.arguments = this.parseCallExpressionArguments(tt.parenR, false); node.optional = true; - return this.finishNode(node, "OptionalCallExpression"); + return this.finishCallExpression(node, /* optional */ true); } else { node.object = base; node.property = this.parseIdentifier(true); @@ -683,11 +683,7 @@ export default class ExpressionParser extends LValParser { base.type !== "Super", node, ); - if (!state.optionalChainMember) { - this.finishCallExpression(node); - } else { - this.finishOptionalCallExpression(node); - } + this.finishCallExpression(node, state.optionalChainMember); if (state.maybeAsyncArrow && this.shouldParseAsyncArrow()) { state.stop = true; @@ -783,21 +779,10 @@ export default class ExpressionParser extends LValParser { ); } - finishCallExpression(node: N.CallExpression): N.CallExpression { - if (node.callee.type === "Import") { - if (node.arguments.length !== 1) { - this.raise(node.start, "import() requires exactly one argument"); - } - - const importArg = node.arguments[0]; - if (importArg && importArg.type === "SpreadElement") { - this.raise(importArg.start, "... is not allowed in import()"); - } - } - return this.finishNode(node, "CallExpression"); - } - - finishOptionalCallExpression(node: N.CallExpression): N.CallExpression { + finishCallExpression( + node: T, + optional: boolean, + ): T { if (node.callee.type === "Import") { if (node.arguments.length !== 1) { this.raise(node.start, "import() requires exactly one argument"); @@ -808,7 +793,10 @@ export default class ExpressionParser extends LValParser { this.raise(importArg.start, "... is not allowed in import()"); } } - return this.finishNode(node, "OptionalCallExpression"); + return this.finishNode( + node, + optional ? "OptionalCallExpression" : "CallExpression", + ); } parseCallExpressionArguments( diff --git a/packages/babel-parser/src/plugins/flow.js b/packages/babel-parser/src/plugins/flow.js index d4c815d38b45..fcdd16df61d2 100644 --- a/packages/babel-parser/src/plugins/flow.js +++ b/packages/babel-parser/src/plugins/flow.js @@ -2709,7 +2709,7 @@ export default (superClass: Class): Class => // $FlowFixMe node.arguments = this.parseCallExpressionArguments(tt.parenR, false); node.optional = true; - return this.finishNode(node, "OptionalCallExpression"); + return this.finishCallExpression(node, /* optional */ true); } else if ( !noCalls && this.shouldParseTypes() && @@ -2722,11 +2722,11 @@ export default (superClass: Class): Class => node.typeArguments = this.flowParseTypeParameterInstantiationCallOrNew(); this.expect(tt.parenL); node.arguments = this.parseCallExpressionArguments(tt.parenR, false); - if (subscriptState.optionalChainMember) { - node.optional = false; - return this.finishNode(node, "OptionalCallExpression"); - } - return this.finishNode(node, "CallExpression"); + if (subscriptState.optionalChainMember) node.optional = false; + return this.finishCallExpression( + node, + subscriptState.optionalChainMember, + ); } catch (e) { if (e instanceof SyntaxError) { this.state = state; diff --git a/packages/babel-parser/src/plugins/typescript/index.js b/packages/babel-parser/src/plugins/typescript/index.js index 26a6246d59e6..4dc707be7cb9 100644 --- a/packages/babel-parser/src/plugins/typescript/index.js +++ b/packages/babel-parser/src/plugins/typescript/index.js @@ -1655,7 +1655,7 @@ export default (superClass: Class): Class => /* possibleAsync */ false, ); node.typeParameters = typeArguments; - return this.finishCallExpression(node); + return this.finishCallExpression(node, state.optionalChainMember); } else if (this.match(tt.backQuote)) { return this.parseTaggedTemplateExpression( startPos, diff --git a/packages/babel-parser/test/fixtures/typescript/optional-chaining/type-arguments/input.ts b/packages/babel-parser/test/fixtures/typescript/optional-chaining/type-arguments/input.ts new file mode 100644 index 000000000000..731a05f63b36 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/optional-chaining/type-arguments/input.ts @@ -0,0 +1 @@ +example.inner?.greet() diff --git a/packages/babel-parser/test/fixtures/typescript/optional-chaining/type-arguments/options.json b/packages/babel-parser/test/fixtures/typescript/optional-chaining/type-arguments/options.json new file mode 100644 index 000000000000..ccc6341666b4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/optional-chaining/type-arguments/options.json @@ -0,0 +1,4 @@ +{ + "sourceType": "module", + "plugins": ["typescript", "optionalChaining"] +} diff --git a/packages/babel-parser/test/fixtures/typescript/optional-chaining/type-arguments/output.json b/packages/babel-parser/test/fixtures/typescript/optional-chaining/type-arguments/output.json new file mode 100644 index 000000000000..42f6c8b98b0e --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/optional-chaining/type-arguments/output.json @@ -0,0 +1,182 @@ +{ + "type": "File", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "expression": { + "type": "OptionalCallExpression", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "callee": { + "type": "OptionalMemberExpression", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "object": { + "type": "MemberExpression", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "object": { + "type": "Identifier", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "example" + }, + "name": "example" + }, + "property": { + "type": "Identifier", + "start": 8, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 13 + }, + "identifierName": "inner" + }, + "name": "inner" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 15, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 20 + }, + "identifierName": "greet" + }, + "name": "greet" + }, + "computed": false, + "optional": true + }, + "arguments": [], + "typeParameters": { + "type": "TSTypeParameterInstantiation", + "start": 20, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "params": [ + { + "type": "TSStringKeyword", + "start": 21, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 27 + } + } + } + ] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file From 5e240166233bd78049fda6f05f6d2be9bbdd7ff8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hu=C3=A1ng=20J=C3=B9nli=C3=A0ng?= Date: Mon, 4 Nov 2019 15:51:24 -0500 Subject: [PATCH 036/648] fix: remove ExportNamedDeclaration when the specifier is empty (#10638) --- .../babel-plugin-transform-modules-systemjs/src/index.js | 2 ++ .../test/fixtures/systemjs/export-named-8/input.mjs | 1 + .../test/fixtures/systemjs/export-named-8/output.mjs | 8 ++++++++ 3 files changed, 11 insertions(+) create mode 100644 packages/babel-plugin-transform-modules-systemjs/test/fixtures/systemjs/export-named-8/input.mjs create mode 100644 packages/babel-plugin-transform-modules-systemjs/test/fixtures/systemjs/export-named-8/output.mjs diff --git a/packages/babel-plugin-transform-modules-systemjs/src/index.js b/packages/babel-plugin-transform-modules-systemjs/src/index.js index 779b76170cdc..c09a438262bc 100644 --- a/packages/babel-plugin-transform-modules-systemjs/src/index.js +++ b/packages/babel-plugin-transform-modules-systemjs/src/index.js @@ -413,6 +413,8 @@ export default declare((api, options) => { path.replaceWithMultiple(nodes); } + } else { + path.remove(); } } } diff --git a/packages/babel-plugin-transform-modules-systemjs/test/fixtures/systemjs/export-named-8/input.mjs b/packages/babel-plugin-transform-modules-systemjs/test/fixtures/systemjs/export-named-8/input.mjs new file mode 100644 index 000000000000..336ce12bb910 --- /dev/null +++ b/packages/babel-plugin-transform-modules-systemjs/test/fixtures/systemjs/export-named-8/input.mjs @@ -0,0 +1 @@ +export {} diff --git a/packages/babel-plugin-transform-modules-systemjs/test/fixtures/systemjs/export-named-8/output.mjs b/packages/babel-plugin-transform-modules-systemjs/test/fixtures/systemjs/export-named-8/output.mjs new file mode 100644 index 000000000000..5ed7cacb99d1 --- /dev/null +++ b/packages/babel-plugin-transform-modules-systemjs/test/fixtures/systemjs/export-named-8/output.mjs @@ -0,0 +1,8 @@ +System.register([], function (_export, _context) { + "use strict"; + + return { + setters: [], + execute: function () {} + }; +}); From 43aa7e262c6ee60f7f8afbe1d04c654e06449905 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?= Date: Mon, 4 Nov 2019 22:50:36 +0100 Subject: [PATCH 037/648] Don't throw when destructuring into a var named as an import (#10628) --- .../src/rewrite-live-references.js | 28 +++++++++---------- .../misc/import-shadowed-assign/input.mjs | 12 ++++++++ .../misc/import-shadowed-assign/output.js | 23 +++++++++++++++ 3 files changed, 48 insertions(+), 15 deletions(-) create mode 100644 packages/babel-plugin-transform-modules-commonjs/test/fixtures/misc/import-shadowed-assign/input.mjs create mode 100644 packages/babel-plugin-transform-modules-commonjs/test/fixtures/misc/import-shadowed-assign/output.js diff --git a/packages/babel-helper-module-transforms/src/rewrite-live-references.js b/packages/babel-helper-module-transforms/src/rewrite-live-references.js index 185ba9142220..8bd93f509c25 100644 --- a/packages/babel-helper-module-transforms/src/rewrite-live-references.js +++ b/packages/babel-helper-module-transforms/src/rewrite-live-references.js @@ -224,6 +224,10 @@ const rewriteReferencesVisitor = { seen.add(path.node); const left = path.get("left"); + + // No change needed + if (left.isMemberExpression()) return; + if (left.isIdentifier()) { // Simple update-assign foo += 1; export { foo }; // => exports.foo = (foo += 1); @@ -234,9 +238,9 @@ const rewriteReferencesVisitor = { return; } - const exportedNames = exported.get(localName) || []; + const exportedNames = exported.get(localName); const importData = imported.get(localName); - if (exportedNames.length > 0 || importData) { + if (exportedNames?.length > 0 || importData) { assert(path.node.operator === "=", "Path was not simplified"); const assignment = path.node; @@ -259,13 +263,14 @@ const rewriteReferencesVisitor = { ); requeueInParent(path); } - } else if (left.isMemberExpression()) { - // No change needed } else { const ids = left.getOuterBindingIdentifiers(); - const id = Object.keys(ids) - .filter(localName => imported.has(localName)) - .pop(); + const programScopeIds = Object.keys(ids).filter( + localName => + scope.getBinding(localName) === path.scope.getBinding(localName), + ); + const id = programScopeIds.find(localName => imported.has(localName)); + if (id) { path.node.right = t.sequenceExpression([ path.node.right, @@ -276,14 +281,7 @@ const rewriteReferencesVisitor = { // Complex ({a, b, c} = {}); export { a, c }; // => ({a, b, c} = {}), (exports.a = a, exports.c = c); const items = []; - Object.keys(ids).forEach(localName => { - // redeclared in this scope - if ( - scope.getBinding(localName) !== path.scope.getBinding(localName) - ) { - return; - } - + programScopeIds.forEach(localName => { const exportedNames = exported.get(localName) || []; if (exportedNames.length > 0) { items.push( diff --git a/packages/babel-plugin-transform-modules-commonjs/test/fixtures/misc/import-shadowed-assign/input.mjs b/packages/babel-plugin-transform-modules-commonjs/test/fixtures/misc/import-shadowed-assign/input.mjs new file mode 100644 index 000000000000..0ba3bfe4e6bc --- /dev/null +++ b/packages/babel-plugin-transform-modules-commonjs/test/fixtures/misc/import-shadowed-assign/input.mjs @@ -0,0 +1,12 @@ +import { foo } from "x"; + +function f(foo) { + foo = 2; + [foo] = []; + ({ foo } = {}); +} + + +foo = 2; +[foo] = []; +({ foo } = {}); diff --git a/packages/babel-plugin-transform-modules-commonjs/test/fixtures/misc/import-shadowed-assign/output.js b/packages/babel-plugin-transform-modules-commonjs/test/fixtures/misc/import-shadowed-assign/output.js new file mode 100644 index 000000000000..d78aaf7826e6 --- /dev/null +++ b/packages/babel-plugin-transform-modules-commonjs/test/fixtures/misc/import-shadowed-assign/output.js @@ -0,0 +1,23 @@ +"use strict"; + +var _x = require("x"); + +function f(foo) { + foo = 2; + [foo] = []; + ({ + foo + } = {}); +} + +_x.foo = (2, function () { + throw new Error('"' + "foo" + '" is read-only.'); +}()); +[foo] = ([], function () { + throw new Error('"' + "foo" + '" is read-only.'); +}()); +({ + foo +} = ({}, function () { + throw new Error('"' + "foo" + '" is read-only.'); +}())); From 861844761f9c911e3c2ab44173372775399fd76c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?= Date: Mon, 4 Nov 2019 22:53:53 +0100 Subject: [PATCH 038/648] =?UTF-8?q?[preset-env]=20Don't=20use=20async-to-g?= =?UTF-8?q?enerator=20when=20already=20using=20re=E2=80=A6=20(#9481)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [preset-env] Don't use async-to-generator when already using regenerator * Add tests * Update fixtures --- .../test/fixtures/regression/T6755/output.js | 42 ++++++------------- .../test/fixtures/regression/4219/output.js | 35 ++++++---------- .../data/overlapping-plugins.js | 15 +++++++ packages/babel-preset-env/src/filter-items.js | 10 +++++ packages/babel-preset-env/src/index.js | 4 +- .../usage-regenerator-used-async/output.mjs | 31 ++++---------- .../usage-regenerator-used-async/output.mjs | 29 ++++--------- .../corejs-without-usebuiltins/stdout.txt | 1 - .../debug/entry-corejs2-android/stdout.txt | 1 - .../debug/entry-corejs2-electron/stdout.txt | 1 - .../stdout.txt | 1 - .../debug/entry-corejs2-proposals/stdout.txt | 1 - .../entry-corejs2-shippedProposals/stdout.txt | 1 - .../entry-corejs2-specific-targets/stdout.txt | 1 - .../stdout.txt | 1 - .../entry-corejs2-versions-strings/stdout.txt | 1 - .../fixtures/debug/entry-corejs2/stdout.txt | 1 - .../debug/entry-corejs3-all/stdout.txt | 1 - .../debug/entry-corejs3-android/stdout.txt | 1 - .../entry-corejs3-babel-polyfill/stdout.txt | 1 - .../debug/entry-corejs3-electron/stdout.txt | 1 - .../entry-corejs3-es-proposals/stdout.txt | 1 - .../debug/entry-corejs3-es/stdout.txt | 1 - .../stdout.txt | 1 - .../debug/entry-corejs3-proposals/stdout.txt | 1 - .../entry-corejs3-specific-entries/stdout.txt | 1 - .../entry-corejs3-specific-targets/stdout.txt | 1 - .../debug/entry-corejs3-stable/stdout.txt | 1 - .../debug/entry-corejs3-stage/stdout.txt | 1 - .../stdout.txt | 1 - .../stdout.txt | 1 - .../stdout.txt | 1 - .../entry-corejs3-versions-strings/stdout.txt | 1 - .../debug/entry-corejs3-web/stdout.txt | 1 - .../fixtures/debug/entry-corejs3/stdout.txt | 1 - .../stdout.txt | 1 - .../debug/entry-no-corejs-uglify/stdout.txt | 1 - .../fixtures/debug/entry-no-corejs/stdout.txt | 1 - .../fixtures/debug/usage-corejs2-1/stdout.txt | 1 - .../fixtures/debug/usage-corejs2-2/stdout.txt | 1 - .../debug/usage-corejs2-none-1/stdout.txt | 1 - .../debug/usage-corejs2-none-2/stdout.txt | 1 - .../usage-corejs2-proposals-1/stdout.txt | 1 - .../usage-corejs2-proposals-2/stdout.txt | 1 - .../stdout.txt | 1 - .../stdout.txt | 1 - .../fixtures/debug/usage-corejs3-1/stdout.txt | 1 - .../fixtures/debug/usage-corejs3-2/stdout.txt | 1 - .../debug/usage-corejs3-none-1/stdout.txt | 1 - .../debug/usage-corejs3-none-2/stdout.txt | 1 - .../usage-corejs3-proposals-1/stdout.txt | 1 - .../usage-corejs3-proposals-2/stdout.txt | 1 - .../stdout.txt | 1 - .../stdout.txt | 1 - .../stdout.txt | 1 - .../stdout.txt | 1 - .../stdout.txt | 1 - .../stdout.txt | 1 - .../debug/usage-no-corejs-1/stdout.txt | 1 - .../debug/usage-no-corejs-2/stdout.txt | 1 - .../debug/usage-no-corejs-none-1/stdout.txt | 1 - .../debug/usage-no-corejs-none-2/stdout.txt | 1 - .../plugins-overlapping/chrome-49/input.js | 1 + .../chrome-49/options.json | 11 +++++ .../plugins-overlapping/chrome-49/output.js | 9 ++++ .../plugins-overlapping/chrome-50/input.js | 1 + .../chrome-50/options.json | 11 +++++ .../plugins-overlapping/chrome-50/output.js | 12 ++++++ .../plugins-overlapping/chrome-54/input.js | 1 + .../chrome-54/options.json | 11 +++++ .../plugins-overlapping/chrome-54/output.js | 12 ++++++ .../plugins-overlapping/chrome-55/input.js | 1 + .../chrome-55/options.json | 11 +++++ .../plugins-overlapping/chrome-55/output.js | 1 + 74 files changed, 152 insertions(+), 151 deletions(-) create mode 100644 packages/babel-preset-env/data/overlapping-plugins.js create mode 100644 packages/babel-preset-env/test/fixtures/plugins-overlapping/chrome-49/input.js create mode 100644 packages/babel-preset-env/test/fixtures/plugins-overlapping/chrome-49/options.json create mode 100644 packages/babel-preset-env/test/fixtures/plugins-overlapping/chrome-49/output.js create mode 100644 packages/babel-preset-env/test/fixtures/plugins-overlapping/chrome-50/input.js create mode 100644 packages/babel-preset-env/test/fixtures/plugins-overlapping/chrome-50/options.json create mode 100644 packages/babel-preset-env/test/fixtures/plugins-overlapping/chrome-50/output.js create mode 100644 packages/babel-preset-env/test/fixtures/plugins-overlapping/chrome-54/input.js create mode 100644 packages/babel-preset-env/test/fixtures/plugins-overlapping/chrome-54/options.json create mode 100644 packages/babel-preset-env/test/fixtures/plugins-overlapping/chrome-54/output.js create mode 100644 packages/babel-preset-env/test/fixtures/plugins-overlapping/chrome-55/input.js create mode 100644 packages/babel-preset-env/test/fixtures/plugins-overlapping/chrome-55/options.json create mode 100644 packages/babel-preset-env/test/fixtures/plugins-overlapping/chrome-55/output.js diff --git a/packages/babel-plugin-transform-classes/test/fixtures/regression/T6755/output.js b/packages/babel-plugin-transform-classes/test/fixtures/regression/T6755/output.js index 435ad8c4dfa3..204120c62c82 100644 --- a/packages/babel-plugin-transform-classes/test/fixtures/regression/T6755/output.js +++ b/packages/babel-plugin-transform-classes/test/fixtures/regression/T6755/output.js @@ -1,7 +1,3 @@ -function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } - -function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } - var Example = /*#__PURE__*/ function () { @@ -11,33 +7,21 @@ function () { var _proto = Example.prototype; - _proto.test1 = - /*#__PURE__*/ - function () { - var _test = _asyncToGenerator( - /*#__PURE__*/ - regeneratorRuntime.mark(function _callee() { - return regeneratorRuntime.wrap(function _callee$(_context) { - while (1) { - switch (_context.prev = _context.next) { - case 0: - _context.next = 2; - return Promise.resolve(2); + _proto.test1 = function test1() { + return regeneratorRuntime.async(function test1$(_context) { + while (1) { + switch (_context.prev = _context.next) { + case 0: + _context.next = 2; + return regeneratorRuntime.awrap(Promise.resolve(2)); - case 2: - case "end": - return _context.stop(); - } + case 2: + case "end": + return _context.stop(); } - }, _callee); - })); - - function test1() { - return _test.apply(this, arguments); - } - - return test1; - }(); + } + }); + }; _proto.test2 = /*#__PURE__*/ diff --git a/packages/babel-plugin-transform-regenerator/test/fixtures/regression/4219/output.js b/packages/babel-plugin-transform-regenerator/test/fixtures/regression/4219/output.js index 0b2d02f3770d..a3b8fd1f26c4 100644 --- a/packages/babel-plugin-transform-regenerator/test/fixtures/regression/4219/output.js +++ b/packages/babel-plugin-transform-regenerator/test/fixtures/regression/4219/output.js @@ -1,26 +1,17 @@ -function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } - -function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } - function test(fn) { - return ( - /*#__PURE__*/ - _asyncToGenerator( - /*#__PURE__*/ - regeneratorRuntime.mark(function _callee() { - var _args = arguments; - return regeneratorRuntime.wrap(function _callee$(_context) { - while (1) { - switch (_context.prev = _context.next) { - case 0: - return _context.abrupt("return", fn.apply(void 0, _args)); + return function _callee() { + var _args = arguments; + return regeneratorRuntime.async(function _callee$(_context) { + while (1) { + switch (_context.prev = _context.next) { + case 0: + return _context.abrupt("return", fn.apply(void 0, _args)); - case 1: - case "end": - return _context.stop(); - } + case 1: + case "end": + return _context.stop(); } - }, _callee); - })) - ); + } + }); + }; } diff --git a/packages/babel-preset-env/data/overlapping-plugins.js b/packages/babel-preset-env/data/overlapping-plugins.js new file mode 100644 index 000000000000..84c0d416b4ad --- /dev/null +++ b/packages/babel-preset-env/data/overlapping-plugins.js @@ -0,0 +1,15 @@ +"use strict"; + +module.exports = new Map(); + +// async -> regenerator is better than async -> generator -> regenerator +ifIncluded("transform-regenerator") + .isUnnecessary("transform-async-to-generator"); + +function ifIncluded(name) { + const set = new Set(); + module.exports.set(name, set); + return { + isUnnecessary(name) { set.add(name); return this; } + }; +} diff --git a/packages/babel-preset-env/src/filter-items.js b/packages/babel-preset-env/src/filter-items.js index 7d9c07026eba..3c5a3297083f 100644 --- a/packages/babel-preset-env/src/filter-items.js +++ b/packages/babel-preset-env/src/filter-items.js @@ -85,3 +85,13 @@ export default function( return result; } + +export function removeUnnecessaryItems( + items: Set, + overlapping: Map>, +) { + items.forEach(item => { + const names = overlapping.get(item); + if (names) names.forEach(name => items.delete(name)); + }); +} diff --git a/packages/babel-preset-env/src/index.js b/packages/babel-preset-env/src/index.js index b1d335e5527a..1c0b08f853df 100644 --- a/packages/babel-preset-env/src/index.js +++ b/packages/babel-preset-env/src/index.js @@ -3,11 +3,12 @@ import { SemVer } from "semver"; import { logPluginOrPolyfill } from "./debug"; import getOptionSpecificExcludesFor from "./get-option-specific-excludes"; -import filterItems from "./filter-items"; +import filterItems, { removeUnnecessaryItems } from "./filter-items"; import moduleTransformations from "./module-transformations"; import normalizeOptions from "./normalize-options"; import pluginList from "../data/plugins.json"; import { proposalPlugins, pluginSyntaxMap } from "../data/shipped-proposals"; +import overlappingPlugins from "../data/overlapping-plugins"; import addCoreJS2UsagePlugin from "./polyfills/corejs2/usage-plugin"; import addCoreJS3UsagePlugin from "./polyfills/corejs3/usage-plugin"; @@ -248,6 +249,7 @@ export default declare((api, opts) => { getOptionSpecificExcludesFor({ loose }), pluginSyntaxMap, ); + removeUnnecessaryItems(pluginNames, overlappingPlugins); const polyfillPlugins = getPolyfillPlugins({ useBuiltIns, diff --git a/packages/babel-preset-env/test/fixtures/corejs2/usage-regenerator-used-async/output.mjs b/packages/babel-preset-env/test/fixtures/corejs2/usage-regenerator-used-async/output.mjs index db18b8bfe116..178c426ba53f 100644 --- a/packages/babel-preset-env/test/fixtures/corejs2/usage-regenerator-used-async/output.mjs +++ b/packages/babel-preset-env/test/fixtures/corejs2/usage-regenerator-used-async/output.mjs @@ -1,28 +1,13 @@ import "regenerator-runtime/runtime"; -import "core-js/modules/es6.promise"; -import "core-js/modules/es6.object.to-string"; - -function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } - -function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } function a() { - return _a.apply(this, arguments); -} - -function _a() { - _a = _asyncToGenerator( - /*#__PURE__*/ - regeneratorRuntime.mark(function _callee() { - return regeneratorRuntime.wrap(function _callee$(_context) { - while (1) { - switch (_context.prev = _context.next) { - case 0: - case "end": - return _context.stop(); - } + return regeneratorRuntime.async(function a$(_context) { + while (1) { + switch (_context.prev = _context.next) { + case 0: + case "end": + return _context.stop(); } - }, _callee); - })); - return _a.apply(this, arguments); + } + }); } diff --git a/packages/babel-preset-env/test/fixtures/corejs3/usage-regenerator-used-async/output.mjs b/packages/babel-preset-env/test/fixtures/corejs3/usage-regenerator-used-async/output.mjs index 5663fd906a75..03624378656f 100644 --- a/packages/babel-preset-env/test/fixtures/corejs3/usage-regenerator-used-async/output.mjs +++ b/packages/babel-preset-env/test/fixtures/corejs3/usage-regenerator-used-async/output.mjs @@ -2,27 +2,14 @@ import "core-js/modules/es.object.to-string"; import "core-js/modules/es.promise"; import "regenerator-runtime/runtime"; -function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } - -function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } - function a() { - return _a.apply(this, arguments); -} - -function _a() { - _a = _asyncToGenerator( - /*#__PURE__*/ - regeneratorRuntime.mark(function _callee() { - return regeneratorRuntime.wrap(function _callee$(_context) { - while (1) { - switch (_context.prev = _context.next) { - case 0: - case "end": - return _context.stop(); - } + return regeneratorRuntime.async(function a$(_context) { + while (1) { + switch (_context.prev = _context.next) { + case 0: + case "end": + return _context.stop(); } - }, _callee); - })); - return _a.apply(this, arguments); + } + }); } diff --git a/packages/babel-preset-env/test/fixtures/debug/corejs-without-usebuiltins/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/corejs-without-usebuiltins/stdout.txt index dd2af17fc22d..d263c3020966 100644 --- a/packages/babel-preset-env/test/fixtures/debug/corejs-without-usebuiltins/stdout.txt +++ b/packages/babel-preset-env/test/fixtures/debug/corejs-without-usebuiltins/stdout.txt @@ -30,7 +30,6 @@ Using plugins: transform-new-target {} transform-regenerator {} transform-exponentiation-operator {} - transform-async-to-generator {} proposal-async-generator-functions {} proposal-object-rest-spread {} proposal-unicode-property-regex {} diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-android/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-android/stdout.txt index d4cb727787d8..b2d6215dfff4 100644 --- a/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-android/stdout.txt +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-android/stdout.txt @@ -30,7 +30,6 @@ Using plugins: transform-new-target { "android":"4" } transform-regenerator { "android":"4" } transform-exponentiation-operator { "android":"4" } - transform-async-to-generator { "android":"4" } proposal-async-generator-functions { "android":"4" } proposal-object-rest-spread { "android":"4" } proposal-unicode-property-regex { "android":"4" } diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-electron/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-electron/stdout.txt index c3c18fa3a051..bfc587d621ae 100644 --- a/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-electron/stdout.txt +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-electron/stdout.txt @@ -25,7 +25,6 @@ Using plugins: transform-block-scoping { "electron":"0.36" } transform-regenerator { "electron":"0.36" } transform-exponentiation-operator { "electron":"0.36" } - transform-async-to-generator { "electron":"0.36" } proposal-async-generator-functions { "electron":"0.36" } proposal-object-rest-spread { "electron":"0.36" } proposal-unicode-property-regex { "electron":"0.36" } diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-force-all-transforms/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-force-all-transforms/stdout.txt index 32637c13542d..f5645e48ccb3 100644 --- a/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-force-all-transforms/stdout.txt +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-force-all-transforms/stdout.txt @@ -30,7 +30,6 @@ Using plugins: transform-new-target {} transform-regenerator {} transform-exponentiation-operator {} - transform-async-to-generator {} proposal-async-generator-functions { "chrome":"55" } proposal-object-rest-spread { "chrome":"55" } proposal-unicode-property-regex { "chrome":"55" } diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-proposals/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-proposals/stdout.txt index e5a186c32135..bea5ddcef506 100644 --- a/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-proposals/stdout.txt +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-proposals/stdout.txt @@ -28,7 +28,6 @@ Using plugins: transform-new-target {} transform-regenerator {} transform-exponentiation-operator {} - transform-async-to-generator {} proposal-async-generator-functions {} proposal-object-rest-spread {} proposal-unicode-property-regex {} diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-shippedProposals/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-shippedProposals/stdout.txt index cbffdcc578f3..bc8c000777a8 100644 --- a/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-shippedProposals/stdout.txt +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-shippedProposals/stdout.txt @@ -28,7 +28,6 @@ Using plugins: transform-new-target {} transform-regenerator {} transform-exponentiation-operator {} - transform-async-to-generator {} proposal-async-generator-functions {} proposal-object-rest-spread {} proposal-unicode-property-regex {} diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-specific-targets/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-specific-targets/stdout.txt index 16202760ee72..fd3e8b442630 100644 --- a/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-specific-targets/stdout.txt +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-specific-targets/stdout.txt @@ -35,7 +35,6 @@ Using plugins: transform-new-target { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } transform-regenerator { "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } transform-exponentiation-operator { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - transform-async-to-generator { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } proposal-async-generator-functions { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } proposal-object-rest-spread { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } proposal-unicode-property-regex { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-versions-decimals/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-versions-decimals/stdout.txt index 63ba5e06fce5..afe468aa8aba 100644 --- a/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-versions-decimals/stdout.txt +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-versions-decimals/stdout.txt @@ -41,7 +41,6 @@ Using plugins: transform-new-target { "ie":"10" } transform-regenerator { "electron":"0.36", "ie":"10" } transform-exponentiation-operator { "electron":"0.36", "ie":"10", "node":"6.1" } - transform-async-to-generator { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } proposal-async-generator-functions { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } proposal-object-rest-spread { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } proposal-unicode-property-regex { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-versions-strings/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-versions-strings/stdout.txt index ae6350c447da..c14636d386e1 100644 --- a/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-versions-strings/stdout.txt +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2-versions-strings/stdout.txt @@ -32,7 +32,6 @@ Using plugins: transform-new-target { "ie":"10" } transform-regenerator { "ie":"10" } transform-exponentiation-operator { "ie":"10", "node":"6.10" } - transform-async-to-generator { "chrome":"54", "ie":"10", "node":"6.10" } proposal-async-generator-functions { "chrome":"54", "ie":"10", "node":"6.10" } proposal-object-rest-spread { "chrome":"54", "ie":"10", "node":"6.10" } proposal-unicode-property-regex { "chrome":"54", "ie":"10", "node":"6.10" } diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs2/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2/stdout.txt index 4b45c43d32d2..14ad1ce4b6cd 100644 --- a/packages/babel-preset-env/test/fixtures/debug/entry-corejs2/stdout.txt +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs2/stdout.txt @@ -32,7 +32,6 @@ Using plugins: transform-new-target { "ie":"10" } transform-regenerator { "ie":"10" } transform-exponentiation-operator { "ie":"10", "node":"6" } - transform-async-to-generator { "chrome":"54", "ie":"10", "node":"6" } proposal-async-generator-functions { "chrome":"54", "ie":"10", "node":"6" } proposal-object-rest-spread { "chrome":"54", "ie":"10", "node":"6" } proposal-unicode-property-regex { "chrome":"54", "ie":"10", "node":"6" } diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-all/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-all/stdout.txt index 0d0f575f70c3..38e834034f84 100644 --- a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-all/stdout.txt +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-all/stdout.txt @@ -28,7 +28,6 @@ Using plugins: transform-new-target {} transform-regenerator {} transform-exponentiation-operator {} - transform-async-to-generator {} proposal-async-generator-functions {} proposal-object-rest-spread {} proposal-unicode-property-regex {} diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-android/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-android/stdout.txt index 42d9f81c58b4..684f0ebd9aa1 100644 --- a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-android/stdout.txt +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-android/stdout.txt @@ -30,7 +30,6 @@ Using plugins: transform-new-target { "android":"4" } transform-regenerator { "android":"4" } transform-exponentiation-operator { "android":"4" } - transform-async-to-generator { "android":"4" } proposal-async-generator-functions { "android":"4" } proposal-object-rest-spread { "android":"4" } proposal-unicode-property-regex { "android":"4" } diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-babel-polyfill/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-babel-polyfill/stdout.txt index a900b4720ab0..e730eb6421ca 100644 --- a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-babel-polyfill/stdout.txt +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-babel-polyfill/stdout.txt @@ -28,7 +28,6 @@ Using plugins: transform-new-target {} transform-regenerator {} transform-exponentiation-operator {} - transform-async-to-generator {} proposal-async-generator-functions {} proposal-object-rest-spread {} proposal-unicode-property-regex {} diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-electron/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-electron/stdout.txt index 85026b3df8e2..32c6a7530002 100644 --- a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-electron/stdout.txt +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-electron/stdout.txt @@ -25,7 +25,6 @@ Using plugins: transform-block-scoping { "electron":"0.36" } transform-regenerator { "electron":"0.36" } transform-exponentiation-operator { "electron":"0.36" } - transform-async-to-generator { "electron":"0.36" } proposal-async-generator-functions { "electron":"0.36" } proposal-object-rest-spread { "electron":"0.36" } proposal-unicode-property-regex { "electron":"0.36" } diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-es-proposals/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-es-proposals/stdout.txt index 07743893310e..39b7566a4edc 100644 --- a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-es-proposals/stdout.txt +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-es-proposals/stdout.txt @@ -28,7 +28,6 @@ Using plugins: transform-new-target {} transform-regenerator {} transform-exponentiation-operator {} - transform-async-to-generator {} proposal-async-generator-functions {} proposal-object-rest-spread {} proposal-unicode-property-regex {} diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-es/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-es/stdout.txt index f6c3da52ca39..cf8816e74969 100644 --- a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-es/stdout.txt +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-es/stdout.txt @@ -28,7 +28,6 @@ Using plugins: transform-new-target {} transform-regenerator {} transform-exponentiation-operator {} - transform-async-to-generator {} proposal-async-generator-functions {} proposal-object-rest-spread {} proposal-unicode-property-regex {} diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-force-all-transforms/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-force-all-transforms/stdout.txt index dbc3ba935e3e..2733197a3382 100644 --- a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-force-all-transforms/stdout.txt +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-force-all-transforms/stdout.txt @@ -30,7 +30,6 @@ Using plugins: transform-new-target {} transform-regenerator {} transform-exponentiation-operator {} - transform-async-to-generator {} proposal-async-generator-functions { "chrome":"55" } proposal-object-rest-spread { "chrome":"55" } proposal-unicode-property-regex { "chrome":"55" } diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-proposals/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-proposals/stdout.txt index 2d70ebb4d616..b400e3b3da64 100644 --- a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-proposals/stdout.txt +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-proposals/stdout.txt @@ -28,7 +28,6 @@ Using plugins: transform-new-target {} transform-regenerator {} transform-exponentiation-operator {} - transform-async-to-generator {} proposal-async-generator-functions {} proposal-object-rest-spread {} proposal-unicode-property-regex {} diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-specific-entries/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-specific-entries/stdout.txt index 237cf943f7c3..9b8ceb81a002 100644 --- a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-specific-entries/stdout.txt +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-specific-entries/stdout.txt @@ -28,7 +28,6 @@ Using plugins: transform-new-target {} transform-regenerator {} transform-exponentiation-operator {} - transform-async-to-generator {} proposal-async-generator-functions {} proposal-object-rest-spread {} proposal-unicode-property-regex {} diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-specific-targets/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-specific-targets/stdout.txt index cda9f2bec5f3..2229f64bab90 100644 --- a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-specific-targets/stdout.txt +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-specific-targets/stdout.txt @@ -35,7 +35,6 @@ Using plugins: transform-new-target { "edge":"13", "ie":"10", "ios":"9", "safari":"7" } transform-regenerator { "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } transform-exponentiation-operator { "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } - transform-async-to-generator { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } proposal-async-generator-functions { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } proposal-object-rest-spread { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } proposal-unicode-property-regex { "chrome":"54", "edge":"13", "firefox":"49", "ie":"10", "ios":"9", "safari":"7" } diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-stable/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-stable/stdout.txt index 38e8356a3478..223ef746fda9 100644 --- a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-stable/stdout.txt +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-stable/stdout.txt @@ -28,7 +28,6 @@ Using plugins: transform-new-target {} transform-regenerator {} transform-exponentiation-operator {} - transform-async-to-generator {} proposal-async-generator-functions {} proposal-object-rest-spread {} proposal-unicode-property-regex {} diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-stage/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-stage/stdout.txt index 5380e1c89aa6..9cee893f2a2e 100644 --- a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-stage/stdout.txt +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-stage/stdout.txt @@ -28,7 +28,6 @@ Using plugins: transform-new-target {} transform-regenerator {} transform-exponentiation-operator {} - transform-async-to-generator {} proposal-async-generator-functions {} proposal-object-rest-spread {} proposal-unicode-property-regex {} diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-versions-decimals/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-versions-decimals/stdout.txt index efcedad873c6..ad6cde3c24aa 100644 --- a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-versions-decimals/stdout.txt +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-versions-decimals/stdout.txt @@ -41,7 +41,6 @@ Using plugins: transform-new-target { "ie":"10" } transform-regenerator { "electron":"0.36", "ie":"10" } transform-exponentiation-operator { "electron":"0.36", "ie":"10", "node":"6.1" } - transform-async-to-generator { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } proposal-async-generator-functions { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } proposal-object-rest-spread { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } proposal-unicode-property-regex { "chrome":"54", "electron":"0.36", "ie":"10", "node":"6.1" } diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-versions-strings-minor-3.0/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-versions-strings-minor-3.0/stdout.txt index af5f0f9ffe87..8d8cf7fe2333 100644 --- a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-versions-strings-minor-3.0/stdout.txt +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-versions-strings-minor-3.0/stdout.txt @@ -32,7 +32,6 @@ Using plugins: transform-new-target { "ie":"10" } transform-regenerator { "ie":"10" } transform-exponentiation-operator { "ie":"10", "node":"6.10" } - transform-async-to-generator { "chrome":"54", "ie":"10", "node":"6.10" } proposal-async-generator-functions { "chrome":"54", "ie":"10", "node":"6.10" } proposal-object-rest-spread { "chrome":"54", "ie":"10", "node":"6.10" } proposal-unicode-property-regex { "chrome":"54", "ie":"10", "node":"6.10" } diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-versions-strings-minor-3.1/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-versions-strings-minor-3.1/stdout.txt index c74e3e37cb55..31c21bace19c 100644 --- a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-versions-strings-minor-3.1/stdout.txt +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-versions-strings-minor-3.1/stdout.txt @@ -32,7 +32,6 @@ Using plugins: transform-new-target { "ie":"10" } transform-regenerator { "ie":"10" } transform-exponentiation-operator { "ie":"10", "node":"6.10" } - transform-async-to-generator { "chrome":"54", "ie":"10", "node":"6.10" } proposal-async-generator-functions { "chrome":"54", "ie":"10", "node":"6.10" } proposal-object-rest-spread { "chrome":"54", "ie":"10", "node":"6.10" } proposal-unicode-property-regex { "chrome":"54", "ie":"10", "node":"6.10" } diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-versions-strings/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-versions-strings/stdout.txt index caff30ef4984..74c154a2b26d 100644 --- a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-versions-strings/stdout.txt +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-versions-strings/stdout.txt @@ -32,7 +32,6 @@ Using plugins: transform-new-target { "ie":"10" } transform-regenerator { "ie":"10" } transform-exponentiation-operator { "ie":"10", "node":"6.10" } - transform-async-to-generator { "chrome":"54", "ie":"10", "node":"6.10" } proposal-async-generator-functions { "chrome":"54", "ie":"10", "node":"6.10" } proposal-object-rest-spread { "chrome":"54", "ie":"10", "node":"6.10" } proposal-unicode-property-regex { "chrome":"54", "ie":"10", "node":"6.10" } diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-web/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-web/stdout.txt index 9dea1a0f8905..d92ec30279e3 100644 --- a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-web/stdout.txt +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3-web/stdout.txt @@ -28,7 +28,6 @@ Using plugins: transform-new-target {} transform-regenerator {} transform-exponentiation-operator {} - transform-async-to-generator {} proposal-async-generator-functions {} proposal-object-rest-spread {} proposal-unicode-property-regex {} diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3/stdout.txt index b337515f602d..a35cd149137c 100644 --- a/packages/babel-preset-env/test/fixtures/debug/entry-corejs3/stdout.txt +++ b/packages/babel-preset-env/test/fixtures/debug/entry-corejs3/stdout.txt @@ -32,7 +32,6 @@ Using plugins: transform-new-target { "ie":"10" } transform-regenerator { "ie":"10" } transform-exponentiation-operator { "ie":"10", "node":"6" } - transform-async-to-generator { "chrome":"54", "ie":"10", "node":"6" } proposal-async-generator-functions { "chrome":"54", "ie":"10", "node":"6" } proposal-object-rest-spread { "chrome":"54", "ie":"10", "node":"6" } proposal-unicode-property-regex { "chrome":"54", "ie":"10", "node":"6" } diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-no-corejs-shippedProposals/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-no-corejs-shippedProposals/stdout.txt index 621161013483..e28519a1f6ad 100644 --- a/packages/babel-preset-env/test/fixtures/debug/entry-no-corejs-shippedProposals/stdout.txt +++ b/packages/babel-preset-env/test/fixtures/debug/entry-no-corejs-shippedProposals/stdout.txt @@ -28,7 +28,6 @@ Using plugins: transform-new-target {} transform-regenerator {} transform-exponentiation-operator {} - transform-async-to-generator {} proposal-async-generator-functions {} proposal-object-rest-spread {} proposal-unicode-property-regex {} diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-no-corejs-uglify/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-no-corejs-uglify/stdout.txt index c773b35d1314..d051b5019f6b 100644 --- a/packages/babel-preset-env/test/fixtures/debug/entry-no-corejs-uglify/stdout.txt +++ b/packages/babel-preset-env/test/fixtures/debug/entry-no-corejs-uglify/stdout.txt @@ -33,7 +33,6 @@ Using plugins: transform-new-target {} transform-regenerator {} transform-exponentiation-operator {} - transform-async-to-generator {} proposal-async-generator-functions { "chrome":"55" } proposal-object-rest-spread { "chrome":"55" } proposal-unicode-property-regex { "chrome":"55" } diff --git a/packages/babel-preset-env/test/fixtures/debug/entry-no-corejs/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/entry-no-corejs/stdout.txt index b070fd82ae2c..596d823fbcd7 100644 --- a/packages/babel-preset-env/test/fixtures/debug/entry-no-corejs/stdout.txt +++ b/packages/babel-preset-env/test/fixtures/debug/entry-no-corejs/stdout.txt @@ -32,7 +32,6 @@ Using plugins: transform-new-target { "ie":"10" } transform-regenerator { "ie":"10" } transform-exponentiation-operator { "ie":"10", "node":"6" } - transform-async-to-generator { "chrome":"54", "ie":"10", "node":"6" } proposal-async-generator-functions { "chrome":"54", "ie":"10", "node":"6" } proposal-object-rest-spread { "chrome":"54", "ie":"10", "node":"6" } proposal-unicode-property-regex { "chrome":"54", "ie":"10", "node":"6" } diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-1/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-1/stdout.txt index 10a416642303..3a4742537bf8 100644 --- a/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-1/stdout.txt +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-1/stdout.txt @@ -31,7 +31,6 @@ Using plugins: transform-new-target { "ie":"11" } transform-regenerator { "firefox":"50", "ie":"11" } transform-exponentiation-operator { "firefox":"50", "ie":"11" } - transform-async-to-generator { "chrome":"52", "firefox":"50", "ie":"11" } proposal-async-generator-functions { "chrome":"52", "firefox":"50", "ie":"11" } proposal-object-rest-spread { "chrome":"52", "firefox":"50", "ie":"11" } proposal-unicode-property-regex { "chrome":"52", "firefox":"50", "ie":"11" } diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-2/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-2/stdout.txt index c6bd456f09c6..7337bd97a95e 100644 --- a/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-2/stdout.txt +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-2/stdout.txt @@ -31,7 +31,6 @@ Using plugins: transform-new-target { "ie":"11" } transform-regenerator { "firefox":"50", "ie":"11" } transform-exponentiation-operator { "firefox":"50", "ie":"11" } - transform-async-to-generator { "chrome":"52", "firefox":"50", "ie":"11" } proposal-async-generator-functions { "chrome":"52", "firefox":"50", "ie":"11" } proposal-object-rest-spread { "chrome":"52", "firefox":"50", "ie":"11" } proposal-unicode-property-regex { "chrome":"52", "firefox":"50", "ie":"11" } diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-none-1/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-none-1/stdout.txt index 83701579d0ee..f17969a7c09a 100644 --- a/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-none-1/stdout.txt +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-none-1/stdout.txt @@ -31,7 +31,6 @@ Using plugins: transform-new-target { "ie":"11" } transform-regenerator { "firefox":"50", "ie":"11" } transform-exponentiation-operator { "firefox":"50", "ie":"11" } - transform-async-to-generator { "chrome":"52", "firefox":"50", "ie":"11" } proposal-async-generator-functions { "chrome":"52", "firefox":"50", "ie":"11" } proposal-object-rest-spread { "chrome":"52", "firefox":"50", "ie":"11" } proposal-unicode-property-regex { "chrome":"52", "firefox":"50", "ie":"11" } diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-none-2/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-none-2/stdout.txt index d0cc380462d3..0c1cce6bfe7d 100644 --- a/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-none-2/stdout.txt +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-none-2/stdout.txt @@ -31,7 +31,6 @@ Using plugins: transform-new-target { "ie":"11" } transform-regenerator { "firefox":"50", "ie":"11" } transform-exponentiation-operator { "firefox":"50", "ie":"11" } - transform-async-to-generator { "chrome":"52", "firefox":"50", "ie":"11" } proposal-async-generator-functions { "chrome":"52", "firefox":"50", "ie":"11" } proposal-object-rest-spread { "chrome":"52", "firefox":"50", "ie":"11" } proposal-unicode-property-regex { "chrome":"52", "firefox":"50", "ie":"11" } diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-proposals-1/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-proposals-1/stdout.txt index f7f567c4c47a..54f7d2b6892c 100644 --- a/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-proposals-1/stdout.txt +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-proposals-1/stdout.txt @@ -31,7 +31,6 @@ Using plugins: transform-new-target { "ie":"11" } transform-regenerator { "firefox":"50", "ie":"11" } transform-exponentiation-operator { "firefox":"50", "ie":"11" } - transform-async-to-generator { "chrome":"52", "firefox":"50", "ie":"11" } proposal-async-generator-functions { "chrome":"52", "firefox":"50", "ie":"11" } proposal-object-rest-spread { "chrome":"52", "firefox":"50", "ie":"11" } proposal-unicode-property-regex { "chrome":"52", "firefox":"50", "ie":"11" } diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-proposals-2/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-proposals-2/stdout.txt index 8f4c5e1df667..f251da3a1fb9 100644 --- a/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-proposals-2/stdout.txt +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-proposals-2/stdout.txt @@ -31,7 +31,6 @@ Using plugins: transform-new-target { "ie":"11" } transform-regenerator { "firefox":"50", "ie":"11" } transform-exponentiation-operator { "firefox":"50", "ie":"11" } - transform-async-to-generator { "chrome":"52", "firefox":"50", "ie":"11" } proposal-async-generator-functions { "chrome":"52", "firefox":"50", "ie":"11" } proposal-object-rest-spread { "chrome":"52", "firefox":"50", "ie":"11" } proposal-unicode-property-regex { "chrome":"52", "firefox":"50", "ie":"11" } diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-shippedProposals-1/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-shippedProposals-1/stdout.txt index f456fc31c325..65b636097824 100644 --- a/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-shippedProposals-1/stdout.txt +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-shippedProposals-1/stdout.txt @@ -31,7 +31,6 @@ Using plugins: transform-new-target { "ie":"11" } transform-regenerator { "firefox":"50", "ie":"11" } transform-exponentiation-operator { "firefox":"50", "ie":"11" } - transform-async-to-generator { "chrome":"52", "firefox":"50", "ie":"11" } proposal-async-generator-functions { "chrome":"52", "firefox":"50", "ie":"11" } proposal-object-rest-spread { "chrome":"52", "firefox":"50", "ie":"11" } proposal-unicode-property-regex { "chrome":"52", "firefox":"50", "ie":"11" } diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-shippedProposals-2/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-shippedProposals-2/stdout.txt index 14c735dcba8c..baea99e275f5 100644 --- a/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-shippedProposals-2/stdout.txt +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs2-shippedProposals-2/stdout.txt @@ -31,7 +31,6 @@ Using plugins: transform-new-target { "ie":"11" } transform-regenerator { "firefox":"50", "ie":"11" } transform-exponentiation-operator { "firefox":"50", "ie":"11" } - transform-async-to-generator { "chrome":"52", "firefox":"50", "ie":"11" } proposal-async-generator-functions { "chrome":"52", "firefox":"50", "ie":"11" } proposal-object-rest-spread { "chrome":"52", "firefox":"50", "ie":"11" } proposal-unicode-property-regex { "chrome":"52", "firefox":"50", "ie":"11" } diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-1/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-1/stdout.txt index ce78b1615fa3..5420011af7ff 100644 --- a/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-1/stdout.txt +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-1/stdout.txt @@ -31,7 +31,6 @@ Using plugins: transform-new-target { "ie":"11" } transform-regenerator { "firefox":"50", "ie":"11" } transform-exponentiation-operator { "firefox":"50", "ie":"11" } - transform-async-to-generator { "chrome":"52", "firefox":"50", "ie":"11" } proposal-async-generator-functions { "chrome":"52", "firefox":"50", "ie":"11" } proposal-object-rest-spread { "chrome":"52", "firefox":"50", "ie":"11" } proposal-unicode-property-regex { "chrome":"52", "firefox":"50", "ie":"11" } diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-2/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-2/stdout.txt index 4545ec9ddac5..51c71b8b36d6 100644 --- a/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-2/stdout.txt +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-2/stdout.txt @@ -31,7 +31,6 @@ Using plugins: transform-new-target { "ie":"11" } transform-regenerator { "firefox":"50", "ie":"11" } transform-exponentiation-operator { "firefox":"50", "ie":"11" } - transform-async-to-generator { "chrome":"52", "firefox":"50", "ie":"11" } proposal-async-generator-functions { "chrome":"52", "firefox":"50", "ie":"11" } proposal-object-rest-spread { "chrome":"52", "firefox":"50", "ie":"11" } proposal-unicode-property-regex { "chrome":"52", "firefox":"50", "ie":"11" } diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-none-1/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-none-1/stdout.txt index 5effbeed1198..0cb836caf43e 100644 --- a/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-none-1/stdout.txt +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-none-1/stdout.txt @@ -31,7 +31,6 @@ Using plugins: transform-new-target { "ie":"11" } transform-regenerator { "firefox":"50", "ie":"11" } transform-exponentiation-operator { "firefox":"50", "ie":"11" } - transform-async-to-generator { "chrome":"52", "firefox":"50", "ie":"11" } proposal-async-generator-functions { "chrome":"52", "firefox":"50", "ie":"11" } proposal-object-rest-spread { "chrome":"52", "firefox":"50", "ie":"11" } proposal-unicode-property-regex { "chrome":"52", "firefox":"50", "ie":"11" } diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-none-2/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-none-2/stdout.txt index 999084137006..0ca472fb637f 100644 --- a/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-none-2/stdout.txt +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-none-2/stdout.txt @@ -31,7 +31,6 @@ Using plugins: transform-new-target { "ie":"11" } transform-regenerator { "firefox":"50", "ie":"11" } transform-exponentiation-operator { "firefox":"50", "ie":"11" } - transform-async-to-generator { "chrome":"52", "firefox":"50", "ie":"11" } proposal-async-generator-functions { "chrome":"52", "firefox":"50", "ie":"11" } proposal-object-rest-spread { "chrome":"52", "firefox":"50", "ie":"11" } proposal-unicode-property-regex { "chrome":"52", "firefox":"50", "ie":"11" } diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-proposals-1/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-proposals-1/stdout.txt index 4f5e93bc1d2a..a1c85b5f240b 100644 --- a/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-proposals-1/stdout.txt +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-proposals-1/stdout.txt @@ -31,7 +31,6 @@ Using plugins: transform-new-target { "ie":"11" } transform-regenerator { "firefox":"50", "ie":"11" } transform-exponentiation-operator { "firefox":"50", "ie":"11" } - transform-async-to-generator { "chrome":"52", "firefox":"50", "ie":"11" } proposal-async-generator-functions { "chrome":"52", "firefox":"50", "ie":"11" } proposal-object-rest-spread { "chrome":"52", "firefox":"50", "ie":"11" } proposal-unicode-property-regex { "chrome":"52", "firefox":"50", "ie":"11" } diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-proposals-2/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-proposals-2/stdout.txt index c7b2d3da53a4..d21f014f1314 100644 --- a/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-proposals-2/stdout.txt +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-proposals-2/stdout.txt @@ -31,7 +31,6 @@ Using plugins: transform-new-target { "ie":"11" } transform-regenerator { "firefox":"50", "ie":"11" } transform-exponentiation-operator { "firefox":"50", "ie":"11" } - transform-async-to-generator { "chrome":"52", "firefox":"50", "ie":"11" } proposal-async-generator-functions { "chrome":"52", "firefox":"50", "ie":"11" } proposal-object-rest-spread { "chrome":"52", "firefox":"50", "ie":"11" } proposal-unicode-property-regex { "chrome":"52", "firefox":"50", "ie":"11" } diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-shippedProposals-1/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-shippedProposals-1/stdout.txt index 3186c00e2458..56aa662832b0 100644 --- a/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-shippedProposals-1/stdout.txt +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-shippedProposals-1/stdout.txt @@ -31,7 +31,6 @@ Using plugins: transform-new-target { "ie":"11" } transform-regenerator { "firefox":"50", "ie":"11" } transform-exponentiation-operator { "firefox":"50", "ie":"11" } - transform-async-to-generator { "chrome":"52", "firefox":"50", "ie":"11" } proposal-async-generator-functions { "chrome":"52", "firefox":"50", "ie":"11" } proposal-object-rest-spread { "chrome":"52", "firefox":"50", "ie":"11" } proposal-unicode-property-regex { "chrome":"52", "firefox":"50", "ie":"11" } diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-shippedProposals-2/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-shippedProposals-2/stdout.txt index ed270ec46b29..848d033d61be 100644 --- a/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-shippedProposals-2/stdout.txt +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-shippedProposals-2/stdout.txt @@ -31,7 +31,6 @@ Using plugins: transform-new-target { "ie":"11" } transform-regenerator { "firefox":"50", "ie":"11" } transform-exponentiation-operator { "firefox":"50", "ie":"11" } - transform-async-to-generator { "chrome":"52", "firefox":"50", "ie":"11" } proposal-async-generator-functions { "chrome":"52", "firefox":"50", "ie":"11" } proposal-object-rest-spread { "chrome":"52", "firefox":"50", "ie":"11" } proposal-unicode-property-regex { "chrome":"52", "firefox":"50", "ie":"11" } diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-versions-strings-minor-3.0-1/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-versions-strings-minor-3.0-1/stdout.txt index 1fcbf70cef28..d7384c46888d 100644 --- a/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-versions-strings-minor-3.0-1/stdout.txt +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-versions-strings-minor-3.0-1/stdout.txt @@ -31,7 +31,6 @@ Using plugins: transform-new-target { "ie":"11" } transform-regenerator { "firefox":"50", "ie":"11" } transform-exponentiation-operator { "firefox":"50", "ie":"11" } - transform-async-to-generator { "chrome":"52", "firefox":"50", "ie":"11" } proposal-async-generator-functions { "chrome":"52", "firefox":"50", "ie":"11" } proposal-object-rest-spread { "chrome":"52", "firefox":"50", "ie":"11" } proposal-unicode-property-regex { "chrome":"52", "firefox":"50", "ie":"11" } diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-versions-strings-minor-3.0-2/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-versions-strings-minor-3.0-2/stdout.txt index 1b7bf00896fb..3897ddf434ae 100644 --- a/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-versions-strings-minor-3.0-2/stdout.txt +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-versions-strings-minor-3.0-2/stdout.txt @@ -31,7 +31,6 @@ Using plugins: transform-new-target { "ie":"11" } transform-regenerator { "firefox":"50", "ie":"11" } transform-exponentiation-operator { "firefox":"50", "ie":"11" } - transform-async-to-generator { "chrome":"52", "firefox":"50", "ie":"11" } proposal-async-generator-functions { "chrome":"52", "firefox":"50", "ie":"11" } proposal-object-rest-spread { "chrome":"52", "firefox":"50", "ie":"11" } proposal-unicode-property-regex { "chrome":"52", "firefox":"50", "ie":"11" } diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-versions-strings-minor-3.1-1/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-versions-strings-minor-3.1-1/stdout.txt index 7df78cdbe879..31bc70824f26 100644 --- a/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-versions-strings-minor-3.1-1/stdout.txt +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-versions-strings-minor-3.1-1/stdout.txt @@ -31,7 +31,6 @@ Using plugins: transform-new-target { "ie":"11" } transform-regenerator { "firefox":"50", "ie":"11" } transform-exponentiation-operator { "firefox":"50", "ie":"11" } - transform-async-to-generator { "chrome":"52", "firefox":"50", "ie":"11" } proposal-async-generator-functions { "chrome":"52", "firefox":"50", "ie":"11" } proposal-object-rest-spread { "chrome":"52", "firefox":"50", "ie":"11" } proposal-unicode-property-regex { "chrome":"52", "firefox":"50", "ie":"11" } diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-versions-strings-minor-3.1-2/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-versions-strings-minor-3.1-2/stdout.txt index 2dba4464ffa8..29b751d07ae8 100644 --- a/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-versions-strings-minor-3.1-2/stdout.txt +++ b/packages/babel-preset-env/test/fixtures/debug/usage-corejs3-versions-strings-minor-3.1-2/stdout.txt @@ -31,7 +31,6 @@ Using plugins: transform-new-target { "ie":"11" } transform-regenerator { "firefox":"50", "ie":"11" } transform-exponentiation-operator { "firefox":"50", "ie":"11" } - transform-async-to-generator { "chrome":"52", "firefox":"50", "ie":"11" } proposal-async-generator-functions { "chrome":"52", "firefox":"50", "ie":"11" } proposal-object-rest-spread { "chrome":"52", "firefox":"50", "ie":"11" } proposal-unicode-property-regex { "chrome":"52", "firefox":"50", "ie":"11" } diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-no-corejs-1/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/usage-no-corejs-1/stdout.txt index 211854dc7a12..eb4cf5b632c2 100644 --- a/packages/babel-preset-env/test/fixtures/debug/usage-no-corejs-1/stdout.txt +++ b/packages/babel-preset-env/test/fixtures/debug/usage-no-corejs-1/stdout.txt @@ -31,7 +31,6 @@ Using plugins: transform-new-target { "ie":"11" } transform-regenerator { "firefox":"50", "ie":"11" } transform-exponentiation-operator { "firefox":"50", "ie":"11" } - transform-async-to-generator { "chrome":"52", "firefox":"50", "ie":"11" } proposal-async-generator-functions { "chrome":"52", "firefox":"50", "ie":"11" } proposal-object-rest-spread { "chrome":"52", "firefox":"50", "ie":"11" } proposal-unicode-property-regex { "chrome":"52", "firefox":"50", "ie":"11" } diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-no-corejs-2/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/usage-no-corejs-2/stdout.txt index 90c9d87ef822..77a2227dde4e 100644 --- a/packages/babel-preset-env/test/fixtures/debug/usage-no-corejs-2/stdout.txt +++ b/packages/babel-preset-env/test/fixtures/debug/usage-no-corejs-2/stdout.txt @@ -31,7 +31,6 @@ Using plugins: transform-new-target { "ie":"11" } transform-regenerator { "firefox":"50", "ie":"11" } transform-exponentiation-operator { "firefox":"50", "ie":"11" } - transform-async-to-generator { "chrome":"52", "firefox":"50", "ie":"11" } proposal-async-generator-functions { "chrome":"52", "firefox":"50", "ie":"11" } proposal-object-rest-spread { "chrome":"52", "firefox":"50", "ie":"11" } proposal-unicode-property-regex { "chrome":"52", "firefox":"50", "ie":"11" } diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-no-corejs-none-1/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/usage-no-corejs-none-1/stdout.txt index 6afbb5cd98f5..d2f78b1901c6 100644 --- a/packages/babel-preset-env/test/fixtures/debug/usage-no-corejs-none-1/stdout.txt +++ b/packages/babel-preset-env/test/fixtures/debug/usage-no-corejs-none-1/stdout.txt @@ -31,7 +31,6 @@ Using plugins: transform-new-target { "ie":"11" } transform-regenerator { "firefox":"50", "ie":"11" } transform-exponentiation-operator { "firefox":"50", "ie":"11" } - transform-async-to-generator { "chrome":"52", "firefox":"50", "ie":"11" } proposal-async-generator-functions { "chrome":"52", "firefox":"50", "ie":"11" } proposal-object-rest-spread { "chrome":"52", "firefox":"50", "ie":"11" } proposal-unicode-property-regex { "chrome":"52", "firefox":"50", "ie":"11" } diff --git a/packages/babel-preset-env/test/fixtures/debug/usage-no-corejs-none-2/stdout.txt b/packages/babel-preset-env/test/fixtures/debug/usage-no-corejs-none-2/stdout.txt index 5d3445c8f14f..cc7e91a5d56d 100644 --- a/packages/babel-preset-env/test/fixtures/debug/usage-no-corejs-none-2/stdout.txt +++ b/packages/babel-preset-env/test/fixtures/debug/usage-no-corejs-none-2/stdout.txt @@ -31,7 +31,6 @@ Using plugins: transform-new-target { "ie":"11" } transform-regenerator { "firefox":"50", "ie":"11" } transform-exponentiation-operator { "firefox":"50", "ie":"11" } - transform-async-to-generator { "chrome":"52", "firefox":"50", "ie":"11" } proposal-async-generator-functions { "chrome":"52", "firefox":"50", "ie":"11" } proposal-object-rest-spread { "chrome":"52", "firefox":"50", "ie":"11" } proposal-unicode-property-regex { "chrome":"52", "firefox":"50", "ie":"11" } diff --git a/packages/babel-preset-env/test/fixtures/plugins-overlapping/chrome-49/input.js b/packages/babel-preset-env/test/fixtures/plugins-overlapping/chrome-49/input.js new file mode 100644 index 000000000000..9604ae0250bb --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/plugins-overlapping/chrome-49/input.js @@ -0,0 +1 @@ +async function foo() {} \ No newline at end of file diff --git a/packages/babel-preset-env/test/fixtures/plugins-overlapping/chrome-49/options.json b/packages/babel-preset-env/test/fixtures/plugins-overlapping/chrome-49/options.json new file mode 100644 index 000000000000..41ee66e16cc0 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/plugins-overlapping/chrome-49/options.json @@ -0,0 +1,11 @@ +{ + "plugins": [], + "presets": [ + [ + "../../../../lib", + { + "targets": { "chrome": "49" } + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/plugins-overlapping/chrome-49/output.js b/packages/babel-preset-env/test/fixtures/plugins-overlapping/chrome-49/output.js new file mode 100644 index 000000000000..19684e4a4db3 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/plugins-overlapping/chrome-49/output.js @@ -0,0 +1,9 @@ +function foo() { + return regeneratorRuntime.async(function foo$(_context) { + while (1) switch (_context.prev = _context.next) { + case 0: + case "end": + return _context.stop(); + } + }); +} diff --git a/packages/babel-preset-env/test/fixtures/plugins-overlapping/chrome-50/input.js b/packages/babel-preset-env/test/fixtures/plugins-overlapping/chrome-50/input.js new file mode 100644 index 000000000000..9604ae0250bb --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/plugins-overlapping/chrome-50/input.js @@ -0,0 +1 @@ +async function foo() {} \ No newline at end of file diff --git a/packages/babel-preset-env/test/fixtures/plugins-overlapping/chrome-50/options.json b/packages/babel-preset-env/test/fixtures/plugins-overlapping/chrome-50/options.json new file mode 100644 index 000000000000..df56e583e65b --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/plugins-overlapping/chrome-50/options.json @@ -0,0 +1,11 @@ +{ + "plugins": [], + "presets": [ + [ + "../../../../lib", + { + "targets": { "chrome": "50" } + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/plugins-overlapping/chrome-50/output.js b/packages/babel-preset-env/test/fixtures/plugins-overlapping/chrome-50/output.js new file mode 100644 index 000000000000..d69b16f0660c --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/plugins-overlapping/chrome-50/output.js @@ -0,0 +1,12 @@ +function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } + +function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } + +function foo() { + return _foo.apply(this, arguments); +} + +function _foo() { + _foo = _asyncToGenerator(function* () {}); + return _foo.apply(this, arguments); +} diff --git a/packages/babel-preset-env/test/fixtures/plugins-overlapping/chrome-54/input.js b/packages/babel-preset-env/test/fixtures/plugins-overlapping/chrome-54/input.js new file mode 100644 index 000000000000..9604ae0250bb --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/plugins-overlapping/chrome-54/input.js @@ -0,0 +1 @@ +async function foo() {} \ No newline at end of file diff --git a/packages/babel-preset-env/test/fixtures/plugins-overlapping/chrome-54/options.json b/packages/babel-preset-env/test/fixtures/plugins-overlapping/chrome-54/options.json new file mode 100644 index 000000000000..d76f324a91bb --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/plugins-overlapping/chrome-54/options.json @@ -0,0 +1,11 @@ +{ + "plugins": [], + "presets": [ + [ + "../../../../lib", + { + "targets": { "chrome": "54" } + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/plugins-overlapping/chrome-54/output.js b/packages/babel-preset-env/test/fixtures/plugins-overlapping/chrome-54/output.js new file mode 100644 index 000000000000..d69b16f0660c --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/plugins-overlapping/chrome-54/output.js @@ -0,0 +1,12 @@ +function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } + +function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } + +function foo() { + return _foo.apply(this, arguments); +} + +function _foo() { + _foo = _asyncToGenerator(function* () {}); + return _foo.apply(this, arguments); +} diff --git a/packages/babel-preset-env/test/fixtures/plugins-overlapping/chrome-55/input.js b/packages/babel-preset-env/test/fixtures/plugins-overlapping/chrome-55/input.js new file mode 100644 index 000000000000..9604ae0250bb --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/plugins-overlapping/chrome-55/input.js @@ -0,0 +1 @@ +async function foo() {} \ No newline at end of file diff --git a/packages/babel-preset-env/test/fixtures/plugins-overlapping/chrome-55/options.json b/packages/babel-preset-env/test/fixtures/plugins-overlapping/chrome-55/options.json new file mode 100644 index 000000000000..c08a917cbc95 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/plugins-overlapping/chrome-55/options.json @@ -0,0 +1,11 @@ +{ + "plugins": [], + "presets": [ + [ + "../../../../lib", + { + "targets": { "chrome": "55" } + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/plugins-overlapping/chrome-55/output.js b/packages/babel-preset-env/test/fixtures/plugins-overlapping/chrome-55/output.js new file mode 100644 index 000000000000..f9df9686dd67 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/plugins-overlapping/chrome-55/output.js @@ -0,0 +1 @@ +async function foo() {} From d25262ec4b57196f97a5169ceaba3b6145287163 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?= Date: Tue, 5 Nov 2019 00:35:40 +0100 Subject: [PATCH 039/648] Correctly delegate .return() in async generator (#10422) * Correctly delegate .return() in async generator * Add catch param * minNodeVersion * Add another test --- packages/babel-helpers/src/helpers.js | 6 ++- .../fixtures/yield-star/issue-9905/exec.js | 20 ++++++++++ .../yield-star/issue-9905/options.json | 3 ++ .../test/fixtures/yield-star/options.json | 10 +++++ .../exec.js | 34 +++++++++++++++++ .../options.json | 3 ++ .../exec.js | 37 +++++++++++++++++++ .../options.json | 3 ++ .../return-method-with-finally/exec.js | 37 +++++++++++++++++++ .../fixtures/yield-star/return-method/exec.js | 31 ++++++++++++++++ .../yield-star/return-method/options.json | 3 ++ .../throw-method-with-catch/exec.js | 37 +++++++++++++++++++ .../throw-method-with-finally/exec.js | 37 +++++++++++++++++++ .../generator-kinds/async-generator/output.js | 2 +- .../corejs2/entry-shippedProposals/output.js | 2 +- .../corejs2/usage-shippedProposals/output.js | 2 +- .../preset-options/shippedProposals/output.js | 2 +- 17 files changed, 264 insertions(+), 5 deletions(-) create mode 100644 packages/babel-plugin-proposal-async-generator-functions/test/fixtures/yield-star/issue-9905/exec.js create mode 100644 packages/babel-plugin-proposal-async-generator-functions/test/fixtures/yield-star/issue-9905/options.json create mode 100644 packages/babel-plugin-proposal-async-generator-functions/test/fixtures/yield-star/options.json create mode 100644 packages/babel-plugin-proposal-async-generator-functions/test/fixtures/yield-star/return-method-with-finally-multiple-parallel/exec.js create mode 100644 packages/babel-plugin-proposal-async-generator-functions/test/fixtures/yield-star/return-method-with-finally-multiple-parallel/options.json create mode 100644 packages/babel-plugin-proposal-async-generator-functions/test/fixtures/yield-star/return-method-with-finally-multiple-serial/exec.js create mode 100644 packages/babel-plugin-proposal-async-generator-functions/test/fixtures/yield-star/return-method-with-finally-multiple-serial/options.json create mode 100644 packages/babel-plugin-proposal-async-generator-functions/test/fixtures/yield-star/return-method-with-finally/exec.js create mode 100644 packages/babel-plugin-proposal-async-generator-functions/test/fixtures/yield-star/return-method/exec.js create mode 100644 packages/babel-plugin-proposal-async-generator-functions/test/fixtures/yield-star/return-method/options.json create mode 100644 packages/babel-plugin-proposal-async-generator-functions/test/fixtures/yield-star/throw-method-with-catch/exec.js create mode 100644 packages/babel-plugin-proposal-async-generator-functions/test/fixtures/yield-star/throw-method-with-finally/exec.js diff --git a/packages/babel-helpers/src/helpers.js b/packages/babel-helpers/src/helpers.js index 8fb04a895307..fadce7421815 100644 --- a/packages/babel-helpers/src/helpers.js +++ b/packages/babel-helpers/src/helpers.js @@ -136,7 +136,7 @@ helpers.AsyncGenerator = helper("7.0.0-beta.0")` Promise.resolve(wrappedAwait ? value.wrapped : value).then( function (arg) { if (wrappedAwait) { - resume("next", arg); + resume(key === "return" ? "return" : "next", arg); return } @@ -238,6 +238,10 @@ helpers.asyncGeneratorDelegate = helper("7.0.0-beta.0")` if (typeof inner.return === "function") { iter.return = function (value) { + if (waiting) { + waiting = false; + return value; + } return pump("return", value); }; } diff --git a/packages/babel-plugin-proposal-async-generator-functions/test/fixtures/yield-star/issue-9905/exec.js b/packages/babel-plugin-proposal-async-generator-functions/test/fixtures/yield-star/issue-9905/exec.js new file mode 100644 index 000000000000..a4bf16180e24 --- /dev/null +++ b/packages/babel-plugin-proposal-async-generator-functions/test/fixtures/yield-star/issue-9905/exec.js @@ -0,0 +1,20 @@ +const log = []; + +async function* func1() { + log.push(1); + yield "a"; + log.push(2); +} + +async function* func2() { + yield* func1(); + log.push(3); +} + +return (async () => { + const iterator = func2(); + await iterator.next(); + await iterator.return(); + + expect(log).toEqual([1]); +})(); \ No newline at end of file diff --git a/packages/babel-plugin-proposal-async-generator-functions/test/fixtures/yield-star/issue-9905/options.json b/packages/babel-plugin-proposal-async-generator-functions/test/fixtures/yield-star/issue-9905/options.json new file mode 100644 index 000000000000..7edb6d2fc815 --- /dev/null +++ b/packages/babel-plugin-proposal-async-generator-functions/test/fixtures/yield-star/issue-9905/options.json @@ -0,0 +1,3 @@ +{ + "minNodeVersion": "8.0.0" +} \ No newline at end of file diff --git a/packages/babel-plugin-proposal-async-generator-functions/test/fixtures/yield-star/options.json b/packages/babel-plugin-proposal-async-generator-functions/test/fixtures/yield-star/options.json new file mode 100644 index 000000000000..b0483f766a07 --- /dev/null +++ b/packages/babel-plugin-proposal-async-generator-functions/test/fixtures/yield-star/options.json @@ -0,0 +1,10 @@ +{ + "parserOpts": { + "allowReturnOutsideFunction": true + }, + "plugins": [ + "external-helpers", + "transform-async-to-generator", + "proposal-async-generator-functions" + ] +} \ No newline at end of file diff --git a/packages/babel-plugin-proposal-async-generator-functions/test/fixtures/yield-star/return-method-with-finally-multiple-parallel/exec.js b/packages/babel-plugin-proposal-async-generator-functions/test/fixtures/yield-star/return-method-with-finally-multiple-parallel/exec.js new file mode 100644 index 000000000000..1c4ef15d5d06 --- /dev/null +++ b/packages/babel-plugin-proposal-async-generator-functions/test/fixtures/yield-star/return-method-with-finally-multiple-parallel/exec.js @@ -0,0 +1,34 @@ +const log = []; + +async function* inner() { + try { + log.push(1); + yield "a"; + log.push(2); + yield "b"; + log.push(3); + } finally { + log.push(4); + yield "c"; + log.push(5); + } +} + +async function* outer() { + log.push(6); + yield* inner(); + log.push(7); +} + +return (async () => { + const iterator = outer(); + + let res = await iterator.next(); + expect(res).toEqual({ value: "a", done: false }); + expect(log).toEqual([6, 1]); + + const [res1, res2] = await Promise.all([ iterator.return("x"), iterator.return("y") ]); + expect(res1).toEqual({ value: "c", done: false }); + expect(res2).toEqual({ value: "y", done: true }); + expect(log).toEqual([6, 1, 4]); +})(); diff --git a/packages/babel-plugin-proposal-async-generator-functions/test/fixtures/yield-star/return-method-with-finally-multiple-parallel/options.json b/packages/babel-plugin-proposal-async-generator-functions/test/fixtures/yield-star/return-method-with-finally-multiple-parallel/options.json new file mode 100644 index 000000000000..7edb6d2fc815 --- /dev/null +++ b/packages/babel-plugin-proposal-async-generator-functions/test/fixtures/yield-star/return-method-with-finally-multiple-parallel/options.json @@ -0,0 +1,3 @@ +{ + "minNodeVersion": "8.0.0" +} \ No newline at end of file diff --git a/packages/babel-plugin-proposal-async-generator-functions/test/fixtures/yield-star/return-method-with-finally-multiple-serial/exec.js b/packages/babel-plugin-proposal-async-generator-functions/test/fixtures/yield-star/return-method-with-finally-multiple-serial/exec.js new file mode 100644 index 000000000000..84865ef6f3df --- /dev/null +++ b/packages/babel-plugin-proposal-async-generator-functions/test/fixtures/yield-star/return-method-with-finally-multiple-serial/exec.js @@ -0,0 +1,37 @@ +const log = []; + +async function* inner() { + try { + log.push(1); + yield "a"; + log.push(2); + yield "b"; + log.push(3); + } finally { + log.push(4); + yield "c"; + log.push(5); + } +} + +async function* outer() { + log.push(6); + yield* inner(); + log.push(7); +} + +return (async () => { + const iterator = outer(); + + let res = await iterator.next(); + expect(res).toEqual({ value: "a", done: false }); + expect(log).toEqual([6, 1]); + + res = await iterator.return("x"); + expect(res).toEqual({ value: "c", done: false }); + expect(log).toEqual([6, 1, 4]); + + res = await iterator.return("y"); + expect(res).toEqual({ value: "y", done: true }); + expect(log).toEqual([6, 1, 4]); +})(); diff --git a/packages/babel-plugin-proposal-async-generator-functions/test/fixtures/yield-star/return-method-with-finally-multiple-serial/options.json b/packages/babel-plugin-proposal-async-generator-functions/test/fixtures/yield-star/return-method-with-finally-multiple-serial/options.json new file mode 100644 index 000000000000..7edb6d2fc815 --- /dev/null +++ b/packages/babel-plugin-proposal-async-generator-functions/test/fixtures/yield-star/return-method-with-finally-multiple-serial/options.json @@ -0,0 +1,3 @@ +{ + "minNodeVersion": "8.0.0" +} \ No newline at end of file diff --git a/packages/babel-plugin-proposal-async-generator-functions/test/fixtures/yield-star/return-method-with-finally/exec.js b/packages/babel-plugin-proposal-async-generator-functions/test/fixtures/yield-star/return-method-with-finally/exec.js new file mode 100644 index 000000000000..0ef1d454a19f --- /dev/null +++ b/packages/babel-plugin-proposal-async-generator-functions/test/fixtures/yield-star/return-method-with-finally/exec.js @@ -0,0 +1,37 @@ +const log = []; + +async function* inner() { + try { + log.push(1); + yield "a"; + log.push(2); + yield "b"; + log.push(3); + } finally { + log.push(4); + yield "c"; + log.push(5); + } +} + +async function* outer() { + log.push(6); + yield* inner(); + log.push(7); +} + +return (async () => { + const iterator = outer(); + + let res = await iterator.next(); + expect(res).toEqual({ value: "a", done: false }); + expect(log).toEqual([6, 1]); + + res = await iterator.return(); + expect(res).toEqual({ value: "c", done: false }); + expect(log).toEqual([6, 1, 4]); + + res = await iterator.next(); + expect(res).toEqual({ value: undefined, done: true }); + expect(log).toEqual([6, 1, 4, 5, 7]); +})(); diff --git a/packages/babel-plugin-proposal-async-generator-functions/test/fixtures/yield-star/return-method/exec.js b/packages/babel-plugin-proposal-async-generator-functions/test/fixtures/yield-star/return-method/exec.js new file mode 100644 index 000000000000..73be9d85e495 --- /dev/null +++ b/packages/babel-plugin-proposal-async-generator-functions/test/fixtures/yield-star/return-method/exec.js @@ -0,0 +1,31 @@ +const log = []; + +async function* inner() { + log.push(1); + yield "a"; + log.push(2); + yield "b"; + log.push(3); +} + +async function* outer() { + log.push(4); + yield* inner(); + log.push(5); +} + +return (async () => { + const iterator = outer(); + + let res = await iterator.next(); + expect(res).toEqual({ value: "a", done: false }); + expect(log).toEqual([4, 1]); + + res = await iterator.return(); + expect(res).toEqual({ value: undefined, done: true }); + expect(log).toEqual([4, 1]); + + res = await iterator.next(); + expect(res).toEqual({ value: undefined, done: true }); + expect(log).toEqual([4, 1]); +})(); diff --git a/packages/babel-plugin-proposal-async-generator-functions/test/fixtures/yield-star/return-method/options.json b/packages/babel-plugin-proposal-async-generator-functions/test/fixtures/yield-star/return-method/options.json new file mode 100644 index 000000000000..7edb6d2fc815 --- /dev/null +++ b/packages/babel-plugin-proposal-async-generator-functions/test/fixtures/yield-star/return-method/options.json @@ -0,0 +1,3 @@ +{ + "minNodeVersion": "8.0.0" +} \ No newline at end of file diff --git a/packages/babel-plugin-proposal-async-generator-functions/test/fixtures/yield-star/throw-method-with-catch/exec.js b/packages/babel-plugin-proposal-async-generator-functions/test/fixtures/yield-star/throw-method-with-catch/exec.js new file mode 100644 index 000000000000..0859ad463e00 --- /dev/null +++ b/packages/babel-plugin-proposal-async-generator-functions/test/fixtures/yield-star/throw-method-with-catch/exec.js @@ -0,0 +1,37 @@ +const log = []; + +async function* inner() { + try { + log.push(1); + yield "a"; + log.push(2); + yield "b"; + log.push(3); + } catch (e) { + log.push(4); + yield "c"; + log.push(5); + } +} + +async function* outer() { + log.push(6); + yield* inner(); + log.push(7); +} + +return (async () => { + const iterator = outer(); + + let res = await iterator.next(); + expect(res).toEqual({ value: "a", done: false }); + expect(log).toEqual([6, 1]); + + res = await iterator.throw(new Error("TEST")); + expect(res).toEqual({ value: "c", done: false }); + expect(log).toEqual([6, 1, 4]); + + res = await iterator.next(); + expect(res).toEqual({ value: undefined, done: true }); + expect(log).toEqual([6, 1, 4, 5, 7]); +})(); diff --git a/packages/babel-plugin-proposal-async-generator-functions/test/fixtures/yield-star/throw-method-with-finally/exec.js b/packages/babel-plugin-proposal-async-generator-functions/test/fixtures/yield-star/throw-method-with-finally/exec.js new file mode 100644 index 000000000000..425a00b33f80 --- /dev/null +++ b/packages/babel-plugin-proposal-async-generator-functions/test/fixtures/yield-star/throw-method-with-finally/exec.js @@ -0,0 +1,37 @@ +const log = []; + +async function* inner() { + try { + log.push(1); + yield "a"; + log.push(2); + yield "b"; + log.push(3); + } finally { + log.push(4); + yield "c"; + log.push(5); + } +} + +async function* outer() { + log.push(6); + yield* inner(); + log.push(7); +} + +return (async () => { + const iterator = outer(); + + let res = await iterator.next(); + expect(res).toEqual({ value: "a", done: false }); + expect(log).toEqual([6, 1]); + + res = await iterator.throw(new Error("TEST")); + expect(res).toEqual({ value: "c", done: false }); + expect(log).toEqual([6, 1, 4]); + + // "yield" in finally suspended the exception for one turn + await expect(iterator.next()).rejects.toThrow(/TEST/); + expect(log).toEqual([6, 1, 4, 5]); +})(); diff --git a/packages/babel-plugin-proposal-function-sent/test/fixtures/generator-kinds/async-generator/output.js b/packages/babel-plugin-proposal-function-sent/test/fixtures/generator-kinds/async-generator/output.js index a05d6843d84e..8bccb5d80c6c 100644 --- a/packages/babel-plugin-proposal-function-sent/test/fixtures/generator-kinds/async-generator/output.js +++ b/packages/babel-plugin-proposal-function-sent/test/fixtures/generator-kinds/async-generator/output.js @@ -4,7 +4,7 @@ function _awaitAsyncGenerator(value) { return new _AwaitValue(value); } function _wrapAsyncGenerator(fn) { return function () { return new _AsyncGenerator(fn.apply(this, arguments)); }; } -function _AsyncGenerator(gen) { var front, back; function send(key, arg) { return new Promise(function (resolve, reject) { var request = { key: key, arg: arg, resolve: resolve, reject: reject, next: null }; if (back) { back = back.next = request; } else { front = back = request; resume(key, arg); } }); } function resume(key, arg) { try { var result = gen[key](arg); var value = result.value; var wrappedAwait = value instanceof _AwaitValue; Promise.resolve(wrappedAwait ? value.wrapped : value).then(function (arg) { if (wrappedAwait) { resume("next", arg); return; } settle(result.done ? "return" : "normal", arg); }, function (err) { resume("throw", err); }); } catch (err) { settle("throw", err); } } function settle(type, value) { switch (type) { case "return": front.resolve({ value: value, done: true }); break; case "throw": front.reject(value); break; default: front.resolve({ value: value, done: false }); break; } front = front.next; if (front) { resume(front.key, front.arg); } else { back = null; } } this._invoke = send; if (typeof gen.return !== "function") { this.return = undefined; } } +function _AsyncGenerator(gen) { var front, back; function send(key, arg) { return new Promise(function (resolve, reject) { var request = { key: key, arg: arg, resolve: resolve, reject: reject, next: null }; if (back) { back = back.next = request; } else { front = back = request; resume(key, arg); } }); } function resume(key, arg) { try { var result = gen[key](arg); var value = result.value; var wrappedAwait = value instanceof _AwaitValue; Promise.resolve(wrappedAwait ? value.wrapped : value).then(function (arg) { if (wrappedAwait) { resume(key === "return" ? "return" : "next", arg); return; } settle(result.done ? "return" : "normal", arg); }, function (err) { resume("throw", err); }); } catch (err) { settle("throw", err); } } function settle(type, value) { switch (type) { case "return": front.resolve({ value: value, done: true }); break; case "throw": front.reject(value); break; default: front.resolve({ value: value, done: false }); break; } front = front.next; if (front) { resume(front.key, front.arg); } else { back = null; } } this._invoke = send; if (typeof gen.return !== "function") { this.return = undefined; } } if (typeof Symbol === "function" && Symbol.asyncIterator) { _AsyncGenerator.prototype[Symbol.asyncIterator] = function () { return this; }; } diff --git a/packages/babel-preset-env/test/fixtures/corejs2/entry-shippedProposals/output.js b/packages/babel-preset-env/test/fixtures/corejs2/entry-shippedProposals/output.js index 6618653a758e..11efbf4cdb8d 100644 --- a/packages/babel-preset-env/test/fixtures/corejs2/entry-shippedProposals/output.js +++ b/packages/babel-preset-env/test/fixtures/corejs2/entry-shippedProposals/output.js @@ -310,7 +310,7 @@ function _awaitAsyncGenerator(value) { return new _AwaitValue(value); } function _wrapAsyncGenerator(fn) { return function () { return new _AsyncGenerator(fn.apply(this, arguments)); }; } -function _AsyncGenerator(gen) { var front, back; function send(key, arg) { return new Promise(function (resolve, reject) { var request = { key: key, arg: arg, resolve: resolve, reject: reject, next: null }; if (back) { back = back.next = request; } else { front = back = request; resume(key, arg); } }); } function resume(key, arg) { try { var result = gen[key](arg); var value = result.value; var wrappedAwait = value instanceof _AwaitValue; Promise.resolve(wrappedAwait ? value.wrapped : value).then(function (arg) { if (wrappedAwait) { resume("next", arg); return; } settle(result.done ? "return" : "normal", arg); }, function (err) { resume("throw", err); }); } catch (err) { settle("throw", err); } } function settle(type, value) { switch (type) { case "return": front.resolve({ value: value, done: true }); break; case "throw": front.reject(value); break; default: front.resolve({ value: value, done: false }); break; } front = front.next; if (front) { resume(front.key, front.arg); } else { back = null; } } this._invoke = send; if (typeof gen["return"] !== "function") { this["return"] = undefined; } } +function _AsyncGenerator(gen) { var front, back; function send(key, arg) { return new Promise(function (resolve, reject) { var request = { key: key, arg: arg, resolve: resolve, reject: reject, next: null }; if (back) { back = back.next = request; } else { front = back = request; resume(key, arg); } }); } function resume(key, arg) { try { var result = gen[key](arg); var value = result.value; var wrappedAwait = value instanceof _AwaitValue; Promise.resolve(wrappedAwait ? value.wrapped : value).then(function (arg) { if (wrappedAwait) { resume(key === "return" ? "return" : "next", arg); return; } settle(result.done ? "return" : "normal", arg); }, function (err) { resume("throw", err); }); } catch (err) { settle("throw", err); } } function settle(type, value) { switch (type) { case "return": front.resolve({ value: value, done: true }); break; case "throw": front.reject(value); break; default: front.resolve({ value: value, done: false }); break; } front = front.next; if (front) { resume(front.key, front.arg); } else { back = null; } } this._invoke = send; if (typeof gen["return"] !== "function") { this["return"] = undefined; } } if (typeof Symbol === "function" && Symbol.asyncIterator) { _AsyncGenerator.prototype[Symbol.asyncIterator] = function () { return this; }; } diff --git a/packages/babel-preset-env/test/fixtures/corejs2/usage-shippedProposals/output.js b/packages/babel-preset-env/test/fixtures/corejs2/usage-shippedProposals/output.js index 341d5845145e..02988151dce8 100644 --- a/packages/babel-preset-env/test/fixtures/corejs2/usage-shippedProposals/output.js +++ b/packages/babel-preset-env/test/fixtures/corejs2/usage-shippedProposals/output.js @@ -42,7 +42,7 @@ function _awaitAsyncGenerator(value) { return new _AwaitValue(value); } function _wrapAsyncGenerator(fn) { return function () { return new _AsyncGenerator(fn.apply(this, arguments)); }; } -function _AsyncGenerator(gen) { var front, back; function send(key, arg) { return new Promise(function (resolve, reject) { var request = { key: key, arg: arg, resolve: resolve, reject: reject, next: null }; if (back) { back = back.next = request; } else { front = back = request; resume(key, arg); } }); } function resume(key, arg) { try { var result = gen[key](arg); var value = result.value; var wrappedAwait = value instanceof _AwaitValue; Promise.resolve(wrappedAwait ? value.wrapped : value).then(function (arg) { if (wrappedAwait) { resume("next", arg); return; } settle(result.done ? "return" : "normal", arg); }, function (err) { resume("throw", err); }); } catch (err) { settle("throw", err); } } function settle(type, value) { switch (type) { case "return": front.resolve({ value: value, done: true }); break; case "throw": front.reject(value); break; default: front.resolve({ value: value, done: false }); break; } front = front.next; if (front) { resume(front.key, front.arg); } else { back = null; } } this._invoke = send; if (typeof gen["return"] !== "function") { this["return"] = undefined; } } +function _AsyncGenerator(gen) { var front, back; function send(key, arg) { return new Promise(function (resolve, reject) { var request = { key: key, arg: arg, resolve: resolve, reject: reject, next: null }; if (back) { back = back.next = request; } else { front = back = request; resume(key, arg); } }); } function resume(key, arg) { try { var result = gen[key](arg); var value = result.value; var wrappedAwait = value instanceof _AwaitValue; Promise.resolve(wrappedAwait ? value.wrapped : value).then(function (arg) { if (wrappedAwait) { resume(key === "return" ? "return" : "next", arg); return; } settle(result.done ? "return" : "normal", arg); }, function (err) { resume("throw", err); }); } catch (err) { settle("throw", err); } } function settle(type, value) { switch (type) { case "return": front.resolve({ value: value, done: true }); break; case "throw": front.reject(value); break; default: front.resolve({ value: value, done: false }); break; } front = front.next; if (front) { resume(front.key, front.arg); } else { back = null; } } this._invoke = send; if (typeof gen["return"] !== "function") { this["return"] = undefined; } } if (typeof Symbol === "function" && Symbol.asyncIterator) { _AsyncGenerator.prototype[Symbol.asyncIterator] = function () { return this; }; } diff --git a/packages/babel-preset-env/test/fixtures/preset-options/shippedProposals/output.js b/packages/babel-preset-env/test/fixtures/preset-options/shippedProposals/output.js index 4719ee3716e8..358a6a1f78bb 100644 --- a/packages/babel-preset-env/test/fixtures/preset-options/shippedProposals/output.js +++ b/packages/babel-preset-env/test/fixtures/preset-options/shippedProposals/output.js @@ -12,7 +12,7 @@ function _awaitAsyncGenerator(value) { return new _AwaitValue(value); } function _wrapAsyncGenerator(fn) { return function () { return new _AsyncGenerator(fn.apply(this, arguments)); }; } -function _AsyncGenerator(gen) { var front, back; function send(key, arg) { return new Promise(function (resolve, reject) { var request = { key: key, arg: arg, resolve: resolve, reject: reject, next: null }; if (back) { back = back.next = request; } else { front = back = request; resume(key, arg); } }); } function resume(key, arg) { try { var result = gen[key](arg); var value = result.value; var wrappedAwait = value instanceof _AwaitValue; Promise.resolve(wrappedAwait ? value.wrapped : value).then(function (arg) { if (wrappedAwait) { resume("next", arg); return; } settle(result.done ? "return" : "normal", arg); }, function (err) { resume("throw", err); }); } catch (err) { settle("throw", err); } } function settle(type, value) { switch (type) { case "return": front.resolve({ value: value, done: true }); break; case "throw": front.reject(value); break; default: front.resolve({ value: value, done: false }); break; } front = front.next; if (front) { resume(front.key, front.arg); } else { back = null; } } this._invoke = send; if (typeof gen["return"] !== "function") { this["return"] = undefined; } } +function _AsyncGenerator(gen) { var front, back; function send(key, arg) { return new Promise(function (resolve, reject) { var request = { key: key, arg: arg, resolve: resolve, reject: reject, next: null }; if (back) { back = back.next = request; } else { front = back = request; resume(key, arg); } }); } function resume(key, arg) { try { var result = gen[key](arg); var value = result.value; var wrappedAwait = value instanceof _AwaitValue; Promise.resolve(wrappedAwait ? value.wrapped : value).then(function (arg) { if (wrappedAwait) { resume(key === "return" ? "return" : "next", arg); return; } settle(result.done ? "return" : "normal", arg); }, function (err) { resume("throw", err); }); } catch (err) { settle("throw", err); } } function settle(type, value) { switch (type) { case "return": front.resolve({ value: value, done: true }); break; case "throw": front.reject(value); break; default: front.resolve({ value: value, done: false }); break; } front = front.next; if (front) { resume(front.key, front.arg); } else { back = null; } } this._invoke = send; if (typeof gen["return"] !== "function") { this["return"] = undefined; } } if (typeof Symbol === "function" && Symbol.asyncIterator) { _AsyncGenerator.prototype[Symbol.asyncIterator] = function () { return this; }; } From 87feda7c2a33b7bde6dc926ced4dd741a90cc860 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?= Date: Tue, 5 Nov 2019 10:15:00 +0100 Subject: [PATCH 040/648] @babel/parser error recovery (#10363) * Add error recovery support to @babel/parser * Update @babel/parser tests to always recover from errors * Update this.raise usage in @babel/parser: - expression.js - lval.js - statement.js - estree.js - flow.js - jsx/index.js - tokenizer/index.js * Update @babel/parser fixtures with recovered errors * Fix tests out of @babel/parser * Do not use try/catch for control flow * Update invalid fixtures * Do not report invalid lhs in toAssignable * Do not validate function id multiple times * Dedupe reserved await errors * Remove duplicate errors about strict reserved bindings * Remove duplicated error about yield/await inside params * Don't error twice for methods in object patterns * Don't report invalid super() twice * Remove dup error about reserved param for expr arrows * Remove double escapes in migrated tests * Dedupe errors about invalid escapes in identifiers * Remove duplicated error about decorated constructor * Remove duplicated error about spread in flow class * Don't throw for invalid super usage * Don't fail for object decorators with stage 2 * Fix flow inexact type errors * Fix flow * Fix errors about escapes in keywords (ref: #10455) * Update after rebase * Fix todo * Remove duplicated error when using += for defaults * Remove unnecessary throw * Nit: use ?? --- .../test/fixtures/parse/output.json | 1 + packages/babel-parser/src/options.js | 4 + .../babel-parser/src/parser/expression.js | 138 +++-- packages/babel-parser/src/parser/index.js | 5 +- packages/babel-parser/src/parser/location.js | 12 +- packages/babel-parser/src/parser/lval.js | 42 +- packages/babel-parser/src/parser/statement.js | 44 +- packages/babel-parser/src/parser/util.js | 63 ++ packages/babel-parser/src/plugins/estree.js | 14 +- packages/babel-parser/src/plugins/flow.js | 488 ++++++++------- .../babel-parser/src/plugins/jsx/index.js | 17 +- .../src/plugins/typescript/index.js | 192 +++--- packages/babel-parser/src/tokenizer/index.js | 113 ++-- packages/babel-parser/src/tokenizer/state.js | 2 + packages/babel-parser/src/util/identifier.js | 16 +- .../fail/7/options.json | 3 - .../fail/7/output.json | 128 ++++ .../fail/8/options.json | 5 +- .../fail/8/output.json | 20 + .../invalid-fn-decl-inside-loop/options.json | 3 - .../invalid-fn-decl-inside-loop/output.json | 125 ++++ .../options.json | 3 - .../output.json | 189 ++++++ .../core/escape-keyword/invalid/options.json | 3 - .../core/escape-keyword/invalid/output.json | 160 +++++ .../non-octal-eight/options.json | 3 - .../non-octal-eight/output.json | 91 +++ .../non-octal-nine/options.json | 3 - .../non-octal-nine/output.json | 91 +++ .../non-octal-float-strict-mode/options.json | 5 +- .../non-octal-float-strict-mode/output.json | 73 +++ .../dupl-bind-2nd-lvl-lex-nested/options.json | 3 - .../dupl-bind-2nd-lvl-lex-nested/output.json | 247 ++++++++ .../scope/dupl-bind-2nd-lvl-lex/options.json | 3 - .../scope/dupl-bind-2nd-lvl-lex/output.json | 229 ++++++++ .../dupl-bind-2nd-lvl-var-nested/options.json | 3 - .../dupl-bind-2nd-lvl-var-nested/output.json | 247 ++++++++ .../scope/dupl-bind-2nd-lvl-var/options.json | 3 - .../scope/dupl-bind-2nd-lvl-var/output.json | 229 ++++++++ .../dupl-bind-catch-arr-destr/options.json | 3 - .../dupl-bind-catch-arr-destr/output.json | 154 +++++ .../dupl-bind-catch-dbl-let/options.json | 3 - .../scope/dupl-bind-catch-dbl-let/output.json | 222 +++++++ .../scope/dupl-bind-catch-func/options.json | 3 - .../scope/dupl-bind-catch-func/output.json | 173 ++++++ .../scope/dupl-bind-catch-let/options.json | 3 - .../scope/dupl-bind-catch-let/output.json | 172 ++++++ .../dupl-bind-catch-obj-destr/options.json | 3 - .../dupl-bind-catch-obj-destr/output.json | 293 +++++++++ .../options.json | 3 - .../dupl-bind-catch-var-arr-destr/output.json | 189 ++++++ .../options.json | 3 - .../dupl-bind-catch-var-obj-destr/output.json | 227 +++++++ .../scope/dupl-bind-class-class/options.json | 3 - .../scope/dupl-bind-class-class/output.json | 166 ++++++ .../scope/dupl-bind-class-const/options.json | 3 - .../scope/dupl-bind-class-const/output.json | 172 ++++++ .../scope/dupl-bind-class-func/options.json | 3 - .../scope/dupl-bind-class-func/output.json | 169 ++++++ .../scope/dupl-bind-class-let/options.json | 3 - .../scope/dupl-bind-class-let/output.json | 172 ++++++ .../scope/dupl-bind-class-var/options.json | 3 - .../scope/dupl-bind-class-var/output.json | 153 +++++ .../scope/dupl-bind-const-const/options.json | 3 - .../scope/dupl-bind-const-const/output.json | 160 +++++ .../scope/dupl-bind-func-gen/options.json | 3 - .../core/scope/dupl-bind-func-gen/output.json | 160 +++++ .../dupl-bind-func-module-sloppy/options.json | 5 +- .../dupl-bind-func-module-sloppy/output.json | 160 +++++ .../scope/dupl-bind-func-module/options.json | 5 +- .../scope/dupl-bind-func-module/output.json | 142 +++++ .../dupl-bind-func-var-sloppy/options.json | 3 - .../dupl-bind-func-var-sloppy/output.json | 178 ++++++ .../scope/dupl-bind-gen-func/options.json | 3 - .../core/scope/dupl-bind-gen-func/output.json | 160 +++++ .../core/scope/dupl-bind-let-let/options.json | 3 - .../core/scope/dupl-bind-let-let/output.json | 122 ++++ .../dupl-bind-nested-let-var/options.json | 3 - .../dupl-bind-nested-let-var/output.json | 176 ++++++ .../fixtures/core/scope/for-var/options.json | 3 - .../fixtures/core/scope/for-var/output.json | 194 ++++++ .../undecl-export-as-default/options.json | 5 +- .../undecl-export-as-default/output.json | 106 ++++ .../core/scope/undecl-export-as/options.json | 5 +- .../core/scope/undecl-export-as/output.json | 158 +++++ .../scope/undecl-export-block/options.json | 5 +- .../scope/undecl-export-block/output.json | 176 ++++++ .../undecl-export-builtin-as/options.json | 5 +- .../undecl-export-builtin-as/output.json | 106 ++++ .../scope/undecl-export-builtin/options.json | 5 +- .../scope/undecl-export-builtin/output.json | 106 ++++ .../core/scope/undecl-export-if/options.json | 5 +- .../core/scope/undecl-export-if/output.json | 191 ++++++ .../core/scope/undecl-export/options.json | 5 +- .../core/scope/undecl-export/output.json | 106 ++++ .../core/uncategorised/108/options.json | 3 - .../core/uncategorised/108/output.json | 112 ++++ .../core/uncategorised/347/options.json | 4 +- .../core/uncategorised/349/options.json | 3 - .../core/uncategorised/349/output.json | 73 +++ .../core/uncategorised/350/options.json | 3 - .../core/uncategorised/350/output.json | 73 +++ .../core/uncategorised/351/options.json | 3 - .../core/uncategorised/351/output.json | 73 +++ .../core/uncategorised/354/options.json | 3 - .../core/uncategorised/354/output.json | 73 +++ .../core/uncategorised/361/options.json | 3 - .../core/uncategorised/361/output.json | 70 +++ .../core/uncategorised/362/options.json | 3 - .../core/uncategorised/362/output.json | 70 +++ .../core/uncategorised/363/options.json | 3 - .../core/uncategorised/363/output.json | 70 +++ .../core/uncategorised/366/options.json | 3 - .../core/uncategorised/366/output.json | 109 ++++ .../core/uncategorised/367/options.json | 3 - .../core/uncategorised/367/output.json | 109 ++++ .../core/uncategorised/368/options.json | 3 - .../core/uncategorised/368/output.json | 122 ++++ .../core/uncategorised/369/options.json | 3 - .../core/uncategorised/369/output.json | 149 +++++ .../core/uncategorised/370/options.json | 3 - .../core/uncategorised/370/output.json | 90 +++ .../core/uncategorised/371/options.json | 3 - .../core/uncategorised/371/output.json | 90 +++ .../core/uncategorised/372/options.json | 3 - .../core/uncategorised/372/output.json | 90 +++ .../core/uncategorised/373/options.json | 3 - .../core/uncategorised/373/output.json | 90 +++ .../core/uncategorised/374/options.json | 3 - .../core/uncategorised/374/output.json | 196 ++++++ .../core/uncategorised/382/options.json | 3 - .../core/uncategorised/382/output.json | 108 ++++ .../core/uncategorised/383/options.json | 3 - .../core/uncategorised/383/output.json | 142 +++++ .../core/uncategorised/384/options.json | 3 - .../core/uncategorised/384/output.json | 123 ++++ .../core/uncategorised/397/options.json | 3 - .../core/uncategorised/397/output.json | 108 ++++ .../core/uncategorised/398/options.json | 3 - .../core/uncategorised/398/output.json | 108 ++++ .../core/uncategorised/399/options.json | 3 - .../core/uncategorised/399/output.json | 108 ++++ .../core/uncategorised/400/options.json | 3 - .../core/uncategorised/400/output.json | 108 ++++ .../core/uncategorised/401/options.json | 3 - .../core/uncategorised/401/output.json | 90 +++ .../core/uncategorised/402/options.json | 3 - .../core/uncategorised/402/output.json | 90 +++ .../core/uncategorised/403/options.json | 3 - .../core/uncategorised/403/output.json | 90 +++ .../core/uncategorised/404/options.json | 3 - .../core/uncategorised/404/output.json | 90 +++ .../core/uncategorised/409/options.json | 3 - .../core/uncategorised/409/output.json | 54 ++ .../core/uncategorised/411/options.json | 3 - .../core/uncategorised/411/output.json | 54 ++ .../core/uncategorised/417/options.json | 3 - .../core/uncategorised/417/output.json | 137 +++++ .../core/uncategorised/418/options.json | 3 - .../core/uncategorised/418/output.json | 118 ++++ .../core/uncategorised/425/options.json | 3 - .../core/uncategorised/425/output.json | 72 +++ .../core/uncategorised/427/options.json | 3 - .../core/uncategorised/427/output.json | 106 ++++ .../core/uncategorised/446/options.json | 3 - .../core/uncategorised/446/output.json | 71 +++ .../core/uncategorised/447/options.json | 3 - .../core/uncategorised/447/output.json | 70 +++ .../core/uncategorised/448/options.json | 3 - .../core/uncategorised/448/output.json | 70 +++ .../core/uncategorised/449/options.json | 3 - .../core/uncategorised/449/output.json | 70 +++ .../core/uncategorised/453/options.json | 4 +- .../core/uncategorised/454/options.json | 3 - .../core/uncategorised/454/output.json | 54 ++ .../core/uncategorised/455/options.json | 3 - .../core/uncategorised/455/output.json | 54 ++ .../core/uncategorised/456/options.json | 3 - .../core/uncategorised/456/output.json | 54 ++ .../core/uncategorised/457/options.json | 3 - .../core/uncategorised/457/output.json | 106 ++++ .../core/uncategorised/459/options.json | 3 - .../core/uncategorised/459/output.json | 119 ++++ .../core/uncategorised/460/options.json | 3 - .../core/uncategorised/460/output.json | 119 ++++ .../core/uncategorised/461/options.json | 3 - .../core/uncategorised/461/output.json | 207 +++++++ .../core/uncategorised/462/options.json | 3 - .../core/uncategorised/462/output.json | 207 +++++++ .../core/uncategorised/463/options.json | 3 - .../core/uncategorised/463/output.json | 191 ++++++ .../core/uncategorised/464/options.json | 3 - .../core/uncategorised/464/output.json | 191 ++++++ .../core/uncategorised/465/options.json | 3 - .../core/uncategorised/465/output.json | 199 +++++++ .../core/uncategorised/466/options.json | 3 - .../core/uncategorised/466/output.json | 195 ++++++ .../core/uncategorised/467/options.json | 3 - .../core/uncategorised/467/output.json | 193 ++++++ .../core/uncategorised/468/options.json | 3 - .../core/uncategorised/468/output.json | 197 +++++++ .../core/uncategorised/469/options.json | 3 - .../core/uncategorised/469/output.json | 197 +++++++ .../core/uncategorised/470/options.json | 3 - .../core/uncategorised/470/output.json | 209 +++++++ .../core/uncategorised/471/options.json | 3 - .../core/uncategorised/471/output.json | 209 +++++++ .../core/uncategorised/472/options.json | 3 - .../core/uncategorised/472/output.json | 195 ++++++ .../core/uncategorised/473/options.json | 3 - .../core/uncategorised/473/output.json | 195 ++++++ .../core/uncategorised/474/options.json | 3 - .../core/uncategorised/474/output.json | 176 ++++++ .../core/uncategorised/475/options.json | 3 - .../core/uncategorised/475/output.json | 176 ++++++ .../core/uncategorised/476/options.json | 3 - .../core/uncategorised/476/output.json | 176 ++++++ .../core/uncategorised/477/options.json | 3 - .../core/uncategorised/477/output.json | 176 ++++++ .../core/uncategorised/478/options.json | 3 - .../core/uncategorised/478/output.json | 176 ++++++ .../core/uncategorised/479/options.json | 3 - .../core/uncategorised/479/output.json | 176 ++++++ .../core/uncategorised/480/options.json | 3 - .../core/uncategorised/480/output.json | 176 ++++++ .../core/uncategorised/481/options.json | 3 - .../core/uncategorised/481/output.json | 176 ++++++ .../core/uncategorised/482/options.json | 3 - .../core/uncategorised/482/output.json | 179 ++++++ .../core/uncategorised/483/options.json | 3 - .../core/uncategorised/483/output.json | 179 ++++++ .../core/uncategorised/484/options.json | 3 - .../core/uncategorised/484/output.json | 126 ++++ .../core/uncategorised/485/options.json | 3 - .../core/uncategorised/485/output.json | 126 ++++ .../core/uncategorised/486/options.json | 3 - .../core/uncategorised/486/output.json | 214 +++++++ .../core/uncategorised/487/options.json | 3 - .../core/uncategorised/487/output.json | 214 +++++++ .../core/uncategorised/488/options.json | 3 - .../core/uncategorised/488/output.json | 161 +++++ .../core/uncategorised/489/options.json | 3 - .../core/uncategorised/489/output.json | 161 +++++ .../core/uncategorised/490/options.json | 3 - .../core/uncategorised/490/output.json | 250 ++++++++ .../core/uncategorised/491/options.json | 3 - .../core/uncategorised/491/output.json | 161 +++++ .../core/uncategorised/492/options.json | 3 - .../core/uncategorised/492/output.json | 292 +++++++++ .../core/uncategorised/493/options.json | 3 - .../core/uncategorised/493/output.json | 237 ++++++++ .../core/uncategorised/494/options.json | 3 - .../core/uncategorised/494/output.json | 268 +++++++++ .../core/uncategorised/495/options.json | 3 - .../core/uncategorised/495/output.json | 144 +++++ .../core/uncategorised/496/options.json | 3 - .../core/uncategorised/496/output.json | 144 +++++ .../core/uncategorised/497/options.json | 3 - .../core/uncategorised/497/output.json | 197 +++++++ .../core/uncategorised/498/options.json | 3 - .../core/uncategorised/498/output.json | 197 +++++++ .../core/uncategorised/499/options.json | 3 - .../core/uncategorised/499/output.json | 162 +++++ .../core/uncategorised/500/options.json | 3 - .../core/uncategorised/500/output.json | 163 +++++ .../core/uncategorised/501/options.json | 3 - .../core/uncategorised/501/output.json | 221 +++++++ .../core/uncategorised/502/options.json | 3 - .../core/uncategorised/502/output.json | 221 +++++++ .../core/uncategorised/503/options.json | 3 - .../core/uncategorised/503/output.json | 215 +++++++ .../core/uncategorised/504/options.json | 3 - .../core/uncategorised/504/output.json | 178 ++++++ .../core/uncategorised/505/options.json | 3 - .../core/uncategorised/505/output.json | 178 ++++++ .../core/uncategorised/506/options.json | 3 - .../core/uncategorised/506/output.json | 178 ++++++ .../core/uncategorised/507/options.json | 3 - .../core/uncategorised/507/output.json | 178 ++++++ .../core/uncategorised/508/options.json | 3 - .../core/uncategorised/508/output.json | 178 ++++++ .../core/uncategorised/509/options.json | 3 - .../core/uncategorised/509/output.json | 178 ++++++ .../core/uncategorised/510/options.json | 3 - .../core/uncategorised/510/output.json | 178 ++++++ .../core/uncategorised/511/options.json | 3 - .../core/uncategorised/511/output.json | 144 +++++ .../core/uncategorised/512/options.json | 3 - .../core/uncategorised/512/output.json | 126 ++++ .../core/uncategorised/513/options.json | 3 - .../core/uncategorised/513/output.json | 126 ++++ .../core/uncategorised/514/options.json | 3 - .../core/uncategorised/514/output.json | 161 +++++ .../core/uncategorised/515/options.json | 3 - .../core/uncategorised/515/output.json | 144 +++++ .../core/uncategorised/516/options.json | 3 - .../core/uncategorised/516/output.json | 144 +++++ .../core/uncategorised/517/options.json | 3 - .../core/uncategorised/517/output.json | 229 ++++++++ .../core/uncategorised/518/options.json | 3 - .../core/uncategorised/518/output.json | 180 ++++++ .../core/uncategorised/519/options.json | 3 - .../core/uncategorised/519/output.json | 233 ++++++++ .../core/uncategorised/520/options.json | 3 - .../core/uncategorised/520/output.json | 163 +++++ .../core/uncategorised/521/options.json | 3 - .../core/uncategorised/521/output.json | 163 +++++ .../core/uncategorised/522/options.json | 3 - .../core/uncategorised/522/output.json | 285 +++++++++ .../core/uncategorised/523/options.json | 3 - .../core/uncategorised/523/output.json | 108 ++++ .../core/uncategorised/524/options.json | 3 - .../core/uncategorised/524/output.json | 73 +++ .../core/uncategorised/544/options.json | 3 - .../core/uncategorised/544/output.json | 212 +++++++ .../core/uncategorised/545/options.json | 5 +- .../core/uncategorised/545/output.json | 176 ++++++ .../core/uncategorised/547/options.json | 3 - .../core/uncategorised/547/output.json | 213 +++++++ .../core/uncategorised/548/options.json | 5 +- .../core/uncategorised/548/output.json | 177 ++++++ .../core/uncategorised/550/options.json | 3 - .../core/uncategorised/550/output.json | 144 +++++ .../core/uncategorised/552/options.json | 3 - .../core/uncategorised/552/output.json | 144 +++++ .../core/uncategorised/556/options.json | 5 +- .../core/uncategorised/556/output.json | 228 +++++++ .../core/uncategorised/558/options.json | 5 +- .../core/uncategorised/558/output.json | 134 +++++ .../comma-after-rest/options.json | 3 - .../comma-after-rest/output.json | 137 +++++ .../comma-after-spread-for-in/options.json | 3 - .../comma-after-spread-for-in/output.json | 136 +++++ .../comma-after-spread-nested/options.json | 3 - .../comma-after-spread-nested/output.json | 154 +++++ .../comma-after-rest-param/options.json | 4 +- .../options.json | 3 - .../direct-super-in-object-method/output.json | 340 +++++++++++ .../options.json | 3 - .../output.json | 191 ++++++ .../options.json | 3 - .../output.json | 179 ++++++ .../options.json | 3 - .../output.json | 144 +++++ .../disallow-static-prototype/options.json | 3 - .../disallow-static-prototype/output.json | 144 +++++ .../getter-signature/options.json | 3 - .../getter-signature/output.json | 162 +++++ .../malformed-super-expression/options.json | 3 - .../malformed-super-expression/output.json | 211 +++++++ .../es2015/class/extends-strict/options.json | 3 - .../es2015/class/extends-strict/output.json | 237 ++++++++ .../destructuring/binding-this/input.js | 2 +- .../destructuring/binding-this/options.json | 3 - .../destructuring/binding-this/output.json | 159 +++++ .../error-operator-for-default/options.json | 3 - .../error-operator-for-default/output.json | 156 +++++ .../parenthesized-lhs-array/options.json | 3 - .../parenthesized-lhs-array/output.json | 127 ++++ .../parenthesized-lhs-object/options.json | 3 - .../parenthesized-lhs-object/output.json | 165 ++++++ .../for-in/bare-initializer/options.json | 3 - .../for-in/bare-initializer/output.json | 187 ++++++ .../for-in/const-initializer/options.json | 3 - .../for-in/const-initializer/output.json | 154 +++++ .../for-in/let-initializer/options.json | 3 - .../es2015/for-in/let-initializer/output.json | 154 +++++ .../for-in/strict-initializer/options.json | 3 - .../for-in/strict-initializer/output.json | 190 ++++++ .../options.json | 3 - .../output.json | 171 ++++++ .../options.json | 3 - .../output.json | 209 +++++++ .../for-of/bare-initializer/options.json | 3 - .../for-of/bare-initializer/output.json | 188 ++++++ .../generators/invalid-escape-yield/input.js | 2 +- .../invalid-escape-yield/options.json | 3 - .../invalid-escape-yield/output.json | 126 ++++ .../generators/invalid-hanging/options.json | 3 - .../generators/invalid-hanging/output.json | 126 ++++ .../invalid-escape-seq-const/input.js | 2 + .../invalid-escape-seq-const/options.json | 3 - .../invalid-escape-seq-const/output.json | 180 ++++++ .../invalid-escape-seq-export/input.js | 3 + .../invalid-escape-seq-export/options.json | 4 +- .../invalid-escape-seq-export/output.json | 229 ++++++++ .../invalid-escape-seq-if/options.json | 3 - .../invalid-escape-seq-if/output.json | 87 +++ .../invalid-escape-seq-import/input.js | 2 + .../invalid-escape-seq-import/options.json | 4 +- .../invalid-escape-seq-import/output.json | 146 +++++ .../invalid-escape-seq-null/options.json | 3 - .../invalid-escape-seq-null/output.json | 68 +++ .../invalid-escape-seq-true/options.json | 3 - .../invalid-escape-seq-true/output.json | 69 +++ .../options.json | 3 - .../let-as-identifier-strict-fail/output.json | 142 +++++ .../let-at-binding-list-fail-1/options.json | 3 - .../let-at-binding-list-fail-1/output.json | 159 +++++ .../let-at-binding-list-fail-2/options.json | 3 - .../let-at-binding-list-fail-2/output.json | 159 +++++ .../let-at-binding-list-fail-3/options.json | 3 - .../let-at-binding-list-fail-3/output.json | 121 ++++ .../let-at-binding-list-fail-4/options.json | 3 - .../let-at-binding-list-fail-4/output.json | 121 ++++ .../let-at-binding-list-fail-5/options.json | 3 - .../let-at-binding-list-fail-5/output.json | 89 +++ .../let-at-binding-list-fail-6/options.json | 3 - .../let-at-binding-list-fail-6/output.json | 108 ++++ .../let/let-at-catch-block/options.json | 3 - .../es2015/let/let-at-catch-block/output.json | 172 ++++++ .../invalid-arrow-function/options.json | 3 - .../invalid-arrow-function/output.json | 189 ++++++ .../meta-properties/new-invalid-prop/input.js | 4 +- .../new-invalid-prop/options.json | 3 - .../new-invalid-prop/output.json | 155 +++++ .../options.json | 3 - .../output.json | 155 +++++ .../options.json | 3 - .../output.json | 155 +++++ .../new-target-invalid/options.json | 3 - .../new-target-invalid/output.json | 102 ++++ .../options.json | 4 +- .../output.json | 173 ++++++ .../duplicate-export-default/options.json | 4 +- .../duplicate-export-default/output.json | 135 +++++ .../options.json | 4 +- .../output.json | 187 ++++++ .../options.json | 5 +- .../output.json | 280 +++++++++ .../options.json | 3 - .../output.json | 331 +++++++++++ .../options.json | 3 - .../output.json | 521 ++++++++++++++++ .../options.json | 3 - .../output.json | 504 ++++++++++++++++ .../options.json | 3 - .../output.json | 556 ++++++++++++++++++ .../options.json | 3 - .../output.json | 262 +++++++++ .../options.json | 3 - .../output.json | 262 +++++++++ .../options.json | 3 - .../output.json | 259 ++++++++ .../options.json | 3 - .../output.json | 259 ++++++++ .../options.json | 3 - .../output.json | 293 +++++++++ .../options.json | 3 - .../output.json | 311 ++++++++++ .../options.json | 3 - .../output.json | 262 +++++++++ .../options.json | 3 - .../output.json | 262 +++++++++ .../options.json | 3 - .../output.json | 224 +++++++ .../options.json | 3 - .../output.json | 224 +++++++ .../options.json | 3 - .../output.json | 279 +++++++++ .../options.json | 3 - .../output.json | 279 +++++++++ .../options.json | 3 - .../output.json | 259 ++++++++ .../options.json | 3 - .../output.json | 221 +++++++ .../options.json | 4 +- .../output.json | 190 ++++++ .../options.json | 4 +- .../output.json | 190 ++++++ .../duplicate-named-export/options.json | 4 +- .../duplicate-named-export/output.json | 176 ++++++ .../import-invalid-keyword-flow/options.json | 8 +- .../import-invalid-keyword-flow/output.json | 126 ++++ .../options.json | 8 +- .../output.json | 126 ++++ .../options.json | 4 +- .../import-invalid-keyword-typeof/output.json | 124 ++++ .../import-invalid-keyword/options.json | 4 +- .../import-invalid-keyword/output.json | 124 ++++ .../options.json | 3 - .../output.json | 165 ++++++ .../es2015/regex/duplicate-flags/options.json | 3 - .../es2015/regex/duplicate-flags/output.json | 73 +++ .../fixtures/es2015/shorthand/1/options.json | 3 - .../fixtures/es2015/shorthand/1/output.json | 164 ++++++ .../fixtures/es2015/shorthand/2/options.json | 3 - .../fixtures/es2015/shorthand/2/output.json | 240 ++++++++ .../label-invalid-const/options.json | 3 - .../label-invalid-const/output.json | 135 +++++ .../label-invalid-func-async/options.json | 3 - .../label-invalid-func-async/output.json | 122 ++++ .../label-invalid-func-generator/options.json | 3 - .../label-invalid-func-generator/output.json | 122 ++++ .../label-invalid-func-strict/options.json | 3 - .../label-invalid-func-strict/output.json | 211 +++++++ .../es2015/uncategorised/109/options.json | 3 - .../es2015/uncategorised/109/output.json | 207 +++++++ .../es2015/uncategorised/123/options.json | 3 - .../es2015/uncategorised/123/output.json | 246 ++++++++ .../es2015/uncategorised/125/input.js | 2 +- .../es2015/uncategorised/125/options.json | 3 - .../es2015/uncategorised/125/output.json | 203 +++++++ .../es2015/uncategorised/126/options.json | 3 - .../es2015/uncategorised/126/output.json | 144 +++++ .../es2015/uncategorised/127/options.json | 3 - .../es2015/uncategorised/127/output.json | 144 +++++ .../es2015/uncategorised/166/options.json | 3 - .../es2015/uncategorised/166/output.json | 180 ++++++ .../es2015/uncategorised/198/options.json | 3 - .../es2015/uncategorised/198/output.json | 73 +++ .../es2015/uncategorised/200/options.json | 3 - .../es2015/uncategorised/200/output.json | 73 +++ .../es2015/uncategorised/201/options.json | 3 - .../es2015/uncategorised/201/output.json | 73 +++ .../es2015/uncategorised/202/options.json | 3 - .../es2015/uncategorised/202/output.json | 73 +++ .../es2015/uncategorised/204/options.json | 3 - .../es2015/uncategorised/204/output.json | 73 +++ .../es2015/uncategorised/205/options.json | 3 - .../es2015/uncategorised/205/output.json | 73 +++ .../es2015/uncategorised/206/options.json | 3 - .../es2015/uncategorised/206/output.json | 73 +++ .../es2015/uncategorised/208/options.json | 3 - .../es2015/uncategorised/208/output.json | 73 +++ .../es2015/uncategorised/209/options.json | 3 - .../es2015/uncategorised/209/output.json | 73 +++ .../es2015/uncategorised/210/options.json | 3 - .../es2015/uncategorised/210/output.json | 73 +++ .../es2015/uncategorised/211/options.json | 3 - .../es2015/uncategorised/211/output.json | 73 +++ .../es2015/uncategorised/213/options.json | 3 - .../es2015/uncategorised/213/output.json | 73 +++ .../es2015/uncategorised/214/options.json | 3 - .../es2015/uncategorised/214/output.json | 73 +++ .../es2015/uncategorised/215/options.json | 3 - .../es2015/uncategorised/215/output.json | 73 +++ .../es2015/uncategorised/216/options.json | 4 +- .../es2015/uncategorised/217/options.json | 3 - .../es2015/uncategorised/217/output.json | 73 +++ .../es2015/uncategorised/218/options.json | 3 - .../es2015/uncategorised/218/output.json | 73 +++ .../es2015/uncategorised/219/options.json | 3 - .../es2015/uncategorised/219/output.json | 73 +++ .../es2015/uncategorised/220/options.json | 3 - .../es2015/uncategorised/220/output.json | 120 ++++ .../es2015/uncategorised/221/options.json | 3 - .../es2015/uncategorised/221/output.json | 126 ++++ .../es2015/uncategorised/222/input.js | 2 +- .../es2015/uncategorised/222/options.json | 3 - .../es2015/uncategorised/222/output.json | 165 ++++++ .../es2015/uncategorised/223/input.js | 2 +- .../es2015/uncategorised/223/options.json | 3 - .../es2015/uncategorised/223/output.json | 166 ++++++ .../es2015/uncategorised/226/options.json | 3 - .../es2015/uncategorised/226/output.json | 90 +++ .../es2015/uncategorised/227/options.json | 3 - .../es2015/uncategorised/227/output.json | 292 +++++++++ .../es2015/uncategorised/228/options.json | 3 - .../es2015/uncategorised/228/output.json | 254 ++++++++ .../es2015/uncategorised/229/options.json | 3 - .../es2015/uncategorised/229/output.json | 89 +++ .../es2015/uncategorised/230/options.json | 3 - .../es2015/uncategorised/230/output.json | 89 +++ .../es2015/uncategorised/231/options.json | 3 - .../es2015/uncategorised/231/output.json | 89 +++ .../es2015/uncategorised/232/input.js | 2 +- .../es2015/uncategorised/232/options.json | 3 - .../es2015/uncategorised/232/output.json | 108 ++++ .../es2015/uncategorised/233/input.js | 2 +- .../es2015/uncategorised/233/options.json | 3 - .../es2015/uncategorised/233/output.json | 195 ++++++ .../es2015/uncategorised/234/input.js | 2 +- .../es2015/uncategorised/234/options.json | 3 - .../es2015/uncategorised/234/output.json | 195 ++++++ .../es2015/uncategorised/235/options.json | 3 - .../es2015/uncategorised/235/output.json | 206 +++++++ .../es2015/uncategorised/236/options.json | 3 - .../es2015/uncategorised/236/output.json | 207 +++++++ .../es2015/uncategorised/242/options.json | 3 - .../es2015/uncategorised/242/output.json | 182 ++++++ .../es2015/uncategorised/243/options.json | 3 - .../es2015/uncategorised/243/output.json | 146 +++++ .../es2015/uncategorised/244/options.json | 3 - .../es2015/uncategorised/244/output.json | 146 +++++ .../es2015/uncategorised/245/options.json | 3 - .../es2015/uncategorised/245/output.json | 163 +++++ .../es2015/uncategorised/246/options.json | 3 - .../es2015/uncategorised/246/output.json | 163 +++++ .../es2015/uncategorised/247/options.json | 3 - .../es2015/uncategorised/247/output.json | 198 +++++++ .../es2015/uncategorised/248/options.json | 3 - .../es2015/uncategorised/248/output.json | 163 +++++ .../es2015/uncategorised/249/options.json | 3 - .../es2015/uncategorised/249/output.json | 146 +++++ .../es2015/uncategorised/251/options.json | 3 - .../es2015/uncategorised/251/output.json | 113 ++++ .../es2015/uncategorised/252/options.json | 3 - .../es2015/uncategorised/252/output.json | 134 +++++ .../es2015/uncategorised/280/options.json | 3 - .../es2015/uncategorised/280/output.json | 216 +++++++ .../es2015/uncategorised/281/options.json | 3 - .../es2015/uncategorised/281/output.json | 392 ++++++++++++ .../es2015/uncategorised/284/options.json | 3 - .../es2015/uncategorised/284/output.json | 127 ++++ .../es2015/uncategorised/289/options.json | 3 - .../es2015/uncategorised/289/output.json | 184 ++++++ .../es2015/uncategorised/290/options.json | 3 - .../es2015/uncategorised/290/output.json | 165 ++++++ .../es2015/uncategorised/291/options.json | 3 - .../es2015/uncategorised/291/output.json | 111 ++++ .../es2015/uncategorised/296/options.json | 3 - .../es2015/uncategorised/296/output.json | 146 +++++ .../es2015/uncategorised/297/options.json | 3 - .../es2015/uncategorised/297/output.json | 179 ++++++ .../es2015/uncategorised/298/options.json | 3 - .../es2015/uncategorised/298/output.json | 166 ++++++ .../es2015/uncategorised/324/options.json | 3 - .../es2015/uncategorised/324/output.json | 106 ++++ .../es2015/uncategorised/325/options.json | 3 - .../es2015/uncategorised/325/output.json | 106 ++++ .../es2015/uncategorised/329/options.json | 3 - .../es2015/uncategorised/329/output.json | 126 ++++ .../es2015/uncategorised/332/options.json | 3 - .../es2015/uncategorised/332/output.json | 171 ++++++ .../es2015/uncategorised/333/options.json | 3 - .../es2015/uncategorised/333/output.json | 231 ++++++++ .../es2015/uncategorised/334/options.json | 5 +- .../es2015/uncategorised/334/output.json | 135 +++++ .../es2015/uncategorised/339/options.json | 3 - .../es2015/uncategorised/339/output.json | 91 +++ .../es2015/uncategorised/344/options.json | 3 - .../es2015/uncategorised/344/output.json | 69 +++ .../es2015/uncategorised/347/options.json | 3 - .../es2015/uncategorised/347/output.json | 179 ++++++ .../es2015/uncategorised/348/options.json | 3 - .../es2015/uncategorised/348/output.json | 184 ++++++ .../es2015/uncategorised/349/options.json | 3 - .../es2015/uncategorised/349/output.json | 187 ++++++ .../es2015/uncategorised/357/options.json | 5 +- .../es2015/uncategorised/357/output.json | 119 ++++ .../es2015/uncategorised/359/options.json | 5 +- .../es2015/uncategorised/359/output.json | 121 ++++ .../es2015/uncategorised/361/options.json | 5 +- .../es2015/uncategorised/361/output.json | 176 ++++++ .../es2015/uncategorised/363/options.json | 5 +- .../es2015/uncategorised/363/output.json | 163 +++++ .../es2015/uncategorised/365/options.json | 5 +- .../es2015/uncategorised/365/output.json | 90 +++ .../es2015/uncategorised/367/options.json | 5 +- .../es2015/uncategorised/367/output.json | 87 +++ .../es2015/uncategorised/368/options.json | 5 +- .../es2015/uncategorised/368/output.json | 119 ++++ .../es2015/uncategorised/369/options.json | 5 +- .../es2015/uncategorised/369/output.json | 119 ++++ .../es2015/uncategorised/37/options.json | 3 - .../es2015/uncategorised/37/output.json | 160 +++++ .../es2015/uncategorised/370/options.json | 5 +- .../es2015/uncategorised/370/output.json | 121 ++++ .../es2015/uncategorised/371/options.json | 5 +- .../es2015/uncategorised/371/output.json | 121 ++++ .../es2015/uncategorised/372/options.json | 5 +- .../es2015/uncategorised/372/output.json | 176 ++++++ .../es2015/uncategorised/373/options.json | 5 +- .../es2015/uncategorised/373/output.json | 176 ++++++ .../es2015/uncategorised/374/options.json | 5 +- .../es2015/uncategorised/374/output.json | 163 +++++ .../es2015/uncategorised/375/options.json | 5 +- .../es2015/uncategorised/375/output.json | 163 +++++ .../es2015/uncategorised/376/options.json | 5 +- .../es2015/uncategorised/376/output.json | 90 +++ .../es2015/uncategorised/377/options.json | 5 +- .../es2015/uncategorised/377/output.json | 90 +++ .../es2015/uncategorised/378/options.json | 5 +- .../es2015/uncategorised/378/output.json | 87 +++ .../es2015/uncategorised/379/options.json | 5 +- .../es2015/uncategorised/379/output.json | 87 +++ .../es2015/uncategorised/395/options.json | 5 +- .../es2015/uncategorised/395/output.json | 160 +++++ .../options.json | 3 - .../output.json | 143 +++++ .../options.json | 3 - .../output.json | 122 ++++ .../function-name-strict-body/options.json | 3 - .../function-name-strict-body/output.json | 126 ++++ .../yield/function-name-strict/options.json | 3 - .../yield/function-name-strict/output.json | 126 ++++ .../yield/in-class-heritage/options.json | 4 +- .../yield/in-iterator-stmt/options.json | 4 +- .../options.json | 3 - .../output.json | 192 ++++++ .../options.json | 3 - .../output.json | 331 +++++++++++ .../options.json | 3 - .../output.json | 208 +++++++ .../options.json | 3 - .../output.json | 261 ++++++++ .../options.json | 3 - .../output.json | 230 ++++++++ .../options.json | 3 - .../output.json | 196 ++++++ .../options.json | 3 - .../output.json | 180 ++++++ .../options.json | 3 - .../output.json | 140 +++++ .../parameter-default-strict/options.json | 3 - .../parameter-default-strict/output.json | 176 ++++++ .../options.json | 3 - .../output.json | 161 +++++ .../options.json | 3 - .../output.json | 177 ++++++ .../options.json | 3 - .../output.json | 195 ++++++ .../options.json | 3 - .../output.json | 148 +++++ .../parameter-name-generator/options.json | 3 - .../parameter-name-generator/output.json | 108 ++++ .../parameter-name-strict-body/options.json | 3 - .../parameter-name-strict-body/output.json | 144 +++++ .../yield/parameter-name-strict/options.json | 3 - .../yield/parameter-name-strict/output.json | 144 +++++ .../options.json | 3 - .../output.json | 157 +++++ .../exponentiation-operator/10/options.json | 3 - .../exponentiation-operator/10/output.json | 126 ++++ .../exponentiation-operator/11/options.json | 3 - .../exponentiation-operator/11/output.json | 128 ++++ .../exponentiation-operator/12/options.json | 3 - .../exponentiation-operator/12/output.json | 130 ++++ .../exponentiation-operator/15/options.json | 5 +- .../exponentiation-operator/15/output.json | 141 +++++ .../exponentiation-operator/16/options.json | 5 +- .../exponentiation-operator/16/output.json | 141 +++++ .../array-pattern-default/options.json | 3 - .../array-pattern-default/output.json | 209 +++++++ .../array-pattern/options.json | 3 - .../array-pattern/output.json | 178 ++++++ .../arrow-function/options.json | 3 - .../arrow-function/output.json | 209 +++++++ .../async-arrow-function/options.json | 3 - .../async-arrow-function/output.json | 209 +++++++ .../async-function/options.json | 3 - .../async-function/output.json | 175 ++++++ .../default/options.json | 3 - .../simple-parameter-list/default/output.json | 175 ++++++ .../generator-function/options.json | 3 - .../generator-function/output.json | 175 ++++++ .../generator-method/options.json | 3 - .../generator-method/output.json | 246 ++++++++ .../simple-parameter-list/method/options.json | 3 - .../simple-parameter-list/method/output.json | 246 ++++++++ .../object-pattern-default/options.json | 3 - .../object-pattern-default/output.json | 285 +++++++++ .../object-pattern/options.json | 3 - .../object-pattern/output.json | 254 ++++++++ .../simple-parameter-list/rest/options.json | 3 - .../simple-parameter-list/rest/output.json | 159 +++++ .../es2017/async-functions/2/options.json | 3 - .../es2017/async-functions/2/output.json | 154 +++++ .../options.json | 3 - .../output.json | 109 ++++ .../options.json | 3 - .../output.json | 231 ++++++++ .../options.json | 3 - .../output.json | 143 +++++ .../options.json | 3 - .../output.json | 277 +++++++++ .../options.json | 3 - .../output.json | 210 +++++++ .../options.json | 3 - .../output.json | 210 +++++++ .../await-inside-parameters/options.json | 3 - .../await-inside-parameters/output.json | 158 +++++ .../invalid-escape-await/options.json | 4 +- .../invalid-inside-loop/options.json | 3 - .../invalid-inside-loop/output.json | 125 ++++ .../no-constructor/options.json | 3 - .../no-constructor/output.json | 144 +++++ .../options.json | 3 - .../output.json | 122 ++++ .../es2018/object-rest-spread/11/options.json | 5 +- .../es2018/object-rest-spread/11/output.json | 297 ++++++++++ .../es2018/object-rest-spread/12/options.json | 5 +- .../es2018/object-rest-spread/12/output.json | 297 ++++++++++ .../es2018/object-rest-spread/13/options.json | 5 +- .../es2018/object-rest-spread/13/output.json | 349 +++++++++++ .../es2018/object-rest-spread/14/options.json | 5 +- .../es2018/object-rest-spread/14/output.json | 331 +++++++++++ .../es2018/object-rest-spread/15/options.json | 5 +- .../es2018/object-rest-spread/15/output.json | 348 +++++++++++ .../es2018/object-rest-spread/18/options.json | 3 - .../es2018/object-rest-spread/18/output.json | 137 +++++ .../es2018/object-rest-spread/21/options.json | 3 - .../es2018/object-rest-spread/21/output.json | 173 ++++++ .../es2018/object-rest-spread/24/options.json | 3 - .../es2018/object-rest-spread/24/output.json | 137 +++++ .../es2018/object-rest-spread/8/options.json | 3 - .../es2018/object-rest-spread/8/output.json | 250 ++++++++ .../dupe-param/options.json | 3 - .../dupe-param/output.json | 161 +++++ .../invalid-dup-param/options.json | 3 - .../invalid-dup-param/output.json | 193 ++++++ .../dupe-param-1/options.json | 3 - .../dupe-param-1/output.json | 178 ++++++ .../dupe-param-2/options.json | 3 - .../dupe-param-2/output.json | 193 ++++++ .../dupe-param-3/options.json | 3 - .../dupe-param-3/output.json | 248 ++++++++ .../options.json | 3 - .../output.json | 159 +++++ .../invalid-duplicated-params/options.json | 3 - .../invalid-duplicated-params/output.json | 124 ++++ .../invalid-param-strict-mode/options.json | 3 - .../invalid-param-strict-mode/output.json | 143 +++++ .../options.json | 3 - .../output.json | 198 +++++++ .../options.json | 3 - .../output.json | 166 ++++++ .../options.json | 3 - .../output.json | 538 +++++++++++++++++ .../invalid-lhs-01/options.json | 3 - .../invalid-lhs-01/output.json | 160 +++++ .../invalid-lhs-02/options.json | 3 - .../invalid-lhs-02/output.json | 160 +++++ .../invalid-pattern-with-method/input.js | 2 +- .../invalid-pattern-with-method/options.json | 3 - .../invalid-pattern-with-method/output.json | 166 ++++++ .../invalid-group-assignment/options.json | 3 - .../invalid-group-assignment/output.json | 179 ++++++ .../invalid-export-named-default/options.json | 5 +- .../invalid-export-named-default/output.json | 107 ++++ .../invalid-const-init/options.json | 3 - .../invalid-const-init/output.json | 156 +++++ .../invalid-let-init/options.json | 3 - .../invalid-let-init/output.json | 156 +++++ .../invalid-lhs-init/options.json | 3 - .../invalid-lhs-init/output.json | 101 ++++ .../invalid-var-init/options.json | 3 - .../invalid-var-init/output.json | 156 +++++ .../options.json | 3 - .../output.json | 90 +++ .../invalid_expression_await/options.json | 3 - .../invalid_expression_await/output.json | 158 +++++ .../invalid_var_await/options.json | 3 - .../invalid_var_await/output.json | 106 ++++ .../options.json | 3 - .../output.json | 88 +++ .../invalid_const_forin/options.json | 3 - .../invalid_const_forin/output.json | 157 +++++ .../invalid_let_forin/options.json | 3 - .../invalid_let_forin/output.json | 157 +++++ .../invalid-new-target/options.json | 3 - .../invalid-new-target/output.json | 137 +++++ .../unknown-property/options.json | 3 - .../unknown-property/output.json | 189 ++++++ .../options.json | 3 - .../output.json | 234 ++++++++ .../options.json | 3 - .../output.json | 177 ++++++ .../invalid-proto-identifiers/options.json | 3 - .../invalid-proto-identifiers/output.json | 174 ++++++ .../options.json | 3 - .../output.json | 177 ++++++ .../invalid-proto-literals/options.json | 3 - .../invalid-proto-literals/output.json | 180 ++++++ .../options.json | 3 - .../output.json | 252 ++++++++ .../options.json | 3 - .../output.json | 119 ++++ .../invalid-escape/options.json | 3 - .../invalid-escape/output.json | 91 +++ .../options.json | 3 - .../output.json | 211 +++++++ .../options.json | 3 - .../output.json | 164 ++++++ .../options.json | 3 - .../output.json | 215 +++++++ .../options.json | 3 - .../invalid-yield-generator-catch/output.json | 173 ++++++ .../options.json | 3 - .../output.json | 143 +++++ .../options.json | 5 +- .../output.json | 105 ++++ .../options.json | 3 - .../output.json | 109 ++++ .../options.json | 3 - .../output.json | 111 ++++ .../options.json | 3 - .../output.json | 143 +++++ .../options.json | 3 - .../output.json | 143 +++++ .../options.json | 3 - .../output.json | 142 +++++ .../options.json | 3 - .../output.json | 108 ++++ .../invalid-yield-generator-rest/options.json | 3 - .../invalid-yield-generator-rest/output.json | 174 ++++++ .../options.json | 3 - .../output.json | 229 ++++++++ .../options.json | 3 - .../output.json | 231 ++++++++ .../options.json | 3 - .../output.json | 142 +++++ .../options.json | 3 - .../output.json | 160 +++++ .../options.json | 3 - .../output.json | 175 ++++++ .../options.json | 3 - .../output.json | 146 +++++ .../options.json | 3 - .../output.json | 193 ++++++ .../options.json | 3 - .../output.json | 156 +++++ .../options.json | 3 - .../output.json | 144 +++++ .../options.json | 3 - .../output.json | 126 ++++ .../options.json | 3 - .../output.json | 145 +++++ .../options.json | 3 - .../output.json | 159 +++++ .../options.json | 3 - .../output.json | 144 +++++ .../options.json | 3 - .../output.json | 159 +++++ .../options.json | 3 - .../output.json | 125 ++++ .../options.json | 3 - .../yield-generator-arrow-default/output.json | 192 ++++++ .../migrated_0012/input.js | 2 +- .../migrated_0012/options.json | 3 - .../migrated_0012/output.json | 70 +++ .../invalid-syntax/GH-1106-00/options.json | 3 - .../invalid-syntax/GH-1106-00/output.json | 73 +++ .../invalid-syntax/GH-1106-01/options.json | 3 - .../invalid-syntax/GH-1106-01/output.json | 73 +++ .../invalid-syntax/GH-1106-02/options.json | 3 - .../invalid-syntax/GH-1106-02/output.json | 73 +++ .../invalid-syntax/GH-1106-03/options.json | 3 - .../invalid-syntax/GH-1106-03/output.json | 73 +++ .../invalid-syntax/GH-1106-04/options.json | 3 - .../invalid-syntax/GH-1106-04/output.json | 73 +++ .../invalid-syntax/GH-1106-05/options.json | 3 - .../invalid-syntax/GH-1106-05/output.json | 73 +++ .../invalid-syntax/GH-1106-06/options.json | 3 - .../invalid-syntax/GH-1106-06/output.json | 73 +++ .../invalid-syntax/GH-1106-07/options.json | 3 - .../invalid-syntax/GH-1106-07/output.json | 73 +++ .../invalid-syntax/migrated_0002/options.json | 4 +- .../invalid-syntax/migrated_0004/options.json | 3 - .../invalid-syntax/migrated_0004/output.json | 73 +++ .../invalid-syntax/migrated_0005/options.json | 3 - .../invalid-syntax/migrated_0005/output.json | 73 +++ .../invalid-syntax/migrated_0006/options.json | 3 - .../invalid-syntax/migrated_0006/output.json | 73 +++ .../invalid-syntax/migrated_0009/options.json | 3 - .../invalid-syntax/migrated_0009/output.json | 73 +++ .../invalid-syntax/migrated_0012/options.json | 3 - .../invalid-syntax/migrated_0012/output.json | 73 +++ .../invalid-syntax/migrated_0013/options.json | 3 - .../invalid-syntax/migrated_0013/output.json | 73 +++ .../invalid-syntax/migrated_0014/options.json | 3 - .../invalid-syntax/migrated_0014/output.json | 73 +++ .../invalid-syntax/migrated_0015/options.json | 3 - .../invalid-syntax/migrated_0015/output.json | 73 +++ .../invalid-syntax/migrated_0017/options.json | 3 - .../invalid-syntax/migrated_0017/output.json | 73 +++ .../invalid-syntax/migrated_0019/options.json | 3 - .../invalid-syntax/migrated_0019/output.json | 73 +++ .../invalid-syntax/migrated_0020/options.json | 3 - .../invalid-syntax/migrated_0020/output.json | 73 +++ .../invalid-syntax/migrated_0021/options.json | 3 - .../invalid-syntax/migrated_0021/output.json | 73 +++ .../invalid-syntax/migrated_0022/options.json | 3 - .../invalid-syntax/migrated_0022/output.json | 73 +++ .../invalid-syntax/migrated_0024/options.json | 3 - .../invalid-syntax/migrated_0024/output.json | 73 +++ .../invalid-syntax/migrated_0025/options.json | 3 - .../invalid-syntax/migrated_0025/output.json | 73 +++ .../invalid-syntax/migrated_0026/options.json | 3 - .../invalid-syntax/migrated_0026/output.json | 73 +++ .../invalid-syntax/migrated_0027/options.json | 3 - .../invalid-syntax/migrated_0027/output.json | 73 +++ .../invalid-syntax/migrated_0028/options.json | 3 - .../invalid-syntax/migrated_0028/output.json | 73 +++ .../invalid-syntax/migrated_0032/options.json | 3 - .../invalid-syntax/migrated_0032/output.json | 70 +++ .../invalid-syntax/migrated_0033/input.js | 2 +- .../invalid-syntax/migrated_0033/options.json | 3 - .../invalid-syntax/migrated_0033/output.json | 70 +++ .../invalid-syntax/migrated_0034/input.js | 2 +- .../invalid-syntax/migrated_0034/options.json | 3 - .../invalid-syntax/migrated_0034/output.json | 70 +++ .../invalid-syntax/migrated_0036/input.js | 2 +- .../invalid-syntax/migrated_0036/options.json | 3 - .../invalid-syntax/migrated_0036/output.json | 70 +++ .../invalid-syntax/migrated_0037/input.js | 2 +- .../invalid-syntax/migrated_0037/options.json | 3 - .../invalid-syntax/migrated_0037/output.json | 70 +++ .../invalid-syntax/migrated_0041/input.js | 2 +- .../invalid-syntax/migrated_0041/options.json | 3 - .../invalid-syntax/migrated_0041/output.json | 109 ++++ .../invalid-syntax/migrated_0042/input.js | 2 +- .../invalid-syntax/migrated_0042/options.json | 3 - .../invalid-syntax/migrated_0042/output.json | 109 ++++ .../invalid-syntax/migrated_0043/input.js | 2 +- .../invalid-syntax/migrated_0043/options.json | 3 - .../invalid-syntax/migrated_0043/output.json | 110 ++++ .../invalid-syntax/migrated_0044/input.js | 2 +- .../invalid-syntax/migrated_0044/options.json | 3 - .../invalid-syntax/migrated_0044/output.json | 113 ++++ .../invalid-syntax/migrated_0045/options.json | 3 - .../invalid-syntax/migrated_0045/output.json | 109 ++++ .../invalid-syntax/migrated_0046/options.json | 3 - .../invalid-syntax/migrated_0046/output.json | 122 ++++ .../invalid-syntax/migrated_0047/options.json | 3 - .../invalid-syntax/migrated_0047/output.json | 149 +++++ .../invalid-syntax/migrated_0048/input.js | 2 +- .../invalid-syntax/migrated_0048/options.json | 4 +- .../invalid-syntax/migrated_0049/input.js | 2 +- .../invalid-syntax/migrated_0049/options.json | 3 - .../invalid-syntax/migrated_0049/output.json | 70 +++ .../invalid-syntax/migrated_0050/input.js | 2 +- .../invalid-syntax/migrated_0050/options.json | 3 - .../invalid-syntax/migrated_0050/output.json | 70 +++ .../invalid-syntax/migrated_0051/input.js | 2 +- .../invalid-syntax/migrated_0051/options.json | 3 - .../invalid-syntax/migrated_0051/output.json | 70 +++ .../invalid-syntax/migrated_0052/options.json | 3 - .../invalid-syntax/migrated_0052/output.json | 90 +++ .../invalid-syntax/migrated_0053/options.json | 3 - .../invalid-syntax/migrated_0053/output.json | 90 +++ .../invalid-syntax/migrated_0054/options.json | 3 - .../invalid-syntax/migrated_0054/output.json | 90 +++ .../invalid-syntax/migrated_0055/options.json | 3 - .../invalid-syntax/migrated_0055/output.json | 90 +++ .../invalid-syntax/migrated_0056/options.json | 3 - .../invalid-syntax/migrated_0056/output.json | 196 ++++++ .../invalid-syntax/migrated_0064/options.json | 3 - .../invalid-syntax/migrated_0064/output.json | 108 ++++ .../invalid-syntax/migrated_0066/options.json | 3 - .../invalid-syntax/migrated_0066/output.json | 142 +++++ .../invalid-syntax/migrated_0067/options.json | 3 - .../invalid-syntax/migrated_0067/output.json | 123 ++++ .../invalid-syntax/migrated_0075/options.json | 6 +- .../invalid-syntax/migrated_0075/output.json | 145 +++++ .../invalid-syntax/migrated_0087/options.json | 3 - .../invalid-syntax/migrated_0087/output.json | 182 ++++++ .../invalid-syntax/migrated_0088/options.json | 3 - .../invalid-syntax/migrated_0088/output.json | 146 +++++ .../invalid-syntax/migrated_0089/options.json | 3 - .../invalid-syntax/migrated_0089/output.json | 146 +++++ .../invalid-syntax/migrated_0090/options.json | 3 - .../invalid-syntax/migrated_0090/output.json | 163 +++++ .../invalid-syntax/migrated_0091/options.json | 3 - .../invalid-syntax/migrated_0091/output.json | 163 +++++ .../invalid-syntax/migrated_0092/options.json | 3 - .../invalid-syntax/migrated_0092/output.json | 127 ++++ .../invalid-syntax/migrated_0093/options.json | 3 - .../invalid-syntax/migrated_0093/output.json | 163 +++++ .../invalid-syntax/migrated_0094/options.json | 3 - .../invalid-syntax/migrated_0094/output.json | 146 +++++ .../invalid-syntax/migrated_0098/options.json | 3 - .../invalid-syntax/migrated_0098/output.json | 113 ++++ .../invalid-syntax/migrated_0099/options.json | 3 - .../invalid-syntax/migrated_0099/output.json | 134 +++++ .../invalid-syntax/migrated_0100/options.json | 3 - .../invalid-syntax/migrated_0100/output.json | 146 +++++ .../invalid-syntax/migrated_0101/options.json | 3 - .../invalid-syntax/migrated_0101/output.json | 179 ++++++ .../invalid-syntax/migrated_0116/options.json | 3 - .../invalid-syntax/migrated_0116/output.json | 54 ++ .../invalid-syntax/migrated_0118/options.json | 3 - .../invalid-syntax/migrated_0118/output.json | 54 ++ .../invalid-syntax/migrated_0125/options.json | 3 - .../invalid-syntax/migrated_0125/output.json | 137 +++++ .../invalid-syntax/migrated_0126/options.json | 3 - .../invalid-syntax/migrated_0126/output.json | 118 ++++ .../invalid-syntax/migrated_0133/options.json | 3 - .../invalid-syntax/migrated_0133/output.json | 72 +++ .../invalid-syntax/migrated_0137/options.json | 3 - .../invalid-syntax/migrated_0137/output.json | 106 ++++ .../invalid-syntax/migrated_0142/options.json | 3 - .../invalid-syntax/migrated_0142/output.json | 140 +++++ .../invalid-syntax/migrated_0143/options.json | 3 - .../invalid-syntax/migrated_0143/output.json | 106 ++++ .../invalid-syntax/migrated_0162/input.js | 2 +- .../invalid-syntax/migrated_0162/options.json | 3 - .../invalid-syntax/migrated_0162/output.json | 70 +++ .../invalid-syntax/migrated_0163/input.js | 2 +- .../invalid-syntax/migrated_0163/options.json | 3 - .../invalid-syntax/migrated_0163/output.json | 70 +++ .../invalid-syntax/migrated_0164/options.json | 3 - .../invalid-syntax/migrated_0164/output.json | 70 +++ .../invalid-syntax/migrated_0165/input.js | 2 +- .../invalid-syntax/migrated_0165/options.json | 3 - .../invalid-syntax/migrated_0165/output.json | 70 +++ .../invalid-syntax/migrated_0166/options.json | 3 - .../invalid-syntax/migrated_0166/output.json | 102 ++++ .../invalid-syntax/migrated_0167/options.json | 3 - .../invalid-syntax/migrated_0167/output.json | 102 ++++ .../invalid-syntax/migrated_0169/input.js | 2 +- .../invalid-syntax/migrated_0171/options.json | 3 - .../invalid-syntax/migrated_0171/output.json | 54 ++ .../invalid-syntax/migrated_0172/options.json | 3 - .../invalid-syntax/migrated_0172/output.json | 54 ++ .../invalid-syntax/migrated_0173/options.json | 3 - .../invalid-syntax/migrated_0173/output.json | 54 ++ .../invalid-syntax/migrated_0174/options.json | 3 - .../invalid-syntax/migrated_0174/output.json | 106 ++++ .../invalid-syntax/migrated_0176/options.json | 3 - .../invalid-syntax/migrated_0176/output.json | 119 ++++ .../invalid-syntax/migrated_0177/options.json | 3 - .../invalid-syntax/migrated_0177/output.json | 119 ++++ .../invalid-syntax/migrated_0178/options.json | 3 - .../invalid-syntax/migrated_0178/output.json | 207 +++++++ .../invalid-syntax/migrated_0179/options.json | 3 - .../invalid-syntax/migrated_0179/output.json | 207 +++++++ .../invalid-syntax/migrated_0180/options.json | 3 - .../invalid-syntax/migrated_0180/output.json | 191 ++++++ .../invalid-syntax/migrated_0181/options.json | 3 - .../invalid-syntax/migrated_0181/output.json | 191 ++++++ .../invalid-syntax/migrated_0182/options.json | 3 - .../invalid-syntax/migrated_0182/output.json | 199 +++++++ .../invalid-syntax/migrated_0183/options.json | 3 - .../invalid-syntax/migrated_0183/output.json | 195 ++++++ .../invalid-syntax/migrated_0184/options.json | 3 - .../invalid-syntax/migrated_0184/output.json | 193 ++++++ .../invalid-syntax/migrated_0185/options.json | 3 - .../invalid-syntax/migrated_0185/output.json | 197 +++++++ .../invalid-syntax/migrated_0186/options.json | 3 - .../invalid-syntax/migrated_0186/output.json | 197 +++++++ .../invalid-syntax/migrated_0187/options.json | 3 - .../invalid-syntax/migrated_0187/output.json | 209 +++++++ .../invalid-syntax/migrated_0188/options.json | 3 - .../invalid-syntax/migrated_0188/output.json | 209 +++++++ .../invalid-syntax/migrated_0189/options.json | 3 - .../invalid-syntax/migrated_0189/output.json | 195 ++++++ .../invalid-syntax/migrated_0190/options.json | 3 - .../invalid-syntax/migrated_0190/output.json | 195 ++++++ .../invalid-syntax/migrated_0191/options.json | 3 - .../invalid-syntax/migrated_0191/output.json | 176 ++++++ .../invalid-syntax/migrated_0192/options.json | 3 - .../invalid-syntax/migrated_0192/output.json | 176 ++++++ .../invalid-syntax/migrated_0193/options.json | 3 - .../invalid-syntax/migrated_0193/output.json | 176 ++++++ .../invalid-syntax/migrated_0194/options.json | 3 - .../invalid-syntax/migrated_0194/output.json | 176 ++++++ .../invalid-syntax/migrated_0195/options.json | 3 - .../invalid-syntax/migrated_0195/output.json | 176 ++++++ .../invalid-syntax/migrated_0196/options.json | 3 - .../invalid-syntax/migrated_0196/output.json | 176 ++++++ .../invalid-syntax/migrated_0197/options.json | 3 - .../invalid-syntax/migrated_0197/output.json | 176 ++++++ .../invalid-syntax/migrated_0198/options.json | 3 - .../invalid-syntax/migrated_0198/output.json | 176 ++++++ .../invalid-syntax/migrated_0199/options.json | 3 - .../invalid-syntax/migrated_0199/output.json | 179 ++++++ .../invalid-syntax/migrated_0200/options.json | 3 - .../invalid-syntax/migrated_0200/output.json | 179 ++++++ .../invalid-syntax/migrated_0201/options.json | 3 - .../invalid-syntax/migrated_0201/output.json | 126 ++++ .../invalid-syntax/migrated_0202/options.json | 3 - .../invalid-syntax/migrated_0202/output.json | 126 ++++ .../invalid-syntax/migrated_0203/options.json | 3 - .../invalid-syntax/migrated_0203/output.json | 214 +++++++ .../invalid-syntax/migrated_0204/options.json | 3 - .../invalid-syntax/migrated_0204/output.json | 214 +++++++ .../invalid-syntax/migrated_0205/options.json | 3 - .../invalid-syntax/migrated_0205/output.json | 161 +++++ .../invalid-syntax/migrated_0206/options.json | 3 - .../invalid-syntax/migrated_0206/output.json | 161 +++++ .../invalid-syntax/migrated_0207/options.json | 3 - .../invalid-syntax/migrated_0207/output.json | 250 ++++++++ .../invalid-syntax/migrated_0208/options.json | 3 - .../invalid-syntax/migrated_0208/output.json | 161 +++++ .../invalid-syntax/migrated_0209/options.json | 3 - .../invalid-syntax/migrated_0209/output.json | 292 +++++++++ .../invalid-syntax/migrated_0210/options.json | 3 - .../invalid-syntax/migrated_0210/output.json | 237 ++++++++ .../invalid-syntax/migrated_0211/options.json | 3 - .../invalid-syntax/migrated_0211/output.json | 268 +++++++++ .../invalid-syntax/migrated_0212/options.json | 3 - .../invalid-syntax/migrated_0212/output.json | 144 +++++ .../invalid-syntax/migrated_0213/options.json | 3 - .../invalid-syntax/migrated_0213/output.json | 144 +++++ .../invalid-syntax/migrated_0214/options.json | 3 - .../invalid-syntax/migrated_0214/output.json | 197 +++++++ .../invalid-syntax/migrated_0215/options.json | 3 - .../invalid-syntax/migrated_0215/output.json | 197 +++++++ .../invalid-syntax/migrated_0216/options.json | 3 - .../invalid-syntax/migrated_0216/output.json | 108 ++++ .../invalid-syntax/migrated_0217/options.json | 3 - .../invalid-syntax/migrated_0217/output.json | 162 +++++ .../invalid-syntax/migrated_0218/options.json | 3 - .../invalid-syntax/migrated_0218/output.json | 163 +++++ .../invalid-syntax/migrated_0219/options.json | 3 - .../invalid-syntax/migrated_0219/output.json | 221 +++++++ .../invalid-syntax/migrated_0220/options.json | 3 - .../invalid-syntax/migrated_0220/output.json | 221 +++++++ .../invalid-syntax/migrated_0221/options.json | 3 - .../invalid-syntax/migrated_0221/output.json | 161 +++++ .../invalid-syntax/migrated_0222/options.json | 3 - .../invalid-syntax/migrated_0222/output.json | 197 +++++++ .../invalid-syntax/migrated_0223/options.json | 3 - .../invalid-syntax/migrated_0223/output.json | 215 +++++++ .../invalid-syntax/migrated_0224/options.json | 3 - .../invalid-syntax/migrated_0224/output.json | 178 ++++++ .../invalid-syntax/migrated_0225/options.json | 3 - .../invalid-syntax/migrated_0225/output.json | 178 ++++++ .../invalid-syntax/migrated_0226/options.json | 3 - .../invalid-syntax/migrated_0226/output.json | 178 ++++++ .../invalid-syntax/migrated_0227/options.json | 3 - .../invalid-syntax/migrated_0227/output.json | 178 ++++++ .../invalid-syntax/migrated_0228/options.json | 3 - .../invalid-syntax/migrated_0228/output.json | 178 ++++++ .../invalid-syntax/migrated_0229/options.json | 3 - .../invalid-syntax/migrated_0229/output.json | 178 ++++++ .../invalid-syntax/migrated_0230/options.json | 3 - .../invalid-syntax/migrated_0230/output.json | 178 ++++++ .../invalid-syntax/migrated_0231/options.json | 3 - .../invalid-syntax/migrated_0231/output.json | 178 ++++++ .../invalid-syntax/migrated_0232/options.json | 3 - .../invalid-syntax/migrated_0232/output.json | 178 ++++++ .../invalid-syntax/migrated_0233/options.json | 3 - .../invalid-syntax/migrated_0233/output.json | 144 +++++ .../invalid-syntax/migrated_0234/options.json | 3 - .../invalid-syntax/migrated_0234/output.json | 126 ++++ .../invalid-syntax/migrated_0235/options.json | 3 - .../invalid-syntax/migrated_0235/output.json | 144 +++++ .../invalid-syntax/migrated_0236/options.json | 3 - .../invalid-syntax/migrated_0236/output.json | 144 +++++ .../invalid-syntax/migrated_0239/options.json | 3 - .../invalid-syntax/migrated_0239/output.json | 126 ++++ .../invalid-syntax/migrated_0240/options.json | 3 - .../invalid-syntax/migrated_0240/output.json | 161 +++++ .../invalid-syntax/migrated_0241/options.json | 3 - .../invalid-syntax/migrated_0241/output.json | 144 +++++ .../invalid-syntax/migrated_0242/options.json | 3 - .../invalid-syntax/migrated_0242/output.json | 144 +++++ .../invalid-syntax/migrated_0243/options.json | 3 - .../invalid-syntax/migrated_0243/output.json | 229 ++++++++ .../invalid-syntax/migrated_0244/options.json | 3 - .../invalid-syntax/migrated_0244/output.json | 180 ++++++ .../invalid-syntax/migrated_0245/options.json | 3 - .../invalid-syntax/migrated_0245/output.json | 233 ++++++++ .../invalid-syntax/migrated_0246/options.json | 3 - .../invalid-syntax/migrated_0246/output.json | 163 +++++ .../invalid-syntax/migrated_0247/options.json | 3 - .../invalid-syntax/migrated_0247/output.json | 163 +++++ .../invalid-syntax/migrated_0248/options.json | 3 - .../invalid-syntax/migrated_0248/output.json | 137 +++++ .../invalid-syntax/migrated_0249/options.json | 3 - .../invalid-syntax/migrated_0249/output.json | 161 +++++ .../invalid-syntax/migrated_0250/options.json | 3 - .../invalid-syntax/migrated_0250/output.json | 213 +++++++ .../invalid-syntax/migrated_0270/options.json | 3 - .../invalid-syntax/migrated_0270/output.json | 144 +++++ .../invalid-syntax/migrated_0271/options.json | 3 - .../invalid-syntax/migrated_0271/output.json | 147 +++++ .../invalid-syntax/migrated_0272/options.json | 3 - .../invalid-syntax/migrated_0272/output.json | 144 +++++ .../invalid-syntax/migrated_0273/options.json | 3 - .../invalid-syntax/migrated_0273/output.json | 162 +++++ .../invalid-syntax/migrated_0274/options.json | 3 - .../invalid-syntax/migrated_0274/output.json | 203 +++++++ .../invalid-syntax/migrated_0277/options.json | 3 - .../invalid-syntax/migrated_0277/output.json | 162 +++++ .../invalid-syntax/migrated_0278/options.json | 3 - .../invalid-syntax/migrated_0278/output.json | 144 +++++ .../invalid-setter-rest/options.json | 3 - .../invalid-setter-rest/output.json | 192 ++++++ .../migrated_0002/options.json | 3 - .../migrated_0002/output.json | 70 +++ .../migrated_0003/options.json | 3 - .../migrated_0003/output.json | 70 +++ .../migrated_0004/options.json | 3 - .../migrated_0004/output.json | 70 +++ .../migrated_0005/options.json | 3 - .../migrated_0005/output.json | 70 +++ .../options.json | 3 - .../complex-pattern-requires-init/output.json | 88 +++ .../bigint/invalid-decimal/options.json | 1 - .../bigint/invalid-decimal/output.json | 73 +++ .../bigint/invalid-e/options.json | 1 - .../experimental/bigint/invalid-e/output.json | 73 +++ .../options.json | 6 +- .../invalid-non-octal-decimal-int/output.json | 73 +++ .../bigint/invalid-octal-legacy/options.json | 1 - .../bigint/invalid-octal-legacy/output.json | 73 +++ .../failure-name-constructor/options.json | 7 +- .../failure-name-constructor/output.json | 158 +++++ .../failure-spaces/options.json | 1 - .../failure-spaces/output.json | 207 +++++++ .../options.json | 7 +- .../output.json | 289 +++++++++ .../failure-name-constructor/options.json | 7 +- .../failure-name-constructor/output.json | 137 +++++ .../failure-spaces/options.json | 3 +- .../failure-spaces/output.json | 137 +++++ .../super-call/options.json | 7 +- .../super-call/output.json | 306 ++++++++++ .../super-private-member-access/options.json | 5 +- .../super-private-member-access/output.json | 288 +++++++++ .../arguments-in-arrow-function/options.json | 7 +- .../arguments-in-arrow-function/output.json | 211 +++++++ .../class-properties/arguments/options.json | 7 +- .../class-properties/arguments/output.json | 192 ++++++ .../new-target-invalid/options.json | 7 +- .../new-target-invalid/output.json | 137 +++++ .../class-properties/no-ctor-2/options.json | 5 +- .../class-properties/no-ctor-2/output.json | 179 ++++++ .../class-properties/no-ctor/options.json | 5 +- .../class-properties/no-ctor/output.json | 123 ++++ .../no-static-prototype-2/options.json | 7 +- .../no-static-prototype-2/output.json | 179 ++++++ .../no-static-prototype/options.json | 7 +- .../no-static-prototype/output.json | 123 ++++ .../options.json | 7 +- .../output.json | 123 ++++ .../class-properties/super-call/options.json | 7 +- .../class-properties/super-call/output.json | 292 +++++++++ .../super-inside-function/options.json | 7 +- .../super-inside-function/output.json | 254 ++++++++ .../options.json | 14 +- .../output.json | 136 +++++ .../no-class-method-parameter/options.json | 3 - .../no-class-method-parameter/output.json | 196 ++++++ .../no-constructor-decorators/options.json | 3 - .../no-constructor-decorators/output.json | 178 ++++++ .../options.json | 3 +- .../no-export-decorators-on-class/output.json | 120 ++++ .../no-function-parameters/options.json | 3 - .../no-function-parameters/output.json | 142 +++++ .../no-object-method-parameters/options.json | 3 - .../no-object-method-parameters/output.json | 213 +++++++ .../no-object-methods/options.json | 11 +- .../no-object-methods/output.json | 195 ++++++ .../no-constructor-decorators/options.json | 3 - .../no-constructor-decorators/output.json | 178 ++++++ .../direct-calls-only/options.json | 6 +- .../direct-calls-only/output.json | 172 ++++++ .../invalid-arguments-spread/options.json | 6 +- .../invalid-arguments-spread/output.json | 137 +++++ .../dynamic-import/invalid-new/options.json | 6 +- .../dynamic-import/invalid-new/output.json | 105 ++++ .../invalid-trailing-comma/options.json | 4 +- .../invalid-trailing-comma/output.json | 108 ++++ .../dynamic-import/multiple-args/options.json | 6 +- .../dynamic-import/multiple-args/output.json | 125 ++++ .../dynamic-import/no-args/options.json | 6 +- .../dynamic-import/no-args/output.json | 84 +++ .../import-meta/error-in-script/options.json | 8 +- .../import-meta/error-in-script/output.json | 137 +++++ .../no-other-prop-names/options.json | 8 +- .../no-other-prop-names/output.json | 102 ++++ .../import-meta/not-assignable/options.json | 8 +- .../import-meta/not-assignable/output.json | 134 +++++ .../numeric-separator/invalid-0/options.json | 1 - .../numeric-separator/invalid-0/output.json | 73 +++ .../numeric-separator/invalid-1/options.json | 1 - .../numeric-separator/invalid-1/output.json | 73 +++ .../numeric-separator/invalid-10/options.json | 1 - .../numeric-separator/invalid-10/output.json | 73 +++ .../invalid-100/options.json | 1 - .../numeric-separator/invalid-100/output.json | 75 +++ .../invalid-101/options.json | 1 - .../numeric-separator/invalid-101/output.json | 75 +++ .../invalid-102/options.json | 1 - .../numeric-separator/invalid-102/output.json | 76 +++ .../invalid-103/options.json | 1 - .../numeric-separator/invalid-103/output.json | 76 +++ .../invalid-104/options.json | 1 - .../numeric-separator/invalid-104/output.json | 75 +++ .../invalid-105/options.json | 1 - .../numeric-separator/invalid-105/output.json | 75 +++ .../invalid-106/options.json | 1 - .../numeric-separator/invalid-106/output.json | 75 +++ .../invalid-107/options.json | 1 - .../numeric-separator/invalid-107/output.json | 75 +++ .../invalid-108/options.json | 1 - .../numeric-separator/invalid-108/output.json | 75 +++ .../invalid-109/options.json | 1 - .../numeric-separator/invalid-109/output.json | 75 +++ .../numeric-separator/invalid-11/options.json | 1 - .../numeric-separator/invalid-11/output.json | 73 +++ .../invalid-110/options.json | 1 - .../numeric-separator/invalid-110/output.json | 75 +++ .../invalid-111/options.json | 1 - .../numeric-separator/invalid-111/output.json | 75 +++ .../invalid-112/options.json | 1 - .../numeric-separator/invalid-112/output.json | 75 +++ .../invalid-113/options.json | 1 - .../numeric-separator/invalid-113/output.json | 77 +++ .../invalid-114/options.json | 1 - .../numeric-separator/invalid-114/output.json | 77 +++ .../invalid-115/options.json | 1 - .../numeric-separator/invalid-115/output.json | 76 +++ .../invalid-116/options.json | 1 - .../numeric-separator/invalid-116/output.json | 75 +++ .../invalid-117/options.json | 1 - .../numeric-separator/invalid-117/output.json | 75 +++ .../invalid-118/options.json | 1 - .../numeric-separator/invalid-118/output.json | 76 +++ .../invalid-119/options.json | 1 - .../numeric-separator/invalid-119/output.json | 75 +++ .../numeric-separator/invalid-12/options.json | 1 - .../numeric-separator/invalid-12/output.json | 73 +++ .../invalid-120/options.json | 1 - .../numeric-separator/invalid-120/output.json | 76 +++ .../invalid-121/options.json | 1 - .../numeric-separator/invalid-121/output.json | 75 +++ .../invalid-122/options.json | 1 - .../numeric-separator/invalid-122/output.json | 75 +++ .../invalid-123/options.json | 1 - .../numeric-separator/invalid-123/output.json | 76 +++ .../invalid-124/options.json | 1 - .../numeric-separator/invalid-124/output.json | 91 +++ .../invalid-125/options.json | 1 - .../numeric-separator/invalid-125/output.json | 91 +++ .../invalid-126/options.json | 1 - .../numeric-separator/invalid-126/output.json | 92 +++ .../invalid-127/options.json | 1 - .../numeric-separator/invalid-127/output.json | 92 +++ .../invalid-128/options.json | 1 - .../numeric-separator/invalid-128/output.json | 91 +++ .../invalid-129/options.json | 1 - .../numeric-separator/invalid-129/output.json | 91 +++ .../numeric-separator/invalid-13/options.json | 1 - .../numeric-separator/invalid-13/output.json | 75 +++ .../invalid-130/options.json | 1 - .../numeric-separator/invalid-130/output.json | 91 +++ .../invalid-131/options.json | 1 - .../numeric-separator/invalid-131/output.json | 91 +++ .../invalid-132/options.json | 1 - .../numeric-separator/invalid-132/output.json | 91 +++ .../invalid-133/options.json | 1 - .../numeric-separator/invalid-133/output.json | 91 +++ .../invalid-134/options.json | 1 - .../numeric-separator/invalid-134/output.json | 91 +++ .../invalid-135/options.json | 1 - .../numeric-separator/invalid-135/output.json | 91 +++ .../invalid-136/options.json | 1 - .../numeric-separator/invalid-136/output.json | 91 +++ .../invalid-137/options.json | 1 - .../numeric-separator/invalid-137/output.json | 93 +++ .../invalid-138/options.json | 1 - .../numeric-separator/invalid-138/output.json | 93 +++ .../invalid-139/options.json | 1 - .../numeric-separator/invalid-139/output.json | 92 +++ .../numeric-separator/invalid-14/options.json | 1 - .../numeric-separator/invalid-14/output.json | 75 +++ .../invalid-140/options.json | 1 - .../numeric-separator/invalid-140/output.json | 91 +++ .../invalid-141/options.json | 1 - .../numeric-separator/invalid-141/output.json | 91 +++ .../invalid-142/options.json | 1 - .../numeric-separator/invalid-142/output.json | 92 +++ .../invalid-143/options.json | 1 - .../numeric-separator/invalid-143/output.json | 91 +++ .../invalid-144/options.json | 1 - .../numeric-separator/invalid-144/output.json | 92 +++ .../invalid-145/options.json | 1 - .../numeric-separator/invalid-145/output.json | 91 +++ .../invalid-146/options.json | 1 - .../numeric-separator/invalid-146/output.json | 91 +++ .../invalid-147/options.json | 1 - .../numeric-separator/invalid-147/output.json | 92 +++ .../numeric-separator/invalid-15/options.json | 1 - .../numeric-separator/invalid-15/output.json | 74 +++ .../numeric-separator/invalid-16/options.json | 1 - .../numeric-separator/invalid-16/output.json | 73 +++ .../numeric-separator/invalid-17/options.json | 1 - .../numeric-separator/invalid-17/output.json | 73 +++ .../numeric-separator/invalid-18/options.json | 1 - .../numeric-separator/invalid-18/output.json | 74 +++ .../numeric-separator/invalid-19/options.json | 1 - .../numeric-separator/invalid-19/output.json | 73 +++ .../numeric-separator/invalid-2/options.json | 1 - .../numeric-separator/invalid-2/output.json | 74 +++ .../numeric-separator/invalid-20/options.json | 1 - .../numeric-separator/invalid-20/output.json | 74 +++ .../numeric-separator/invalid-21/options.json | 1 - .../numeric-separator/invalid-21/output.json | 73 +++ .../numeric-separator/invalid-22/options.json | 1 - .../numeric-separator/invalid-22/output.json | 73 +++ .../numeric-separator/invalid-23/options.json | 1 - .../numeric-separator/invalid-23/output.json | 74 +++ .../numeric-separator/invalid-25/options.json | 1 - .../numeric-separator/invalid-25/output.json | 74 +++ .../numeric-separator/invalid-26/options.json | 1 - .../numeric-separator/invalid-26/output.json | 73 +++ .../numeric-separator/invalid-27/options.json | 4 +- .../numeric-separator/invalid-28/options.json | 1 - .../numeric-separator/invalid-28/output.json | 73 +++ .../numeric-separator/invalid-29/options.json | 1 - .../numeric-separator/invalid-29/output.json | 73 +++ .../numeric-separator/invalid-3/options.json | 1 - .../numeric-separator/invalid-3/output.json | 74 +++ .../numeric-separator/invalid-30/options.json | 1 - .../numeric-separator/invalid-30/output.json | 74 +++ .../numeric-separator/invalid-31/options.json | 1 - .../numeric-separator/invalid-31/output.json | 74 +++ .../numeric-separator/invalid-32/options.json | 1 - .../numeric-separator/invalid-32/output.json | 73 +++ .../numeric-separator/invalid-33/options.json | 1 - .../numeric-separator/invalid-33/output.json | 73 +++ .../numeric-separator/invalid-34/options.json | 1 - .../numeric-separator/invalid-34/output.json | 73 +++ .../numeric-separator/invalid-35/options.json | 1 - .../numeric-separator/invalid-35/output.json | 73 +++ .../numeric-separator/invalid-36/options.json | 1 - .../numeric-separator/invalid-36/output.json | 73 +++ .../numeric-separator/invalid-37/options.json | 1 - .../numeric-separator/invalid-37/output.json | 73 +++ .../numeric-separator/invalid-38/options.json | 1 - .../numeric-separator/invalid-38/output.json | 73 +++ .../numeric-separator/invalid-39/options.json | 1 - .../numeric-separator/invalid-39/output.json | 73 +++ .../numeric-separator/invalid-4/options.json | 1 - .../numeric-separator/invalid-4/output.json | 73 +++ .../numeric-separator/invalid-40/options.json | 1 - .../numeric-separator/invalid-40/output.json | 73 +++ .../numeric-separator/invalid-41/options.json | 1 - .../numeric-separator/invalid-41/output.json | 75 +++ .../numeric-separator/invalid-42/options.json | 1 - .../numeric-separator/invalid-42/output.json | 75 +++ .../numeric-separator/invalid-43/options.json | 1 - .../numeric-separator/invalid-43/output.json | 74 +++ .../numeric-separator/invalid-44/options.json | 1 - .../numeric-separator/invalid-44/output.json | 73 +++ .../numeric-separator/invalid-45/options.json | 1 - .../numeric-separator/invalid-45/output.json | 73 +++ .../numeric-separator/invalid-46/options.json | 1 - .../numeric-separator/invalid-46/output.json | 74 +++ .../numeric-separator/invalid-47/options.json | 1 - .../numeric-separator/invalid-47/output.json | 73 +++ .../numeric-separator/invalid-48/options.json | 1 - .../numeric-separator/invalid-48/output.json | 74 +++ .../numeric-separator/invalid-49/options.json | 1 - .../numeric-separator/invalid-49/output.json | 73 +++ .../numeric-separator/invalid-5/options.json | 1 - .../numeric-separator/invalid-5/output.json | 73 +++ .../numeric-separator/invalid-50/options.json | 1 - .../numeric-separator/invalid-50/output.json | 73 +++ .../numeric-separator/invalid-51/options.json | 1 - .../numeric-separator/invalid-51/output.json | 74 +++ .../numeric-separator/invalid-52/input.js | 2 +- .../numeric-separator/invalid-52/options.json | 1 - .../numeric-separator/invalid-52/output.json | 110 ++++ .../numeric-separator/invalid-53/input.js | 2 +- .../numeric-separator/invalid-53/options.json | 1 - .../numeric-separator/invalid-53/output.json | 110 ++++ .../numeric-separator/invalid-54/input.js | 2 +- .../numeric-separator/invalid-54/options.json | 1 - .../numeric-separator/invalid-54/output.json | 111 ++++ .../numeric-separator/invalid-55/input.js | 2 +- .../numeric-separator/invalid-55/options.json | 1 - .../numeric-separator/invalid-55/output.json | 111 ++++ .../numeric-separator/invalid-56/input.js | 2 +- .../numeric-separator/invalid-56/options.json | 1 - .../numeric-separator/invalid-56/output.json | 110 ++++ .../numeric-separator/invalid-57/input.js | 2 +- .../numeric-separator/invalid-57/options.json | 1 - .../numeric-separator/invalid-57/output.json | 110 ++++ .../numeric-separator/invalid-58/input.js | 2 +- .../numeric-separator/invalid-58/options.json | 1 - .../numeric-separator/invalid-58/output.json | 110 ++++ .../numeric-separator/invalid-59/input.js | 2 +- .../numeric-separator/invalid-59/options.json | 1 - .../numeric-separator/invalid-59/output.json | 110 ++++ .../numeric-separator/invalid-6/options.json | 1 - .../numeric-separator/invalid-6/output.json | 73 +++ .../numeric-separator/invalid-60/input.js | 2 +- .../numeric-separator/invalid-60/options.json | 1 - .../numeric-separator/invalid-60/output.json | 110 ++++ .../numeric-separator/invalid-61/input.js | 2 +- .../numeric-separator/invalid-61/options.json | 1 - .../numeric-separator/invalid-61/output.json | 110 ++++ .../numeric-separator/invalid-62/input.js | 2 +- .../numeric-separator/invalid-62/options.json | 1 - .../numeric-separator/invalid-62/output.json | 110 ++++ .../numeric-separator/invalid-63/input.js | 2 +- .../numeric-separator/invalid-63/options.json | 1 - .../numeric-separator/invalid-63/output.json | 110 ++++ .../numeric-separator/invalid-64/input.js | 2 +- .../numeric-separator/invalid-64/options.json | 1 - .../numeric-separator/invalid-64/output.json | 110 ++++ .../numeric-separator/invalid-65/input.js | 2 +- .../numeric-separator/invalid-65/options.json | 1 - .../numeric-separator/invalid-65/output.json | 112 ++++ .../numeric-separator/invalid-66/input.js | 2 +- .../numeric-separator/invalid-66/options.json | 1 - .../numeric-separator/invalid-66/output.json | 112 ++++ .../numeric-separator/invalid-67/input.js | 2 +- .../numeric-separator/invalid-67/options.json | 1 - .../numeric-separator/invalid-67/output.json | 111 ++++ .../numeric-separator/invalid-68/input.js | 2 +- .../numeric-separator/invalid-68/options.json | 1 - .../numeric-separator/invalid-68/output.json | 110 ++++ .../numeric-separator/invalid-69/input.js | 2 +- .../numeric-separator/invalid-69/options.json | 1 - .../numeric-separator/invalid-69/output.json | 110 ++++ .../numeric-separator/invalid-7/options.json | 1 - .../numeric-separator/invalid-7/output.json | 73 +++ .../numeric-separator/invalid-70/input.js | 2 +- .../numeric-separator/invalid-70/options.json | 1 - .../numeric-separator/invalid-70/output.json | 111 ++++ .../numeric-separator/invalid-71/input.js | 2 +- .../numeric-separator/invalid-71/options.json | 1 - .../numeric-separator/invalid-71/output.json | 110 ++++ .../numeric-separator/invalid-72/input.js | 2 +- .../numeric-separator/invalid-72/options.json | 1 - .../numeric-separator/invalid-72/output.json | 111 ++++ .../numeric-separator/invalid-73/input.js | 2 +- .../numeric-separator/invalid-73/options.json | 1 - .../numeric-separator/invalid-73/output.json | 110 ++++ .../numeric-separator/invalid-74/input.js | 2 +- .../numeric-separator/invalid-74/options.json | 1 - .../numeric-separator/invalid-74/output.json | 110 ++++ .../numeric-separator/invalid-75/input.js | 2 +- .../numeric-separator/invalid-75/options.json | 1 - .../numeric-separator/invalid-75/output.json | 111 ++++ .../numeric-separator/invalid-76/options.json | 1 - .../numeric-separator/invalid-76/output.json | 90 +++ .../numeric-separator/invalid-77/options.json | 1 - .../numeric-separator/invalid-77/output.json | 90 +++ .../numeric-separator/invalid-78/options.json | 1 - .../numeric-separator/invalid-78/output.json | 91 +++ .../numeric-separator/invalid-79/options.json | 1 - .../numeric-separator/invalid-79/output.json | 91 +++ .../numeric-separator/invalid-8/options.json | 1 - .../numeric-separator/invalid-8/output.json | 73 +++ .../numeric-separator/invalid-80/options.json | 1 - .../numeric-separator/invalid-80/output.json | 90 +++ .../numeric-separator/invalid-81/options.json | 1 - .../numeric-separator/invalid-81/output.json | 90 +++ .../numeric-separator/invalid-82/options.json | 1 - .../numeric-separator/invalid-82/output.json | 90 +++ .../numeric-separator/invalid-83/options.json | 1 - .../numeric-separator/invalid-83/output.json | 90 +++ .../numeric-separator/invalid-84/options.json | 1 - .../numeric-separator/invalid-84/output.json | 90 +++ .../numeric-separator/invalid-85/options.json | 1 - .../numeric-separator/invalid-85/output.json | 90 +++ .../numeric-separator/invalid-86/options.json | 1 - .../numeric-separator/invalid-86/output.json | 90 +++ .../numeric-separator/invalid-87/options.json | 1 - .../numeric-separator/invalid-87/output.json | 90 +++ .../numeric-separator/invalid-88/options.json | 1 - .../numeric-separator/invalid-88/output.json | 90 +++ .../numeric-separator/invalid-89/options.json | 1 - .../numeric-separator/invalid-89/output.json | 92 +++ .../numeric-separator/invalid-9/options.json | 1 - .../numeric-separator/invalid-9/output.json | 73 +++ .../numeric-separator/invalid-90/options.json | 1 - .../numeric-separator/invalid-90/output.json | 92 +++ .../numeric-separator/invalid-91/options.json | 1 - .../numeric-separator/invalid-91/output.json | 91 +++ .../numeric-separator/invalid-92/options.json | 1 - .../numeric-separator/invalid-92/output.json | 90 +++ .../numeric-separator/invalid-93/options.json | 1 - .../numeric-separator/invalid-93/output.json | 90 +++ .../numeric-separator/invalid-94/options.json | 1 - .../numeric-separator/invalid-94/output.json | 91 +++ .../numeric-separator/invalid-95/options.json | 1 - .../numeric-separator/invalid-95/output.json | 90 +++ .../numeric-separator/invalid-96/options.json | 1 - .../numeric-separator/invalid-96/output.json | 91 +++ .../numeric-separator/invalid-97/options.json | 1 - .../numeric-separator/invalid-97/output.json | 90 +++ .../numeric-separator/invalid-98/options.json | 1 - .../numeric-separator/invalid-98/output.json | 90 +++ .../numeric-separator/invalid-99/options.json | 1 - .../numeric-separator/invalid-99/output.json | 91 +++ .../invalid-hex/options.json | 7 +- .../numeric-separator/invalid-hex/output.json | 73 +++ .../invalid-leading-zero/options.json | 7 +- .../invalid-leading-zero/output.json | 73 +++ .../invalid-legacy-octal-literal/options.json | 7 +- .../invalid-legacy-octal-literal/output.json | 73 +++ .../options.json | 7 +- .../invalid-non-octal-decimal-int/output.json | 74 +++ .../invalid-unicode-2/options.json | 7 +- .../invalid-unicode-2/output.json | 73 +++ .../invalid-unicode/options.json | 7 +- .../invalid-unicode/output.json | 73 +++ .../class-contructor-call/options.json | 7 +- .../class-contructor-call/output.json | 154 +++++ .../optional-constructor/options.json | 7 +- .../optional-constructor/output.json | 86 +++ .../options.json | 3 +- .../optional-super-property-class/output.json | 209 +++++++ .../optional-super-property/options.json | 3 +- .../optional-super-property/output.json | 226 +++++++ .../options.json | 7 +- .../output.json | 157 +++++ .../in-SuperCall/options.json | 7 +- .../in-SuperCall/output.json | 390 ++++++++++++ .../partial-application/in-new/options.json | 7 +- .../partial-application/in-new/output.json | 155 +++++ .../options.json | 12 +- .../output.json | 162 +++++ .../options.json | 3 +- .../output.json | 207 +++++++ .../options.json | 3 +- .../output.json | 241 ++++++++ .../options.json | 3 +- .../output.json | 205 +++++++ .../options.json | 3 +- .../output.json | 184 ++++++ .../options.json | 3 +- .../output.json | 170 ++++++ .../options.json | 12 +- .../output.json | 203 +++++++ .../options.json | 12 +- .../output.json | 155 +++++ .../options.json | 3 +- .../output.json | 151 +++++ .../options.json | 3 +- .../output.json | 151 +++++ .../options.json | 3 +- .../output.json | 134 +++++ .../options.json | 3 +- .../output.json | 172 ++++++ .../input.js | 2 +- .../options.json | 3 +- .../output.json | 266 +++++++++ .../options.json | 3 +- .../output.json | 302 ++++++++++ .../options.json | 3 +- .../output.json | 353 +++++++++++ .../options.json | 3 +- .../output.json | 214 +++++++ .../options.json | 3 +- .../output.json | 215 +++++++ .../options.json | 3 +- .../output.json | 412 +++++++++++++ .../options.json | 3 +- .../output.json | 266 +++++++++ .../options.json | 3 +- .../output.json | 196 ++++++ .../options.json | 3 +- .../output.json | 287 +++++++++ .../options.json | 3 +- .../output.json | 169 ++++++ .../options.json | 3 +- .../output.json | 215 +++++++ .../1/options.json | 3 - .../1/output.json | 91 +++ .../10/options.json | 3 - .../10/output.json | 132 +++++ .../11/options.json | 3 - .../11/output.json | 132 +++++ .../12/options.json | 3 - .../12/output.json | 172 ++++++ .../13/options.json | 3 - .../13/output.json | 91 +++ .../14/options.json | 3 - .../14/output.json | 132 +++++ .../15/options.json | 3 - .../15/output.json | 132 +++++ .../16/options.json | 3 - .../16/output.json | 172 ++++++ .../17/options.json | 3 - .../17/output.json | 91 +++ .../18/options.json | 3 - .../18/output.json | 132 +++++ .../19/options.json | 3 - .../19/output.json | 132 +++++ .../2/options.json | 3 - .../2/output.json | 132 +++++ .../20/options.json | 3 - .../20/output.json | 172 ++++++ .../21/options.json | 3 - .../21/output.json | 91 +++ .../22/options.json | 3 - .../22/output.json | 132 +++++ .../23/options.json | 3 - .../23/output.json | 132 +++++ .../24/options.json | 3 - .../24/output.json | 172 ++++++ .../25/options.json | 3 - .../25/output.json | 91 +++ .../26/options.json | 3 - .../26/output.json | 132 +++++ .../27/options.json | 3 - .../27/output.json | 132 +++++ .../28/options.json | 3 - .../28/output.json | 172 ++++++ .../29/options.json | 3 - .../29/output.json | 91 +++ .../3/options.json | 3 - .../3/output.json | 132 +++++ .../30/options.json | 3 - .../30/output.json | 132 +++++ .../31/options.json | 3 - .../31/output.json | 132 +++++ .../32/options.json | 3 - .../32/output.json | 172 ++++++ .../33/options.json | 3 - .../33/output.json | 91 +++ .../34/options.json | 3 - .../34/output.json | 132 +++++ .../35/options.json | 3 - .../35/output.json | 132 +++++ .../36/options.json | 3 - .../36/output.json | 172 ++++++ .../37/options.json | 3 - .../37/output.json | 91 +++ .../38/options.json | 3 - .../38/output.json | 132 +++++ .../39/options.json | 3 - .../39/output.json | 132 +++++ .../4/options.json | 3 - .../4/output.json | 172 ++++++ .../40/options.json | 3 - .../40/output.json | 172 ++++++ .../41/options.json | 3 - .../41/output.json | 91 +++ .../42/options.json | 3 - .../42/output.json | 132 +++++ .../43/options.json | 3 - .../43/output.json | 132 +++++ .../44/options.json | 3 - .../44/output.json | 172 ++++++ .../45/options.json | 3 - .../45/output.json | 91 +++ .../46/options.json | 3 - .../46/output.json | 132 +++++ .../47/options.json | 3 - .../47/output.json | 132 +++++ .../48/options.json | 3 - .../48/output.json | 172 ++++++ .../49/options.json | 3 - .../49/output.json | 91 +++ .../5/options.json | 3 - .../5/output.json | 91 +++ .../50/options.json | 3 - .../50/output.json | 132 +++++ .../51/options.json | 3 - .../51/output.json | 132 +++++ .../52/options.json | 3 - .../52/output.json | 172 ++++++ .../53/options.json | 3 - .../53/output.json | 91 +++ .../54/options.json | 3 - .../54/output.json | 132 +++++ .../55/options.json | 3 - .../55/output.json | 132 +++++ .../56/options.json | 3 - .../56/output.json | 172 ++++++ .../57/options.json | 3 - .../57/output.json | 91 +++ .../58/options.json | 3 - .../58/output.json | 132 +++++ .../59/options.json | 3 - .../59/output.json | 132 +++++ .../6/options.json | 3 - .../6/output.json | 132 +++++ .../60/options.json | 3 - .../60/output.json | 172 ++++++ .../61/options.json | 3 - .../61/output.json | 91 +++ .../62/options.json | 3 - .../62/output.json | 132 +++++ .../63/options.json | 3 - .../63/output.json | 132 +++++ .../64/options.json | 3 - .../64/output.json | 172 ++++++ .../65/options.json | 3 - .../65/output.json | 91 +++ .../66/options.json | 3 - .../66/output.json | 132 +++++ .../67/options.json | 3 - .../67/output.json | 132 +++++ .../68/options.json | 3 - .../68/output.json | 172 ++++++ .../7/options.json | 3 - .../7/output.json | 132 +++++ .../8/options.json | 3 - .../8/output.json | 172 ++++++ .../9/options.json | 3 - .../9/output.json | 91 +++ .../top-level-await/inside-arrow/options.json | 1 + .../inside-function/options.json | 1 + .../options.json | 10 +- .../output.json | 172 ++++++ .../options.json | 3 - .../output.json | 73 +++ .../invalid-commonjs-module/options.json | 3 - .../invalid-commonjs-module/output.json | 214 +++++++ .../invalid-es-module/options.json | 3 - .../invalid-es-module/output.json | 214 +++++++ .../invalid-import/options.json | 3 - .../declare-module/invalid-import/output.json | 161 +++++ .../invalid-module-in-module/options.json | 3 - .../invalid-module-in-module/output.json | 137 +++++ .../invalid-multiple-commonjs/options.json | 3 - .../invalid-multiple-commonjs/output.json | 181 ++++++ .../options.json | 3 +- .../output.json | 87 +++ .../options.json | 3 +- .../output.json | 136 +++++ .../duplicate-member-name/options.json | 3 +- .../duplicate-member-name/output.json | 152 +++++ .../flow/enum-declaration/export/options.json | 9 +- .../options.json | 3 +- .../output.json | 87 +++ .../options.json | 3 +- .../output.json | 87 +++ .../options.json | 6 +- .../output.json | 87 +++ .../options.json | 3 +- .../output.json | 87 +++ .../options.json | 3 +- .../output.json | 86 +++ .../options.json | 3 +- .../output.json | 87 +++ .../options.json | 3 +- .../output.json | 87 +++ .../options.json | 2 +- .../options.json | 3 +- .../output.json | 87 +++ .../options.json | 3 +- .../output.json | 87 +++ .../invalid-member-name/options.json | 3 +- .../invalid-member-name/output.json | 153 +++++ .../options.json | 3 +- .../output.json | 87 +++ .../options.json | 3 +- .../output.json | 140 +++++ .../reserved-word-enum-name/options.json | 3 +- .../reserved-word-enum-name/output.json | 87 +++ .../options.json | 3 +- .../output.json | 152 +++++ .../options.json | 3 +- .../output.json | 192 ++++++ .../options.json | 4 +- .../output.json | 130 ++++ .../options.json | 4 +- .../output.json | 184 ++++++ .../options.json | 3 +- .../output.json | 185 ++++++ .../options.json | 3 +- .../output.json | 238 ++++++++ .../options.json | 5 - .../output.json | 184 ++++++ .../options.json | 3 +- .../output.json | 185 ++++++ .../options.json | 3 +- .../output.json | 238 ++++++++ .../options.json | 3 +- .../output.json | 182 ++++++ .../options.json | 3 +- .../output.json | 182 ++++++ .../options.json | 3 +- .../output.json | 235 ++++++++ .../options.json | 3 +- .../output.json | 182 ++++++ .../options.json | 3 +- .../output.json | 230 ++++++++ .../id-reserved-type-invalid/options.json | 3 - .../id-reserved-type-invalid/output.json | 94 +++ .../options.json | 3 - .../output.json | 122 ++++ .../fixtures/flow/iterator/03/options.json | 3 - .../fixtures/flow/iterator/03/output.json | 89 +++ .../fixtures/flow/iterator/04/options.json | 3 - .../fixtures/flow/iterator/04/output.json | 89 +++ .../fixtures/flow/iterator/05/options.json | 3 - .../fixtures/flow/iterator/05/output.json | 144 +++++ .../fixtures/flow/iterator/06/options.json | 3 - .../fixtures/flow/iterator/06/output.json | 144 +++++ .../fixtures/flow/iterator/07/options.json | 3 - .../fixtures/flow/iterator/07/output.json | 86 +++ .../fixtures/flow/iterator/08/options.json | 3 - .../fixtures/flow/iterator/08/output.json | 86 +++ .../fixtures/flow/iterator/09/options.json | 3 - .../fixtures/flow/iterator/09/output.json | 161 +++++ .../fixtures/flow/iterator/10/options.json | 3 - .../fixtures/flow/iterator/10/output.json | 161 +++++ .../fixtures/flow/iterator/11/options.json | 3 - .../fixtures/flow/iterator/11/output.json | 161 +++++ .../multiple-declarations/class/options.json | 3 +- .../multiple-declarations/class/output.json | 143 +++++ .../interface/options.json | 3 +- .../interface/output.json | 180 ++++++ .../multiple-declarations/type/options.json | 3 +- .../multiple-declarations/type/output.json | 134 +++++ .../options.json | 3 - .../output.json | 212 +++++++ .../invalid-getter-param-count/options.json | 3 - .../invalid-getter-param-count/output.json | 212 +++++++ .../invalid-setter-param-count/options.json | 3 - .../invalid-setter-param-count/output.json | 163 +++++ .../invalid-setter-param-type/options.json | 3 - .../invalid-setter-param-type/output.json | 212 +++++++ .../reserved-type-invalid/options.json | 3 - .../reserved-type-invalid/output.json | 87 +++ .../flow/optional-type/6/options.json | 3 - .../fixtures/flow/optional-type/6/output.json | 124 ++++ .../fixtures/flow/predicates/4/options.json | 3 - .../fixtures/flow/predicates/4/output.json | 241 ++++++++ .../fixtures/flow/predicates/5/options.json | 3 - .../fixtures/flow/predicates/5/output.json | 210 +++++++ .../issue-58-ambiguous/options.json | 2 +- .../issue-58-failing-1/options.json | 3 - .../regression/issue-58-failing-1/output.json | 233 ++++++++ .../issue-58-failing-2/options.json | 3 - .../regression/issue-58-failing-2/output.json | 353 +++++++++++ .../issue-58-failing-3/options.json | 3 - .../regression/issue-58-failing-3/output.json | 270 +++++++++ .../issue-58-failing-4/options.json | 3 - .../regression/issue-58-failing-4/output.json | 270 +++++++++ .../options.json | 8 +- .../dupl-decl-const-declare-class/output.json | 164 ++++++ .../options.json | 8 +- .../output.json | 164 ++++++ .../dupl-decl-const-interface/options.json | 8 +- .../dupl-decl-const-interface/output.json | 164 ++++++ .../dupl-decl-const-opaque-type/options.json | 3 - .../dupl-decl-const-opaque-type/output.json | 163 +++++ .../scope/dupl-decl-const-type/options.json | 3 - .../scope/dupl-decl-const-type/output.json | 162 +++++ .../options.json | 8 +- .../output.json | 150 +++++ .../options.json | 8 +- .../output.json | 150 +++++ .../dupl-decl-declare-var-let/options.json | 8 +- .../dupl-decl-declare-var-let/output.json | 151 +++++ .../options.json | 8 +- .../dupl-decl-interface-interface/output.json | 150 +++++ .../dupl-decl-let-declare-class/options.json | 8 +- .../dupl-decl-let-declare-class/output.json | 164 ++++++ .../options.json | 8 +- .../output.json | 164 ++++++ .../dupl-decl-let-interface/options.json | 8 +- .../scope/dupl-decl-let-interface/output.json | 164 ++++++ .../dupl-decl-let-opaque-type/options.json | 3 - .../dupl-decl-let-opaque-type/output.json | 163 +++++ .../scope/dupl-decl-let-type/options.json | 3 - .../flow/scope/dupl-decl-let-type/output.json | 162 +++++ .../dupl-decl-opaque-type-const/options.json | 3 - .../dupl-decl-opaque-type-const/output.json | 163 +++++ .../dupl-decl-opaque-type-let/options.json | 3 - .../dupl-decl-opaque-type-let/output.json | 163 +++++ .../options.json | 3 - .../output.json | 148 +++++ .../dupl-decl-opaque-type-type/options.json | 3 - .../dupl-decl-opaque-type-type/output.json | 147 +++++ .../dupl-decl-opaque-type-var/options.json | 3 - .../dupl-decl-opaque-type-var/output.json | 163 +++++ .../scope/dupl-decl-type-const/options.json | 3 - .../scope/dupl-decl-type-const/output.json | 162 +++++ .../dupl-decl-type-interface/options.json | 8 +- .../dupl-decl-type-interface/output.json | 142 +++++ .../scope/dupl-decl-type-let/options.json | 3 - .../flow/scope/dupl-decl-type-let/output.json | 162 +++++ .../dupl-decl-type-opaque-type/options.json | 3 - .../dupl-decl-type-opaque-type/output.json | 147 +++++ .../scope/dupl-decl-type-type/options.json | 3 - .../scope/dupl-decl-type-type/output.json | 146 +++++ .../scope/dupl-decl-type-var/options.json | 3 - .../flow/scope/dupl-decl-type-var/output.json | 162 +++++ .../options.json | 8 +- .../output.json | 164 ++++++ .../dupl-decl-var-interface/options.json | 8 +- .../scope/dupl-decl-var-interface/output.json | 164 ++++++ .../dupl-decl-var-opaque-type/options.json | 3 - .../dupl-decl-var-opaque-type/output.json | 163 +++++ .../scope/dupl-decl-var-type/options.json | 3 - .../flow/scope/dupl-decl-var-type/output.json | 162 +++++ .../flow/type-annotations/131/options.json | 3 - .../flow/type-annotations/131/output.json | 86 +++ .../flow/type-annotations/132/options.json | 3 - .../flow/type-annotations/132/output.json | 119 ++++ .../flow/type-annotations/133/options.json | 3 - .../flow/type-annotations/133/output.json | 236 ++++++++ .../flow/type-annotations/134/options.json | 3 - .../flow/type-annotations/134/output.json | 86 +++ .../flow/type-annotations/137/options.json | 3 - .../flow/type-annotations/137/output.json | 140 +++++ .../flow/type-annotations/139/options.json | 3 - .../flow/type-annotations/139/output.json | 190 ++++++ .../with-default-invalid/options.json | 3 - .../with-default-invalid/output.json | 173 ++++++ .../invalid-import-type-2/options.json | 3 - .../invalid-import-type-2/output.json | 126 ++++ .../invalid-import-type-3/options.json | 3 - .../invalid-import-type-3/output.json | 108 ++++ .../invalid-import-type-4/options.json | 3 - .../invalid-import-type-4/output.json | 108 ++++ .../invalid-import-type-as/options.json | 8 +- .../invalid-import-type-as/output.json | 126 ++++ .../options.json | 3 - .../output.json | 126 ++++ .../options.json | 3 - .../output.json | 126 ++++ .../options.json | 3 - .../output.json | 126 ++++ .../options.json | 3 - .../invalid-import-type-shorthand/output.json | 126 ++++ .../invalid-import-type/options.json | 3 - .../invalid-import-type/output.json | 108 ++++ .../default-missing/options.json | 3 - .../default-missing/output.json | 169 ++++++ .../options.json | 9 +- .../output.json | 94 +++ .../options.json | 5 - .../output.json | 241 ++++++++ .../options.json | 3 +- .../output.json | 122 ++++ .../options.json | 5 - .../output.json | 174 ++++++ .../fail-in-calls-with-one-arg/options.json | 3 - .../fail-in-calls-with-one-arg/output.json | 149 +++++ .../flow/typecasts/fail-in-calls/options.json | 3 - .../flow/typecasts/fail-in-calls/output.json | 166 ++++++ .../fail-without-parens/options.json | 3 - .../typecasts/fail-without-parens/output.json | 171 ++++++ .../fails-in-array-expression-1/options.json | 3 - .../fails-in-array-expression-1/output.json | 132 +++++ .../fails-in-array-expression-2/options.json | 3 - .../fails-in-array-expression-2/output.json | 136 +++++ .../fails-in-array-expression-3/options.json | 3 - .../fails-in-array-expression-3/output.json | 170 ++++++ .../fails-in-array-expression-4/options.json | 3 - .../fails-in-array-expression-4/output.json | 166 ++++++ .../fails-in-array-expression-5/options.json | 3 - .../fails-in-array-expression-5/output.json | 200 +++++++ .../jsx/errors/adjacent-tags/options.json | 3 - .../jsx/errors/adjacent-tags/output.json | 189 ++++++ .../attribute-empty-expression/options.json | 3 - .../attribute-empty-expression/output.json | 165 ++++++ .../wrong-closing-tag-fragment/options.json | 3 - .../wrong-closing-tag-fragment/output.json | 115 ++++ .../jsx/errors/wrong-closing-tag/options.json | 3 - .../jsx/errors/wrong-closing-tag/output.json | 133 +++++ .../wrong-opening-tag-fragment/options.json | 3 - .../wrong-opening-tag-fragment/output.json | 117 ++++ .../_errors/space-after/options.json | 3 +- .../_errors/space-after/output.json | 71 +++ .../_errors/space-before/options.json | 3 +- .../_errors/space-before/output.json | 71 +++ .../arrow-async-parameter-as/options.json | 3 - .../cast/arrow-async-parameter-as/output.json | 154 +++++ .../options.json | 3 - .../output.json | 154 +++++ .../cast/arrow-parameter-as/options.json | 3 - .../cast/arrow-parameter-as/output.json | 154 +++++ .../arrow-parameter-assertion/options.json | 3 - .../arrow-parameter-assertion/output.json | 154 +++++ .../class/extends-empty/options.json | 3 - .../class/extends-empty/output.json | 87 +++ .../extends-implements-empty/options.json | 3 - .../extends-implements-empty/output.json | 104 ++++ .../class/implements-empty/options.json | 3 - .../class/implements-empty/output.json | 88 +++ .../options.json | 3 - .../output.json | 177 ++++++ .../options.json | 3 - .../output.json | 139 +++++ .../options.json | 3 - .../output.json | 138 +++++ .../options.json | 3 - .../output.json | 138 +++++ .../options.json | 3 - .../output.json | 138 +++++ .../function/pattern-parameters/options.json | 3 - .../function/pattern-parameters/output.json | 124 ++++ .../redeclaration-class-class/options.json | 3 - .../redeclaration-class-class/output.json | 136 +++++ .../redeclaration-class-enum/options.json | 3 - .../redeclaration-class-enum/output.json | 120 ++++ .../redeclaration-class-type/options.json | 3 - .../redeclaration-class-type/output.json | 134 +++++ .../redeclaration-constenum-enum/options.json | 3 - .../redeclaration-constenum-enum/output.json | 105 ++++ .../redeclaration-enum-class/options.json | 3 - .../redeclaration-enum-class/output.json | 120 ++++ .../redeclaration-enum-constenum/options.json | 3 - .../redeclaration-enum-constenum/output.json | 105 ++++ .../redeclaration-enum-function/options.json | 3 - .../redeclaration-enum-function/output.json | 123 ++++ .../redeclaration-enum-interface/options.json | 3 - .../redeclaration-enum-interface/output.json | 119 ++++ .../scope/redeclaration-enum-let/options.json | 3 - .../scope/redeclaration-enum-let/output.json | 122 ++++ .../redeclaration-enum-type/options.json | 3 - .../scope/redeclaration-enum-type/output.json | 118 ++++ .../scope/redeclaration-enum-var/options.json | 3 - .../scope/redeclaration-enum-var/output.json | 122 ++++ .../redeclaration-function-enum/options.json | 3 - .../redeclaration-function-enum/output.json | 123 ++++ .../redeclaration-interface-enum/options.json | 3 - .../redeclaration-interface-enum/output.json | 119 ++++ .../scope/redeclaration-let-enum/options.json | 3 - .../scope/redeclaration-let-enum/output.json | 122 ++++ .../redeclaration-type-class/options.json | 3 - .../redeclaration-type-class/output.json | 134 +++++ .../redeclaration-type-enum/options.json | 3 - .../scope/redeclaration-type-enum/output.json | 118 ++++ .../redeclaration-type-interface/options.json | 3 - .../redeclaration-type-interface/output.json | 133 +++++ .../redeclaration-type-type/options.json | 3 - .../scope/redeclaration-type-type/output.json | 132 +++++ .../scope/redeclaration-var-enum/options.json | 3 - .../scope/redeclaration-var-enum/output.json | 122 ++++ .../types/literal-string-2/options.json | 5 - .../types/literal-string-2/output.json | 195 ++++++ .../typescript/types/read-only-1/options.json | 5 - .../typescript/types/read-only-1/output.json | 137 +++++ .../typescript/types/read-only-2/options.json | 5 - .../typescript/types/read-only-2/output.json | 154 +++++ .../typescript/types/read-only-3/options.json | 5 - .../typescript/types/read-only-3/output.json | 168 ++++++ .../typescript/types/read-only-4/options.json | 5 - .../typescript/types/read-only-4/output.json | 186 ++++++ .../types/tuple-optional-invalid/options.json | 5 - .../types/tuple-optional-invalid/output.json | 166 ++++++ .../options.json | 2 +- .../test/helpers/runFixtureTests.js | 44 +- .../jsx-compat/ts-invalid/options.json | 2 +- 2224 files changed, 155997 insertions(+), 3354 deletions(-) delete mode 100644 packages/babel-parser/test/expressions/is-expression-babel-parser/fail/7/options.json create mode 100644 packages/babel-parser/test/expressions/is-expression-babel-parser/fail/7/output.json create mode 100644 packages/babel-parser/test/expressions/is-expression-babel-parser/fail/8/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/categorized/invalid-fn-decl-inside-loop/options.json create mode 100644 packages/babel-parser/test/fixtures/core/categorized/invalid-fn-decl-inside-loop/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/categorized/invalid-fn-decl-labeled-inside-loop/options.json create mode 100644 packages/babel-parser/test/fixtures/core/categorized/invalid-fn-decl-labeled-inside-loop/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/escape-keyword/invalid/options.json create mode 100644 packages/babel-parser/test/fixtures/core/escape-keyword/invalid/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/escape-template/non-octal-eight/options.json create mode 100644 packages/babel-parser/test/fixtures/core/escape-template/non-octal-eight/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/escape-template/non-octal-nine/options.json create mode 100644 packages/babel-parser/test/fixtures/core/escape-template/non-octal-nine/output.json create mode 100644 packages/babel-parser/test/fixtures/core/regression/non-octal-float-strict-mode/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/scope/dupl-bind-2nd-lvl-lex-nested/options.json create mode 100644 packages/babel-parser/test/fixtures/core/scope/dupl-bind-2nd-lvl-lex-nested/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/scope/dupl-bind-2nd-lvl-lex/options.json create mode 100644 packages/babel-parser/test/fixtures/core/scope/dupl-bind-2nd-lvl-lex/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/scope/dupl-bind-2nd-lvl-var-nested/options.json create mode 100644 packages/babel-parser/test/fixtures/core/scope/dupl-bind-2nd-lvl-var-nested/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/scope/dupl-bind-2nd-lvl-var/options.json create mode 100644 packages/babel-parser/test/fixtures/core/scope/dupl-bind-2nd-lvl-var/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-arr-destr/options.json create mode 100644 packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-arr-destr/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-dbl-let/options.json create mode 100644 packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-dbl-let/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-func/options.json create mode 100644 packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-func/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-let/options.json create mode 100644 packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-let/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-obj-destr/options.json create mode 100644 packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-obj-destr/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-var-arr-destr/options.json create mode 100644 packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-var-arr-destr/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-var-obj-destr/options.json create mode 100644 packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-var-obj-destr/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/scope/dupl-bind-class-class/options.json create mode 100644 packages/babel-parser/test/fixtures/core/scope/dupl-bind-class-class/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/scope/dupl-bind-class-const/options.json create mode 100644 packages/babel-parser/test/fixtures/core/scope/dupl-bind-class-const/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/scope/dupl-bind-class-func/options.json create mode 100644 packages/babel-parser/test/fixtures/core/scope/dupl-bind-class-func/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/scope/dupl-bind-class-let/options.json create mode 100644 packages/babel-parser/test/fixtures/core/scope/dupl-bind-class-let/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/scope/dupl-bind-class-var/options.json create mode 100644 packages/babel-parser/test/fixtures/core/scope/dupl-bind-class-var/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/scope/dupl-bind-const-const/options.json create mode 100644 packages/babel-parser/test/fixtures/core/scope/dupl-bind-const-const/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/scope/dupl-bind-func-gen/options.json create mode 100644 packages/babel-parser/test/fixtures/core/scope/dupl-bind-func-gen/output.json create mode 100644 packages/babel-parser/test/fixtures/core/scope/dupl-bind-func-module-sloppy/output.json create mode 100644 packages/babel-parser/test/fixtures/core/scope/dupl-bind-func-module/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/scope/dupl-bind-func-var-sloppy/options.json create mode 100644 packages/babel-parser/test/fixtures/core/scope/dupl-bind-func-var-sloppy/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/scope/dupl-bind-gen-func/options.json create mode 100644 packages/babel-parser/test/fixtures/core/scope/dupl-bind-gen-func/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/scope/dupl-bind-let-let/options.json create mode 100644 packages/babel-parser/test/fixtures/core/scope/dupl-bind-let-let/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/scope/dupl-bind-nested-let-var/options.json create mode 100644 packages/babel-parser/test/fixtures/core/scope/dupl-bind-nested-let-var/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/scope/for-var/options.json create mode 100644 packages/babel-parser/test/fixtures/core/scope/for-var/output.json create mode 100644 packages/babel-parser/test/fixtures/core/scope/undecl-export-as-default/output.json create mode 100644 packages/babel-parser/test/fixtures/core/scope/undecl-export-as/output.json create mode 100644 packages/babel-parser/test/fixtures/core/scope/undecl-export-block/output.json create mode 100644 packages/babel-parser/test/fixtures/core/scope/undecl-export-builtin-as/output.json create mode 100644 packages/babel-parser/test/fixtures/core/scope/undecl-export-builtin/output.json create mode 100644 packages/babel-parser/test/fixtures/core/scope/undecl-export-if/output.json create mode 100644 packages/babel-parser/test/fixtures/core/scope/undecl-export/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/108/options.json create mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/108/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/349/options.json create mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/349/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/350/options.json create mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/350/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/351/options.json create mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/351/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/354/options.json create mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/354/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/361/options.json create mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/361/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/362/options.json create mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/362/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/363/options.json create mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/363/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/366/options.json create mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/366/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/367/options.json create mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/367/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/368/options.json create mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/368/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/369/options.json create mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/369/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/370/options.json create mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/370/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/371/options.json create mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/371/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/372/options.json create mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/372/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/373/options.json create mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/373/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/374/options.json create mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/374/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/382/options.json create mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/382/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/383/options.json create mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/383/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/384/options.json create mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/384/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/397/options.json create mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/397/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/398/options.json create mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/398/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/399/options.json create mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/399/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/400/options.json create mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/400/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/401/options.json create mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/401/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/402/options.json create mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/402/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/403/options.json create mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/403/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/404/options.json create mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/404/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/409/options.json create mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/409/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/411/options.json create mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/411/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/417/options.json create mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/417/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/418/options.json create mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/418/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/425/options.json create mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/425/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/427/options.json create mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/427/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/446/options.json create mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/446/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/447/options.json create mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/447/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/448/options.json create mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/448/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/449/options.json create mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/449/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/454/options.json create mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/454/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/455/options.json create mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/455/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/456/options.json create mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/456/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/457/options.json create mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/457/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/459/options.json create mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/459/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/460/options.json create mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/460/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/461/options.json create mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/461/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/462/options.json create mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/462/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/463/options.json create mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/463/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/464/options.json create mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/464/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/465/options.json create mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/465/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/466/options.json create mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/466/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/467/options.json create mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/467/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/468/options.json create mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/468/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/469/options.json create mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/469/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/470/options.json create mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/470/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/471/options.json create mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/471/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/472/options.json create mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/472/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/473/options.json create mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/473/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/474/options.json create mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/474/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/475/options.json create mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/475/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/476/options.json create mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/476/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/477/options.json create mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/477/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/478/options.json create mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/478/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/479/options.json create mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/479/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/480/options.json create mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/480/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/481/options.json create mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/481/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/482/options.json create mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/482/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/483/options.json create mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/483/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/484/options.json create mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/484/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/485/options.json create mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/485/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/486/options.json create mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/486/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/487/options.json create mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/487/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/488/options.json create mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/488/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/489/options.json create mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/489/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/490/options.json create mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/490/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/491/options.json create mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/491/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/492/options.json create mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/492/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/493/options.json create mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/493/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/494/options.json create mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/494/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/495/options.json create mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/495/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/496/options.json create mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/496/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/497/options.json create mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/497/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/498/options.json create mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/498/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/499/options.json create mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/499/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/500/options.json create mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/500/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/501/options.json create mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/501/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/502/options.json create mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/502/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/503/options.json create mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/503/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/504/options.json create mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/504/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/505/options.json create mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/505/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/506/options.json create mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/506/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/507/options.json create mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/507/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/508/options.json create mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/508/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/509/options.json create mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/509/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/510/options.json create mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/510/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/511/options.json create mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/511/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/512/options.json create mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/512/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/513/options.json create mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/513/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/514/options.json create mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/514/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/515/options.json create mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/515/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/516/options.json create mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/516/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/517/options.json create mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/517/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/518/options.json create mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/518/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/519/options.json create mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/519/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/520/options.json create mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/520/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/521/options.json create mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/521/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/522/options.json create mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/522/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/523/options.json create mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/523/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/524/options.json create mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/524/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/544/options.json create mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/544/output.json create mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/545/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/547/options.json create mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/547/output.json create mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/548/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/550/options.json create mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/550/output.json delete mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/552/options.json create mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/552/output.json create mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/556/output.json create mode 100644 packages/babel-parser/test/fixtures/core/uncategorised/558/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/array-rest-spread/comma-after-rest/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/array-rest-spread/comma-after-rest/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/array-rest-spread/comma-after-spread-for-in/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/array-rest-spread/comma-after-spread-for-in/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/array-rest-spread/comma-after-spread-nested/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/array-rest-spread/comma-after-spread-nested/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/class-methods/direct-super-in-object-method/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/class-methods/direct-super-in-object-method/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/class-methods/direct-super-outside-constructor/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/class-methods/direct-super-outside-constructor/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/class-methods/disallow-duplicate-method-params/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/class-methods/disallow-duplicate-method-params/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/class-methods/disallow-static-generator-prototype/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/class-methods/disallow-static-generator-prototype/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/class-methods/disallow-static-prototype/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/class-methods/disallow-static-prototype/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/class-methods/getter-signature/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/class-methods/getter-signature/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/class-methods/malformed-super-expression/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/class-methods/malformed-super-expression/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/class/extends-strict/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/class/extends-strict/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/destructuring/binding-this/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/destructuring/binding-this/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/destructuring/error-operator-for-default/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/destructuring/error-operator-for-default/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/destructuring/parenthesized-lhs-array/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/destructuring/parenthesized-lhs-array/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/destructuring/parenthesized-lhs-object/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/destructuring/parenthesized-lhs-object/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/for-in/bare-initializer/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/for-in/bare-initializer/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/for-in/const-initializer/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/for-in/const-initializer/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/for-in/let-initializer/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/for-in/let-initializer/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/for-in/strict-initializer/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/for-in/strict-initializer/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/for-in/var-arraybindingpattern-initializer/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/for-in/var-arraybindingpattern-initializer/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/for-in/var-objectbindingpattern-initializer/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/for-in/var-objectbindingpattern-initializer/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/for-of/bare-initializer/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/for-of/bare-initializer/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/generators/invalid-escape-yield/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/generators/invalid-escape-yield/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/generators/invalid-hanging/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/generators/invalid-hanging/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-const/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-const/output.json create mode 100644 packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-export/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-if/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-if/output.json create mode 100644 packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-import/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-null/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-null/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-true/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-true/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/let/let-as-identifier-strict-fail/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/let/let-as-identifier-strict-fail/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/let/let-at-binding-list-fail-1/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/let/let-at-binding-list-fail-1/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/let/let-at-binding-list-fail-2/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/let/let-at-binding-list-fail-2/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/let/let-at-binding-list-fail-3/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/let/let-at-binding-list-fail-3/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/let/let-at-binding-list-fail-4/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/let/let-at-binding-list-fail-4/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/let/let-at-binding-list-fail-5/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/let/let-at-binding-list-fail-5/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/let/let-at-binding-list-fail-6/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/let/let-at-binding-list-fail-6/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/let/let-at-catch-block/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/let/let-at-catch-block/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/meta-properties/invalid-arrow-function/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/meta-properties/invalid-arrow-function/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/meta-properties/new-invalid-prop/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/meta-properties/new-invalid-prop/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/meta-properties/new-target-invalid-escaped-new/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/meta-properties/new-target-invalid-escaped-new/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/meta-properties/new-target-invalid-escaped-target/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/meta-properties/new-target-invalid-escaped-target/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/meta-properties/new-target-invalid/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/meta-properties/new-target-invalid/output.json create mode 100644 packages/babel-parser/test/fixtures/es2015/modules/duplicate-export-default-and-export-as-default/output.json create mode 100644 packages/babel-parser/test/fixtures/es2015/modules/duplicate-export-default/output.json create mode 100644 packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-class-declaration/output.json create mode 100644 packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring-assignment/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring10/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring10/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring11/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring11/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring12/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring12/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring13/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring13/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring14/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring14/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring15/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring15/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring16/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring16/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring17/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring17/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring18/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring18/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring19/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring19/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring2/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring2/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring3/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring3/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring4/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring4/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring5/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring5/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring6/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring6/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring7/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring7/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring8/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring8/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring9/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring9/output.json create mode 100644 packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-function-declaration/output.json create mode 100644 packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-variable-declaration/output.json create mode 100644 packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export/output.json create mode 100644 packages/babel-parser/test/fixtures/es2015/modules/import-invalid-keyword-flow/output.json create mode 100644 packages/babel-parser/test/fixtures/es2015/modules/import-invalid-keyword-typeof-flow/output.json create mode 100644 packages/babel-parser/test/fixtures/es2015/modules/import-invalid-keyword-typeof/output.json create mode 100644 packages/babel-parser/test/fixtures/es2015/modules/import-invalid-keyword/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/object/disallow-duplicate-method-params/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/object/disallow-duplicate-method-params/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/regex/duplicate-flags/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/regex/duplicate-flags/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/shorthand/1/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/shorthand/1/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/shorthand/2/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/shorthand/2/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/statements/label-invalid-const/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/statements/label-invalid-const/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/statements/label-invalid-func-async/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/statements/label-invalid-func-async/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/statements/label-invalid-func-generator/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/statements/label-invalid-func-generator/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/statements/label-invalid-func-strict/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/statements/label-invalid-func-strict/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/109/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/109/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/123/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/123/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/125/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/125/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/126/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/126/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/127/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/127/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/166/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/166/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/198/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/198/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/200/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/200/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/201/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/201/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/202/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/202/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/204/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/204/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/205/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/205/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/206/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/206/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/208/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/208/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/209/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/209/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/210/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/210/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/211/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/211/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/213/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/213/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/214/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/214/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/215/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/215/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/217/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/217/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/218/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/218/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/219/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/219/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/220/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/220/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/221/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/221/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/222/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/222/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/223/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/223/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/226/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/226/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/227/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/227/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/228/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/228/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/229/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/229/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/230/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/230/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/231/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/231/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/232/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/232/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/233/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/233/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/234/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/234/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/235/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/235/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/236/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/236/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/242/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/242/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/243/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/243/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/244/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/244/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/245/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/245/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/246/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/246/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/247/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/247/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/248/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/248/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/249/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/249/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/251/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/251/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/252/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/252/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/280/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/280/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/281/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/281/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/284/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/284/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/289/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/289/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/290/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/290/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/291/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/291/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/296/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/296/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/297/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/297/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/298/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/298/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/324/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/324/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/325/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/325/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/329/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/329/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/332/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/332/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/333/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/333/output.json create mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/334/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/339/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/339/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/344/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/344/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/347/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/347/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/348/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/348/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/349/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/349/output.json create mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/357/output.json create mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/359/output.json create mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/361/output.json create mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/363/output.json create mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/365/output.json create mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/367/output.json create mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/368/output.json create mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/369/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/37/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/37/output.json create mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/370/output.json create mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/371/output.json create mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/372/output.json create mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/373/output.json create mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/374/output.json create mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/375/output.json create mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/376/output.json create mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/377/output.json create mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/378/output.json create mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/379/output.json create mode 100644 packages/babel-parser/test/fixtures/es2015/uncategorised/395/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/yield/function-name-function-declaration-inside-generator/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/yield/function-name-function-declaration-inside-generator/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/yield/function-name-generator-expression/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/yield/function-name-generator-expression/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/yield/function-name-strict-body/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/yield/function-name-strict-body/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/yield/function-name-strict/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/yield/function-name-strict/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-1/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-1/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-2/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-2/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-3/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-3/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-4/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-4/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-5/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-5/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-6/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-6/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-generator-method/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-generator-method/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-generator/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-generator/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/yield/parameter-default-strict/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/yield/parameter-default-strict/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/yield/parameter-name-arrow-inside-generator-1/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/yield/parameter-name-arrow-inside-generator-1/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/yield/parameter-name-arrow-inside-generator-2/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/yield/parameter-name-arrow-inside-generator-2/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/yield/parameter-name-arrow-inside-generator-3/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/yield/parameter-name-arrow-inside-generator-3/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/yield/parameter-name-generator-method/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/yield/parameter-name-generator-method/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/yield/parameter-name-generator/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/yield/parameter-name-generator/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/yield/parameter-name-strict-body/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/yield/parameter-name-strict-body/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/yield/parameter-name-strict/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/yield/parameter-name-strict/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2015/yield/yield-star-parameter-default-inside-generator/options.json create mode 100644 packages/babel-parser/test/fixtures/es2015/yield/yield-star-parameter-default-inside-generator/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2016/exponentiation-operator/10/options.json create mode 100644 packages/babel-parser/test/fixtures/es2016/exponentiation-operator/10/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2016/exponentiation-operator/11/options.json create mode 100644 packages/babel-parser/test/fixtures/es2016/exponentiation-operator/11/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2016/exponentiation-operator/12/options.json create mode 100644 packages/babel-parser/test/fixtures/es2016/exponentiation-operator/12/output.json create mode 100644 packages/babel-parser/test/fixtures/es2016/exponentiation-operator/15/output.json create mode 100644 packages/babel-parser/test/fixtures/es2016/exponentiation-operator/16/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2016/simple-parameter-list/array-pattern-default/options.json create mode 100644 packages/babel-parser/test/fixtures/es2016/simple-parameter-list/array-pattern-default/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2016/simple-parameter-list/array-pattern/options.json create mode 100644 packages/babel-parser/test/fixtures/es2016/simple-parameter-list/array-pattern/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2016/simple-parameter-list/arrow-function/options.json create mode 100644 packages/babel-parser/test/fixtures/es2016/simple-parameter-list/arrow-function/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2016/simple-parameter-list/async-arrow-function/options.json create mode 100644 packages/babel-parser/test/fixtures/es2016/simple-parameter-list/async-arrow-function/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2016/simple-parameter-list/async-function/options.json create mode 100644 packages/babel-parser/test/fixtures/es2016/simple-parameter-list/async-function/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2016/simple-parameter-list/default/options.json create mode 100644 packages/babel-parser/test/fixtures/es2016/simple-parameter-list/default/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2016/simple-parameter-list/generator-function/options.json create mode 100644 packages/babel-parser/test/fixtures/es2016/simple-parameter-list/generator-function/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2016/simple-parameter-list/generator-method/options.json create mode 100644 packages/babel-parser/test/fixtures/es2016/simple-parameter-list/generator-method/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2016/simple-parameter-list/method/options.json create mode 100644 packages/babel-parser/test/fixtures/es2016/simple-parameter-list/method/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2016/simple-parameter-list/object-pattern-default/options.json create mode 100644 packages/babel-parser/test/fixtures/es2016/simple-parameter-list/object-pattern-default/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2016/simple-parameter-list/object-pattern/options.json create mode 100644 packages/babel-parser/test/fixtures/es2016/simple-parameter-list/object-pattern/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2016/simple-parameter-list/rest/options.json create mode 100644 packages/babel-parser/test/fixtures/es2016/simple-parameter-list/rest/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2017/async-functions/2/options.json create mode 100644 packages/babel-parser/test/fixtures/es2017/async-functions/2/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2017/async-functions/await-async-function-expression-name/options.json create mode 100644 packages/babel-parser/test/fixtures/es2017/async-functions/await-async-function-expression-name/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2017/async-functions/await-binding-inside-arrow-params-inside-async-arrow-params/options.json create mode 100644 packages/babel-parser/test/fixtures/es2017/async-functions/await-binding-inside-arrow-params-inside-async-arrow-params/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2017/async-functions/await-function-declaration-name-inside-async-function/options.json create mode 100644 packages/babel-parser/test/fixtures/es2017/async-functions/await-function-declaration-name-inside-async-function/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-arguments-of-async-call-inside-parameters-of-async-arrow-function/options.json create mode 100644 packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-arguments-of-async-call-inside-parameters-of-async-arrow-function/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-parameters-of-nested-arrow-function/options.json create mode 100644 packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-parameters-of-nested-arrow-function/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-parameters-of-nested-async-arrow-function/options.json create mode 100644 packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-parameters-of-nested-async-arrow-function/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-parameters/options.json create mode 100644 packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-parameters/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2017/async-functions/invalid-inside-loop/options.json create mode 100644 packages/babel-parser/test/fixtures/es2017/async-functions/invalid-inside-loop/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2017/async-functions/no-constructor/options.json create mode 100644 packages/babel-parser/test/fixtures/es2017/async-functions/no-constructor/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2017/async-functions/params-invalid-rest-trailing-comma/options.json create mode 100644 packages/babel-parser/test/fixtures/es2017/async-functions/params-invalid-rest-trailing-comma/output.json create mode 100644 packages/babel-parser/test/fixtures/es2018/object-rest-spread/11/output.json create mode 100644 packages/babel-parser/test/fixtures/es2018/object-rest-spread/12/output.json create mode 100644 packages/babel-parser/test/fixtures/es2018/object-rest-spread/13/output.json create mode 100644 packages/babel-parser/test/fixtures/es2018/object-rest-spread/14/output.json create mode 100644 packages/babel-parser/test/fixtures/es2018/object-rest-spread/15/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2018/object-rest-spread/18/options.json create mode 100644 packages/babel-parser/test/fixtures/es2018/object-rest-spread/18/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2018/object-rest-spread/21/options.json create mode 100644 packages/babel-parser/test/fixtures/es2018/object-rest-spread/21/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2018/object-rest-spread/24/options.json create mode 100644 packages/babel-parser/test/fixtures/es2018/object-rest-spread/24/output.json delete mode 100644 packages/babel-parser/test/fixtures/es2018/object-rest-spread/8/options.json create mode 100644 packages/babel-parser/test/fixtures/es2018/object-rest-spread/8/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/declaration-function/dupe-param/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/declaration-function/dupe-param/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-array-binding-pattern/invalid-dup-param/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-array-binding-pattern/invalid-dup-param/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-array-pattern/dupe-param-1/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-array-pattern/dupe-param-1/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-array-pattern/dupe-param-2/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-array-pattern/dupe-param-2/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-array-pattern/dupe-param-3/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-array-pattern/dupe-param-3/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/complex-rest-in-arrow-not-allowed/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/complex-rest-in-arrow-not-allowed/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/invalid-duplicated-params/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/invalid-duplicated-params/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/invalid-param-strict-mode/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/invalid-param-strict-mode/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/object-binding-pattern-invalid-member-expr/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/object-binding-pattern-invalid-member-expr/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/object-binding-pattern-invalid-method-in-pattern/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/object-binding-pattern-invalid-method-in-pattern/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/object-binding-pattern-invalid-nested-param/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/object-binding-pattern-invalid-nested-param/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-object-pattern/invalid-lhs-01/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-object-pattern/invalid-lhs-01/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-object-pattern/invalid-lhs-02/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-object-pattern/invalid-lhs-02/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-object-pattern/invalid-pattern-with-method/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-object-pattern/invalid-pattern-with-method/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment/invalid-group-assignment/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment/invalid-group-assignment/output.json create mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/invalid-export-named-default/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-for-of/invalid-const-init/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-for-of/invalid-const-init/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-for-of/invalid-let-init/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-for-of/invalid-let-init/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-for-of/invalid-lhs-init/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-for-of/invalid-lhs-init/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-for-of/invalid-var-init/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-for-of/invalid-var-init/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-identifier/invalid_escaped_surrogate_pairs/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-identifier/invalid_escaped_surrogate_pairs/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-identifier/invalid_expression_await/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-identifier/invalid_expression_await/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-identifier/invalid_var_await/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-identifier/invalid_var_await/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-lexical-declaration/invalid_complex_binding_without_init/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-lexical-declaration/invalid_complex_binding_without_init/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-lexical-declaration/invalid_const_forin/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-lexical-declaration/invalid_const_forin/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-lexical-declaration/invalid_let_forin/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-lexical-declaration/invalid_let_forin/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-meta-property/invalid-new-target/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-meta-property/invalid-new-target/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-meta-property/unknown-property/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-meta-property/unknown-property/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/invalid-proto-getter-literal-identifier/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/invalid-proto-getter-literal-identifier/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/invalid-proto-identifier-literal/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/invalid-proto-identifier-literal/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/invalid-proto-identifiers/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/invalid-proto-identifiers/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/invalid-proto-literal-identifier/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/invalid-proto-literal-identifier/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/invalid-proto-literals/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/invalid-proto-literals/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/invalid-proto-setter-literal-identifier/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/invalid-proto-setter-literal-identifier/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-super-property/invalid_super_not_inside_function/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-super-property/invalid_super_not_inside_function/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-template-literals/invalid-escape/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-template-literals/invalid-escape/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-arrow-default/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-arrow-default/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-arrow-parameter/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-arrow-parameter/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-arrow-parameters/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-arrow-parameters/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-catch/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-catch/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-declaration/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-declaration/output.json create mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-export-default/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-expression-name/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-expression-name/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-expression-parameter/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-expression-parameter/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-expression-rest/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-expression-rest/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-function-declaration/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-function-declaration/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-lexical-declaration/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-lexical-declaration/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-parameter/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-parameter/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-rest/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-rest/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-strict-function-expression/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-strict-function-expression/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-strict-function-parameter/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-strict-function-parameter/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-variable-declaration/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-variable-declaration/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-array-pattern/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-array-pattern/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-arrow-parameter-default/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-arrow-parameter-default/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-arrow-parameter-name/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-arrow-parameter-name/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-binding-element/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-binding-element/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-catch-parameter/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-catch-parameter/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-formal-parameter/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-formal-parameter/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-function-declaration/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-function-declaration/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-function-expression/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-function-expression/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-identifier/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-identifier/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-lexical-declaration/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-lexical-declaration/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-rest-parameter/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-rest-parameter/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-variable-declaration/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-variable-declaration/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-generator-arrow-default/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-generator-arrow-default/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/expression-primary-array/migrated_0012/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/expression-primary-array/migrated_0012/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-00/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-00/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-01/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-01/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-02/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-02/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-03/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-03/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-04/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-04/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-05/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-05/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-06/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-06/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-07/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-07/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0004/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0004/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0005/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0005/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0006/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0006/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0009/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0009/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0012/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0012/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0013/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0013/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0014/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0014/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0015/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0015/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0017/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0017/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0019/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0019/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0020/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0020/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0021/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0021/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0022/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0022/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0024/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0024/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0025/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0025/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0026/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0026/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0027/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0027/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0028/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0028/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0032/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0032/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0033/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0033/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0034/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0034/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0036/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0036/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0037/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0037/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0041/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0041/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0042/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0042/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0043/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0043/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0044/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0044/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0045/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0045/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0046/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0046/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0047/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0047/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0049/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0049/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0050/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0050/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0051/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0051/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0052/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0052/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0053/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0053/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0054/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0054/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0055/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0055/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0056/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0056/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0064/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0064/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0066/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0066/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0067/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0067/output.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0075/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0087/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0087/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0088/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0088/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0089/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0089/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0090/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0090/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0091/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0091/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0092/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0092/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0093/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0093/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0094/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0094/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0098/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0098/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0099/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0099/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0100/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0100/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0101/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0101/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0116/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0116/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0118/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0118/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0125/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0125/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0126/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0126/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0133/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0133/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0137/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0137/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0142/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0142/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0143/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0143/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0162/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0162/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0163/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0163/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0164/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0164/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0165/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0165/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0166/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0166/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0167/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0167/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0171/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0171/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0172/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0172/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0173/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0173/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0174/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0174/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0176/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0176/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0177/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0177/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0178/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0178/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0179/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0179/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0180/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0180/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0181/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0181/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0182/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0182/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0183/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0183/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0184/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0184/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0185/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0185/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0186/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0186/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0187/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0187/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0188/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0188/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0189/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0189/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0190/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0190/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0191/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0191/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0192/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0192/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0193/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0193/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0194/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0194/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0195/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0195/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0196/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0196/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0197/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0197/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0198/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0198/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0199/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0199/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0200/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0200/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0201/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0201/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0202/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0202/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0203/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0203/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0204/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0204/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0205/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0205/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0206/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0206/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0207/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0207/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0208/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0208/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0209/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0209/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0210/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0210/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0211/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0211/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0212/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0212/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0213/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0213/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0214/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0214/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0215/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0215/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0216/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0216/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0217/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0217/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0218/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0218/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0219/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0219/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0220/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0220/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0221/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0221/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0222/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0222/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0223/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0223/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0224/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0224/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0225/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0225/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0226/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0226/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0227/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0227/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0228/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0228/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0229/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0229/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0230/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0230/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0231/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0231/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0232/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0232/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0233/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0233/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0234/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0234/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0235/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0235/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0236/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0236/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0239/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0239/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0240/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0240/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0241/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0241/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0242/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0242/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0243/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0243/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0244/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0244/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0245/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0245/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0246/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0246/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0247/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0247/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0248/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0248/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0249/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0249/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0250/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0250/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0270/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0270/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0271/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0271/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0272/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0272/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0273/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0273/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0274/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0274/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0277/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0277/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0278/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0278/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/rest-parameter/invalid-setter-rest/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/rest-parameter/invalid-setter-rest/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/statement-expression/migrated_0002/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/statement-expression/migrated_0002/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/statement-expression/migrated_0003/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/statement-expression/migrated_0003/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/statement-expression/migrated_0004/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/statement-expression/migrated_0004/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/statement-expression/migrated_0005/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/statement-expression/migrated_0005/output.json delete mode 100644 packages/babel-parser/test/fixtures/esprima/statement-variable/complex-pattern-requires-init/options.json create mode 100644 packages/babel-parser/test/fixtures/esprima/statement-variable/complex-pattern-requires-init/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/bigint/invalid-decimal/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/bigint/invalid-decimal/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/bigint/invalid-e/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/bigint/invalid-e/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/bigint/invalid-non-octal-decimal-int/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/bigint/invalid-octal-legacy/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/bigint/invalid-octal-legacy/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/class-private-methods/failure-name-constructor/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/class-private-methods/failure-spaces/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/class-private-properties/failure-delete-private-property/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/class-private-properties/failure-name-constructor/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/class-private-properties/failure-spaces/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/class-private-properties/super-call/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/class-private-properties/super-private-member-access/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/class-properties/arguments-in-arrow-function/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/class-properties/arguments/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/class-properties/new-target-invalid/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/class-properties/no-ctor-2/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/class-properties/no-ctor/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/class-properties/no-static-prototype-2/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/class-properties/no-static-prototype/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/class-properties/static-field-named-constructor/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/class-properties/super-call/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/class-properties/super-inside-function/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/decorators-2/decoratorsBeforeExport-export-default-decorated-expression-without-parens/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/decorators-2/no-class-method-parameter/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/decorators-2/no-class-method-parameter/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/decorators-2/no-constructor-decorators/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/decorators-2/no-constructor-decorators/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/decorators-2/no-export-decorators-on-class/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/decorators-2/no-function-parameters/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/decorators-2/no-function-parameters/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/decorators-2/no-object-method-parameters/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/decorators-2/no-object-method-parameters/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/decorators-2/no-object-methods/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/decorators/no-constructor-decorators/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/decorators/no-constructor-decorators/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/dynamic-import/direct-calls-only/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/dynamic-import/invalid-arguments-spread/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/dynamic-import/invalid-new/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/dynamic-import/invalid-trailing-comma/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/dynamic-import/multiple-args/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/dynamic-import/no-args/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/import-meta/error-in-script/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/import-meta/no-other-prop-names/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/import-meta/not-assignable/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-0/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-0/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-1/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-1/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-10/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-10/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-100/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-100/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-101/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-101/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-102/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-102/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-103/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-103/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-104/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-104/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-105/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-105/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-106/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-106/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-107/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-107/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-108/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-108/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-109/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-109/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-11/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-11/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-110/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-110/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-111/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-111/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-112/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-112/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-113/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-113/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-114/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-114/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-115/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-115/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-116/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-116/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-117/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-117/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-118/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-118/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-119/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-119/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-12/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-12/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-120/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-120/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-121/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-121/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-122/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-122/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-123/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-123/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-124/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-124/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-125/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-125/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-126/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-126/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-127/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-127/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-128/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-128/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-129/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-129/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-13/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-13/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-130/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-130/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-131/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-131/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-132/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-132/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-133/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-133/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-134/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-134/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-135/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-135/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-136/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-136/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-137/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-137/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-138/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-138/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-139/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-139/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-14/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-14/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-140/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-140/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-141/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-141/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-142/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-142/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-143/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-143/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-144/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-144/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-145/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-145/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-146/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-146/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-147/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-147/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-15/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-15/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-16/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-16/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-17/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-17/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-18/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-18/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-19/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-19/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-2/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-2/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-20/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-20/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-21/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-21/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-22/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-22/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-23/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-23/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-25/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-25/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-26/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-26/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-28/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-28/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-29/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-29/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-3/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-3/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-30/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-30/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-31/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-31/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-32/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-32/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-33/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-33/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-34/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-34/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-35/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-35/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-36/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-36/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-37/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-37/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-38/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-38/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-39/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-39/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-4/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-4/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-40/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-40/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-41/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-41/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-42/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-42/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-43/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-43/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-44/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-44/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-45/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-45/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-46/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-46/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-47/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-47/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-48/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-48/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-49/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-49/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-5/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-5/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-50/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-50/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-51/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-51/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-52/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-52/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-53/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-53/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-54/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-54/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-55/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-55/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-56/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-56/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-57/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-57/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-58/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-58/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-59/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-59/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-6/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-6/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-60/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-60/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-61/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-61/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-62/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-62/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-63/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-63/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-64/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-64/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-65/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-65/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-66/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-66/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-67/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-67/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-68/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-68/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-69/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-69/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-7/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-7/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-70/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-70/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-71/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-71/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-72/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-72/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-73/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-73/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-74/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-74/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-75/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-75/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-76/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-76/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-77/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-77/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-78/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-78/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-79/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-79/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-8/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-8/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-80/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-80/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-81/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-81/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-82/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-82/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-83/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-83/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-84/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-84/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-85/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-85/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-86/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-86/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-87/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-87/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-88/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-88/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-89/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-89/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-9/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-9/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-90/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-90/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-91/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-91/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-92/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-92/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-93/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-93/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-94/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-94/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-95/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-95/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-96/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-96/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-97/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-97/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-98/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-98/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-99/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-99/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-hex/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-leading-zero/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-legacy-octal-literal/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-non-octal-decimal-int/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-unicode-2/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-unicode/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/optional-chaining/class-contructor-call/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/optional-chaining/optional-constructor/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/optional-chaining/optional-super-property-class/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/optional-chaining/optional-super-property/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/optional-chaining/optional-tagged-template-literals/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/partial-application/in-SuperCall/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/partial-application/in-new/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-bare-style,-head-with-topic-reference-pair/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-nested-pipelines,-topic-style-with-arrow-function-with-bare-style,-no-outer-topic-reference/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-nested-pipelines,-topic-style-with-arrow-function-with-topic-style,-no-inner-topic-reference/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-nested-pipelines,-topic-style-with-arrow-function-with-topic-style,-no-outer-topic-reference/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-nested-pipelines,-topic-style-with-inner-topic-style,-no-inner-topic-reference/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-nested-pipelines,-topic-style-with-inner-topic-style,-no-outer-topic-reference/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-sequence-style,-body-with-topic-reference-pair-followed-by-bare-style-pipeline-body/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-sequence-style,-body-with-topic-reference-pair-then-end/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-computed,-no-topic-reference/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-no-topic-reference,-addition/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-no-topic-reference,-class-expression/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-no-topic-reference,-function-expression/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-do-while-loop,-outer-topic-reference-in-loop-body/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-for-await-of-loop,-outer-topic-reference-in-loop-body/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-for-classic-loop,-outer-topic-reference-in-loop-body/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-for-in-loop,-outer-topic-reference-in-loop-body/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-for-of-loop,-outer-topic-reference-in-loop-body/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-try-statement,-outer-topic-reference-in-catch-clause/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-while-loop,-outer-topic-reference-in-loop-body/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-with-statement,-outer-topic-reference-in-with-body/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-unbound-topic,-inner-class-in-pipeline-body/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-unbound-topic,-inner-function-in-pipeline-body/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-unbound-topic,-pipeline-head-in-inner-function-in-pipeline-body/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/1/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/1/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/10/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/10/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/11/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/11/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/12/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/12/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/13/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/13/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/14/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/14/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/15/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/15/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/16/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/16/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/17/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/17/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/18/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/18/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/19/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/19/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/2/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/2/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/20/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/20/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/21/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/21/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/22/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/22/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/23/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/23/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/24/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/24/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/25/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/25/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/26/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/26/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/27/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/27/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/28/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/28/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/29/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/29/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/3/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/3/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/30/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/30/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/31/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/31/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/32/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/32/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/33/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/33/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/34/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/34/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/35/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/35/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/36/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/36/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/37/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/37/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/38/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/38/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/39/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/39/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/4/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/4/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/40/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/40/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/41/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/41/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/42/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/42/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/43/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/43/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/44/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/44/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/45/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/45/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/46/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/46/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/47/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/47/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/48/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/48/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/49/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/49/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/5/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/5/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/50/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/50/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/51/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/51/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/52/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/52/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/53/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/53/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/54/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/54/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/55/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/55/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/56/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/56/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/57/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/57/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/58/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/58/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/59/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/59/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/6/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/6/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/60/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/60/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/61/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/61/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/62/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/62/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/63/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/63/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/64/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/64/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/65/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/65/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/66/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/66/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/67/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/67/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/68/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/68/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/7/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/7/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/8/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/8/output.json delete mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/9/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/9/output.json create mode 100644 packages/babel-parser/test/fixtures/flow/classes/constructor-override-with-class-prop-plugin/output.json delete mode 100644 packages/babel-parser/test/fixtures/flow/comment/12-line-comment-nested-invalid/options.json create mode 100644 packages/babel-parser/test/fixtures/flow/comment/12-line-comment-nested-invalid/output.json delete mode 100644 packages/babel-parser/test/fixtures/flow/declare-module/invalid-commonjs-module/options.json create mode 100644 packages/babel-parser/test/fixtures/flow/declare-module/invalid-commonjs-module/output.json delete mode 100644 packages/babel-parser/test/fixtures/flow/declare-module/invalid-es-module/options.json create mode 100644 packages/babel-parser/test/fixtures/flow/declare-module/invalid-es-module/output.json delete mode 100644 packages/babel-parser/test/fixtures/flow/declare-module/invalid-import/options.json create mode 100644 packages/babel-parser/test/fixtures/flow/declare-module/invalid-import/output.json delete mode 100644 packages/babel-parser/test/fixtures/flow/declare-module/invalid-module-in-module/options.json create mode 100644 packages/babel-parser/test/fixtures/flow/declare-module/invalid-module-in-module/output.json delete mode 100644 packages/babel-parser/test/fixtures/flow/declare-module/invalid-multiple-commonjs/options.json create mode 100644 packages/babel-parser/test/fixtures/flow/declare-module/invalid-multiple-commonjs/output.json create mode 100644 packages/babel-parser/test/fixtures/flow/enum-declaration/boolean-member-not-initialized-explicit/output.json create mode 100644 packages/babel-parser/test/fixtures/flow/enum-declaration/boolean-member-not-initialized-implicit/output.json create mode 100644 packages/babel-parser/test/fixtures/flow/enum-declaration/duplicate-member-name/output.json create mode 100644 packages/babel-parser/test/fixtures/flow/enum-declaration/inconsistent-member-values-majority-defaulted/output.json create mode 100644 packages/babel-parser/test/fixtures/flow/enum-declaration/inconsistent-member-values-mixed-initializers/output.json create mode 100644 packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-explicit-type-identifier/output.json create mode 100644 packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-boolean-explicit-string/output.json create mode 100644 packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-literal-explicit-symbol/output.json create mode 100644 packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-number-explicit-boolean/output.json create mode 100644 packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-number-explicit-string/output.json create mode 100644 packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-string-explicit-boolean/output.json create mode 100644 packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-string-explicit-number/output.json create mode 100644 packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-name/output.json create mode 100644 packages/babel-parser/test/fixtures/flow/enum-declaration/number-member-not-initialized-explicit/output.json create mode 100644 packages/babel-parser/test/fixtures/flow/enum-declaration/number-member-not-initialized-implicit/output.json create mode 100644 packages/babel-parser/test/fixtures/flow/enum-declaration/reserved-word-enum-name/output.json create mode 100644 packages/babel-parser/test/fixtures/flow/enum-declaration/string-member-inconsistently-initialized-majority-defaulted/output.json create mode 100644 packages/babel-parser/test/fixtures/flow/enum-declaration/string-member-inconsistently-initialized-majority-initialized/output.json create mode 100644 packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects1/output.json create mode 100644 packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects2/output.json create mode 100644 packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects3/output.json create mode 100644 packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects4/output.json delete mode 100644 packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects5/options.json create mode 100644 packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects5/output.json create mode 100644 packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects6/output.json create mode 100644 packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects7/output.json create mode 100644 packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_forbidden_in_exact/output.json create mode 100644 packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_must_appear_last/output.json create mode 100644 packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_object_invalid1/output.json create mode 100644 packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_object_invalid2/output.json create mode 100644 packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_object_invalid3/output.json delete mode 100644 packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/id-reserved-type-invalid/options.json create mode 100644 packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/id-reserved-type-invalid/output.json delete mode 100644 packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/implements-reserved-type-invalid/options.json create mode 100644 packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/implements-reserved-type-invalid/output.json delete mode 100644 packages/babel-parser/test/fixtures/flow/iterator/03/options.json create mode 100644 packages/babel-parser/test/fixtures/flow/iterator/03/output.json delete mode 100644 packages/babel-parser/test/fixtures/flow/iterator/04/options.json create mode 100644 packages/babel-parser/test/fixtures/flow/iterator/04/output.json delete mode 100644 packages/babel-parser/test/fixtures/flow/iterator/05/options.json create mode 100644 packages/babel-parser/test/fixtures/flow/iterator/05/output.json delete mode 100644 packages/babel-parser/test/fixtures/flow/iterator/06/options.json create mode 100644 packages/babel-parser/test/fixtures/flow/iterator/06/output.json delete mode 100644 packages/babel-parser/test/fixtures/flow/iterator/07/options.json create mode 100644 packages/babel-parser/test/fixtures/flow/iterator/07/output.json delete mode 100644 packages/babel-parser/test/fixtures/flow/iterator/08/options.json create mode 100644 packages/babel-parser/test/fixtures/flow/iterator/08/output.json delete mode 100644 packages/babel-parser/test/fixtures/flow/iterator/09/options.json create mode 100644 packages/babel-parser/test/fixtures/flow/iterator/09/output.json delete mode 100644 packages/babel-parser/test/fixtures/flow/iterator/10/options.json create mode 100644 packages/babel-parser/test/fixtures/flow/iterator/10/output.json delete mode 100644 packages/babel-parser/test/fixtures/flow/iterator/11/options.json create mode 100644 packages/babel-parser/test/fixtures/flow/iterator/11/output.json create mode 100644 packages/babel-parser/test/fixtures/flow/multiple-declarations/class/output.json create mode 100644 packages/babel-parser/test/fixtures/flow/multiple-declarations/interface/output.json create mode 100644 packages/babel-parser/test/fixtures/flow/multiple-declarations/type/output.json delete mode 100644 packages/babel-parser/test/fixtures/flow/object-types/invalid-getter-param-count-rest/options.json create mode 100644 packages/babel-parser/test/fixtures/flow/object-types/invalid-getter-param-count-rest/output.json delete mode 100644 packages/babel-parser/test/fixtures/flow/object-types/invalid-getter-param-count/options.json create mode 100644 packages/babel-parser/test/fixtures/flow/object-types/invalid-getter-param-count/output.json delete mode 100644 packages/babel-parser/test/fixtures/flow/object-types/invalid-setter-param-count/options.json create mode 100644 packages/babel-parser/test/fixtures/flow/object-types/invalid-setter-param-count/output.json delete mode 100644 packages/babel-parser/test/fixtures/flow/object-types/invalid-setter-param-type/options.json create mode 100644 packages/babel-parser/test/fixtures/flow/object-types/invalid-setter-param-type/output.json delete mode 100644 packages/babel-parser/test/fixtures/flow/opaque-type-alias/reserved-type-invalid/options.json create mode 100644 packages/babel-parser/test/fixtures/flow/opaque-type-alias/reserved-type-invalid/output.json delete mode 100644 packages/babel-parser/test/fixtures/flow/optional-type/6/options.json create mode 100644 packages/babel-parser/test/fixtures/flow/optional-type/6/output.json delete mode 100644 packages/babel-parser/test/fixtures/flow/predicates/4/options.json create mode 100644 packages/babel-parser/test/fixtures/flow/predicates/4/output.json delete mode 100644 packages/babel-parser/test/fixtures/flow/predicates/5/options.json create mode 100644 packages/babel-parser/test/fixtures/flow/predicates/5/output.json delete mode 100644 packages/babel-parser/test/fixtures/flow/regression/issue-58-failing-1/options.json create mode 100644 packages/babel-parser/test/fixtures/flow/regression/issue-58-failing-1/output.json delete mode 100644 packages/babel-parser/test/fixtures/flow/regression/issue-58-failing-2/options.json create mode 100644 packages/babel-parser/test/fixtures/flow/regression/issue-58-failing-2/output.json delete mode 100644 packages/babel-parser/test/fixtures/flow/regression/issue-58-failing-3/options.json create mode 100644 packages/babel-parser/test/fixtures/flow/regression/issue-58-failing-3/output.json delete mode 100644 packages/babel-parser/test/fixtures/flow/regression/issue-58-failing-4/options.json create mode 100644 packages/babel-parser/test/fixtures/flow/regression/issue-58-failing-4/output.json create mode 100644 packages/babel-parser/test/fixtures/flow/scope/dupl-decl-const-declare-class/output.json create mode 100644 packages/babel-parser/test/fixtures/flow/scope/dupl-decl-const-declare-interface/output.json create mode 100644 packages/babel-parser/test/fixtures/flow/scope/dupl-decl-const-interface/output.json delete mode 100644 packages/babel-parser/test/fixtures/flow/scope/dupl-decl-const-opaque-type/options.json create mode 100644 packages/babel-parser/test/fixtures/flow/scope/dupl-decl-const-opaque-type/output.json delete mode 100644 packages/babel-parser/test/fixtures/flow/scope/dupl-decl-const-type/options.json create mode 100644 packages/babel-parser/test/fixtures/flow/scope/dupl-decl-const-type/output.json create mode 100644 packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-class-declare-interface/output.json create mode 100644 packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-interface-declare-class/output.json create mode 100644 packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-var-let/output.json create mode 100644 packages/babel-parser/test/fixtures/flow/scope/dupl-decl-interface-interface/output.json create mode 100644 packages/babel-parser/test/fixtures/flow/scope/dupl-decl-let-declare-class/output.json create mode 100644 packages/babel-parser/test/fixtures/flow/scope/dupl-decl-let-declare-interface/output.json create mode 100644 packages/babel-parser/test/fixtures/flow/scope/dupl-decl-let-interface/output.json delete mode 100644 packages/babel-parser/test/fixtures/flow/scope/dupl-decl-let-opaque-type/options.json create mode 100644 packages/babel-parser/test/fixtures/flow/scope/dupl-decl-let-opaque-type/output.json delete mode 100644 packages/babel-parser/test/fixtures/flow/scope/dupl-decl-let-type/options.json create mode 100644 packages/babel-parser/test/fixtures/flow/scope/dupl-decl-let-type/output.json delete mode 100644 packages/babel-parser/test/fixtures/flow/scope/dupl-decl-opaque-type-const/options.json create mode 100644 packages/babel-parser/test/fixtures/flow/scope/dupl-decl-opaque-type-const/output.json delete mode 100644 packages/babel-parser/test/fixtures/flow/scope/dupl-decl-opaque-type-let/options.json create mode 100644 packages/babel-parser/test/fixtures/flow/scope/dupl-decl-opaque-type-let/output.json delete mode 100644 packages/babel-parser/test/fixtures/flow/scope/dupl-decl-opaque-type-opaque-type/options.json create mode 100644 packages/babel-parser/test/fixtures/flow/scope/dupl-decl-opaque-type-opaque-type/output.json delete mode 100644 packages/babel-parser/test/fixtures/flow/scope/dupl-decl-opaque-type-type/options.json create mode 100644 packages/babel-parser/test/fixtures/flow/scope/dupl-decl-opaque-type-type/output.json delete mode 100644 packages/babel-parser/test/fixtures/flow/scope/dupl-decl-opaque-type-var/options.json create mode 100644 packages/babel-parser/test/fixtures/flow/scope/dupl-decl-opaque-type-var/output.json delete mode 100644 packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-const/options.json create mode 100644 packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-const/output.json create mode 100644 packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-interface/output.json delete mode 100644 packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-let/options.json create mode 100644 packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-let/output.json delete mode 100644 packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-opaque-type/options.json create mode 100644 packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-opaque-type/output.json delete mode 100644 packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-type/options.json create mode 100644 packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-type/output.json delete mode 100644 packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-var/options.json create mode 100644 packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-var/output.json create mode 100644 packages/babel-parser/test/fixtures/flow/scope/dupl-decl-var-declare-interface/output.json create mode 100644 packages/babel-parser/test/fixtures/flow/scope/dupl-decl-var-interface/output.json delete mode 100644 packages/babel-parser/test/fixtures/flow/scope/dupl-decl-var-opaque-type/options.json create mode 100644 packages/babel-parser/test/fixtures/flow/scope/dupl-decl-var-opaque-type/output.json delete mode 100644 packages/babel-parser/test/fixtures/flow/scope/dupl-decl-var-type/options.json create mode 100644 packages/babel-parser/test/fixtures/flow/scope/dupl-decl-var-type/output.json delete mode 100644 packages/babel-parser/test/fixtures/flow/type-annotations/131/options.json create mode 100644 packages/babel-parser/test/fixtures/flow/type-annotations/131/output.json delete mode 100644 packages/babel-parser/test/fixtures/flow/type-annotations/132/options.json create mode 100644 packages/babel-parser/test/fixtures/flow/type-annotations/132/output.json delete mode 100644 packages/babel-parser/test/fixtures/flow/type-annotations/133/options.json create mode 100644 packages/babel-parser/test/fixtures/flow/type-annotations/133/output.json delete mode 100644 packages/babel-parser/test/fixtures/flow/type-annotations/134/options.json create mode 100644 packages/babel-parser/test/fixtures/flow/type-annotations/134/output.json delete mode 100644 packages/babel-parser/test/fixtures/flow/type-annotations/137/options.json create mode 100644 packages/babel-parser/test/fixtures/flow/type-annotations/137/output.json delete mode 100644 packages/babel-parser/test/fixtures/flow/type-annotations/139/options.json create mode 100644 packages/babel-parser/test/fixtures/flow/type-annotations/139/output.json delete mode 100644 packages/babel-parser/test/fixtures/flow/type-annotations/with-default-invalid/options.json create mode 100644 packages/babel-parser/test/fixtures/flow/type-annotations/with-default-invalid/output.json delete mode 100644 packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-2/options.json create mode 100644 packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-2/output.json delete mode 100644 packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-3/options.json create mode 100644 packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-3/output.json delete mode 100644 packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-4/options.json create mode 100644 packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-4/output.json create mode 100644 packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-as/output.json delete mode 100644 packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-shorthand-2/options.json create mode 100644 packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-shorthand-2/output.json delete mode 100644 packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-shorthand-3/options.json create mode 100644 packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-shorthand-3/output.json delete mode 100644 packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-shorthand-4/options.json create mode 100644 packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-shorthand-4/output.json delete mode 100644 packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-shorthand/options.json create mode 100644 packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-shorthand/output.json delete mode 100644 packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type/options.json create mode 100644 packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type/output.json delete mode 100644 packages/babel-parser/test/fixtures/flow/type-parameter-declaration/default-missing/options.json create mode 100644 packages/babel-parser/test/fixtures/flow/type-parameter-declaration/default-missing/output.json create mode 100644 packages/babel-parser/test/fixtures/flow/type-parameter-declaration/reserved-word-class-name-failure/output.json delete mode 100644 packages/babel-parser/test/fixtures/flow/typeapp-call/underscore_is_illegal_param_instantiation_otherwise/options.json create mode 100644 packages/babel-parser/test/fixtures/flow/typeapp-call/underscore_is_illegal_param_instantiation_otherwise/output.json create mode 100644 packages/babel-parser/test/fixtures/flow/typeapp-call/underscore_is_illegal_type_name/output.json delete mode 100644 packages/babel-parser/test/fixtures/flow/typeapp-call/underscore_is_illegal_type_param_name/options.json create mode 100644 packages/babel-parser/test/fixtures/flow/typeapp-call/underscore_is_illegal_type_param_name/output.json delete mode 100644 packages/babel-parser/test/fixtures/flow/typecasts/fail-in-calls-with-one-arg/options.json create mode 100644 packages/babel-parser/test/fixtures/flow/typecasts/fail-in-calls-with-one-arg/output.json delete mode 100644 packages/babel-parser/test/fixtures/flow/typecasts/fail-in-calls/options.json create mode 100644 packages/babel-parser/test/fixtures/flow/typecasts/fail-in-calls/output.json delete mode 100644 packages/babel-parser/test/fixtures/flow/typecasts/fail-without-parens/options.json create mode 100644 packages/babel-parser/test/fixtures/flow/typecasts/fail-without-parens/output.json delete mode 100644 packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-1/options.json create mode 100644 packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-1/output.json delete mode 100644 packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-2/options.json create mode 100644 packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-2/output.json delete mode 100644 packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-3/options.json create mode 100644 packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-3/output.json delete mode 100644 packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-4/options.json create mode 100644 packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-4/output.json delete mode 100644 packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-5/options.json create mode 100644 packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-5/output.json delete mode 100644 packages/babel-parser/test/fixtures/jsx/errors/adjacent-tags/options.json create mode 100644 packages/babel-parser/test/fixtures/jsx/errors/adjacent-tags/output.json delete mode 100644 packages/babel-parser/test/fixtures/jsx/errors/attribute-empty-expression/options.json create mode 100644 packages/babel-parser/test/fixtures/jsx/errors/attribute-empty-expression/output.json delete mode 100644 packages/babel-parser/test/fixtures/jsx/errors/wrong-closing-tag-fragment/options.json create mode 100644 packages/babel-parser/test/fixtures/jsx/errors/wrong-closing-tag-fragment/output.json delete mode 100644 packages/babel-parser/test/fixtures/jsx/errors/wrong-closing-tag/options.json create mode 100644 packages/babel-parser/test/fixtures/jsx/errors/wrong-closing-tag/output.json delete mode 100644 packages/babel-parser/test/fixtures/jsx/errors/wrong-opening-tag-fragment/options.json create mode 100644 packages/babel-parser/test/fixtures/jsx/errors/wrong-opening-tag-fragment/output.json create mode 100644 packages/babel-parser/test/fixtures/placeholders/_errors/space-after/output.json create mode 100644 packages/babel-parser/test/fixtures/placeholders/_errors/space-before/output.json delete mode 100644 packages/babel-parser/test/fixtures/typescript/cast/arrow-async-parameter-as/options.json create mode 100644 packages/babel-parser/test/fixtures/typescript/cast/arrow-async-parameter-as/output.json delete mode 100644 packages/babel-parser/test/fixtures/typescript/cast/arrow-async-parameter-assertion/options.json create mode 100644 packages/babel-parser/test/fixtures/typescript/cast/arrow-async-parameter-assertion/output.json delete mode 100644 packages/babel-parser/test/fixtures/typescript/cast/arrow-parameter-as/options.json create mode 100644 packages/babel-parser/test/fixtures/typescript/cast/arrow-parameter-as/output.json delete mode 100644 packages/babel-parser/test/fixtures/typescript/cast/arrow-parameter-assertion/options.json create mode 100644 packages/babel-parser/test/fixtures/typescript/cast/arrow-parameter-assertion/output.json delete mode 100644 packages/babel-parser/test/fixtures/typescript/class/extends-empty/options.json create mode 100644 packages/babel-parser/test/fixtures/typescript/class/extends-empty/output.json delete mode 100644 packages/babel-parser/test/fixtures/typescript/class/extends-implements-empty/options.json create mode 100644 packages/babel-parser/test/fixtures/typescript/class/extends-implements-empty/output.json delete mode 100644 packages/babel-parser/test/fixtures/typescript/class/implements-empty/options.json create mode 100644 packages/babel-parser/test/fixtures/typescript/class/implements-empty/output.json delete mode 100644 packages/babel-parser/test/fixtures/typescript/class/parameter-properties-binding-patterns/options.json create mode 100644 packages/babel-parser/test/fixtures/typescript/class/parameter-properties-binding-patterns/output.json delete mode 100644 packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-abstract/options.json create mode 100644 packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-abstract/output.json delete mode 100644 packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-private/options.json create mode 100644 packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-private/output.json delete mode 100644 packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-protected/options.json create mode 100644 packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-protected/output.json delete mode 100644 packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-public/options.json create mode 100644 packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-public/output.json delete mode 100644 packages/babel-parser/test/fixtures/typescript/function/pattern-parameters/options.json create mode 100644 packages/babel-parser/test/fixtures/typescript/function/pattern-parameters/output.json delete mode 100644 packages/babel-parser/test/fixtures/typescript/scope/redeclaration-class-class/options.json create mode 100644 packages/babel-parser/test/fixtures/typescript/scope/redeclaration-class-class/output.json delete mode 100644 packages/babel-parser/test/fixtures/typescript/scope/redeclaration-class-enum/options.json create mode 100644 packages/babel-parser/test/fixtures/typescript/scope/redeclaration-class-enum/output.json delete mode 100644 packages/babel-parser/test/fixtures/typescript/scope/redeclaration-class-type/options.json create mode 100644 packages/babel-parser/test/fixtures/typescript/scope/redeclaration-class-type/output.json delete mode 100644 packages/babel-parser/test/fixtures/typescript/scope/redeclaration-constenum-enum/options.json create mode 100644 packages/babel-parser/test/fixtures/typescript/scope/redeclaration-constenum-enum/output.json delete mode 100644 packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-class/options.json create mode 100644 packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-class/output.json delete mode 100644 packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-constenum/options.json create mode 100644 packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-constenum/output.json delete mode 100644 packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-function/options.json create mode 100644 packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-function/output.json delete mode 100644 packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-interface/options.json create mode 100644 packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-interface/output.json delete mode 100644 packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-let/options.json create mode 100644 packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-let/output.json delete mode 100644 packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-type/options.json create mode 100644 packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-type/output.json delete mode 100644 packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-var/options.json create mode 100644 packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-var/output.json delete mode 100644 packages/babel-parser/test/fixtures/typescript/scope/redeclaration-function-enum/options.json create mode 100644 packages/babel-parser/test/fixtures/typescript/scope/redeclaration-function-enum/output.json delete mode 100644 packages/babel-parser/test/fixtures/typescript/scope/redeclaration-interface-enum/options.json create mode 100644 packages/babel-parser/test/fixtures/typescript/scope/redeclaration-interface-enum/output.json delete mode 100644 packages/babel-parser/test/fixtures/typescript/scope/redeclaration-let-enum/options.json create mode 100644 packages/babel-parser/test/fixtures/typescript/scope/redeclaration-let-enum/output.json delete mode 100644 packages/babel-parser/test/fixtures/typescript/scope/redeclaration-type-class/options.json create mode 100644 packages/babel-parser/test/fixtures/typescript/scope/redeclaration-type-class/output.json delete mode 100644 packages/babel-parser/test/fixtures/typescript/scope/redeclaration-type-enum/options.json create mode 100644 packages/babel-parser/test/fixtures/typescript/scope/redeclaration-type-enum/output.json delete mode 100644 packages/babel-parser/test/fixtures/typescript/scope/redeclaration-type-interface/options.json create mode 100644 packages/babel-parser/test/fixtures/typescript/scope/redeclaration-type-interface/output.json delete mode 100644 packages/babel-parser/test/fixtures/typescript/scope/redeclaration-type-type/options.json create mode 100644 packages/babel-parser/test/fixtures/typescript/scope/redeclaration-type-type/output.json delete mode 100644 packages/babel-parser/test/fixtures/typescript/scope/redeclaration-var-enum/options.json create mode 100644 packages/babel-parser/test/fixtures/typescript/scope/redeclaration-var-enum/output.json delete mode 100644 packages/babel-parser/test/fixtures/typescript/types/literal-string-2/options.json create mode 100644 packages/babel-parser/test/fixtures/typescript/types/literal-string-2/output.json delete mode 100644 packages/babel-parser/test/fixtures/typescript/types/read-only-1/options.json create mode 100644 packages/babel-parser/test/fixtures/typescript/types/read-only-1/output.json delete mode 100644 packages/babel-parser/test/fixtures/typescript/types/read-only-2/options.json create mode 100644 packages/babel-parser/test/fixtures/typescript/types/read-only-2/output.json delete mode 100644 packages/babel-parser/test/fixtures/typescript/types/read-only-3/options.json create mode 100644 packages/babel-parser/test/fixtures/typescript/types/read-only-3/output.json delete mode 100644 packages/babel-parser/test/fixtures/typescript/types/read-only-4/options.json create mode 100644 packages/babel-parser/test/fixtures/typescript/types/read-only-4/output.json delete mode 100644 packages/babel-parser/test/fixtures/typescript/types/tuple-optional-invalid/options.json create mode 100644 packages/babel-parser/test/fixtures/typescript/types/tuple-optional-invalid/output.json diff --git a/packages/babel-core/test/fixtures/parse/output.json b/packages/babel-core/test/fixtures/parse/output.json index 06fb684869dc..5c48f0e09836 100644 --- a/packages/babel-core/test/fixtures/parse/output.json +++ b/packages/babel-core/test/fixtures/parse/output.json @@ -2,6 +2,7 @@ "type": "File", "start": 0, "end": 91, + "errors": [], "loc": { "start": { "line": 1, diff --git a/packages/babel-parser/src/options.js b/packages/babel-parser/src/options.js index 8b030847f970..eb4dd6789605 100755 --- a/packages/babel-parser/src/options.js +++ b/packages/babel-parser/src/options.js @@ -21,6 +21,7 @@ export type Options = { ranges: boolean, tokens: boolean, createParenthesizedExpressions: boolean, + errorRecovery: boolean, }; export const defaultOptions: Options = { @@ -62,6 +63,9 @@ export const defaultOptions: Options = { // Whether to create ParenthesizedExpression AST nodes (if false // the parser sets extra.parenthesized on the expression nodes instead). createParenthesizedExpressions: false, + // When enabled, errors are attached to the AST instead of being directly thrown. + // Some errors will still throw, because @babel/parser can't always recover. + errorRecovery: false, }; // Interpret and default an options object diff --git a/packages/babel-parser/src/parser/expression.js b/packages/babel-parser/src/parser/expression.js index eb7952a3e8d9..291351594925 100644 --- a/packages/babel-parser/src/parser/expression.js +++ b/packages/babel-parser/src/parser/expression.js @@ -108,6 +108,7 @@ export default class ExpressionParser extends LValParser { this.unexpected(); } expr.comments = this.state.comments; + expr.errors = this.state.errors; return expr; } @@ -786,11 +787,11 @@ export default class ExpressionParser extends LValParser { if (node.callee.type === "Import") { if (node.arguments.length !== 1) { this.raise(node.start, "import() requires exactly one argument"); - } - - const importArg = node.arguments[0]; - if (importArg && importArg.type === "SpreadElement") { - this.raise(importArg.start, "... is not allowed in import()"); + } else { + const importArg = node.arguments[0]; + if (importArg && importArg.type === "SpreadElement") { + this.raise(importArg.start, "... is not allowed in import()"); + } } } return this.finishNode( @@ -903,13 +904,6 @@ export default class ExpressionParser extends LValParser { switch (this.state.type) { case tt._super: - if (!this.scope.allowSuper && !this.options.allowSuperOutsideMethod) { - this.raise( - this.state.start, - "super is only allowed in object methods and classes", - ); - } - node = this.startNode(); this.next(); if ( @@ -922,6 +916,14 @@ export default class ExpressionParser extends LValParser { "super() is only valid inside a class constructor of a subclass. " + "Maybe a typo in the method name ('constructor') or not extending another class?", ); + } else if ( + !this.scope.allowSuper && + !this.options.allowSuperOutsideMethod + ) { + this.raise( + node.start, + "super is only allowed in object methods and classes", + ); } if ( @@ -929,7 +931,11 @@ export default class ExpressionParser extends LValParser { !this.match(tt.bracketL) && !this.match(tt.dot) ) { - this.unexpected(); + this.raise( + node.start, + "super can only be used with function calls (i.e. super()) or " + + "in property accesses (i.e. super.prop or super[prop])", + ); } return this.finishNode(node, "Super"); @@ -1106,15 +1112,16 @@ export default class ExpressionParser extends LValParser { } this.next(); - if (this.primaryTopicReferenceIsAllowedInCurrentTopicContext()) { - this.registerTopicReference(); - return this.finishNode(node, "PipelinePrimaryTopicReference"); - } else { - throw this.raise( + + if (!this.primaryTopicReferenceIsAllowedInCurrentTopicContext()) { + this.raise( node.start, `Topic reference was used in a lexical context without topic binding`, ); } + + this.registerTopicReference(); + return this.finishNode(node, "PipelinePrimaryTopicReference"); } } @@ -1199,6 +1206,15 @@ export default class ExpressionParser extends LValParser { if (this.isContextual("meta")) { this.expectPlugin("importMeta"); + + if (!this.inModule) { + this.raise( + id.start, + `import.meta may appear only with 'sourceType: "module"'`, + { code: "BABEL_PARSER_SOURCETYPE_MODULE_REQUIRED" }, + ); + } + this.sawUnambiguousESM = true; } else if (!this.hasPlugin("importMeta")) { this.raise( id.start, @@ -1206,15 +1222,6 @@ export default class ExpressionParser extends LValParser { ); } - if (!this.inModule) { - this.raise( - id.start, - `import.meta may appear only with 'sourceType: "module"'`, - { code: "BABEL_PARSER_SOURCETYPE_MODULE_REQUIRED" }, - ); - } - this.sawUnambiguousESM = true; - return this.parseMetaProperty(node, id, "meta"); } @@ -1386,7 +1393,10 @@ export default class ExpressionParser extends LValParser { parseNew(): N.NewExpression | N.MetaProperty { const node = this.startNode(); - const meta = this.parseIdentifier(true); + + let meta = this.startNode(); + this.next(); + meta = this.createIdentifier(meta, "new"); if (this.eat(tt.dot)) { const metaProp = this.parseMetaProperty(node, meta, "target"); @@ -1553,12 +1563,12 @@ export default class ExpressionParser extends LValParser { this.state.start, "Stage 2 decorators disallow object literal property decorators", ); - } else { - // we needn't check if decorators (stage 0) plugin is enabled since it's checked by - // the call to this.parseDecorator - while (this.match(tt.at)) { - decorators.push(this.parseDecorator()); - } + } + + // we needn't check if decorators (stage 0) plugin is enabled since it's checked by + // the call to this.parseDecorator + while (this.match(tt.at)) { + decorators.push(this.parseDecorator()); } } @@ -1933,7 +1943,7 @@ export default class ExpressionParser extends LValParser { if (isExpression) { node.body = this.parseMaybeAssign(); - this.checkParams(node, false, allowExpression); + this.checkParams(node, false, allowExpression, false); } else { const nonSimple = !this.isSimpleParamList(node.params); if (!oldStrict || nonSimple) { @@ -1967,6 +1977,7 @@ export default class ExpressionParser extends LValParser { node, !oldStrict && !useStrict && !allowExpression && !isMethod && !nonSimple, allowExpression, + !oldStrict && useStrict, ); node.body = this.parseBlock(true, false); this.state.labels = oldLabels; @@ -1975,7 +1986,14 @@ export default class ExpressionParser extends LValParser { this.state.inParameters = oldInParameters; // Ensure the function name isn't a forbidden identifier in strict mode, e.g. 'eval' if (this.state.strict && node.id) { - this.checkLVal(node.id, BIND_OUTSIDE, undefined, "function name"); + this.checkLVal( + node.id, + BIND_OUTSIDE, + undefined, + "function name", + undefined, + !oldStrict && useStrict, + ); } this.state.strict = oldStrict; } @@ -1994,6 +2012,7 @@ export default class ExpressionParser extends LValParser { allowDuplicates: boolean, // eslint-disable-next-line no-unused-vars isArrowFunction: ?boolean, + strictModeChanged?: boolean = true, ): void { // $FlowIssue const nameHash: {} = Object.create(null); @@ -2003,6 +2022,8 @@ export default class ExpressionParser extends LValParser { BIND_VAR, allowDuplicates ? null : nameHash, "function parameter list", + undefined, + strictModeChanged, ); } } @@ -2084,6 +2105,8 @@ export default class ExpressionParser extends LValParser { // Parse the next token as an identifier. If `liberal` is true (used // when parsing properties), it will also convert keywords into // identifiers. + // This shouldn't be used to parse the keywords of meta properties, since they + // are not identifiers and cannot contain escape sequences. parseIdentifier(liberal?: boolean): N.Identifier { const node = this.startNode(); @@ -2104,11 +2127,6 @@ export default class ExpressionParser extends LValParser { if (this.match(tt.name)) { name = this.state.value; - - // An escaped identifier whose value is the same as a keyword - if (!liberal && this.state.containsEsc && isKeyword(name)) { - this.raise(this.state.pos, `Escape sequence in keyword ${name}`); - } } else if (this.state.type.keyword) { name = this.state.type.keyword; @@ -2128,7 +2146,11 @@ export default class ExpressionParser extends LValParser { throw this.unexpected(); } - if (!liberal) { + if (liberal) { + // If the current token is not used as a keyword, set its type to "tt.name". + // This will prevent this.next() from throwing about unexpected escapes. + this.state.type = tt.name; + } else { this.checkReservedWord( name, this.state.start, @@ -2153,6 +2175,7 @@ export default class ExpressionParser extends LValParser { startLoc, "Can not use 'yield' as identifier inside a generator", ); + return; } if (word === "await") { @@ -2161,7 +2184,9 @@ export default class ExpressionParser extends LValParser { startLoc, "Can not use 'await' as identifier inside an async function", ); - } else if ( + return; + } + if ( this.state.awaitPos === -1 && (this.state.maybeInArrowParameters || this.isAwaitAllowed()) ) { @@ -2174,9 +2199,11 @@ export default class ExpressionParser extends LValParser { startLoc, "'arguments' is not allowed in class field initializer", ); + return; } if (checkKeywords && isKeyword(word)) { this.raise(startLoc, `Unexpected keyword '${word}'`); + return; } const reservedTest = !this.state.strict @@ -2191,8 +2218,9 @@ export default class ExpressionParser extends LValParser { startLoc, "Can not use keyword 'await' outside an async function", ); + } else { + this.raise(startLoc, `Unexpected reserved word '${word}'`); } - this.raise(startLoc, `Unexpected reserved word '${word}'`); } } @@ -2206,9 +2234,6 @@ export default class ExpressionParser extends LValParser { // Parses await expression inside async function. parseAwait(): N.AwaitExpression { - if (this.state.awaitPos === -1) { - this.state.awaitPos = this.state.start; - } const node = this.startNode(); this.next(); @@ -2218,8 +2243,10 @@ export default class ExpressionParser extends LValParser { node.start, "await is not allowed in async function parameters", ); + } else if (this.state.awaitPos === -1) { + this.state.awaitPos = node.start; } - if (this.match(tt.star)) { + if (this.eat(tt.star)) { this.raise( node.start, "await* has been removed from the async functions proposal. Use Promise.all() instead.", @@ -2259,13 +2286,12 @@ export default class ExpressionParser extends LValParser { // Parses yield expression inside generator. parseYield(noIn?: ?boolean): N.YieldExpression { - if (this.state.yieldPos === -1) { - this.state.yieldPos = this.state.start; - } const node = this.startNode(); if (this.state.inParameters) { this.raise(node.start, "yield is not allowed in generator parameters"); + } else if (this.state.yieldPos === -1) { + this.state.yieldPos = node.start; } this.next(); @@ -2291,7 +2317,7 @@ export default class ExpressionParser extends LValParser { if (left.type === "SequenceExpression") { // Ensure that the pipeline head is not a comma-delimited // sequence expression. - throw this.raise( + this.raise( leftStartPos, `Pipeline head should not be a comma-separated sequence expression`, ); @@ -2336,7 +2362,7 @@ export default class ExpressionParser extends LValParser { pipelineStyle === "PipelineTopicExpression" && childExpression.type === "SequenceExpression" ) { - throw this.raise( + this.raise( startPos, `Pipeline body may not be a comma-separated sequence expression`, ); @@ -2362,7 +2388,7 @@ export default class ExpressionParser extends LValParser { break; case "PipelineTopicExpression": if (!this.topicReferenceWasUsedInCurrentTopicContext()) { - throw this.raise( + this.raise( startPos, `Pipeline is in topic style but does not use topic reference`, ); @@ -2370,7 +2396,9 @@ export default class ExpressionParser extends LValParser { bodyNode.expression = childExpression; break; default: - throw this.raise(startPos, `Unknown pipeline style ${pipelineStyle}`); + throw new Error( + `Internal @babel/parser error: Unknown pipeline style (${pipelineStyle})`, + ); } return this.finishNode(bodyNode, pipelineStyle); } diff --git a/packages/babel-parser/src/parser/index.js b/packages/babel-parser/src/parser/index.js index 9e75bf6044d3..2c96336f1c13 100644 --- a/packages/babel-parser/src/parser/index.js +++ b/packages/babel-parser/src/parser/index.js @@ -39,7 +39,10 @@ export default class Parser extends StatementParser { const file = this.startNode(); const program = this.startNode(); this.nextToken(); - return this.parseTopLevel(file, program); + file.errors = null; + this.parseTopLevel(file, program); + file.errors = this.state.errors; + return file; } } diff --git a/packages/babel-parser/src/parser/location.js b/packages/babel-parser/src/parser/location.js index 1839f359ae4c..3694a567090a 100644 --- a/packages/babel-parser/src/parser/location.js +++ b/packages/babel-parser/src/parser/location.js @@ -10,6 +10,8 @@ import CommentsParser from "./comments"; // message. export default class LocationParser extends CommentsParser { + +isLookahead: boolean; + getLocationForPosition(pos: number): Position { let loc; if (pos === this.state.start) loc = this.state.startLoc; @@ -31,7 +33,7 @@ export default class LocationParser extends CommentsParser { missingPluginNames?: Array, code?: string, } = {}, - ): empty { + ): Error | empty { const loc = this.getLocationForPosition(pos); message += ` (${loc.line}:${loc.column})`; @@ -47,6 +49,12 @@ export default class LocationParser extends CommentsParser { if (code !== undefined) { err.code = code; } - throw err; + + if (this.options.errorRecovery) { + if (!this.isLookahead) this.state.errors.push(err); + return err; + } else { + throw err; + } } } diff --git a/packages/babel-parser/src/parser/lval.js b/packages/babel-parser/src/parser/lval.js index 050bb1eda6c1..547441b0ce41 100644 --- a/packages/babel-parser/src/parser/lval.js +++ b/packages/babel-parser/src/parser/lval.js @@ -15,7 +15,10 @@ import type { SpreadElement, } from "../types"; import type { Pos, Position } from "../util/location"; -import { isStrictBindReservedWord } from "../util/identifier"; +import { + isStrictBindOnlyReservedWord, + isStrictBindReservedWord, +} from "../util/identifier"; import { NodeUtils } from "./node"; import { type BindingTypes, BIND_NONE } from "../util/scopeflags"; @@ -37,6 +40,8 @@ export default class LValParser extends NodeUtils { // Convert existing expression atom to assignable pattern // if possible. + // NOTE: There is a corresponding "isAssignable" method in flow.js. + // When this one is updated, please check if also that one needs to be updated. toAssignable( node: Node, @@ -96,15 +101,16 @@ export default class LValParser extends NodeUtils { break; case "AssignmentExpression": - if (node.operator === "=") { - node.type = "AssignmentPattern"; - delete node.operator; - } else { + if (node.operator !== "=") { this.raise( node.left.end, "Only '=' operator can be used for specifying default value.", ); } + + node.type = "AssignmentPattern"; + delete node.operator; + this.toAssignable(node.left, isBinding, contextDescription); break; case "ParenthesizedExpression": @@ -118,14 +124,9 @@ export default class LValParser extends NodeUtils { case "MemberExpression": if (!isBinding) break; - default: { - const message = - "Invalid left-hand side" + - (contextDescription - ? " in " + contextDescription - : /* istanbul ignore next */ "expression"); - this.raise(node.start, message); - } + default: + // We don't know how to deal with this node. It will + // be reported by a later call to checkLVal } } return node; @@ -349,12 +350,18 @@ export default class LValParser extends NodeUtils { checkClashes: ?{ [key: string]: boolean }, contextDescription: string, disallowLetBinding?: boolean, + strictModeChanged?: boolean = false, ): void { switch (expr.type) { case "Identifier": if ( this.state.strict && - isStrictBindReservedWord(expr.name, this.inModule) + // "Global" reserved words have already been checked by parseIdentifier, + // unless they have been found in the id or parameters of a strict-mode + // function in a sloppy context. + (strictModeChanged + ? isStrictBindReservedWord(expr.name, this.inModule) + : isStrictBindOnlyReservedWord(expr.name)) ) { this.raise( expr.start, @@ -404,6 +411,11 @@ export default class LValParser extends NodeUtils { case "ObjectPattern": for (let prop of expr.properties) { if (prop.type === "ObjectProperty") prop = prop.value; + // If we find here an ObjectMethod, it's because this was originally + // an ObjectExpression which has then been converted. + // toAssignable already reported this error with a nicer message. + else if (prop.type === "ObjectMethod") continue; + this.checkLVal( prop, bindingType, @@ -489,7 +501,7 @@ export default class LValParser extends NodeUtils { } raiseRestNotLast(pos: number) { - this.raise(pos, `Rest element must be last element`); + throw this.raise(pos, `Rest element must be last element`); } raiseTrailingCommaAfterRest(pos: number) { diff --git a/packages/babel-parser/src/parser/statement.js b/packages/babel-parser/src/parser/statement.js index 9d87c3d27ed2..827cedfbd7d9 100644 --- a/packages/babel-parser/src/parser/statement.js +++ b/packages/babel-parser/src/parser/statement.js @@ -203,7 +203,7 @@ export default class StatementParser extends ExpressionParser { case tt._var: kind = kind || this.state.value; if (context && kind !== "var") { - this.unexpected( + this.raise( this.state.start, "Lexical declaration cannot appear in a single-statement context", ); @@ -269,8 +269,8 @@ export default class StatementParser extends ExpressionParser { default: { if (this.isAsyncFunction()) { if (context) { - this.unexpected( - null, + this.raise( + this.state.start, "Async functions can only be declared at the top level or inside a block", ); } @@ -351,7 +351,7 @@ export default class StatementParser extends ExpressionParser { ); } } else if (!this.canHaveLeadingDecorator()) { - this.raise( + throw this.raise( this.state.start, "Leading decorators must be attached to a class declaration", ); @@ -1036,7 +1036,7 @@ export default class StatementParser extends ExpressionParser { this.initFunction(node, isAsync); if (this.match(tt.star) && isHangingStatement) { - this.unexpected( + this.raise( this.state.start, "Generators can only be declared at the top level or inside a block", ); @@ -1077,10 +1077,10 @@ export default class StatementParser extends ExpressionParser { this.scope.exit(); if (isStatement && !isHangingStatement) { - // We need to validate this _after_ parsing the function body + // We need to register this _after_ parsing the function body // because of TypeScript body-less function declarations, // which shouldn't be added to the scope. - this.checkFunctionStatementId(node); + this.registerFunctionStatementId(node); } this.state.maybeInArrowParameters = oldMaybeInArrowParameters; @@ -1111,22 +1111,21 @@ export default class StatementParser extends ExpressionParser { this.checkYieldAwaitInDefaultParams(); } - checkFunctionStatementId(node: N.Function): void { + registerFunctionStatementId(node: N.Function): void { if (!node.id) return; // If it is a regular function declaration in sloppy mode, then it is // subject to Annex B semantics (BIND_FUNCTION). Otherwise, the binding // mode depends on properties of the current scope (see // treatFunctionsAsVar). - this.checkLVal( - node.id, + this.scope.declareName( + node.id.name, this.state.strict || node.generator || node.async ? this.scope.treatFunctionsAsVar ? BIND_VAR : BIND_LEXICAL : BIND_FUNCTION, - null, - "function name", + node.id.start, ); } @@ -1191,7 +1190,7 @@ export default class StatementParser extends ExpressionParser { while (!this.eat(tt.braceR)) { if (this.eat(tt.semi)) { if (decorators.length > 0) { - this.raise( + throw this.raise( this.state.lastTokEnd, "Decorators must not be followed by a semicolon", ); @@ -1229,7 +1228,7 @@ export default class StatementParser extends ExpressionParser { }); if (decorators.length) { - this.raise( + throw this.raise( this.state.start, "You have trailing decorators with no method", ); @@ -1362,13 +1361,6 @@ export default class StatementParser extends ExpressionParser { if (isConstructor) { publicMethod.kind = "constructor"; - if (publicMethod.decorators) { - this.raise( - publicMethod.start, - "You can't attach decorators to a class constructor", - ); - } - // TypeScript allows multiple overloaded constructor declarations. if (state.hadConstructor && !this.hasPlugin("typescript")) { this.raise(key.start, "Duplicate constructor in the same class"); @@ -1797,7 +1789,7 @@ export default class StatementParser extends ExpressionParser { this.hasPlugin("decorators") && this.getPluginOption("decorators", "decoratorsBeforeExport") ) { - this.unexpected( + this.raise( this.state.start, "Decorators must be placed *before* the 'export' keyword." + " You can set the 'decoratorsBeforeExport' option to false to use" + @@ -1807,7 +1799,7 @@ export default class StatementParser extends ExpressionParser { this.parseDecorators(false); return this.parseClass(expr, true, true); } else if (this.match(tt._const) || this.match(tt._var) || this.isLet()) { - return this.raise( + throw this.raise( this.state.start, "Only expressions, functions or classes are allowed as the `default` export.", ); @@ -1977,7 +1969,7 @@ export default class StatementParser extends ExpressionParser { name: string, ): void { if (this.state.exportedIdentifiers.indexOf(name) > -1) { - throw this.raise( + this.raise( node.start, name === "default" ? "Only one default export allowed per module." @@ -2098,8 +2090,8 @@ export default class StatementParser extends ExpressionParser { } else { // Detect an attempt to deep destructure if (this.eat(tt.colon)) { - this.unexpected( - null, + throw this.raise( + this.state.start, "ES2015 named imports do not destructure. " + "Use another statement for destructuring after the import.", ); diff --git a/packages/babel-parser/src/parser/util.js b/packages/babel-parser/src/parser/util.js index d66671551ee2..f1093f31b57f 100644 --- a/packages/babel-parser/src/parser/util.js +++ b/packages/babel-parser/src/parser/util.js @@ -2,6 +2,7 @@ import { types as tt, type TokenType } from "../tokenizer/types"; import Tokenizer from "../tokenizer"; +import State from "../tokenizer/state"; import type { Node } from "../types"; import { lineBreak, skipWhiteSpace } from "../util/whitespace"; import { isIdentifierChar } from "../util/identifier"; @@ -9,6 +10,14 @@ import * as charCodes from "charcodes"; const literal = /^('|")((?:\\?.)*?)\1/; +type TryParse = { + node: Node, + error: Error, + thrown: Thrown, + aborted: Aborted, + failState: FailState, +}; + // ## Parser utilities export default class UtilParser extends Tokenizer { @@ -215,4 +224,58 @@ export default class UtilParser extends Tokenizer { return false; } + + // tryParse will clone parser state. + // It is expensive and should be used with cautions + tryParse>( + fn: (abort: (node?: T) => empty) => T, + oldState: State = this.state.clone(), + ): + | TryParse + | TryParse + | TryParse { + const abortSignal: { node: T | null } = { node: null }; + try { + const node = fn((node = null) => { + abortSignal.node = node; + throw abortSignal; + }); + if (this.state.errors.length > oldState.errors.length) { + const failState = this.state; + this.state = oldState; + return { + node, + error: (failState.errors[oldState.errors.length]: SyntaxError), + thrown: false, + aborted: false, + failState, + }; + } + + return { + node, + error: null, + thrown: false, + aborted: false, + failState: null, + }; + } catch (error) { + const failState = this.state; + this.state = oldState; + if (error instanceof SyntaxError) { + return { node: null, error, thrown: true, aborted: false, failState }; + } + if (error === abortSignal) { + return { + node: abortSignal.node, + error: null, + thrown: false, + aborted: true, + failState, + }; + } + + throw error; + } + } } diff --git a/packages/babel-parser/src/plugins/estree.js b/packages/babel-parser/src/plugins/estree.js index 014a1a54067d..60bc1effffa7 100644 --- a/packages/babel-parser/src/plugins/estree.js +++ b/packages/babel-parser/src/plugins/estree.js @@ -93,9 +93,10 @@ export default (superClass: Class): Class => } else { this.raise(start, "setter must have exactly one formal parameter"); } - } - - if (prop.kind === "set" && prop.value.params[0].type === "RestElement") { + } else if ( + prop.kind === "set" && + prop.value.params[0].type === "RestElement" + ) { this.raise( start, "setter function argument must not be a rest parameter", @@ -382,12 +383,15 @@ export default (superClass: Class): Class => isLast: boolean, ) { if (prop.kind === "get" || prop.kind === "set") { - this.raise( + throw this.raise( prop.key.start, "Object pattern can't contain getter or setter", ); } else if (prop.method) { - this.raise(prop.key.start, "Object pattern can't contain methods"); + throw this.raise( + prop.key.start, + "Object pattern can't contain methods", + ); } else { super.toAssignableObjectExpressionProp(prop, isBinding, isLast); } diff --git a/packages/babel-parser/src/plugins/flow.js b/packages/babel-parser/src/plugins/flow.js index fcdd16df61d2..5e7187455da2 100644 --- a/packages/babel-parser/src/plugins/flow.js +++ b/packages/babel-parser/src/plugins/flow.js @@ -1,5 +1,7 @@ // @flow +/*:: declare var invariant; */ + import type Parser from "../parser"; import { types as tt, type TokenType } from "../tokenizer/types"; import * as N from "../types"; @@ -263,7 +265,7 @@ export default (superClass: Class): Class => return this.flowParseDeclareModuleExports(node); } else { if (insideModule) { - this.unexpected( + this.raise( this.state.lastTokStart, "`declare module` cannot be used inside another `declare module`", ); @@ -313,7 +315,7 @@ export default (superClass: Class): Class => if (this.match(tt._import)) { this.next(); if (!this.isContextual("type") && !this.match(tt._typeof)) { - this.unexpected( + this.raise( this.state.lastTokStart, "Imports within a `declare module` body must always be `import type` or `import typeof`", ); @@ -345,17 +347,17 @@ export default (superClass: Class): Class => body.forEach(bodyElement => { if (isEsModuleType(bodyElement)) { if (kind === "CommonJS") { - this.unexpected(bodyElement.start, errorMessage); + this.raise(bodyElement.start, errorMessage); } kind = "ES"; } else if (bodyElement.type === "DeclareModuleExports") { if (hasModuleExport) { - this.unexpected( + this.raise( bodyElement.start, "Duplicate `declare module.exports` statement", ); } - if (kind === "ES") this.unexpected(bodyElement.start, errorMessage); + if (kind === "ES") this.raise(bodyElement.start, errorMessage); kind = "CommonJS"; hasModuleExport = true; } @@ -548,8 +550,8 @@ export default (superClass: Class): Class => checkNotUnderscore(word: string) { if (word === "_") { - throw this.unexpected( - null, + this.raise( + this.state.start, "`_` is only allowed as a type argument to call or new", ); } @@ -632,7 +634,7 @@ export default (superClass: Class): Class => node.default = this.flowParseType(); } else { if (requireDefault) { - this.unexpected( + this.raise( nodeStart, // eslint-disable-next-line max-len "Type parameter declaration needs a default, since a preceding type parameter declaration has a default.", @@ -878,6 +880,7 @@ export default (superClass: Class): Class => while (!this.match(endDelim)) { let isStatic = false; let protoStart: ?number = null; + let inexactStart: ?number = null; const node = this.startNode(); if (allowProto && this.isContextual("proto")) { @@ -950,17 +953,29 @@ export default (superClass: Class): Class => variance, kind, allowSpread, - allowInexact, + allowInexact ?? !exact, ); if (propOrInexact === null) { inexact = true; + inexactStart = this.state.lastTokStart; } else { nodeStart.properties.push(propOrInexact); } } this.flowObjectTypeSemicolon(); + + if ( + inexactStart && + !this.match(tt.braceR) && + !this.match(tt.braceBarR) + ) { + this.raise( + inexactStart, + "Explicit inexact syntax must appear at the end of an inexact object", + ); + } } this.expect(endDelim); @@ -990,10 +1005,38 @@ export default (superClass: Class): Class => allowSpread: boolean, allowInexact: boolean, ): (N.FlowObjectTypeProperty | N.FlowObjectTypeSpreadProperty) | null { - if (this.match(tt.ellipsis)) { + if (this.eat(tt.ellipsis)) { + const isInexactToken = + this.match(tt.comma) || + this.match(tt.semi) || + this.match(tt.braceR) || + this.match(tt.braceBarR); + + if (isInexactToken) { + if (!allowSpread) { + this.raise( + this.state.lastTokStart, + "Explicit inexact syntax cannot appear in class or interface definitions", + ); + } else if (!allowInexact) { + this.raise( + this.state.lastTokStart, + "Explicit inexact syntax cannot appear inside an explicit exact object type", + ); + } + if (variance) { + this.raise( + variance.start, + "Explicit inexact syntax cannot have variance", + ); + } + + return null; + } + if (!allowSpread) { - this.unexpected( - null, + this.raise( + this.state.lastTokStart, "Spread operator cannot appear in class or interface definitions", ); } @@ -1001,35 +1044,9 @@ export default (superClass: Class): Class => this.unexpected(protoStart); } if (variance) { - this.unexpected( - variance.start, - "Spread properties cannot have variance", - ); - } - this.expect(tt.ellipsis); - const isInexactToken = this.eat(tt.comma) || this.eat(tt.semi); - - if (this.match(tt.braceR)) { - if (allowInexact) return null; - this.unexpected( - null, - "Explicit inexact syntax is only allowed inside inexact objects", - ); - } - - if (this.match(tt.braceBarR)) { - this.unexpected( - null, - "Explicit inexact syntax cannot appear inside an explicit exact object type", - ); + this.raise(variance.start, "Spread properties cannot have variance"); } - if (isInexactToken) { - this.unexpected( - null, - "Explicit inexact syntax must appear at the end of an inexact object", - ); - } node.argument = this.flowParseType(); return this.finishNode(node, "ObjectTypeSpreadProperty"); } else { @@ -1400,8 +1417,8 @@ export default (superClass: Class): Class => ); } - this.unexpected( - null, + throw this.raise( + this.state.start, `Unexpected token, expected "number" or "bigint"`, ); } @@ -1720,23 +1737,23 @@ export default (superClass: Class): Class => ): N.Expression { if (!this.match(tt.question)) return expr; - // only do the expensive clone if there is a question mark + // only use the expensive "tryParse" method if there is a question mark // and if we come from inside parens if (refNeedsArrowPos) { - const state = this.state.clone(); - try { - return super.parseConditional(expr, noIn, startPos, startLoc); - } catch (err) { - if (err instanceof SyntaxError) { - this.state = state; - refNeedsArrowPos.start = err.pos || this.state.start; - return expr; - } else { - // istanbul ignore next: no such error is expected - throw err; - } + const result = this.tryParse(() => + super.parseConditional(expr, noIn, startPos, startLoc), + ); + + if (!result.node) { + // $FlowIgnore + refNeedsArrowPos.start = result.error.pos || this.state.start; + return expr; } + + if (result.error) this.state = result.failState; + return result.node; } + this.expect(tt.question); const state = this.state.clone(); const originalNoArrowAt = this.state.noArrowAt; @@ -1776,10 +1793,10 @@ export default (superClass: Class): Class => this.state.noArrowAt = noArrowAt.concat(valid[0].start); ({ consequent, failed } = this.tryParseConditionalConsequent()); } - - this.getArrowLikeExpressions(consequent, true); } + this.getArrowLikeExpressions(consequent, true); + this.state.noArrowAt = originalNoArrowAt; this.expect(tt.colon); @@ -1825,19 +1842,7 @@ export default (superClass: Class): Class => if (node.type === "ArrowFunctionExpression") { if (node.typeParameters || !node.returnType) { // This is an arrow expression without ambiguity, so check its parameters - this.toAssignableList( - // node.params is Expression[] instead of $ReadOnlyArray because it - // has not been converted yet. - ((node.params: any): N.Expression[]), - true, - "arrow function parameters", - node.extra?.trailingComma, - ); - // Enter scope, as checkParams defines bindings - this.scope.enter(functionFlags(false, false) | SCOPE_ARROW); - // Use super's method to force the parameters to be checked - super.checkParams(node, false, true); - this.scope.exit(); + this.finishArrowValidation(node); } else { arrows.push(node); } @@ -1849,30 +1854,29 @@ export default (superClass: Class): Class => } if (disallowInvalid) { - for (let i = 0; i < arrows.length; i++) { - this.toAssignableList( - ((node.params: any): N.Expression[]), - true, - "arrow function parameters", - node.extra?.trailingComma, - ); - } + arrows.forEach(node => this.finishArrowValidation(node)); return [arrows, []]; } - return partition(arrows, node => { - try { - this.toAssignableList( - ((node.params: any): N.Expression[]), - true, - "arrow function parameters", - node.extra?.trailingComma, - ); - return true; - } catch (err) { - return false; - } - }); + return partition(arrows, node => + node.params.every(param => this.isAssignable(param, true)), + ); + } + + finishArrowValidation(node: N.ArrowFunctionExpression) { + this.toAssignableList( + // node.params is Expression[] instead of $ReadOnlyArray because it + // has not been converted yet. + ((node.params: any): N.Expression[]), + true, + "arrow function parameters", + node.extra?.trailingComma, + ); + // Enter scope, as checkParams defines bindings + this.scope.enter(functionFlags(false, false) | SCOPE_ARROW); + // Use super's method to force the parameters to be checked + super.checkParams(node, false, true); + this.scope.exit(); } forwardNoArrowParamsConversionAt(node: N.Node, parse: () => T): T { @@ -2025,6 +2029,49 @@ export default (superClass: Class): Class => } } + isAssignable(node: N.Node, isBinding?: boolean): boolean { + switch (node.type) { + case "Identifier": + case "ObjectPattern": + case "ArrayPattern": + case "AssignmentPattern": + return true; + + case "ObjectExpression": { + const last = node.properties.length - 1; + return node.properties.every((prop, i) => { + return ( + prop.type !== "ObjectMethod" && + (i === last || prop.type === "SpreadElement") && + this.isAssignable(prop) + ); + }); + } + + case "ObjectProperty": + return this.isAssignable(node.value); + + case "SpreadElement": + return this.isAssignable(node.argument); + + case "ArrayExpression": + return node.elements.every(element => this.isAssignable(element)); + + case "AssignmentExpression": + return node.operator === "="; + + case "ParenthesizedExpression": + return this.isAssignable(node.expression); + + case "MemberExpression": + case "OptionalMemberExpression": + return !isBinding; + + default: + return false; + } + } + toAssignable( node: N.Node, isBinding: ?boolean, @@ -2253,13 +2300,13 @@ export default (superClass: Class): Class => parseAssignableListItemTypes(param: N.Pattern): N.Pattern { if (this.eat(tt.question)) { if (param.type !== "Identifier") { - throw this.raise( + this.raise( param.start, "A binding pattern parameter cannot be optional in an implementation signature.", ); } - param.optional = true; + ((param: any): N.Identifier).optional = true; } if (this.match(tt.colon)) { param.typeAnnotation = this.flowParseTypeAnnotation(); @@ -2490,45 +2537,50 @@ export default (superClass: Class): Class => afterLeftParse?: Function, refNeedsArrowPos?: ?Pos, ): N.Expression { - let jsxError = null; + let state = null; + + let jsx; + if ( this.hasPlugin("jsx") && (this.match(tt.jsxTagStart) || this.isRelational("<")) ) { - const state = this.state.clone(); - try { - return super.parseMaybeAssign( - noIn, - refShorthandDefaultPos, - afterLeftParse, - refNeedsArrowPos, - ); - } catch (err) { - if (err instanceof SyntaxError) { - this.state = state; - - // Remove `tc.j_expr` and `tc.j_oTag` from context added - // by parsing `jsxTagStart` to stop the JSX plugin from - // messing with the tokens - const cLength = this.state.context.length; - if (this.state.context[cLength - 1] === tc.j_oTag) { - this.state.context.length -= 2; - } + state = this.state.clone(); + + jsx = this.tryParse( + () => + super.parseMaybeAssign( + noIn, + refShorthandDefaultPos, + afterLeftParse, + refNeedsArrowPos, + ), + state, + ); + /*:: invariant(!jsx.aborted) */ - jsxError = err; - } else { - // istanbul ignore next: no such error is expected - throw err; - } + if (!jsx.error) return jsx.node; + + // Remove `tc.j_expr` and `tc.j_oTag` from context added + // by parsing `jsxTagStart` to stop the JSX plugin from + // messing with the tokens + const { context } = this.state; + if (context[context.length - 1] === tc.j_oTag) { + context.length -= 2; + } else if (context[context.length - 1] === tc.j_expr) { + context.length -= 1; } } - if (jsxError != null || this.isRelational("<")) { - let arrowExpression; + if ((jsx && jsx.error) || this.isRelational("<")) { + state = state || this.state.clone(); + let typeParameters; - try { + + const arrow = this.tryParse(() => { typeParameters = this.flowParseTypeParameterDeclaration(); - arrowExpression = this.forwardNoArrowParamsConversionAt( + + const arrowExpression = this.forwardNoArrowParamsConversionAt( typeParameters, () => super.parseMaybeAssign( @@ -2540,20 +2592,43 @@ export default (superClass: Class): Class => ); arrowExpression.typeParameters = typeParameters; this.resetStartLocationFromNode(arrowExpression, typeParameters); - } catch (err) { - throw jsxError || err; + + return arrowExpression; + }, state); + + const arrowExpression: ?N.ArrowFunctionExpression = + arrow.node && arrow.node.type === "ArrowFunctionExpression" + ? arrow.node + : null; + + if (!arrow.error && arrowExpression) return arrowExpression; + + // If we are here, both JSX and Flow parsing attemps failed. + // Give the precedence to the JSX error, except if JSX had an + // unrecoverable error while Flow didn't. + // If the error is recoverable, we can only re-report it if there is + // a node we can return. + + if (jsx && jsx.node) { + /*:: invariant(jsx.failState) */ + this.state = jsx.failState; + return jsx.node; } - if (arrowExpression.type === "ArrowFunctionExpression") { + if (arrowExpression) { + /*:: invariant(arrow.failState) */ + this.state = arrow.failState; return arrowExpression; - } else if (jsxError != null) { - throw jsxError; - } else { - this.raise( - typeParameters.start, - "Expected an arrow function after this type parameter declaration", - ); } + + if (jsx && jsx.thrown) throw jsx.error; + if (arrow.thrown) throw arrow.error; + + /*:: invariant(typeParameters) */ + throw this.raise( + typeParameters.start, + "Expected an arrow function after this type parameter declaration", + ); } return super.parseMaybeAssign( @@ -2567,8 +2642,7 @@ export default (superClass: Class): Class => // handle return types for arrow functions parseArrow(node: N.ArrowFunctionExpression): ?N.ArrowFunctionExpression { if (this.match(tt.colon)) { - const state = this.state.clone(); - try { + const result = this.tryParse(() => { const oldNoAnonFunctionType = this.state.noAnonFunctionType; this.state.noAnonFunctionType = true; @@ -2586,18 +2660,18 @@ export default (superClass: Class): Class => if (this.canInsertSemicolon()) this.unexpected(); if (!this.match(tt.arrow)) this.unexpected(); - // assign after it is clear it is an arrow - node.returnType = typeNode.typeAnnotation - ? this.finishNode(typeNode, "TypeAnnotation") - : null; - } catch (err) { - if (err instanceof SyntaxError) { - this.state = state; - } else { - // istanbul ignore next: no such error is expected - throw err; - } - } + return typeNode; + }); + + if (result.thrown) return null; + /*:: invariant(result.node) */ + + if (result.error) this.state = result.failState; + + // assign after it is clear it is an arrow + node.returnType = result.node.typeAnnotation + ? this.finishNode(result.node, "TypeAnnotation") + : null; } return super.parseArrow(node); @@ -2630,7 +2704,7 @@ export default (superClass: Class): Class => return; } - return super.checkParams(node, allowDuplicates, isArrowFunction); + return super.checkParams(...arguments); } parseParenAndDistinguishExpression(canBeArrow: boolean): N.Expression { @@ -2662,23 +2736,33 @@ export default (superClass: Class): Class => this.isRelational("<") ) { const state = this.state.clone(); - let error; - try { - const node = this.parseAsyncArrowWithTypeParameters( - startPos, - startLoc, - ); - if (node) return node; - } catch (e) { - error = e; + const arrow = this.tryParse( + abort => + this.parseAsyncArrowWithTypeParameters(startPos, startLoc) || + abort(), + state, + ); + + if (!arrow.error && !arrow.aborted) return arrow.node; + + const result = this.tryParse( + () => super.parseSubscripts(base, startPos, startLoc, noCalls), + state, + ); + + if (result.node && !result.error) return result.node; + + if (arrow.node) { + this.state = arrow.failState; + return arrow.node; } - this.state = state; - try { - return super.parseSubscripts(base, startPos, startLoc, noCalls); - } catch (e) { - throw error || e; + if (result.node) { + this.state = result.failState; + return result.node; } + + throw arrow.error || result.error; } return super.parseSubscripts(base, startPos, startLoc, noCalls); @@ -2717,8 +2801,8 @@ export default (superClass: Class): Class => ) { const node = this.startNodeAt(startPos, startLoc); node.callee = base; - const state = this.state.clone(); - try { + + const result = this.tryParse(() => { node.typeArguments = this.flowParseTypeParameterInstantiationCallOrNew(); this.expect(tt.parenL); node.arguments = this.parseCallExpressionArguments(tt.parenR, false); @@ -2727,12 +2811,11 @@ export default (superClass: Class): Class => node, subscriptState.optionalChainMember, ); - } catch (e) { - if (e instanceof SyntaxError) { - this.state = state; - } else { - throw e; - } + }); + + if (result.node) { + if (result.error) this.state = result.failState; + return result.node; } } @@ -2748,16 +2831,9 @@ export default (superClass: Class): Class => parseNewArguments(node: N.NewExpression): void { let targs = null; if (this.shouldParseTypes() && this.isRelational("<")) { - const state = this.state.clone(); - try { - targs = this.flowParseTypeParameterInstantiationCallOrNew(); - } catch (e) { - if (e instanceof SyntaxError) { - this.state = state; - } else { - throw e; - } - } + targs = this.tryParse(() => + this.flowParseTypeParameterInstantiationCallOrNew(), + ).node; } node.typeArguments = targs; @@ -2811,7 +2887,7 @@ export default (superClass: Class): Class => parseTopLevel(file: N.File, program: N.Program): N.File { const fileNode = super.parseTopLevel(file, program); if (this.state.hasFlowComment) { - this.unexpected(null, "Unterminated flow-comment"); + this.raise(this.state.pos, "Unterminated flow-comment"); } return fileNode; } @@ -2832,7 +2908,9 @@ export default (superClass: Class): Class => if (this.state.hasFlowComment) { const end = this.input.indexOf("*-/", (this.state.pos += 2)); - if (end === -1) this.raise(this.state.pos - 2, "Unterminated comment"); + if (end === -1) { + throw this.raise(this.state.pos - 2, "Unterminated comment"); + } this.state.pos = end + 3; return; } @@ -2874,7 +2952,7 @@ export default (superClass: Class): Class => hasFlowCommentCompletion(): void { const end = this.input.indexOf("*/", this.state.pos); if (end === -1) { - this.raise(this.state.pos, "Unterminated comment"); + throw this.raise(this.state.pos, "Unterminated comment"); } } @@ -2931,7 +3009,7 @@ export default (superClass: Class): Class => enumName, suppliedType, }: { enumName: string, suppliedType: null | string }, - ): void { + ) { const suggestion = `Use one of \`boolean\`, \`number\`, \`string\`, or \`symbol\` in ` + `enum \`${enumName}\`.`; @@ -2939,13 +3017,13 @@ export default (superClass: Class): Class => suppliedType === null ? `Supplied enum type is not valid. ${suggestion}` : `Enum type \`${suppliedType}\` is not valid. ${suggestion}`; - this.raise(pos, message); + return this.raise(pos, message); } flowEnumErrorInvalidMemberInitializer( pos: number, { enumName, explicitType, memberName }: EnumContext, - ): void { + ) { let message = null; switch (explicitType) { case "boolean": @@ -2966,7 +3044,7 @@ export default (superClass: Class): Class => `The enum member initializer for \`${memberName}\` needs to be a literal (either ` + `a boolean, number, or string) in enum \`${enumName}\`.`; } - this.raise(pos, message); + return this.raise(pos, message); } flowEnumErrorNumberMemberNotInitialized( @@ -3119,8 +3197,7 @@ export default (superClass: Class): Class => break; } case "invalid": { - this.flowEnumErrorInvalidMemberInitializer(init.pos, context); - break; + throw this.flowEnumErrorInvalidMemberInitializer(init.pos, context); } case "none": { switch (explicitType) { @@ -3184,28 +3261,29 @@ export default (superClass: Class): Class => enumName: string, }): EnumExplicitType { if (this.eatContextual("of")) { - if (this.match(tt.name)) { - switch (this.state.value) { - case "boolean": - case "number": - case "string": - case "symbol": { - const explicitType = this.state.value; - this.next(); - return explicitType; - } - default: - this.flowEnumErrorInvalidExplicitType(this.state.start, { - enumName, - suppliedType: this.state.value, - }); - } - } else { - this.flowEnumErrorInvalidExplicitType(this.state.start, { + if (!this.match(tt.name)) { + throw this.flowEnumErrorInvalidExplicitType(this.state.start, { enumName, suppliedType: null, }); } + + const { value } = this.state; + this.next(); + + if ( + value !== "boolean" && + value !== "number" && + value !== "string" && + value !== "symbol" + ) { + this.flowEnumErrorInvalidExplicitType(this.state.start, { + enumName, + suppliedType: value, + }); + } + + return value; } return null; } diff --git a/packages/babel-parser/src/plugins/jsx/index.js b/packages/babel-parser/src/plugins/jsx/index.js index 4daa31ef545d..523702f0dd84 100644 --- a/packages/babel-parser/src/plugins/jsx/index.js +++ b/packages/babel-parser/src/plugins/jsx/index.js @@ -82,7 +82,7 @@ export default (superClass: Class): Class => let chunkStart = this.state.pos; for (;;) { if (this.state.pos >= this.length) { - this.raise(this.state.start, "Unterminated JSX contents"); + throw this.raise(this.state.start, "Unterminated JSX contents"); } const ch = this.input.charCodeAt(this.state.pos); @@ -142,7 +142,7 @@ export default (superClass: Class): Class => let chunkStart = ++this.state.pos; for (;;) { if (this.state.pos >= this.length) { - this.raise(this.state.start, "Unterminated string constant"); + throw this.raise(this.state.start, "Unterminated string constant"); } const ch = this.input.charCodeAt(this.state.pos); @@ -279,13 +279,12 @@ export default (superClass: Class): Class => this.next(); node = this.jsxParseExpressionContainer(node); if (node.expression.type === "JSXEmptyExpression") { - throw this.raise( + this.raise( node.start, "JSX attributes must only be assigned a non-empty expression", ); - } else { - return node; } + return node; case tt.jsxTagStart: case tt.string: @@ -485,12 +484,18 @@ export default (superClass: Class): Class => node.closingElement = closingElement; } node.children = children; - if (this.match(tt.relational) && this.state.value === "<") { + while (this.isRelational("<")) { + // In case we encounter an lt token here it will always be the start of + // jsx as the lt sign is not allowed in places that expect an expression + this.finishToken(tt.jsxTagStart); + this.raise( this.state.start, "Adjacent JSX elements must be wrapped in an enclosing tag. " + "Did you want a JSX fragment <>...?", ); + + this.jsxParseElement(); } return isFragment(openingElement) diff --git a/packages/babel-parser/src/plugins/typescript/index.js b/packages/babel-parser/src/plugins/typescript/index.js index 4dc707be7cb9..e5d461b55e46 100644 --- a/packages/babel-parser/src/plugins/typescript/index.js +++ b/packages/babel-parser/src/plugins/typescript/index.js @@ -1,6 +1,9 @@ // @flow +/*:: declare var invariant; */ + import type { TokenType } from "../../tokenizer/types"; +import type State from "../../tokenizer/state"; import { types as tt } from "../../tokenizer/types"; import { types as ct } from "../../tokenizer/context"; import * as N from "../../types"; @@ -234,8 +237,8 @@ export default (superClass: Class): Class => this.expect(tt._import); this.expect(tt.parenL); if (!this.match(tt.string)) { - throw this.unexpected( - null, + this.raise( + this.state.start, "Argument in a type import must be a string literal", ); } @@ -371,13 +374,13 @@ export default (superClass: Class): Class => pattern.type !== "ObjectPattern" && pattern.type !== "ArrayPattern" ) { - throw this.unexpected( + this.raise( pattern.start, "Name in a signature must be an Identifier, ObjectPattern or ArrayPattern," + `instead got ${pattern.type}`, ); } - return pattern; + return (pattern: any); }, ); } @@ -642,7 +645,7 @@ export default (superClass: Class): Class => const node: N.TsLiteralType = this.startNode(); const templateNode = this.parseTemplate(false); if (templateNode.expressions.length > 0) { - throw this.raise( + this.raise( templateNode.expressions[0].start, "Template literal types cannot have any substitution", ); @@ -1276,17 +1279,12 @@ export default (superClass: Class): Class => return res; } - tsTryParseAndCatch(f: () => T): ?T { - const state = this.state.clone(); - try { - return f(); - } catch (e) { - if (e instanceof SyntaxError) { - this.state = state; - return undefined; - } - throw e; - } + tsTryParseAndCatch(f: () => T): ?T { + const result = this.tryParse(abort => f() || abort()); + + if (result.aborted || !result.node) return undefined; + if (result.error) this.state = result.failState; + return result.node; } tsTryParse(f: () => ?T): ?T { @@ -1558,12 +1556,12 @@ export default (superClass: Class): Class => if (accessibility) pp.accessibility = accessibility; if (readonly) pp.readonly = readonly; if (elt.type !== "Identifier" && elt.type !== "AssignmentPattern") { - throw this.raise( + this.raise( pp.start, "A parameter property may not be declared using a binding pattern.", ); } - pp.parameter = elt; + pp.parameter = ((elt: any): N.Identifier | N.AssignmentPattern); return this.finishNode(pp, "TSParameterProperty"); } @@ -1597,11 +1595,13 @@ export default (superClass: Class): Class => super.parseFunctionBodyAndFinish(node, type, isMethod); } - checkFunctionStatementId(node: N.Function): void { + registerFunctionStatementId(node: N.Function): void { if (!node.body && node.id) { + // Function ids are validated after parsing their body. + // For bodyless function, we need to do it here. this.checkLVal(node.id, BIND_TS_AMBIENT, null, "function name"); } else { - super.checkFunctionStatementId(...arguments); + super.registerFunctionStatementId(...arguments); } } @@ -1946,19 +1946,17 @@ export default (superClass: Class): Class => ); } - const state = this.state.clone(); - try { - return super.parseConditional(expr, noIn, startPos, startLoc); - } catch (err) { - if (!(err instanceof SyntaxError)) { - // istanbul ignore next: no such error is expected - throw err; - } + const result = this.tryParse(() => + super.parseConditional(expr, noIn, startPos, startLoc), + ); - this.state = state; - refNeedsArrowPos.start = err.pos || this.state.start; + if (!result.node) { + // $FlowIgnore + refNeedsArrowPos.start = result.error.pos || this.state.start; return expr; } + if (result.error) this.state = result.failState; + return result.node; } // Note: These "type casts" are *not* valid TS expressions. @@ -2161,80 +2159,97 @@ export default (superClass: Class): Class => parseMaybeAssign(...args): N.Expression { // Note: When the JSX plugin is on, type assertions (` x`) aren't valid syntax. - let jsxError: ?SyntaxError; + let state: ?State; + let jsx; + let typeCast; if (this.match(tt.jsxTagStart)) { - const context = this.curContext(); - assert(context === ct.j_oTag); - // Only time j_oTag is pushed is right after j_expr. - assert(this.state.context[this.state.context.length - 2] === ct.j_expr); - // Prefer to parse JSX if possible. But may be an arrow fn. - const state = this.state.clone(); - try { - return super.parseMaybeAssign(...args); - } catch (err) { - if (!(err instanceof SyntaxError)) { - // istanbul ignore next: no such error is expected - throw err; - } + state = this.state.clone(); + + jsx = this.tryParse(() => super.parseMaybeAssign(...args), state); + /*:: invariant(!jsx.aborted) */ + + if (!jsx.error) return jsx.node; - this.state = state; - // Pop the context added by the jsxTagStart. - assert(this.curContext() === ct.j_oTag); - this.state.context.pop(); - assert(this.curContext() === ct.j_expr); - this.state.context.pop(); - jsxError = err; + // Remove `tc.j_expr` and `tc.j_oTag` from context added + // by parsing `jsxTagStart` to stop the JSX plugin from + // messing with the tokens + const { context } = this.state; + if (context[context.length - 1] === ct.j_oTag) { + context.length -= 2; + } else if (context[context.length - 1] === ct.j_expr) { + context.length -= 1; } } - if (jsxError === undefined && !this.isRelational("<")) { + if (!(jsx && jsx.error) && !this.isRelational("<")) { return super.parseMaybeAssign(...args); } // Either way, we're looking at a '<': tt.jsxTagStart or relational. - let arrowExpression; let typeParameters: N.TsTypeParameterDeclaration; - const state = this.state.clone(); - try { + state = state || this.state.clone(); + + const arrow = this.tryParse(abort => { // This is similar to TypeScript's `tryParseParenthesizedArrowFunctionExpression`. typeParameters = this.tsParseTypeParameters(); - arrowExpression = super.parseMaybeAssign(...args); + const expr = super.parseMaybeAssign(...args); + if ( - arrowExpression.type !== "ArrowFunctionExpression" || - (arrowExpression.extra && arrowExpression.extra.parenthesized) + expr.type !== "ArrowFunctionExpression" || + (expr.extra && expr.extra.parenthesized) ) { - this.unexpected(); // Go to the catch block (needs a SyntaxError). - } - } catch (err) { - if (!(err instanceof SyntaxError)) { - // istanbul ignore next: no such error is expected - throw err; + abort(); } - if (jsxError) { - throw jsxError; + // Correct TypeScript code should have at least 1 type parameter, but don't crash on bad code. + if (typeParameters && typeParameters.params.length !== 0) { + this.resetStartLocationFromNode(expr, typeParameters); } + expr.typeParameters = typeParameters; + return expr; + }, state); + + if (!arrow.error && !arrow.aborted) return arrow.node; + if (!jsx) { // Try parsing a type cast instead of an arrow function. // This will never happen outside of JSX. // (Because in JSX the '<' should be a jsxTagStart and not a relational. assert(!this.hasPlugin("jsx")); - // Parsing an arrow function failed, so try a type cast. - this.state = state; + // This will start with a type assertion (via parseMaybeUnary). // But don't directly call `this.tsParseTypeAssertion` because we want to handle any binary after it. - return super.parseMaybeAssign(...args); + typeCast = this.tryParse(() => super.parseMaybeAssign(...args), state); + /*:: invariant(!typeCast.aborted) */ + if (!typeCast.error) return typeCast.node; + } + + if (jsx && jsx.node) { + /*:: invariant(jsx.failState) */ + this.state = jsx.failState; + return jsx.node; + } + + if (arrow.node) { + /*:: invariant(arrow.failState) */ + this.state = arrow.failState; + return arrow.node; } - // Correct TypeScript code should have at least 1 type parameter, but don't crash on bad code. - if (typeParameters && typeParameters.params.length !== 0) { - this.resetStartLocationFromNode(arrowExpression, typeParameters); + if (typeCast && typeCast.node) { + /*:: invariant(typeCast.failState) */ + this.state = typeCast.failState; + return typeCast.node; } - arrowExpression.typeParameters = typeParameters; - return arrowExpression; + + if (jsx && jsx.thrown) throw jsx.error; + if (arrow.thrown) throw arrow.error; + if (typeCast && typeCast.thrown) throw typeCast.error; + + throw (jsx && jsx.error) || arrow.error || (typeCast && typeCast.error); } // Handle type assertions @@ -2250,23 +2265,20 @@ export default (superClass: Class): Class => if (this.match(tt.colon)) { // This is different from how the TS parser does it. // TS uses lookahead. The Babel Parser parses it as a parenthesized expression and converts. - const state = this.state.clone(); - try { + + const result = this.tryParse(abort => { const returnType = this.tsParseTypeOrTypePredicateAnnotation( tt.colon, ); - if (this.canInsertSemicolon() || !this.match(tt.arrow)) { - this.state = state; - return undefined; - } - node.returnType = returnType; - } catch (err) { - if (err instanceof SyntaxError) { - this.state = state; - } else { - // istanbul ignore next: no such error is expected - throw err; - } + if (this.canInsertSemicolon() || !this.match(tt.arrow)) abort(); + return returnType; + }); + + if (result.aborted) return; + + if (!result.thrown) { + if (result.error) this.state = result.failState; + node.returnType = result.node; } } @@ -2277,13 +2289,13 @@ export default (superClass: Class): Class => parseAssignableListItemTypes(param: N.Pattern) { if (this.eat(tt.question)) { if (param.type !== "Identifier") { - throw this.raise( + this.raise( param.start, "A binding pattern parameter cannot be optional in an implementation signature.", ); } - param.optional = true; + ((param: any): N.Identifier).optional = true; } const type = this.tsTryParseTypeAnnotation(); if (type) param.typeAnnotation = type; diff --git a/packages/babel-parser/src/tokenizer/index.js b/packages/babel-parser/src/tokenizer/index.js index ab0dbe5b9237..32c8a03fc0b9 100644 --- a/packages/babel-parser/src/tokenizer/index.js +++ b/packages/babel-parser/src/tokenizer/index.js @@ -126,8 +126,11 @@ export default class Tokenizer extends LocationParser { // Move to the next token next(): void { - if (this.options.tokens && !this.isLookahead) { - this.state.tokens.push(new Token(this.state)); + if (!this.isLookahead) { + this.checkKeywordEscapes(); + if (this.options.tokens) { + this.state.tokens.push(new Token(this.state)); + } } this.state.lastTokEnd = this.state.end; @@ -248,7 +251,7 @@ export default class Tokenizer extends LocationParser { const startLoc = this.state.curPosition(); const start = this.state.pos; const end = this.input.indexOf("*/", this.state.pos + 2); - if (end === -1) this.raise(start, "Unterminated comment"); + if (end === -1) throw this.raise(start, "Unterminated comment"); this.state.pos = end + 2; lineBreakG.lastIndex = start; @@ -384,7 +387,7 @@ export default class Tokenizer extends LocationParser { const nextPos = this.state.pos + 1; const next = this.input.charCodeAt(nextPos); if (next >= charCodes.digit0 && next <= charCodes.digit9) { - this.raise(this.state.pos, "Unexpected digit after hash token"); + throw this.raise(this.state.pos, "Unexpected digit after hash token"); } if ( @@ -400,7 +403,7 @@ export default class Tokenizer extends LocationParser { ) { this.finishOp(tt.hash, 1); } else { - this.raise(this.state.pos, "Unexpected character '#'"); + throw this.raise(this.state.pos, "Unexpected character '#'"); } } @@ -808,7 +811,7 @@ export default class Tokenizer extends LocationParser { } } - this.raise( + throw this.raise( this.state.pos, `Unexpected character '${String.fromCodePoint(code)}'`, ); @@ -825,11 +828,11 @@ export default class Tokenizer extends LocationParser { let escaped, inClass; for (;;) { if (this.state.pos >= this.length) { - this.raise(start, "Unterminated regular expression"); + throw this.raise(start, "Unterminated regular expression"); } const ch = this.input.charAt(this.state.pos); if (lineBreak.test(ch)) { - this.raise(start, "Unterminated regular expression"); + throw this.raise(start, "Unterminated regular expression"); } if (escaped) { escaped = false; @@ -858,9 +861,6 @@ export default class Tokenizer extends LocationParser { if (mods.indexOf(char) > -1) { this.raise(this.state.pos + 1, "Duplicate regular expression flag"); } - - ++this.state.pos; - mods += char; } else if ( isIdentifierChar(charCode) || charCode === charCodes.backslash @@ -869,6 +869,9 @@ export default class Tokenizer extends LocationParser { } else { break; } + + ++this.state.pos; + mods += char; } this.finishToken(tt.regexp, { @@ -880,10 +883,16 @@ export default class Tokenizer extends LocationParser { // Read an integer in the given radix. Return null if zero digits // were read, the integer value otherwise. When `len` is given, this // will return `null` unless the integer has exactly `len` digits. + // When `forceLen` is `true`, it means that we already know that in case + // of a malformed number we have to skip `len` characters anyway, instead + // of bailing out early. For example, in "\u{123Z}" we want to read up to } + // anyway, while in "\u00Z" we will stop at Z instead of consuming four + // characters (and thus the closing quote). readInt( radix: number, len?: number, + forceLen?: boolean, allowNumSeparator: boolean = true, ): number | null { const start = this.state.pos; @@ -900,6 +909,7 @@ export default class Tokenizer extends LocationParser { ? allowedNumericSeparatorSiblings.oct : allowedNumericSeparatorSiblings.bin; + let invalid = false; let total = 0; for (let i = 0, e = len == null ? Infinity : len; i < e; ++i) { @@ -911,15 +921,19 @@ export default class Tokenizer extends LocationParser { const prev = this.input.charCodeAt(this.state.pos - 1); const next = this.input.charCodeAt(this.state.pos + 1); if (allowedSiblings.indexOf(next) === -1) { - this.raise(this.state.pos, "Invalid or unexpected token"); - } - - if ( + this.raise( + this.state.pos, + "A numeric separator is only allowed between two digits", + ); + } else if ( forbiddenSiblings.indexOf(prev) > -1 || forbiddenSiblings.indexOf(next) > -1 || Number.isNaN(next) ) { - this.raise(this.state.pos, "Invalid or unexpected token"); + this.raise( + this.state.pos, + "A numeric separator is only allowed between two digits", + ); } if (!allowNumSeparator) { @@ -944,13 +958,30 @@ export default class Tokenizer extends LocationParser { } else { val = Infinity; } - if (val >= radix) break; + if (val >= radix) { + // If we are in "errorRecovery" mode and we found a digit which is too big, + // don't break the loop. + + if (this.options.errorRecovery && val <= 9) { + val = 0; + this.raise( + this.state.start + i + 2, + "Expected number in radix " + radix, + ); + } else if (forceLen) { + val = 0; + invalid = true; + } else { + break; + } + } ++this.state.pos; total = total * radix + val; } if ( this.state.pos === start || - (len != null && this.state.pos - start !== len) + (len != null && this.state.pos - start !== len) || + invalid ) { return null; } @@ -976,7 +1007,7 @@ export default class Tokenizer extends LocationParser { } if (isIdentifierStart(this.input.codePointAt(this.state.pos))) { - this.raise(this.state.pos, "Identifier directly after number"); + throw this.raise(this.state.pos, "Identifier directly after number"); } if (isBigInt) { @@ -1062,7 +1093,7 @@ export default class Tokenizer extends LocationParser { } if (isIdentifierStart(this.input.codePointAt(this.state.pos))) { - this.raise(this.state.pos, "Identifier directly after number"); + throw this.raise(this.state.pos, "Identifier directly after number"); } // remove "_" for numeric literal separator, and "n" for BigInts @@ -1087,6 +1118,7 @@ export default class Tokenizer extends LocationParser { const codePos = ++this.state.pos; code = this.readHexChar( this.input.indexOf("}", this.state.pos) - this.state.pos, + true, throwOnInvalid, ); ++this.state.pos; @@ -1102,7 +1134,7 @@ export default class Tokenizer extends LocationParser { } } } else { - code = this.readHexChar(4, throwOnInvalid); + code = this.readHexChar(4, false, throwOnInvalid); } return code; } @@ -1112,7 +1144,7 @@ export default class Tokenizer extends LocationParser { chunkStart = ++this.state.pos; for (;;) { if (this.state.pos >= this.length) { - this.raise(this.state.start, "Unterminated string constant"); + throw this.raise(this.state.start, "Unterminated string constant"); } const ch = this.input.charCodeAt(this.state.pos); if (ch === quote) break; @@ -1128,7 +1160,7 @@ export default class Tokenizer extends LocationParser { ++this.state.pos; ++this.state.curLine; } else if (isNewLine(ch)) { - this.raise(this.state.start, "Unterminated string constant"); + throw this.raise(this.state.start, "Unterminated string constant"); } else { ++this.state.pos; } @@ -1145,7 +1177,7 @@ export default class Tokenizer extends LocationParser { containsInvalid = false; for (;;) { if (this.state.pos >= this.length) { - this.raise(this.state.start, "Unterminated template"); + throw this.raise(this.state.start, "Unterminated template"); } const ch = this.input.charCodeAt(this.state.pos); if ( @@ -1214,7 +1246,7 @@ export default class Tokenizer extends LocationParser { case charCodes.lowercaseR: return "\r"; case charCodes.lowercaseX: { - const code = this.readHexChar(2, throwOnInvalid); + const code = this.readHexChar(2, false, throwOnInvalid); return code === null ? null : String.fromCharCode(code); } case charCodes.lowercaseU: { @@ -1288,9 +1320,13 @@ export default class Tokenizer extends LocationParser { // Used to read character escape sequences ('\x', '\u'). - readHexChar(len: number, throwOnInvalid: boolean): number | null { + readHexChar( + len: number, + forceLen: boolean, + throwOnInvalid: boolean, + ): number | null { const codePos = this.state.pos; - const n = this.readInt(16, len, false); + const n = this.readInt(16, len, forceLen, false); if (n === null) { if (throwOnInvalid) { this.raise(codePos, "Bad character escape sequence"); @@ -1333,20 +1369,18 @@ export default class Tokenizer extends LocationParser { this.state.pos, "Expecting Unicode escape sequence \\uXXXX", ); + continue; } ++this.state.pos; const esc = this.readCodePoint(true); + if (esc !== null) { + if (!identifierCheck(esc)) { + this.raise(escStart, "Invalid Unicode escape"); + } - if ( - // $FlowFixMe (thinks esc may be null, but throwOnInvalid is true) - !identifierCheck(esc, true) - ) { - this.raise(escStart, "Invalid Unicode escape"); + word += String.fromCodePoint(esc); } - - // $FlowFixMe - word += String.fromCodePoint(esc); chunkStart = this.state.pos; } else { break; @@ -1364,7 +1398,7 @@ export default class Tokenizer extends LocationParser { readWord(): void { const word = this.readWord1(); - const type = (!this.state.containsEsc && keywordTypes.get(word)) || tt.name; + const type = keywordTypes.get(word) || tt.name; // Allow @@iterator and @@asyncIterator as a identifier only inside type if ( @@ -1377,6 +1411,13 @@ export default class Tokenizer extends LocationParser { this.finishToken(type, word); } + checkKeywordEscapes(): void { + const kw = this.state.type.keyword; + if (kw && this.state.containsEsc) { + this.raise(this.state.start, `Escape sequence in keyword ${kw}`); + } + } + braceIsBlock(prevType: TokenType): boolean { const parent = this.curContext(); if (parent === ct.functionExpression || parent === ct.functionStatement) { diff --git a/packages/babel-parser/src/tokenizer/state.js b/packages/babel-parser/src/tokenizer/state.js index 4ee937e1d292..6ff711f373c6 100644 --- a/packages/babel-parser/src/tokenizer/state.js +++ b/packages/babel-parser/src/tokenizer/state.js @@ -38,6 +38,8 @@ export default class State { this.startLoc = this.endLoc = this.curPosition(); } + errors: SyntaxError[] = []; + // Used to signify the start of a potential arrow function potentialArrowAt: number = -1; diff --git a/packages/babel-parser/src/util/identifier.js b/packages/babel-parser/src/util/identifier.js index 7fda0e27de71..cbcc59cb6f81 100644 --- a/packages/babel-parser/src/util/identifier.js +++ b/packages/babel-parser/src/util/identifier.js @@ -21,9 +21,7 @@ const reservedWords = { }; const reservedWordsStrictSet = new Set(reservedWords.strict); -const reservedWordsStrictBindSet = new Set( - reservedWords.strict.concat(reservedWords.strictBind), -); +const reservedWordsStrictBindSet = new Set(reservedWords.strictBind); /** * Checks if word is a reserved word in non-strict mode @@ -41,6 +39,14 @@ export function isStrictReservedWord(word: string, inModule: boolean): boolean { return isReservedWord(word, inModule) || reservedWordsStrictSet.has(word); } +/** + * Checks if word is a reserved word in binding strict mode, but it is allowed as + * a normal identifier. + */ +export function isStrictBindOnlyReservedWord(word: string): boolean { + return reservedWordsStrictBindSet.has(word); +} + /** * Checks if word is a reserved word in binding strict mode * @@ -50,7 +56,9 @@ export function isStrictBindReservedWord( word: string, inModule: boolean, ): boolean { - return isReservedWord(word, inModule) || reservedWordsStrictBindSet.has(word); + return ( + isStrictReservedWord(word, inModule) || isStrictBindOnlyReservedWord(word) + ); } export function isKeyword(word: string): boolean { diff --git a/packages/babel-parser/test/expressions/is-expression-babel-parser/fail/7/options.json b/packages/babel-parser/test/expressions/is-expression-babel-parser/fail/7/options.json deleted file mode 100644 index 12b18792fcc4..000000000000 --- a/packages/babel-parser/test/expressions/is-expression-babel-parser/fail/7/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Illegal 'use strict' directive in function with non-simple parameter list (1:0)" -} diff --git a/packages/babel-parser/test/expressions/is-expression-babel-parser/fail/7/output.json b/packages/babel-parser/test/expressions/is-expression-babel-parser/fail/7/output.json new file mode 100644 index 000000000000..bed17cab3909 --- /dev/null +++ b/packages/babel-parser/test/expressions/is-expression-babel-parser/fail/7/output.json @@ -0,0 +1,128 @@ +{ + "type": "FunctionExpression", + "start": 0, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "AssignmentPattern", + "start": 10, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "left": { + "type": "Identifier", + "start": 10, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + }, + "identifierName": "a" + }, + "name": "a" + }, + "right": { + "type": "StringLiteral", + "start": 14, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "extra": { + "rawValue": "default", + "raw": "\"default\"" + }, + "value": "default" + } + } + ], + "body": { + "type": "BlockStatement", + "start": 25, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 26, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 26, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + }, + "errors": [ + "SyntaxError: Illegal 'use strict' directive in function with non-simple parameter list (1:0)" + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/expressions/is-expression-babel-parser/fail/8/options.json b/packages/babel-parser/test/expressions/is-expression-babel-parser/fail/8/options.json index 5f24fc4399ed..4f434cf0aa86 100644 --- a/packages/babel-parser/test/expressions/is-expression-babel-parser/fail/8/options.json +++ b/packages/babel-parser/test/expressions/is-expression-babel-parser/fail/8/options.json @@ -1,4 +1,3 @@ { - "strictMode": true, - "throws": "Unexpected reserved word 'public' (2:0)" -} + "strictMode": true +} \ No newline at end of file diff --git a/packages/babel-parser/test/expressions/is-expression-babel-parser/fail/8/output.json b/packages/babel-parser/test/expressions/is-expression-babel-parser/fail/8/output.json new file mode 100644 index 000000000000..df12702dd8b4 --- /dev/null +++ b/packages/babel-parser/test/expressions/is-expression-babel-parser/fail/8/output.json @@ -0,0 +1,20 @@ +{ + "type": "Identifier", + "start": 1, + "end": 7, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 6 + }, + "identifierName": "public" + }, + "name": "public", + "errors": [ + "SyntaxError: Unexpected reserved word 'public' (2:0)" + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/categorized/invalid-fn-decl-inside-loop/options.json b/packages/babel-parser/test/fixtures/core/categorized/invalid-fn-decl-inside-loop/options.json deleted file mode 100644 index 05a7826ae8ba..000000000000 --- a/packages/babel-parser/test/fixtures/core/categorized/invalid-fn-decl-inside-loop/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "In non-strict mode code, functions can only be declared at top level, inside a block, or as the body of an if statement (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/core/categorized/invalid-fn-decl-inside-loop/output.json b/packages/babel-parser/test/fixtures/core/categorized/invalid-fn-decl-inside-loop/output.json new file mode 100644 index 000000000000..7ad34b6ae910 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/categorized/invalid-fn-decl-inside-loop/output.json @@ -0,0 +1,125 @@ +{ + "type": "File", + "start": 0, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "errors": [ + "SyntaxError: In non-strict mode code, functions can only be declared at top level, inside a block, or as the body of an if statement (1:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "WhileStatement", + "start": 0, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "test": { + "type": "NumericLiteral", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + }, + "body": { + "type": "FunctionDeclaration", + "start": 10, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "id": { + "type": "Identifier", + "start": 19, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 22 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 24, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "body": [], + "directives": [] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/categorized/invalid-fn-decl-labeled-inside-loop/options.json b/packages/babel-parser/test/fixtures/core/categorized/invalid-fn-decl-labeled-inside-loop/options.json deleted file mode 100644 index 395620bfa2f8..000000000000 --- a/packages/babel-parser/test/fixtures/core/categorized/invalid-fn-decl-labeled-inside-loop/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "In non-strict mode code, functions can only be declared at top level, inside a block, or as the body of an if statement (1:20)" -} diff --git a/packages/babel-parser/test/fixtures/core/categorized/invalid-fn-decl-labeled-inside-loop/output.json b/packages/babel-parser/test/fixtures/core/categorized/invalid-fn-decl-labeled-inside-loop/output.json new file mode 100644 index 000000000000..64064c04c2b9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/categorized/invalid-fn-decl-labeled-inside-loop/output.json @@ -0,0 +1,189 @@ +{ + "type": "File", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "errors": [ + "SyntaxError: In non-strict mode code, functions can only be declared at top level, inside a block, or as the body of an if statement (1:20)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "WhileStatement", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "test": { + "type": "NumericLiteral", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + }, + "body": { + "type": "LabeledStatement", + "start": 10, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "body": { + "type": "LabeledStatement", + "start": 15, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "body": { + "type": "FunctionDeclaration", + "start": 20, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "id": { + "type": "Identifier", + "start": 29, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 32 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 34, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "body": [], + "directives": [] + } + }, + "label": { + "type": "Identifier", + "start": 15, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 18 + }, + "identifierName": "bar" + }, + "name": "bar" + } + }, + "label": { + "type": "Identifier", + "start": 10, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 13 + }, + "identifierName": "foo" + }, + "name": "foo" + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/escape-keyword/invalid/options.json b/packages/babel-parser/test/fixtures/core/escape-keyword/invalid/options.json deleted file mode 100644 index 3ef90d2032d2..000000000000 --- a/packages/babel-parser/test/fixtures/core/escape-keyword/invalid/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected keyword 'break' (2:2)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/escape-keyword/invalid/output.json b/packages/babel-parser/test/fixtures/core/escape-keyword/invalid/output.json new file mode 100644 index 000000000000..742ca4b45728 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/escape-keyword/invalid/output.json @@ -0,0 +1,160 @@ +{ + "type": "File", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 2 + } + }, + "errors": [ + "SyntaxError: Unexpected keyword 'break' (2:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 2 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 2 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 4, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "a" + }, + "name": "a" + }, + "init": { + "type": "ObjectExpression", + "start": 8, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 12, + "end": 22, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 12 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 12, + "end": 22, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 12 + }, + "identifierName": "break" + }, + "name": "break" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start": 12, + "end": 22, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 12 + }, + "identifierName": "break" + }, + "name": "break" + }, + "extra": { + "shorthand": true + } + } + ] + } + } + ], + "kind": "var" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/escape-template/non-octal-eight/options.json b/packages/babel-parser/test/fixtures/core/escape-template/non-octal-eight/options.json deleted file mode 100644 index 3ae5cb6c96c4..000000000000 --- a/packages/babel-parser/test/fixtures/core/escape-template/non-octal-eight/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:2)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/escape-template/non-octal-eight/output.json b/packages/babel-parser/test/fixtures/core/escape-template/non-octal-eight/output.json new file mode 100644 index 000000000000..20b84ecf03fa --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/escape-template/non-octal-eight/output.json @@ -0,0 +1,91 @@ +{ + "type": "File", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "expressions": [], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "value": { + "raw": "\\8", + "cooked": null + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/escape-template/non-octal-nine/options.json b/packages/babel-parser/test/fixtures/core/escape-template/non-octal-nine/options.json deleted file mode 100644 index 3ae5cb6c96c4..000000000000 --- a/packages/babel-parser/test/fixtures/core/escape-template/non-octal-nine/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:2)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/escape-template/non-octal-nine/output.json b/packages/babel-parser/test/fixtures/core/escape-template/non-octal-nine/output.json new file mode 100644 index 000000000000..9e0985f69a92 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/escape-template/non-octal-nine/output.json @@ -0,0 +1,91 @@ +{ + "type": "File", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "expressions": [], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "value": { + "raw": "\\9", + "cooked": null + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/regression/non-octal-float-strict-mode/options.json b/packages/babel-parser/test/fixtures/core/regression/non-octal-float-strict-mode/options.json index 8ac5b45f7194..54925950e059 100644 --- a/packages/babel-parser/test/fixtures/core/regression/non-octal-float-strict-mode/options.json +++ b/packages/babel-parser/test/fixtures/core/regression/non-octal-float-strict-mode/options.json @@ -1,4 +1,3 @@ { - "sourceType": "module", - "throws": "Legacy octal literals are not allowed in strict mode (1:0)" -} + "sourceType": "module" +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/regression/non-octal-float-strict-mode/output.json b/packages/babel-parser/test/fixtures/core/regression/non-octal-float-strict-mode/output.json new file mode 100644 index 000000000000..99253558c815 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/regression/non-octal-float-strict-mode/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "errors": [ + "SyntaxError: Legacy octal literals are not allowed in strict mode (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "extra": { + "rawValue": 9.5, + "raw": "09.5" + }, + "value": 9.5 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-2nd-lvl-lex-nested/options.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-2nd-lvl-lex-nested/options.json deleted file mode 100644 index b14806508f97..000000000000 --- a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-2nd-lvl-lex-nested/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'foo' has already been declared (4:6)" -} diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-2nd-lvl-lex-nested/output.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-2nd-lvl-lex-nested/output.json new file mode 100644 index 000000000000..f017f0fa5f00 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-2nd-lvl-lex-nested/output.json @@ -0,0 +1,247 @@ +{ + "type": "File", + "start": 0, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Identifier 'foo' has already been declared (4:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "BlockStatement", + "start": 0, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "body": [ + { + "type": "VariableDeclaration", + "start": 4, + "end": 12, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 10 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 8, + "end": 11, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 9 + } + }, + "id": { + "type": "Identifier", + "start": 8, + "end": 11, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 9 + }, + "identifierName": "bar" + }, + "name": "bar" + }, + "init": null + } + ], + "kind": "let" + }, + { + "type": "VariableDeclaration", + "start": 15, + "end": 27, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 14 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 19, + "end": 26, + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 13 + } + }, + "id": { + "type": "Identifier", + "start": 19, + "end": 22, + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 9 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "init": { + "type": "NumericLiteral", + "start": 25, + "end": 26, + "loc": { + "start": { + "line": 3, + "column": 12 + }, + "end": { + "line": 3, + "column": 13 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "var" + }, + { + "type": "VariableDeclaration", + "start": 30, + "end": 42, + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 4, + "column": 14 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 34, + "end": 41, + "loc": { + "start": { + "line": 4, + "column": 6 + }, + "end": { + "line": 4, + "column": 13 + } + }, + "id": { + "type": "Identifier", + "start": 34, + "end": 37, + "loc": { + "start": { + "line": 4, + "column": 6 + }, + "end": { + "line": 4, + "column": 9 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "init": { + "type": "NumericLiteral", + "start": 40, + "end": 41, + "loc": { + "start": { + "line": 4, + "column": 12 + }, + "end": { + "line": 4, + "column": 13 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "let" + } + ], + "directives": [] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-2nd-lvl-lex/options.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-2nd-lvl-lex/options.json deleted file mode 100644 index 6a0c16d56696..000000000000 --- a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-2nd-lvl-lex/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'foo' has already been declared (3:4)" -} diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-2nd-lvl-lex/output.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-2nd-lvl-lex/output.json new file mode 100644 index 000000000000..758528386efb --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-2nd-lvl-lex/output.json @@ -0,0 +1,229 @@ +{ + "type": "File", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 12 + } + }, + "errors": [ + "SyntaxError: Identifier 'foo' has already been declared (3:4)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 12 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "id": { + "type": "Identifier", + "start": 4, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "bar" + }, + "name": "bar" + }, + "init": null + } + ], + "kind": "let" + }, + { + "type": "VariableDeclaration", + "start": 9, + "end": 21, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 12 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 13, + "end": 20, + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "id": { + "type": "Identifier", + "start": 13, + "end": 16, + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 7 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "init": { + "type": "NumericLiteral", + "start": 19, + "end": 20, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "var" + }, + { + "type": "VariableDeclaration", + "start": 22, + "end": 34, + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 12 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 26, + "end": 33, + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 11 + } + }, + "id": { + "type": "Identifier", + "start": 26, + "end": 29, + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 7 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "init": { + "type": "NumericLiteral", + "start": 32, + "end": 33, + "loc": { + "start": { + "line": 3, + "column": 10 + }, + "end": { + "line": 3, + "column": 11 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "let" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-2nd-lvl-var-nested/options.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-2nd-lvl-var-nested/options.json deleted file mode 100644 index b14806508f97..000000000000 --- a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-2nd-lvl-var-nested/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'foo' has already been declared (4:6)" -} diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-2nd-lvl-var-nested/output.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-2nd-lvl-var-nested/output.json new file mode 100644 index 000000000000..0444f665d33d --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-2nd-lvl-var-nested/output.json @@ -0,0 +1,247 @@ +{ + "type": "File", + "start": 0, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Identifier 'foo' has already been declared (4:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "BlockStatement", + "start": 0, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "body": [ + { + "type": "VariableDeclaration", + "start": 4, + "end": 12, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 10 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 8, + "end": 11, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 9 + } + }, + "id": { + "type": "Identifier", + "start": 8, + "end": 11, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 9 + }, + "identifierName": "bar" + }, + "name": "bar" + }, + "init": null + } + ], + "kind": "let" + }, + { + "type": "VariableDeclaration", + "start": 15, + "end": 27, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 14 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 19, + "end": 26, + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 13 + } + }, + "id": { + "type": "Identifier", + "start": 19, + "end": 22, + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 9 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "init": { + "type": "NumericLiteral", + "start": 25, + "end": 26, + "loc": { + "start": { + "line": 3, + "column": 12 + }, + "end": { + "line": 3, + "column": 13 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "let" + }, + { + "type": "VariableDeclaration", + "start": 30, + "end": 42, + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 4, + "column": 14 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 34, + "end": 41, + "loc": { + "start": { + "line": 4, + "column": 6 + }, + "end": { + "line": 4, + "column": 13 + } + }, + "id": { + "type": "Identifier", + "start": 34, + "end": 37, + "loc": { + "start": { + "line": 4, + "column": 6 + }, + "end": { + "line": 4, + "column": 9 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "init": { + "type": "NumericLiteral", + "start": 40, + "end": 41, + "loc": { + "start": { + "line": 4, + "column": 12 + }, + "end": { + "line": 4, + "column": 13 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "var" + } + ], + "directives": [] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-2nd-lvl-var/options.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-2nd-lvl-var/options.json deleted file mode 100644 index 6a0c16d56696..000000000000 --- a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-2nd-lvl-var/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'foo' has already been declared (3:4)" -} diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-2nd-lvl-var/output.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-2nd-lvl-var/output.json new file mode 100644 index 000000000000..76f48823dd81 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-2nd-lvl-var/output.json @@ -0,0 +1,229 @@ +{ + "type": "File", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 12 + } + }, + "errors": [ + "SyntaxError: Identifier 'foo' has already been declared (3:4)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 12 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "id": { + "type": "Identifier", + "start": 4, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "bar" + }, + "name": "bar" + }, + "init": null + } + ], + "kind": "let" + }, + { + "type": "VariableDeclaration", + "start": 9, + "end": 21, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 12 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 13, + "end": 20, + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "id": { + "type": "Identifier", + "start": 13, + "end": 16, + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 7 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "init": { + "type": "NumericLiteral", + "start": 19, + "end": 20, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "let" + }, + { + "type": "VariableDeclaration", + "start": 22, + "end": 34, + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 12 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 26, + "end": 33, + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 11 + } + }, + "id": { + "type": "Identifier", + "start": 26, + "end": 29, + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 7 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "init": { + "type": "NumericLiteral", + "start": 32, + "end": 33, + "loc": { + "start": { + "line": 3, + "column": 10 + }, + "end": { + "line": 3, + "column": 11 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "var" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-arr-destr/options.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-arr-destr/options.json deleted file mode 100644 index 2cbe06c40914..000000000000 --- a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-arr-destr/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'foo' has already been declared (2:15)" -} diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-arr-destr/output.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-arr-destr/output.json new file mode 100644 index 000000000000..899412645531 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-arr-destr/output.json @@ -0,0 +1,154 @@ +{ + "type": "File", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Identifier 'foo' has already been declared (2:15)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "TryStatement", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "block": { + "type": "BlockStatement", + "start": 4, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 2, + "column": 1 + } + }, + "body": [], + "directives": [] + }, + "handler": { + "type": "CatchClause", + "start": 8, + "end": 30, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "param": { + "type": "ArrayPattern", + "start": 15, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "elements": [ + { + "type": "Identifier", + "start": 16, + "end": 19, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 13 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + { + "type": "Identifier", + "start": 21, + "end": 24, + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 18 + }, + "identifierName": "foo" + }, + "name": "foo" + } + ] + }, + "body": { + "type": "BlockStatement", + "start": 27, + "end": 30, + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [], + "directives": [] + } + }, + "finalizer": null + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-dbl-let/options.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-dbl-let/options.json deleted file mode 100644 index ac735b2ace22..000000000000 --- a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-dbl-let/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'foo' has already been declared (1:35)" -} diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-dbl-let/output.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-dbl-let/output.json new file mode 100644 index 000000000000..cddf0493cba9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-dbl-let/output.json @@ -0,0 +1,222 @@ +{ + "type": "File", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "errors": [ + "SyntaxError: Identifier 'foo' has already been declared (1:35)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "id": { + "type": "Identifier", + "start": 4, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "init": null + } + ], + "kind": "let" + }, + { + "type": "TryStatement", + "start": 9, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "block": { + "type": "BlockStatement", + "start": 13, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "body": [], + "directives": [] + }, + "handler": { + "type": "CatchClause", + "start": 16, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "param": { + "type": "Identifier", + "start": 23, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 26 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "body": { + "type": "BlockStatement", + "start": 28, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "body": [], + "directives": [] + } + }, + "finalizer": null + }, + { + "type": "VariableDeclaration", + "start": 31, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 35, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "id": { + "type": "Identifier", + "start": 35, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 38 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "init": null + } + ], + "kind": "let" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-func/options.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-func/options.json deleted file mode 100644 index 6f5b5641a148..000000000000 --- a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-func/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'foo' has already been declared (3:11)" -} diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-func/output.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-func/output.json new file mode 100644 index 000000000000..ab1db27cf0a8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-func/output.json @@ -0,0 +1,173 @@ +{ + "type": "File", + "start": 0, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Identifier 'foo' has already been declared (3:11)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "TryStatement", + "start": 0, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "block": { + "type": "BlockStatement", + "start": 4, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 2, + "column": 1 + } + }, + "body": [], + "directives": [] + }, + "handler": { + "type": "CatchClause", + "start": 8, + "end": 43, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "param": { + "type": "Identifier", + "start": 15, + "end": 18, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 12 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "body": { + "type": "BlockStatement", + "start": 20, + "end": 43, + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "FunctionDeclaration", + "start": 24, + "end": 41, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 19 + } + }, + "id": { + "type": "Identifier", + "start": 33, + "end": 36, + "loc": { + "start": { + "line": 3, + "column": 11 + }, + "end": { + "line": 3, + "column": 14 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 39, + "end": 41, + "loc": { + "start": { + "line": 3, + "column": 17 + }, + "end": { + "line": 3, + "column": 19 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } + }, + "finalizer": null + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-let/options.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-let/options.json deleted file mode 100644 index 254a763e653e..000000000000 --- a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-let/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'foo' has already been declared (3:6)" -} diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-let/output.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-let/output.json new file mode 100644 index 000000000000..e759f28d0434 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-let/output.json @@ -0,0 +1,172 @@ +{ + "type": "File", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Identifier 'foo' has already been declared (3:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "TryStatement", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "block": { + "type": "BlockStatement", + "start": 4, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 2, + "column": 1 + } + }, + "body": [], + "directives": [] + }, + "handler": { + "type": "CatchClause", + "start": 8, + "end": 34, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "param": { + "type": "Identifier", + "start": 15, + "end": 18, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 12 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "body": { + "type": "BlockStatement", + "start": 20, + "end": 34, + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "VariableDeclaration", + "start": 24, + "end": 32, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 10 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 28, + "end": 31, + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 9 + } + }, + "id": { + "type": "Identifier", + "start": 28, + "end": 31, + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 9 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "init": null + } + ], + "kind": "let" + } + ], + "directives": [] + } + }, + "finalizer": null + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-obj-destr/options.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-obj-destr/options.json deleted file mode 100644 index bf345ea77127..000000000000 --- a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-obj-destr/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'foo' has already been declared (2:28)" -} diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-obj-destr/output.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-obj-destr/output.json new file mode 100644 index 000000000000..5a4c9d365dbe --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-obj-destr/output.json @@ -0,0 +1,293 @@ +{ + "type": "File", + "start": 0, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Identifier 'foo' has already been declared (2:28)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "TryStatement", + "start": 0, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "block": { + "type": "BlockStatement", + "start": 4, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 2, + "column": 1 + } + }, + "body": [], + "directives": [] + }, + "handler": { + "type": "CatchClause", + "start": 8, + "end": 47, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "param": { + "type": "ObjectPattern", + "start": 15, + "end": 42, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 36 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 17, + "end": 23, + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 17 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 17, + "end": 18, + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 12 + }, + "identifierName": "a" + }, + "name": "a" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "Identifier", + "start": 20, + "end": 23, + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 17 + }, + "identifierName": "foo" + }, + "name": "foo" + } + }, + { + "type": "ObjectProperty", + "start": 25, + "end": 40, + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 34 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 25, + "end": 26, + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 20 + }, + "identifierName": "b" + }, + "name": "b" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "ObjectPattern", + "start": 28, + "end": 40, + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 34 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 30, + "end": 38, + "loc": { + "start": { + "line": 2, + "column": 24 + }, + "end": { + "line": 2, + "column": 32 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 30, + "end": 31, + "loc": { + "start": { + "line": 2, + "column": 24 + }, + "end": { + "line": 2, + "column": 25 + }, + "identifierName": "c" + }, + "name": "c" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "ArrayPattern", + "start": 33, + "end": 38, + "loc": { + "start": { + "line": 2, + "column": 27 + }, + "end": { + "line": 2, + "column": 32 + } + }, + "elements": [ + { + "type": "Identifier", + "start": 34, + "end": 37, + "loc": { + "start": { + "line": 2, + "column": 28 + }, + "end": { + "line": 2, + "column": 31 + }, + "identifierName": "foo" + }, + "name": "foo" + } + ] + } + } + ] + } + } + ] + }, + "body": { + "type": "BlockStatement", + "start": 44, + "end": 47, + "loc": { + "start": { + "line": 2, + "column": 38 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [], + "directives": [] + } + }, + "finalizer": null + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-var-arr-destr/options.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-var-arr-destr/options.json deleted file mode 100644 index 254a763e653e..000000000000 --- a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-var-arr-destr/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'foo' has already been declared (3:6)" -} diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-var-arr-destr/output.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-var-arr-destr/output.json new file mode 100644 index 000000000000..40bb3df74915 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-var-arr-destr/output.json @@ -0,0 +1,189 @@ +{ + "type": "File", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Identifier 'foo' has already been declared (3:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "TryStatement", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "block": { + "type": "BlockStatement", + "start": 4, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 2, + "column": 1 + } + }, + "body": [], + "directives": [] + }, + "handler": { + "type": "CatchClause", + "start": 8, + "end": 36, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "param": { + "type": "ArrayPattern", + "start": 15, + "end": 20, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "elements": [ + { + "type": "Identifier", + "start": 16, + "end": 19, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 13 + }, + "identifierName": "foo" + }, + "name": "foo" + } + ] + }, + "body": { + "type": "BlockStatement", + "start": 22, + "end": 36, + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "VariableDeclaration", + "start": 26, + "end": 34, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 10 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 30, + "end": 33, + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 9 + } + }, + "id": { + "type": "Identifier", + "start": 30, + "end": 33, + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 9 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "init": null + } + ], + "kind": "var" + } + ], + "directives": [] + } + }, + "finalizer": null + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-var-obj-destr/options.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-var-obj-destr/options.json deleted file mode 100644 index 254a763e653e..000000000000 --- a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-var-obj-destr/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'foo' has already been declared (3:6)" -} diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-var-obj-destr/output.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-var-obj-destr/output.json new file mode 100644 index 000000000000..5cd4c6abd102 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-catch-var-obj-destr/output.json @@ -0,0 +1,227 @@ +{ + "type": "File", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Identifier 'foo' has already been declared (3:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "TryStatement", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "block": { + "type": "BlockStatement", + "start": 4, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 2, + "column": 1 + } + }, + "body": [], + "directives": [] + }, + "handler": { + "type": "CatchClause", + "start": 8, + "end": 38, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "param": { + "type": "ObjectPattern", + "start": 15, + "end": 22, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 17, + "end": 20, + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 17, + "end": 20, + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 14 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start": 17, + "end": 20, + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 14 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "extra": { + "shorthand": true + } + } + ] + }, + "body": { + "type": "BlockStatement", + "start": 24, + "end": 38, + "loc": { + "start": { + "line": 2, + "column": 18 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "VariableDeclaration", + "start": 28, + "end": 36, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 10 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 32, + "end": 35, + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 9 + } + }, + "id": { + "type": "Identifier", + "start": 32, + "end": 35, + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 9 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "init": null + } + ], + "kind": "var" + } + ], + "directives": [] + } + }, + "finalizer": null + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-class-class/options.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-class-class/options.json deleted file mode 100644 index cdd0ac832c57..000000000000 --- a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-class-class/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'foo' has already been declared (2:6)" -} diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-class-class/output.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-class-class/output.json new file mode 100644 index 000000000000..6d2e82b586ae --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-class-class/output.json @@ -0,0 +1,166 @@ +{ + "type": "File", + "start": 0, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 13 + } + }, + "errors": [ + "SyntaxError: Identifier 'foo' has already been declared (2:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 13 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 10, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "body": [] + } + }, + { + "type": "EmptyStatement", + "start": 12, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "ClassDeclaration", + "start": 14, + "end": 26, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 12 + } + }, + "id": { + "type": "Identifier", + "start": 20, + "end": 23, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 9 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 24, + "end": 26, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 12 + } + }, + "body": [] + } + }, + { + "type": "EmptyStatement", + "start": 26, + "end": 27, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 13 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-class-const/options.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-class-const/options.json deleted file mode 100644 index cdd0ac832c57..000000000000 --- a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-class-const/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'foo' has already been declared (2:6)" -} diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-class-const/output.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-class-const/output.json new file mode 100644 index 000000000000..a23d95cfc217 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-class-const/output.json @@ -0,0 +1,172 @@ +{ + "type": "File", + "start": 0, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "errors": [ + "SyntaxError: Identifier 'foo' has already been declared (2:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 10, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "body": [] + } + }, + { + "type": "EmptyStatement", + "start": 12, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "VariableDeclaration", + "start": 14, + "end": 28, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 20, + "end": 27, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 13 + } + }, + "id": { + "type": "Identifier", + "start": 20, + "end": 23, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 9 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "init": { + "type": "NumericLiteral", + "start": 26, + "end": 27, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 13 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "const" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-class-func/options.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-class-func/options.json deleted file mode 100644 index a3504d289fd7..000000000000 --- a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-class-func/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'foo' has already been declared (2:9)" -} diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-class-func/output.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-class-func/output.json new file mode 100644 index 000000000000..a6bf56aa7623 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-class-func/output.json @@ -0,0 +1,169 @@ +{ + "type": "File", + "start": 0, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "errors": [ + "SyntaxError: Identifier 'foo' has already been declared (2:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 10, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "body": [] + } + }, + { + "type": "EmptyStatement", + "start": 12, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "FunctionDeclaration", + "start": 14, + "end": 32, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "id": { + "type": "Identifier", + "start": 23, + "end": 26, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 12 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 30, + "end": 32, + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "body": [], + "directives": [] + } + }, + { + "type": "EmptyStatement", + "start": 32, + "end": 33, + "loc": { + "start": { + "line": 2, + "column": 18 + }, + "end": { + "line": 2, + "column": 19 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-class-let/options.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-class-let/options.json deleted file mode 100644 index c04a6f3e48eb..000000000000 --- a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-class-let/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'foo' has already been declared (2:4)" -} diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-class-let/output.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-class-let/output.json new file mode 100644 index 000000000000..49daeec3aef6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-class-let/output.json @@ -0,0 +1,172 @@ +{ + "type": "File", + "start": 0, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 12 + } + }, + "errors": [ + "SyntaxError: Identifier 'foo' has already been declared (2:4)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 12 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 10, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "body": [] + } + }, + { + "type": "EmptyStatement", + "start": 12, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "VariableDeclaration", + "start": 14, + "end": 26, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 12 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 18, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "id": { + "type": "Identifier", + "start": 18, + "end": 21, + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 7 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "init": { + "type": "NumericLiteral", + "start": 24, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "let" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-class-var/options.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-class-var/options.json deleted file mode 100644 index c04a6f3e48eb..000000000000 --- a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-class-var/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'foo' has already been declared (2:4)" -} diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-class-var/output.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-class-var/output.json new file mode 100644 index 000000000000..205470069b5d --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-class-var/output.json @@ -0,0 +1,153 @@ +{ + "type": "File", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 8 + } + }, + "errors": [ + "SyntaxError: Identifier 'foo' has already been declared (2:4)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 8 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 10, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "body": [] + } + }, + { + "type": "EmptyStatement", + "start": 12, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "VariableDeclaration", + "start": 14, + "end": 22, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 8 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 18, + "end": 21, + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 7 + } + }, + "id": { + "type": "Identifier", + "start": 18, + "end": 21, + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 7 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "init": null + } + ], + "kind": "var" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-const-const/options.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-const-const/options.json deleted file mode 100644 index d62aabfd1b07..000000000000 --- a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-const-const/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'foo' has already been declared (1:13)" -} diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-const-const/output.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-const-const/output.json new file mode 100644 index 000000000000..b6f764fce7a5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-const-const/output.json @@ -0,0 +1,160 @@ +{ + "type": "File", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "errors": [ + "SyntaxError: Identifier 'foo' has already been declared (1:13)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 6, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "init": { + "type": "NumericLiteral", + "start": 10, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + }, + { + "type": "VariableDeclarator", + "start": 13, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "id": { + "type": "Identifier", + "start": 13, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 16 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "init": { + "type": "NumericLiteral", + "start": 17, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "extra": { + "rawValue": 2, + "raw": "2" + }, + "value": 2 + } + } + ], + "kind": "const" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-func-gen/options.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-func-gen/options.json deleted file mode 100644 index 1b6192a1bc04..000000000000 --- a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-func-gen/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'f' has already been declared (1:28)" -} diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-func-gen/output.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-func-gen/output.json new file mode 100644 index 000000000000..ebd20401ed0f --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-func-gen/output.json @@ -0,0 +1,160 @@ +{ + "type": "File", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "errors": [ + "SyntaxError: Identifier 'f' has already been declared (1:28)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "BlockStatement", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "body": [ + { + "type": "FunctionDeclaration", + "start": 2, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "id": { + "type": "Identifier", + "start": 11, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "f" + }, + "name": "f" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 15, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "body": [], + "directives": [] + } + }, + { + "type": "FunctionDeclaration", + "start": 18, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "id": { + "type": "Identifier", + "start": 28, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + }, + "identifierName": "f" + }, + "name": "f" + }, + "generator": true, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 32, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-func-module-sloppy/options.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-func-module-sloppy/options.json index 3f4250fbe917..54925950e059 100644 --- a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-func-module-sloppy/options.json +++ b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-func-module-sloppy/options.json @@ -1,4 +1,3 @@ { - "sourceType": "module", - "throws": "Identifier 'foo' has already been declared (1:29)" -} + "sourceType": "module" +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-func-module-sloppy/output.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-func-module-sloppy/output.json new file mode 100644 index 000000000000..c1b2c1a85a29 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-func-module-sloppy/output.json @@ -0,0 +1,160 @@ +{ + "type": "File", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "errors": [ + "SyntaxError: Identifier 'foo' has already been declared (1:29)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "BlockStatement", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "body": [ + { + "type": "FunctionDeclaration", + "start": 2, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "id": { + "type": "Identifier", + "start": 11, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "body": [], + "directives": [] + } + }, + { + "type": "FunctionDeclaration", + "start": 20, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "id": { + "type": "Identifier", + "start": 29, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 32 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 35, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-func-module/options.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-func-module/options.json index e253f0a85f47..54925950e059 100644 --- a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-func-module/options.json +++ b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-func-module/options.json @@ -1,4 +1,3 @@ { - "sourceType": "module", - "throws": "Identifier 'foo' has already been declared (2:9)" -} + "sourceType": "module" +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-func-module/output.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-func-module/output.json new file mode 100644 index 000000000000..eadbdeeb68f8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-func-module/output.json @@ -0,0 +1,142 @@ +{ + "type": "File", + "start": 0, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 17 + } + }, + "errors": [ + "SyntaxError: Identifier 'foo' has already been declared (2:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 17 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 15, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "body": [], + "directives": [] + } + }, + { + "type": "FunctionDeclaration", + "start": 18, + "end": 35, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 17 + } + }, + "id": { + "type": "Identifier", + "start": 27, + "end": 30, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 12 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 33, + "end": 35, + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 17 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-func-var-sloppy/options.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-func-var-sloppy/options.json deleted file mode 100644 index 254a763e653e..000000000000 --- a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-func-var-sloppy/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'foo' has already been declared (3:6)" -} diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-func-var-sloppy/output.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-func-var-sloppy/output.json new file mode 100644 index 000000000000..454a440c3426 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-func-var-sloppy/output.json @@ -0,0 +1,178 @@ +{ + "type": "File", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Identifier 'foo' has already been declared (3:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "BlockStatement", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "FunctionDeclaration", + "start": 4, + "end": 21, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "id": { + "type": "Identifier", + "start": 13, + "end": 16, + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 14 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 19, + "end": 21, + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "body": [], + "directives": [] + } + }, + { + "type": "VariableDeclaration", + "start": 24, + "end": 36, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 14 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 28, + "end": 35, + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 13 + } + }, + "id": { + "type": "Identifier", + "start": 28, + "end": 31, + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 9 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "init": { + "type": "NumericLiteral", + "start": 34, + "end": 35, + "loc": { + "start": { + "line": 3, + "column": 12 + }, + "end": { + "line": 3, + "column": 13 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "var" + } + ], + "directives": [] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-gen-func/options.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-gen-func/options.json deleted file mode 100644 index 1b6192a1bc04..000000000000 --- a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-gen-func/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'f' has already been declared (1:28)" -} diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-gen-func/output.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-gen-func/output.json new file mode 100644 index 000000000000..fdad445b5deb --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-gen-func/output.json @@ -0,0 +1,160 @@ +{ + "type": "File", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "errors": [ + "SyntaxError: Identifier 'f' has already been declared (1:28)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "BlockStatement", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "body": [ + { + "type": "FunctionDeclaration", + "start": 2, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "id": { + "type": "Identifier", + "start": 12, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + }, + "identifierName": "f" + }, + "name": "f" + }, + "generator": true, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 16, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "body": [], + "directives": [] + } + }, + { + "type": "FunctionDeclaration", + "start": 19, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "id": { + "type": "Identifier", + "start": 28, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + }, + "identifierName": "f" + }, + "name": "f" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 32, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-let-let/options.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-let-let/options.json deleted file mode 100644 index 8ca49120a98a..000000000000 --- a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-let-let/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'foo' has already been declared (1:9)" -} diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-let-let/output.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-let-let/output.json new file mode 100644 index 000000000000..e28bf9f399b0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-let-let/output.json @@ -0,0 +1,122 @@ +{ + "type": "File", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "errors": [ + "SyntaxError: Identifier 'foo' has already been declared (1:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "id": { + "type": "Identifier", + "start": 4, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "init": null + }, + { + "type": "VariableDeclarator", + "start": 9, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "init": null + } + ], + "kind": "let" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-nested-let-var/options.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-nested-let-var/options.json deleted file mode 100644 index 3eaa378d43e7..000000000000 --- a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-nested-let-var/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'a' has already been declared (3:8)" -} diff --git a/packages/babel-parser/test/fixtures/core/scope/dupl-bind-nested-let-var/output.json b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-nested-let-var/output.json new file mode 100644 index 000000000000..f925321aef98 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/scope/dupl-bind-nested-let-var/output.json @@ -0,0 +1,176 @@ +{ + "type": "File", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Identifier 'a' has already been declared (3:8)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "BlockStatement", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "VariableDeclaration", + "start": 4, + "end": 10, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 8 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 8, + "end": 9, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 7 + } + }, + "id": { + "type": "Identifier", + "start": 8, + "end": 9, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 7 + }, + "identifierName": "a" + }, + "name": "a" + }, + "init": null + } + ], + "kind": "let" + }, + { + "type": "BlockStatement", + "start": 13, + "end": 23, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 12 + } + }, + "body": [ + { + "type": "VariableDeclaration", + "start": 15, + "end": 21, + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 10 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 19, + "end": 20, + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 9 + } + }, + "id": { + "type": "Identifier", + "start": 19, + "end": 20, + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 9 + }, + "identifierName": "a" + }, + "name": "a" + }, + "init": null + } + ], + "kind": "var" + } + ], + "directives": [] + } + ], + "directives": [] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/for-var/options.json b/packages/babel-parser/test/fixtures/core/scope/for-var/options.json deleted file mode 100644 index 5f2332a9ed8f..000000000000 --- a/packages/babel-parser/test/fixtures/core/scope/for-var/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'i' has already been declared (2:8)" -} diff --git a/packages/babel-parser/test/fixtures/core/scope/for-var/output.json b/packages/babel-parser/test/fixtures/core/scope/for-var/output.json new file mode 100644 index 000000000000..bfd483ec7fb4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/scope/for-var/output.json @@ -0,0 +1,194 @@ +{ + "type": "File", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Identifier 'i' has already been declared (2:8)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ForStatement", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "init": { + "type": "VariableDeclaration", + "start": 5, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "i" + }, + "name": "i" + }, + "init": { + "type": "NumericLiteral", + "start": 13, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + } + ], + "kind": "let" + }, + "test": null, + "update": null, + "body": { + "type": "BlockStatement", + "start": 18, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "VariableDeclaration", + "start": 24, + "end": 30, + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 10 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 28, + "end": 29, + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 9 + } + }, + "id": { + "type": "Identifier", + "start": 28, + "end": 29, + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 9 + }, + "identifierName": "i" + }, + "name": "i" + }, + "init": null + } + ], + "kind": "var" + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/undecl-export-as-default/options.json b/packages/babel-parser/test/fixtures/core/scope/undecl-export-as-default/options.json index 8448889cf253..54925950e059 100644 --- a/packages/babel-parser/test/fixtures/core/scope/undecl-export-as-default/options.json +++ b/packages/babel-parser/test/fixtures/core/scope/undecl-export-as-default/options.json @@ -1,4 +1,3 @@ { - "sourceType": "module", - "throws": "Export 'encrypt' is not defined (1:9)" -} + "sourceType": "module" +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/undecl-export-as-default/output.json b/packages/babel-parser/test/fixtures/core/scope/undecl-export-as-default/output.json new file mode 100644 index 000000000000..996bc32d815d --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/scope/undecl-export-as-default/output.json @@ -0,0 +1,106 @@ +{ + "type": "File", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "errors": [ + "SyntaxError: Export 'encrypt' is not defined (1:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "specifiers": [ + { + "type": "ExportSpecifier", + "start": 9, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "local": { + "type": "Identifier", + "start": 9, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 16 + }, + "identifierName": "encrypt" + }, + "name": "encrypt" + }, + "exported": { + "type": "Identifier", + "start": 20, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 27 + }, + "identifierName": "default" + }, + "name": "default" + } + } + ], + "source": null, + "declaration": null + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/undecl-export-as/options.json b/packages/babel-parser/test/fixtures/core/scope/undecl-export-as/options.json index 8448889cf253..54925950e059 100644 --- a/packages/babel-parser/test/fixtures/core/scope/undecl-export-as/options.json +++ b/packages/babel-parser/test/fixtures/core/scope/undecl-export-as/options.json @@ -1,4 +1,3 @@ { - "sourceType": "module", - "throws": "Export 'encrypt' is not defined (1:9)" -} + "sourceType": "module" +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/undecl-export-as/output.json b/packages/babel-parser/test/fixtures/core/scope/undecl-export-as/output.json new file mode 100644 index 000000000000..11a778f34809 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/scope/undecl-export-as/output.json @@ -0,0 +1,158 @@ +{ + "type": "File", + "start": 0, + "end": 52, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 21 + } + }, + "errors": [ + "SyntaxError: Export 'encrypt' is not defined (1:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 52, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 21 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "specifiers": [ + { + "type": "ExportSpecifier", + "start": 9, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "local": { + "type": "Identifier", + "start": 9, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 16 + }, + "identifierName": "encrypt" + }, + "name": "encrypt" + }, + "exported": { + "type": "Identifier", + "start": 20, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 27 + }, + "identifierName": "decrypt" + }, + "name": "decrypt" + } + } + ], + "source": null, + "declaration": null + }, + { + "type": "FunctionDeclaration", + "start": 31, + "end": 52, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 21 + } + }, + "id": { + "type": "Identifier", + "start": 40, + "end": 47, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 16 + }, + "identifierName": "decrypt" + }, + "name": "decrypt" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 50, + "end": 52, + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 21 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/undecl-export-block/options.json b/packages/babel-parser/test/fixtures/core/scope/undecl-export-block/options.json index 0844d3e80e68..54925950e059 100644 --- a/packages/babel-parser/test/fixtures/core/scope/undecl-export-block/options.json +++ b/packages/babel-parser/test/fixtures/core/scope/undecl-export-block/options.json @@ -1,4 +1,3 @@ { - "sourceType": "module", - "throws": "Export 'encrypt' is not defined (4:9)" -} + "sourceType": "module" +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/undecl-export-block/output.json b/packages/babel-parser/test/fixtures/core/scope/undecl-export-block/output.json new file mode 100644 index 000000000000..a660653865e5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/scope/undecl-export-block/output.json @@ -0,0 +1,176 @@ +{ + "type": "File", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 18 + } + }, + "errors": [ + "SyntaxError: Export 'encrypt' is not defined (4:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 18 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "BlockStatement", + "start": 0, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "FunctionDeclaration", + "start": 4, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 23 + } + }, + "id": { + "type": "Identifier", + "start": 13, + "end": 20, + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 18 + }, + "identifierName": "encrypt" + }, + "name": "encrypt" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 23, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 23 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [] + }, + { + "type": "ExportNamedDeclaration", + "start": 28, + "end": 46, + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 18 + } + }, + "specifiers": [ + { + "type": "ExportSpecifier", + "start": 37, + "end": 44, + "loc": { + "start": { + "line": 4, + "column": 9 + }, + "end": { + "line": 4, + "column": 16 + } + }, + "local": { + "type": "Identifier", + "start": 37, + "end": 44, + "loc": { + "start": { + "line": 4, + "column": 9 + }, + "end": { + "line": 4, + "column": 16 + }, + "identifierName": "encrypt" + }, + "name": "encrypt" + }, + "exported": { + "type": "Identifier", + "start": 37, + "end": 44, + "loc": { + "start": { + "line": 4, + "column": 9 + }, + "end": { + "line": 4, + "column": 16 + }, + "identifierName": "encrypt" + }, + "name": "encrypt" + } + } + ], + "source": null, + "declaration": null + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/undecl-export-builtin-as/options.json b/packages/babel-parser/test/fixtures/core/scope/undecl-export-builtin-as/options.json index cbab70613300..54925950e059 100644 --- a/packages/babel-parser/test/fixtures/core/scope/undecl-export-builtin-as/options.json +++ b/packages/babel-parser/test/fixtures/core/scope/undecl-export-builtin-as/options.json @@ -1,4 +1,3 @@ { - "sourceType": "module", - "throws": "Export 'Object' is not defined (1:9)" -} + "sourceType": "module" +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/undecl-export-builtin-as/output.json b/packages/babel-parser/test/fixtures/core/scope/undecl-export-builtin-as/output.json new file mode 100644 index 000000000000..ce100047f2fe --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/scope/undecl-export-builtin-as/output.json @@ -0,0 +1,106 @@ +{ + "type": "File", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "errors": [ + "SyntaxError: Export 'Object' is not defined (1:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "specifiers": [ + { + "type": "ExportSpecifier", + "start": 9, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "local": { + "type": "Identifier", + "start": 9, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 15 + }, + "identifierName": "Object" + }, + "name": "Object" + }, + "exported": { + "type": "Identifier", + "start": 19, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 22 + }, + "identifierName": "Obj" + }, + "name": "Obj" + } + } + ], + "source": null, + "declaration": null + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/undecl-export-builtin/options.json b/packages/babel-parser/test/fixtures/core/scope/undecl-export-builtin/options.json index cbab70613300..54925950e059 100644 --- a/packages/babel-parser/test/fixtures/core/scope/undecl-export-builtin/options.json +++ b/packages/babel-parser/test/fixtures/core/scope/undecl-export-builtin/options.json @@ -1,4 +1,3 @@ { - "sourceType": "module", - "throws": "Export 'Object' is not defined (1:9)" -} + "sourceType": "module" +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/undecl-export-builtin/output.json b/packages/babel-parser/test/fixtures/core/scope/undecl-export-builtin/output.json new file mode 100644 index 000000000000..22aa25d45da7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/scope/undecl-export-builtin/output.json @@ -0,0 +1,106 @@ +{ + "type": "File", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "errors": [ + "SyntaxError: Export 'Object' is not defined (1:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "specifiers": [ + { + "type": "ExportSpecifier", + "start": 9, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "local": { + "type": "Identifier", + "start": 9, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 15 + }, + "identifierName": "Object" + }, + "name": "Object" + }, + "exported": { + "type": "Identifier", + "start": 9, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 15 + }, + "identifierName": "Object" + }, + "name": "Object" + } + } + ], + "source": null, + "declaration": null + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/undecl-export-if/options.json b/packages/babel-parser/test/fixtures/core/scope/undecl-export-if/options.json index 2c97b3ce5a78..54925950e059 100644 --- a/packages/babel-parser/test/fixtures/core/scope/undecl-export-if/options.json +++ b/packages/babel-parser/test/fixtures/core/scope/undecl-export-if/options.json @@ -1,4 +1,3 @@ { - "sourceType": "module", - "throws": "In strict mode code, functions can only be declared at top level or inside a block (2:10)" -} + "sourceType": "module" +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/undecl-export-if/output.json b/packages/babel-parser/test/fixtures/core/scope/undecl-export-if/output.json new file mode 100644 index 000000000000..dbff016172cc --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/scope/undecl-export-if/output.json @@ -0,0 +1,191 @@ +{ + "type": "File", + "start": 0, + "end": 51, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 31 + } + }, + "errors": [ + "SyntaxError: In strict mode code, functions can only be declared at top level or inside a block (2:10)", + "SyntaxError: Export 'encrypt' is not defined (1:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 51, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 31 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "specifiers": [ + { + "type": "ExportSpecifier", + "start": 9, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "local": { + "type": "Identifier", + "start": 9, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 16 + }, + "identifierName": "encrypt" + }, + "name": "encrypt" + }, + "exported": { + "type": "Identifier", + "start": 9, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 16 + }, + "identifierName": "encrypt" + }, + "name": "encrypt" + } + } + ], + "source": null, + "declaration": null + }, + { + "type": "IfStatement", + "start": 20, + "end": 51, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 31 + } + }, + "test": { + "type": "BooleanLiteral", + "start": 24, + "end": 28, + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 8 + } + }, + "value": true + }, + "consequent": { + "type": "FunctionDeclaration", + "start": 30, + "end": 51, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 31 + } + }, + "id": { + "type": "Identifier", + "start": 39, + "end": 46, + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 26 + }, + "identifierName": "encrypt" + }, + "name": "encrypt" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 49, + "end": 51, + "loc": { + "start": { + "line": 2, + "column": 29 + }, + "end": { + "line": 2, + "column": 31 + } + }, + "body": [], + "directives": [] + } + }, + "alternate": null + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/undecl-export/options.json b/packages/babel-parser/test/fixtures/core/scope/undecl-export/options.json index 8448889cf253..54925950e059 100644 --- a/packages/babel-parser/test/fixtures/core/scope/undecl-export/options.json +++ b/packages/babel-parser/test/fixtures/core/scope/undecl-export/options.json @@ -1,4 +1,3 @@ { - "sourceType": "module", - "throws": "Export 'encrypt' is not defined (1:9)" -} + "sourceType": "module" +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/scope/undecl-export/output.json b/packages/babel-parser/test/fixtures/core/scope/undecl-export/output.json new file mode 100644 index 000000000000..6293e83f540f --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/scope/undecl-export/output.json @@ -0,0 +1,106 @@ +{ + "type": "File", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "errors": [ + "SyntaxError: Export 'encrypt' is not defined (1:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "specifiers": [ + { + "type": "ExportSpecifier", + "start": 9, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "local": { + "type": "Identifier", + "start": 9, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 16 + }, + "identifierName": "encrypt" + }, + "name": "encrypt" + }, + "exported": { + "type": "Identifier", + "start": 9, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 16 + }, + "identifierName": "encrypt" + }, + "name": "encrypt" + } + } + ], + "source": null, + "declaration": null + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/108/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/108/options.json deleted file mode 100644 index 080cb0eaaa8a..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/108/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid regular expression flag (1:17)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/108/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/108/output.json new file mode 100644 index 000000000000..65ac2b95f145 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/108/output.json @@ -0,0 +1,112 @@ +{ + "type": "File", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "errors": [ + "SyntaxError: Invalid regular expression flag (1:17)", + "SyntaxError: Invalid regular expression flag (1:19)", + "SyntaxError: Invalid regular expression flag (1:20)", + "SyntaxError: Invalid regular expression flag (1:21)", + "SyntaxError: Invalid regular expression flag (1:22)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "id": { + "type": "Identifier", + "start": 4, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "x" + }, + "name": "x" + }, + "init": { + "type": "RegExpLiteral", + "start": 8, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "extra": { + "raw": "/[P QR]/\\u0067" + }, + "pattern": "[P QR]", + "flags": "\\u0067" + } + } + ], + "kind": "var" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/347/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/347/options.json index 91bb1eef0c0d..aa61ff56c2b3 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/347/options.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/347/options.json @@ -1,3 +1,3 @@ { - "throws": "Invalid number (1:0)" -} + "throws": "Identifier directly after number (1:2)" +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/349/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/349/options.json deleted file mode 100644 index 91bb1eef0c0d..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/349/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid number (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/349/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/349/output.json new file mode 100644 index 000000000000..284fac8c4357 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/349/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "errors": [ + "SyntaxError: Invalid number (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "extra": { + "rawValue": 3, + "raw": "3e" + }, + "value": 3 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/350/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/350/options.json deleted file mode 100644 index 91bb1eef0c0d..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/350/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid number (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/350/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/350/output.json new file mode 100644 index 000000000000..6b6e666b00ca --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/350/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "errors": [ + "SyntaxError: Invalid number (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "extra": { + "rawValue": 3, + "raw": "3e+" + }, + "value": 3 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/351/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/351/options.json deleted file mode 100644 index 91bb1eef0c0d..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/351/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid number (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/351/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/351/output.json new file mode 100644 index 000000000000..b52b27d1ef37 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/351/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "errors": [ + "SyntaxError: Invalid number (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "extra": { + "rawValue": 3, + "raw": "3e-" + }, + "value": 3 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/354/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/354/options.json deleted file mode 100644 index 1a0693338eee..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/354/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Expected number in radix 16 (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/354/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/354/output.json new file mode 100644 index 000000000000..ffcb3680fd0b --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/354/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "errors": [ + "SyntaxError: Expected number in radix 16 (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "extra": { + "rawValue": null, + "raw": "0x" + }, + "value": null + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/361/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/361/options.json deleted file mode 100644 index 18c53b997b56..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/361/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Expecting Unicode escape sequence \\uXXXX (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/361/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/361/output.json new file mode 100644 index 000000000000..fbb1d3b5d554 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/361/output.json @@ -0,0 +1,70 @@ +{ + "type": "File", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "errors": [ + "SyntaxError: Expecting Unicode escape sequence \\uXXXX (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "expression": { + "type": "Identifier", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + }, + "identifierName": "xx\\" + }, + "name": "xx\\" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/362/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/362/options.json deleted file mode 100644 index ea7ba01dc69c..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/362/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid Unicode escape (1:1)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/362/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/362/output.json new file mode 100644 index 000000000000..fae32b78cde4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/362/output.json @@ -0,0 +1,70 @@ +{ + "type": "File", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "errors": [ + "SyntaxError: Invalid Unicode escape (1:1)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "expression": { + "type": "Identifier", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "x\\" + }, + "name": "x\\" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/363/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/363/options.json deleted file mode 100644 index ea7ba01dc69c..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/363/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid Unicode escape (1:1)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/363/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/363/output.json new file mode 100644 index 000000000000..37312f42ce97 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/363/output.json @@ -0,0 +1,70 @@ +{ + "type": "File", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "errors": [ + "SyntaxError: Invalid Unicode escape (1:1)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "expression": { + "type": "Identifier", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "x*" + }, + "name": "x*" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/366/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/366/options.json deleted file mode 100644 index adf556b0a352..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/366/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid regular expression flag (1:16)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/366/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/366/output.json new file mode 100644 index 000000000000..68d637a98170 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/366/output.json @@ -0,0 +1,109 @@ +{ + "type": "File", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "errors": [ + "SyntaxError: Invalid regular expression flag (1:16)", + "SyntaxError: Invalid regular expression flag (1:18)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "id": { + "type": "Identifier", + "start": 4, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "x" + }, + "name": "x" + }, + "init": { + "type": "RegExpLiteral", + "start": 8, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "extra": { + "raw": "/[a-z]/\\ux" + }, + "pattern": "[a-z]", + "flags": "\\ux" + } + } + ], + "kind": "var" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/367/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/367/options.json deleted file mode 100644 index 6010e96ed144..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/367/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in assignment expression (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/367/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/367/output.json new file mode 100644 index 000000000000..99a3e74a04af --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/367/output.json @@ -0,0 +1,109 @@ +{ + "type": "File", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "errors": [ + "SyntaxError: Invalid left-hand side in assignment expression (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "operator": "=", + "left": { + "type": "NumericLiteral", + "start": 0, + "end": 1, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "extra": { + "rawValue": 3, + "raw": "3" + }, + "value": 3 + }, + "right": { + "type": "NumericLiteral", + "start": 4, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "extra": { + "rawValue": 4, + "raw": "4" + }, + "value": 4 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/368/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/368/options.json deleted file mode 100644 index 6010e96ed144..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/368/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in assignment expression (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/368/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/368/output.json new file mode 100644 index 000000000000..8770df4abba7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/368/output.json @@ -0,0 +1,122 @@ +{ + "type": "File", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "errors": [ + "SyntaxError: Invalid left-hand side in assignment expression (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "operator": "=", + "left": { + "type": "CallExpression", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "callee": { + "type": "Identifier", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + }, + "identifierName": "func" + }, + "name": "func" + }, + "arguments": [] + }, + "right": { + "type": "NumericLiteral", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "extra": { + "rawValue": 4, + "raw": "4" + }, + "value": 4 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/369/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/369/options.json deleted file mode 100644 index 7c5f08eb9ba6..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/369/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in assignment expression (1:1)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/369/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/369/output.json new file mode 100644 index 000000000000..42614106f157 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/369/output.json @@ -0,0 +1,149 @@ +{ + "type": "File", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "errors": [ + "SyntaxError: Invalid left-hand side in assignment expression (1:1)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "operator": "=", + "left": { + "type": "BinaryExpression", + "start": 1, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "left": { + "type": "NumericLiteral", + "start": 1, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + }, + "operator": "+", + "right": { + "type": "NumericLiteral", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + }, + "extra": { + "parenthesized": true, + "parenStart": 0 + } + }, + "right": { + "type": "NumericLiteral", + "start": 10, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "extra": { + "rawValue": 10, + "raw": "10" + }, + "value": 10 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/370/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/370/options.json deleted file mode 100644 index c09dac1301de..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/370/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in postfix operation (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/370/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/370/output.json new file mode 100644 index 000000000000..ce2cb3d23d67 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/370/output.json @@ -0,0 +1,90 @@ +{ + "type": "File", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "errors": [ + "SyntaxError: Invalid left-hand side in postfix operation (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "expression": { + "type": "UpdateExpression", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "operator": "++", + "prefix": false, + "argument": { + "type": "NumericLiteral", + "start": 0, + "end": 1, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/371/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/371/options.json deleted file mode 100644 index c09dac1301de..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/371/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in postfix operation (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/371/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/371/output.json new file mode 100644 index 000000000000..57d55fec0b5d --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/371/output.json @@ -0,0 +1,90 @@ +{ + "type": "File", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "errors": [ + "SyntaxError: Invalid left-hand side in postfix operation (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "expression": { + "type": "UpdateExpression", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "operator": "--", + "prefix": false, + "argument": { + "type": "NumericLiteral", + "start": 0, + "end": 1, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/372/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/372/options.json deleted file mode 100644 index 515e441e8ea7..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/372/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in prefix operation (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/372/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/372/output.json new file mode 100644 index 000000000000..9a7a240c5b4a --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/372/output.json @@ -0,0 +1,90 @@ +{ + "type": "File", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "errors": [ + "SyntaxError: Invalid left-hand side in prefix operation (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "expression": { + "type": "UpdateExpression", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "operator": "++", + "prefix": true, + "argument": { + "type": "NumericLiteral", + "start": 2, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/373/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/373/options.json deleted file mode 100644 index 515e441e8ea7..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/373/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in prefix operation (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/373/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/373/output.json new file mode 100644 index 000000000000..85107220dae5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/373/output.json @@ -0,0 +1,90 @@ +{ + "type": "File", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "errors": [ + "SyntaxError: Invalid left-hand side in prefix operation (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "expression": { + "type": "UpdateExpression", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "operator": "--", + "prefix": true, + "argument": { + "type": "NumericLiteral", + "start": 2, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/374/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/374/options.json deleted file mode 100644 index f8560a7de9d6..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/374/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in for-in statement (1:5)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/374/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/374/output.json new file mode 100644 index 000000000000..f9e5df01e76a --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/374/output.json @@ -0,0 +1,196 @@ +{ + "type": "File", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "errors": [ + "SyntaxError: Invalid left-hand side in for-in statement (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ForInStatement", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "left": { + "type": "BinaryExpression", + "start": 5, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "left": { + "type": "NumericLiteral", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + }, + "operator": "+", + "right": { + "type": "NumericLiteral", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + }, + "extra": { + "parenthesized": true, + "parenStart": 4 + } + }, + "right": { + "type": "Identifier", + "start": 15, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 19 + }, + "identifierName": "list" + }, + "name": "list" + }, + "body": { + "type": "ExpressionStatement", + "start": 21, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "expression": { + "type": "CallExpression", + "start": 21, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "callee": { + "type": "Identifier", + "start": 21, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 28 + }, + "identifierName": "process" + }, + "name": "process" + }, + "arguments": [ + { + "type": "Identifier", + "start": 29, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 30 + }, + "identifierName": "x" + }, + "name": "x" + } + ] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/382/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/382/options.json deleted file mode 100644 index 2b91be8d5115..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/382/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected keyword 'if' (1:4)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/382/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/382/output.json new file mode 100644 index 000000000000..ac910291b748 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/382/output.json @@ -0,0 +1,108 @@ +{ + "type": "File", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "errors": [ + "SyntaxError: Unexpected keyword 'if' (1:4)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "id": { + "type": "Identifier", + "start": 4, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "if" + }, + "name": "if" + }, + "init": { + "type": "NumericLiteral", + "start": 9, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + ], + "kind": "var" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/383/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/383/options.json deleted file mode 100644 index 6010e96ed144..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/383/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in assignment expression (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/383/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/383/output.json new file mode 100644 index 000000000000..56547ff7be13 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/383/output.json @@ -0,0 +1,142 @@ +{ + "type": "File", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "errors": [ + "SyntaxError: Invalid left-hand side in assignment expression (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "operator": "=", + "left": { + "type": "BinaryExpression", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "left": { + "type": "Identifier", + "start": 0, + "end": 1, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + }, + "identifierName": "i" + }, + "name": "i" + }, + "operator": "+", + "right": { + "type": "NumericLiteral", + "start": 4, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "extra": { + "rawValue": 2, + "raw": "2" + }, + "value": 2 + } + }, + "right": { + "type": "NumericLiteral", + "start": 8, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/384/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/384/options.json deleted file mode 100644 index 6010e96ed144..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/384/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in assignment expression (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/384/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/384/output.json new file mode 100644 index 000000000000..ece139488ea0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/384/output.json @@ -0,0 +1,123 @@ +{ + "type": "File", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "errors": [ + "SyntaxError: Invalid left-hand side in assignment expression (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "operator": "=", + "left": { + "type": "UnaryExpression", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "operator": "+", + "prefix": true, + "argument": { + "type": "Identifier", + "start": 1, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + }, + "identifierName": "i" + }, + "name": "i" + } + }, + "right": { + "type": "NumericLiteral", + "start": 5, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/397/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/397/options.json deleted file mode 100644 index f9543317a817..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/397/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected keyword 'if' (1:11)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/397/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/397/output.json new file mode 100644 index 000000000000..0e5a7503ecdd --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/397/output.json @@ -0,0 +1,108 @@ +{ + "type": "File", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "errors": [ + "SyntaxError: Unexpected keyword 'if' (1:11)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "t" + }, + "name": "t" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 11, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 13 + }, + "identifierName": "if" + }, + "name": "if" + } + ], + "body": { + "type": "BlockStatement", + "start": 15, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/398/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/398/options.json deleted file mode 100644 index bba7a057d842..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/398/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected keyword 'true' (1:11)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/398/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/398/output.json new file mode 100644 index 000000000000..9da054e4ab90 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/398/output.json @@ -0,0 +1,108 @@ +{ + "type": "File", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "errors": [ + "SyntaxError: Unexpected keyword 'true' (1:11)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "t" + }, + "name": "t" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 11, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 15 + }, + "identifierName": "true" + }, + "name": "true" + } + ], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/399/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/399/options.json deleted file mode 100644 index b04b18396af1..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/399/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected keyword 'false' (1:11)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/399/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/399/output.json new file mode 100644 index 000000000000..f4f5b906e9c7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/399/output.json @@ -0,0 +1,108 @@ +{ + "type": "File", + "start": 0, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "errors": [ + "SyntaxError: Unexpected keyword 'false' (1:11)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "t" + }, + "name": "t" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 11, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 16 + }, + "identifierName": "false" + }, + "name": "false" + } + ], + "body": { + "type": "BlockStatement", + "start": 18, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/400/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/400/options.json deleted file mode 100644 index 667f2cc8816d..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/400/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected keyword 'null' (1:11)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/400/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/400/output.json new file mode 100644 index 000000000000..b8eaca925ad4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/400/output.json @@ -0,0 +1,108 @@ +{ + "type": "File", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "errors": [ + "SyntaxError: Unexpected keyword 'null' (1:11)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "t" + }, + "name": "t" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 11, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 15 + }, + "identifierName": "null" + }, + "name": "null" + } + ], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/401/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/401/options.json deleted file mode 100644 index fa57d4f43f70..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/401/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected keyword 'null' (1:9)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/401/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/401/output.json new file mode 100644 index 000000000000..3fea78461b66 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/401/output.json @@ -0,0 +1,90 @@ +{ + "type": "File", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "errors": [ + "SyntaxError: Unexpected keyword 'null' (1:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 13 + }, + "identifierName": "null" + }, + "name": "null" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 16, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/402/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/402/options.json deleted file mode 100644 index c4a7ead13704..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/402/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected keyword 'true' (1:9)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/402/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/402/output.json new file mode 100644 index 000000000000..fc0c10f2f765 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/402/output.json @@ -0,0 +1,90 @@ +{ + "type": "File", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "errors": [ + "SyntaxError: Unexpected keyword 'true' (1:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 13 + }, + "identifierName": "true" + }, + "name": "true" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 16, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/403/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/403/options.json deleted file mode 100644 index 0e9cf8962aae..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/403/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected keyword 'false' (1:9)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/403/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/403/output.json new file mode 100644 index 000000000000..7e708faf3684 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/403/output.json @@ -0,0 +1,90 @@ +{ + "type": "File", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "errors": [ + "SyntaxError: Unexpected keyword 'false' (1:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "false" + }, + "name": "false" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/404/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/404/options.json deleted file mode 100644 index a87aa98c0e01..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/404/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected keyword 'if' (1:9)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/404/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/404/output.json new file mode 100644 index 000000000000..813c4e9b903a --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/404/output.json @@ -0,0 +1,90 @@ +{ + "type": "File", + "start": 0, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "errors": [ + "SyntaxError: Unexpected keyword 'if' (1:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 11 + }, + "identifierName": "if" + }, + "name": "if" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 14, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/409/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/409/options.json deleted file mode 100644 index 701f9fe8f27a..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/409/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unsyntactic break (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/409/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/409/output.json new file mode 100644 index 000000000000..d3a105c584dd --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/409/output.json @@ -0,0 +1,54 @@ +{ + "type": "File", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "errors": [ + "SyntaxError: Unsyntactic break (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "BreakStatement", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "label": null + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/411/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/411/options.json deleted file mode 100644 index de66853a7a3d..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/411/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unsyntactic continue (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/411/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/411/output.json new file mode 100644 index 000000000000..c32c5b089115 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/411/output.json @@ -0,0 +1,54 @@ +{ + "type": "File", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "errors": [ + "SyntaxError: Unsyntactic continue (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ContinueStatement", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "label": null + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/417/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/417/options.json deleted file mode 100644 index f8560a7de9d6..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/417/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in for-in statement (1:5)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/417/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/417/output.json new file mode 100644 index 000000000000..3844a4d151a7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/417/output.json @@ -0,0 +1,137 @@ +{ + "type": "File", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "errors": [ + "SyntaxError: Invalid left-hand side in for-in statement (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ForInStatement", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "left": { + "type": "BinaryExpression", + "start": 5, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "left": { + "type": "Identifier", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "i" + }, + "name": "i" + }, + "operator": "+", + "right": { + "type": "NumericLiteral", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + }, + "right": { + "type": "ObjectExpression", + "start": 14, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "properties": [] + }, + "body": { + "type": "EmptyStatement", + "start": 17, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/418/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/418/options.json deleted file mode 100644 index f8560a7de9d6..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/418/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in for-in statement (1:5)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/418/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/418/output.json new file mode 100644 index 000000000000..9d008175f644 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/418/output.json @@ -0,0 +1,118 @@ +{ + "type": "File", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "errors": [ + "SyntaxError: Invalid left-hand side in for-in statement (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ForInStatement", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "left": { + "type": "UnaryExpression", + "start": 5, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "operator": "+", + "prefix": true, + "argument": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "i" + }, + "name": "i" + } + }, + "right": { + "type": "ObjectExpression", + "start": 11, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "properties": [] + }, + "body": { + "type": "EmptyStatement", + "start": 14, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/425/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/425/options.json deleted file mode 100644 index 429d96ca3f9a..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/425/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Missing catch or finally clause (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/425/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/425/output.json new file mode 100644 index 000000000000..3d2ee0555b85 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/425/output.json @@ -0,0 +1,72 @@ +{ + "type": "File", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "errors": [ + "SyntaxError: Missing catch or finally clause (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "TryStatement", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "block": { + "type": "BlockStatement", + "start": 4, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "body": [], + "directives": [] + }, + "handler": null, + "finalizer": null + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/427/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/427/options.json deleted file mode 100644 index aadfa63716c2..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/427/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Multiple default clauses (1:22)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/427/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/427/output.json new file mode 100644 index 000000000000..c90c4eefdc6f --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/427/output.json @@ -0,0 +1,106 @@ +{ + "type": "File", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "errors": [ + "SyntaxError: Multiple default clauses (1:22)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "SwitchStatement", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "discriminant": { + "type": "Identifier", + "start": 8, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + }, + "identifierName": "c" + }, + "name": "c" + }, + "cases": [ + { + "type": "SwitchCase", + "start": 13, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "consequent": [], + "test": null + }, + { + "type": "SwitchCase", + "start": 22, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "consequent": [], + "test": null + } + ] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/446/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/446/options.json deleted file mode 100644 index 381fd12ce2d0..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/446/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Expecting Unicode escape sequence \\uXXXX (1:1)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/446/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/446/output.json new file mode 100644 index 000000000000..1db488318bdf --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/446/output.json @@ -0,0 +1,71 @@ +{ + "type": "File", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "errors": [ + "SyntaxError: Expecting Unicode escape sequence \\uXXXX (1:1)", + "SyntaxError: Expecting Unicode escape sequence \\uXXXX (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "expression": { + "type": "Identifier", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + }, + "identifierName": "\\\\\\" + }, + "name": "\\\\\\" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/447/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/447/options.json deleted file mode 100644 index 82bcfe621c49..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/447/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid Unicode escape (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/447/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/447/output.json new file mode 100644 index 000000000000..d44909ca998a --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/447/output.json @@ -0,0 +1,70 @@ +{ + "type": "File", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "errors": [ + "SyntaxError: Invalid Unicode escape (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "expression": { + "type": "Identifier", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "\\" + }, + "name": "\\" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/448/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/448/options.json deleted file mode 100644 index 381fd12ce2d0..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/448/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Expecting Unicode escape sequence \\uXXXX (1:1)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/448/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/448/output.json new file mode 100644 index 000000000000..38cc0c05b021 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/448/output.json @@ -0,0 +1,70 @@ +{ + "type": "File", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "errors": [ + "SyntaxError: Expecting Unicode escape sequence \\uXXXX (1:1)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "expression": { + "type": "Identifier", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + }, + "identifierName": "\\x" + }, + "name": "\\x" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/449/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/449/options.json deleted file mode 100644 index 82bcfe621c49..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/449/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid Unicode escape (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/449/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/449/output.json new file mode 100644 index 000000000000..380e6ec698ef --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/449/output.json @@ -0,0 +1,70 @@ +{ + "type": "File", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "errors": [ + "SyntaxError: Invalid Unicode escape (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "expression": { + "type": "Identifier", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "\u0000" + }, + "name": "\u0000" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/453/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/453/options.json index 8e0dce66eff8..a760565b1bd2 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/453/options.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/453/options.json @@ -1,3 +1,3 @@ { - "throws": "Bad character escape sequence (1:3)" -} + "throws": "Unterminated string constant (1:0)" +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/454/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/454/options.json deleted file mode 100644 index f9d29c7f328c..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/454/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "'return' outside of function (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/454/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/454/output.json new file mode 100644 index 000000000000..e43da2374537 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/454/output.json @@ -0,0 +1,54 @@ +{ + "type": "File", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "errors": [ + "SyntaxError: 'return' outside of function (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ReturnStatement", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "argument": null + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/455/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/455/options.json deleted file mode 100644 index 701f9fe8f27a..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/455/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unsyntactic break (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/455/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/455/output.json new file mode 100644 index 000000000000..d3a105c584dd --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/455/output.json @@ -0,0 +1,54 @@ +{ + "type": "File", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "errors": [ + "SyntaxError: Unsyntactic break (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "BreakStatement", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "label": null + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/456/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/456/options.json deleted file mode 100644 index de66853a7a3d..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/456/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unsyntactic continue (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/456/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/456/output.json new file mode 100644 index 000000000000..c32c5b089115 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/456/output.json @@ -0,0 +1,54 @@ +{ + "type": "File", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "errors": [ + "SyntaxError: Unsyntactic continue (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ContinueStatement", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "label": null + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/457/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/457/options.json deleted file mode 100644 index c726e8fa98e4..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/457/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unsyntactic continue (1:22)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/457/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/457/output.json new file mode 100644 index 000000000000..b83145faf5ab --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/457/output.json @@ -0,0 +1,106 @@ +{ + "type": "File", + "start": 0, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "errors": [ + "SyntaxError: Unsyntactic continue (1:22)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "SwitchStatement", + "start": 0, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "discriminant": { + "type": "Identifier", + "start": 8, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + }, + "identifierName": "x" + }, + "name": "x" + }, + "cases": [ + { + "type": "SwitchCase", + "start": 13, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "consequent": [ + { + "type": "ContinueStatement", + "start": 22, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "label": null + } + ], + "test": null + } + ] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/459/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/459/options.json deleted file mode 100644 index 070e662e80d4..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/459/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unsyntactic break (1:15)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/459/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/459/output.json new file mode 100644 index 000000000000..a7c8d4f9a0ca --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/459/output.json @@ -0,0 +1,119 @@ +{ + "type": "File", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "errors": [ + "SyntaxError: Unsyntactic break (1:15)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "WhileStatement", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "test": { + "type": "BooleanLiteral", + "start": 7, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "value": true + }, + "body": { + "type": "BlockStatement", + "start": 13, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "body": [ + { + "type": "BreakStatement", + "start": 15, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "label": { + "type": "Identifier", + "start": 21, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + }, + "identifierName": "x" + }, + "name": "x" + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/460/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/460/options.json deleted file mode 100644 index 2a2e15787aa7..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/460/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unsyntactic continue (1:15)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/460/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/460/output.json new file mode 100644 index 000000000000..2f1c8737b22e --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/460/output.json @@ -0,0 +1,119 @@ +{ + "type": "File", + "start": 0, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "errors": [ + "SyntaxError: Unsyntactic continue (1:15)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "WhileStatement", + "start": 0, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "test": { + "type": "BooleanLiteral", + "start": 7, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "value": true + }, + "body": { + "type": "BlockStatement", + "start": 13, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "body": [ + { + "type": "ContinueStatement", + "start": 15, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "label": { + "type": "Identifier", + "start": 24, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + }, + "identifierName": "x" + }, + "name": "x" + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/461/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/461/options.json deleted file mode 100644 index 464af80a1561..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/461/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unsyntactic break (1:33)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/461/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/461/output.json new file mode 100644 index 000000000000..7337acd3e8fd --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/461/output.json @@ -0,0 +1,207 @@ +{ + "type": "File", + "start": 0, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 47 + } + }, + "errors": [ + "SyntaxError: Unsyntactic break (1:33)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 47 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "LabeledStatement", + "start": 0, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 47 + } + }, + "body": { + "type": "WhileStatement", + "start": 3, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 47 + } + }, + "test": { + "type": "BooleanLiteral", + "start": 10, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "value": true + }, + "body": { + "type": "BlockStatement", + "start": 16, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 47 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 18, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 45 + } + }, + "expression": { + "type": "FunctionExpression", + "start": 19, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 31, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "body": [ + { + "type": "BreakStatement", + "start": 33, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "label": { + "type": "Identifier", + "start": 39, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 39 + }, + "end": { + "line": 1, + "column": 40 + }, + "identifierName": "x" + }, + "name": "x" + } + } + ], + "directives": [] + }, + "extra": { + "parenthesized": true, + "parenStart": 18 + } + } + } + ], + "directives": [] + } + }, + "label": { + "type": "Identifier", + "start": 0, + "end": 1, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + }, + "identifierName": "x" + }, + "name": "x" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/462/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/462/options.json deleted file mode 100644 index a056cb50e190..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/462/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unsyntactic continue (1:33)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/462/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/462/output.json new file mode 100644 index 000000000000..18bc9b977ca7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/462/output.json @@ -0,0 +1,207 @@ +{ + "type": "File", + "start": 0, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 50 + } + }, + "errors": [ + "SyntaxError: Unsyntactic continue (1:33)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 50 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "LabeledStatement", + "start": 0, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 50 + } + }, + "body": { + "type": "WhileStatement", + "start": 3, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 50 + } + }, + "test": { + "type": "BooleanLiteral", + "start": 10, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "value": true + }, + "body": { + "type": "BlockStatement", + "start": 16, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 50 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 18, + "end": 48, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 48 + } + }, + "expression": { + "type": "FunctionExpression", + "start": 19, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 31, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "body": [ + { + "type": "ContinueStatement", + "start": 33, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 44 + } + }, + "label": { + "type": "Identifier", + "start": 42, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 42 + }, + "end": { + "line": 1, + "column": 43 + }, + "identifierName": "x" + }, + "name": "x" + } + } + ], + "directives": [] + }, + "extra": { + "parenthesized": true, + "parenStart": 18 + } + } + } + ], + "directives": [] + } + }, + "label": { + "type": "Identifier", + "start": 0, + "end": 1, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + }, + "identifierName": "x" + }, + "name": "x" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/463/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/463/options.json deleted file mode 100644 index 464af80a1561..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/463/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unsyntactic break (1:33)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/463/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/463/output.json new file mode 100644 index 000000000000..59ae007d6fba --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/463/output.json @@ -0,0 +1,191 @@ +{ + "type": "File", + "start": 0, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 45 + } + }, + "errors": [ + "SyntaxError: Unsyntactic break (1:33)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 45 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "LabeledStatement", + "start": 0, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 45 + } + }, + "body": { + "type": "WhileStatement", + "start": 3, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 45 + } + }, + "test": { + "type": "BooleanLiteral", + "start": 10, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "value": true + }, + "body": { + "type": "BlockStatement", + "start": 16, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 45 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 18, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "expression": { + "type": "FunctionExpression", + "start": 19, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 31, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "body": [ + { + "type": "BreakStatement", + "start": 33, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "label": null + } + ], + "directives": [] + }, + "extra": { + "parenthesized": true, + "parenStart": 18 + } + } + } + ], + "directives": [] + } + }, + "label": { + "type": "Identifier", + "start": 0, + "end": 1, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + }, + "identifierName": "x" + }, + "name": "x" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/464/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/464/options.json deleted file mode 100644 index a056cb50e190..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/464/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unsyntactic continue (1:33)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/464/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/464/output.json new file mode 100644 index 000000000000..d26e37b08031 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/464/output.json @@ -0,0 +1,191 @@ +{ + "type": "File", + "start": 0, + "end": 48, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 48 + } + }, + "errors": [ + "SyntaxError: Unsyntactic continue (1:33)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 48, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 48 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "LabeledStatement", + "start": 0, + "end": 48, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 48 + } + }, + "body": { + "type": "WhileStatement", + "start": 3, + "end": 48, + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 48 + } + }, + "test": { + "type": "BooleanLiteral", + "start": 10, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "value": true + }, + "body": { + "type": "BlockStatement", + "start": 16, + "end": 48, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 48 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 18, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "expression": { + "type": "FunctionExpression", + "start": 19, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 44 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 31, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 44 + } + }, + "body": [ + { + "type": "ContinueStatement", + "start": 33, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 42 + } + }, + "label": null + } + ], + "directives": [] + }, + "extra": { + "parenthesized": true, + "parenStart": 18 + } + } + } + ], + "directives": [] + } + }, + "label": { + "type": "Identifier", + "start": 0, + "end": 1, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + }, + "identifierName": "x" + }, + "name": "x" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/465/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/465/options.json deleted file mode 100644 index da7f2590db0b..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/465/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Label 'x' is already declared (1:18)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/465/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/465/output.json new file mode 100644 index 000000000000..3025d6bfbf72 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/465/output.json @@ -0,0 +1,199 @@ +{ + "type": "File", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "errors": [ + "SyntaxError: Label 'x' is already declared (1:18)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "LabeledStatement", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "body": { + "type": "WhileStatement", + "start": 3, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "test": { + "type": "BooleanLiteral", + "start": 10, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "value": true + }, + "body": { + "type": "BlockStatement", + "start": 16, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "body": [ + { + "type": "LabeledStatement", + "start": 18, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "body": { + "type": "WhileStatement", + "start": 21, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "test": { + "type": "BooleanLiteral", + "start": 28, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "value": true + }, + "body": { + "type": "BlockStatement", + "start": 34, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "body": [], + "directives": [] + } + }, + "label": { + "type": "Identifier", + "start": 18, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + }, + "identifierName": "x" + }, + "name": "x" + } + } + ], + "directives": [] + } + }, + "label": { + "type": "Identifier", + "start": 0, + "end": 1, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + }, + "identifierName": "x" + }, + "name": "x" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/466/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/466/options.json deleted file mode 100644 index 1517e1719333..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/466/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Deleting local variable in strict mode (1:29)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/466/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/466/output.json new file mode 100644 index 000000000000..f22f0efb0609 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/466/output.json @@ -0,0 +1,195 @@ +{ + "type": "File", + "start": 0, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "errors": [ + "SyntaxError: Deleting local variable in strict mode (1:29)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "expression": { + "type": "CallExpression", + "start": 1, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 42 + } + }, + "callee": { + "type": "FunctionExpression", + "start": 1, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 13, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 29, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "expression": { + "type": "UnaryExpression", + "start": 29, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "operator": "delete", + "prefix": true, + "argument": { + "type": "Identifier", + "start": 36, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 37 + }, + "identifierName": "i" + }, + "name": "i" + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 15, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 15, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + }, + "arguments": [], + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/467/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/467/options.json deleted file mode 100644 index 31b4c6d2a040..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/467/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "'with' in strict mode (1:29)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/467/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/467/output.json new file mode 100644 index 000000000000..1567b18881d6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/467/output.json @@ -0,0 +1,193 @@ +{ + "type": "File", + "start": 0, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "errors": [ + "SyntaxError: 'with' in strict mode (1:29)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "expression": { + "type": "CallExpression", + "start": 1, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 42 + } + }, + "callee": { + "type": "FunctionExpression", + "start": 1, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 13, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "body": [ + { + "type": "WithStatement", + "start": 29, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "object": { + "type": "Identifier", + "start": 35, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 36 + }, + "identifierName": "i" + }, + "name": "i" + }, + "body": { + "type": "EmptyStatement", + "start": 37, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 38 + } + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 15, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 15, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + }, + "arguments": [], + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/468/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/468/options.json deleted file mode 100644 index dfbf1f6d0d1c..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/468/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:36)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/468/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/468/output.json new file mode 100644 index 000000000000..7598b7431e9f --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/468/output.json @@ -0,0 +1,197 @@ +{ + "type": "File", + "start": 0, + "end": 48, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 48 + } + }, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:36)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 48, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 48 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 48, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 48 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 48, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 48 + } + }, + "body": [ + { + "type": "VariableDeclaration", + "start": 32, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 36, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 45 + } + }, + "id": { + "type": "Identifier", + "start": 36, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 40 + }, + "identifierName": "eval" + }, + "name": "eval" + }, + "init": { + "type": "NumericLiteral", + "start": 43, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 43 + }, + "end": { + "line": 1, + "column": 45 + } + }, + "extra": { + "rawValue": 10, + "raw": "10" + }, + "value": 10 + } + } + ], + "kind": "var" + } + ], + "directives": [ + { + "type": "Directive", + "start": 18, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 18, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/469/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/469/options.json deleted file mode 100644 index b74dfcf59199..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/469/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'arguments' in strict mode (1:36)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/469/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/469/output.json new file mode 100644 index 000000000000..7101109189a2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/469/output.json @@ -0,0 +1,197 @@ +{ + "type": "File", + "start": 0, + "end": 53, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 53 + } + }, + "errors": [ + "SyntaxError: Binding 'arguments' in strict mode (1:36)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 53, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 53 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 53, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 53 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 53, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 53 + } + }, + "body": [ + { + "type": "VariableDeclaration", + "start": 32, + "end": 51, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 51 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 36, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 50 + } + }, + "id": { + "type": "Identifier", + "start": 36, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 45 + }, + "identifierName": "arguments" + }, + "name": "arguments" + }, + "init": { + "type": "NumericLiteral", + "start": 48, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 48 + }, + "end": { + "line": 1, + "column": 50 + } + }, + "extra": { + "rawValue": 10, + "raw": "10" + }, + "value": 10 + } + } + ], + "kind": "var" + } + ], + "directives": [ + { + "type": "Directive", + "start": 18, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 18, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/470/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/470/options.json deleted file mode 100644 index e95a2d7f7535..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/470/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:47)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/470/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/470/output.json new file mode 100644 index 000000000000..dd5fca85f2e5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/470/output.json @@ -0,0 +1,209 @@ +{ + "type": "File", + "start": 0, + "end": 58, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 58 + } + }, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:47)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 58, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 58 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 58, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 58 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 58, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 58 + } + }, + "body": [ + { + "type": "TryStatement", + "start": 32, + "end": 56, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 56 + } + }, + "block": { + "type": "BlockStatement", + "start": 36, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "body": [], + "directives": [] + }, + "handler": { + "type": "CatchClause", + "start": 40, + "end": 56, + "loc": { + "start": { + "line": 1, + "column": 40 + }, + "end": { + "line": 1, + "column": 56 + } + }, + "param": { + "type": "Identifier", + "start": 47, + "end": 51, + "loc": { + "start": { + "line": 1, + "column": 47 + }, + "end": { + "line": 1, + "column": 51 + }, + "identifierName": "eval" + }, + "name": "eval" + }, + "body": { + "type": "BlockStatement", + "start": 53, + "end": 56, + "loc": { + "start": { + "line": 1, + "column": 53 + }, + "end": { + "line": 1, + "column": 56 + } + }, + "body": [], + "directives": [] + } + }, + "finalizer": null + } + ], + "directives": [ + { + "type": "Directive", + "start": 18, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 18, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/471/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/471/options.json deleted file mode 100644 index 14d96617b4b6..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/471/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'arguments' in strict mode (1:47)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/471/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/471/output.json new file mode 100644 index 000000000000..3b89f63424e2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/471/output.json @@ -0,0 +1,209 @@ +{ + "type": "File", + "start": 0, + "end": 63, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 63 + } + }, + "errors": [ + "SyntaxError: Binding 'arguments' in strict mode (1:47)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 63, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 63 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 63, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 63 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 63, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 63 + } + }, + "body": [ + { + "type": "TryStatement", + "start": 32, + "end": 61, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 61 + } + }, + "block": { + "type": "BlockStatement", + "start": 36, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "body": [], + "directives": [] + }, + "handler": { + "type": "CatchClause", + "start": 40, + "end": 61, + "loc": { + "start": { + "line": 1, + "column": 40 + }, + "end": { + "line": 1, + "column": 61 + } + }, + "param": { + "type": "Identifier", + "start": 47, + "end": 56, + "loc": { + "start": { + "line": 1, + "column": 47 + }, + "end": { + "line": 1, + "column": 56 + }, + "identifierName": "arguments" + }, + "name": "arguments" + }, + "body": { + "type": "BlockStatement", + "start": 58, + "end": 61, + "loc": { + "start": { + "line": 1, + "column": 58 + }, + "end": { + "line": 1, + "column": 61 + } + }, + "body": [], + "directives": [] + } + }, + "finalizer": null + } + ], + "directives": [ + { + "type": "Directive", + "start": 18, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 18, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/472/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/472/options.json deleted file mode 100644 index 6faa5d0476c3..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/472/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Assigning to 'eval' in strict mode (1:32)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/472/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/472/output.json new file mode 100644 index 000000000000..2973f3517639 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/472/output.json @@ -0,0 +1,195 @@ +{ + "type": "File", + "start": 0, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 44 + } + }, + "errors": [ + "SyntaxError: Assigning to 'eval' in strict mode (1:32)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 44 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 44 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 44 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 32, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 42 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 32, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "operator": "=", + "left": { + "type": "Identifier", + "start": 32, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 36 + }, + "identifierName": "eval" + }, + "name": "eval" + }, + "right": { + "type": "NumericLiteral", + "start": 39, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 39 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "extra": { + "rawValue": 10, + "raw": "10" + }, + "value": 10 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 18, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 18, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/473/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/473/options.json deleted file mode 100644 index 2f502104f7d4..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/473/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Assigning to 'arguments' in strict mode (1:32)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/473/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/473/output.json new file mode 100644 index 000000000000..e328a1e98ef9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/473/output.json @@ -0,0 +1,195 @@ +{ + "type": "File", + "start": 0, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 49 + } + }, + "errors": [ + "SyntaxError: Assigning to 'arguments' in strict mode (1:32)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 49 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 49 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 49 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 32, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 47 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 32, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "operator": "=", + "left": { + "type": "Identifier", + "start": 32, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 41 + }, + "identifierName": "arguments" + }, + "name": "arguments" + }, + "right": { + "type": "NumericLiteral", + "start": 44, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 44 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "extra": { + "rawValue": 10, + "raw": "10" + }, + "value": 10 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 18, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 18, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/474/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/474/options.json deleted file mode 100644 index 0964911894d9..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/474/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Assigning to 'eval' in strict mode (1:34)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/474/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/474/output.json new file mode 100644 index 000000000000..95091e65367d --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/474/output.json @@ -0,0 +1,176 @@ +{ + "type": "File", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "errors": [ + "SyntaxError: Assigning to 'eval' in strict mode (1:34)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 32, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "expression": { + "type": "UpdateExpression", + "start": 32, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "operator": "++", + "prefix": true, + "argument": { + "type": "Identifier", + "start": 34, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 38 + }, + "identifierName": "eval" + }, + "name": "eval" + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 18, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 18, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/475/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/475/options.json deleted file mode 100644 index 0964911894d9..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/475/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Assigning to 'eval' in strict mode (1:34)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/475/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/475/output.json new file mode 100644 index 000000000000..8473055a411c --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/475/output.json @@ -0,0 +1,176 @@ +{ + "type": "File", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "errors": [ + "SyntaxError: Assigning to 'eval' in strict mode (1:34)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 32, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "expression": { + "type": "UpdateExpression", + "start": 32, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "operator": "--", + "prefix": true, + "argument": { + "type": "Identifier", + "start": 34, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 38 + }, + "identifierName": "eval" + }, + "name": "eval" + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 18, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 18, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/476/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/476/options.json deleted file mode 100644 index ba5ef9dd55cc..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/476/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Assigning to 'arguments' in strict mode (1:34)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/476/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/476/output.json new file mode 100644 index 000000000000..c9974932443e --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/476/output.json @@ -0,0 +1,176 @@ +{ + "type": "File", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "errors": [ + "SyntaxError: Assigning to 'arguments' in strict mode (1:34)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 32, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 44 + } + }, + "expression": { + "type": "UpdateExpression", + "start": 32, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "operator": "++", + "prefix": true, + "argument": { + "type": "Identifier", + "start": 34, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 43 + }, + "identifierName": "arguments" + }, + "name": "arguments" + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 18, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 18, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/477/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/477/options.json deleted file mode 100644 index ba5ef9dd55cc..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/477/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Assigning to 'arguments' in strict mode (1:34)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/477/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/477/output.json new file mode 100644 index 000000000000..cf31420c53a0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/477/output.json @@ -0,0 +1,176 @@ +{ + "type": "File", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "errors": [ + "SyntaxError: Assigning to 'arguments' in strict mode (1:34)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 32, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 44 + } + }, + "expression": { + "type": "UpdateExpression", + "start": 32, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "operator": "--", + "prefix": true, + "argument": { + "type": "Identifier", + "start": 34, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 43 + }, + "identifierName": "arguments" + }, + "name": "arguments" + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 18, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 18, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/478/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/478/options.json deleted file mode 100644 index 6faa5d0476c3..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/478/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Assigning to 'eval' in strict mode (1:32)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/478/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/478/output.json new file mode 100644 index 000000000000..59618c91e2ca --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/478/output.json @@ -0,0 +1,176 @@ +{ + "type": "File", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "errors": [ + "SyntaxError: Assigning to 'eval' in strict mode (1:32)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 32, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "expression": { + "type": "UpdateExpression", + "start": 32, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "operator": "++", + "prefix": false, + "argument": { + "type": "Identifier", + "start": 32, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 36 + }, + "identifierName": "eval" + }, + "name": "eval" + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 18, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 18, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/479/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/479/options.json deleted file mode 100644 index 6faa5d0476c3..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/479/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Assigning to 'eval' in strict mode (1:32)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/479/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/479/output.json new file mode 100644 index 000000000000..0b6b047c7b58 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/479/output.json @@ -0,0 +1,176 @@ +{ + "type": "File", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "errors": [ + "SyntaxError: Assigning to 'eval' in strict mode (1:32)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 32, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "expression": { + "type": "UpdateExpression", + "start": 32, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "operator": "--", + "prefix": false, + "argument": { + "type": "Identifier", + "start": 32, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 36 + }, + "identifierName": "eval" + }, + "name": "eval" + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 18, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 18, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/480/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/480/options.json deleted file mode 100644 index 2f502104f7d4..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/480/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Assigning to 'arguments' in strict mode (1:32)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/480/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/480/output.json new file mode 100644 index 000000000000..64f2c09fd91e --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/480/output.json @@ -0,0 +1,176 @@ +{ + "type": "File", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "errors": [ + "SyntaxError: Assigning to 'arguments' in strict mode (1:32)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 32, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 44 + } + }, + "expression": { + "type": "UpdateExpression", + "start": 32, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "operator": "++", + "prefix": false, + "argument": { + "type": "Identifier", + "start": 32, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 41 + }, + "identifierName": "arguments" + }, + "name": "arguments" + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 18, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 18, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/481/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/481/options.json deleted file mode 100644 index 2f502104f7d4..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/481/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Assigning to 'arguments' in strict mode (1:32)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/481/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/481/output.json new file mode 100644 index 000000000000..34c1b59c4e79 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/481/output.json @@ -0,0 +1,176 @@ +{ + "type": "File", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "errors": [ + "SyntaxError: Assigning to 'arguments' in strict mode (1:32)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 32, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 44 + } + }, + "expression": { + "type": "UpdateExpression", + "start": 32, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "operator": "--", + "prefix": false, + "argument": { + "type": "Identifier", + "start": 32, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 41 + }, + "identifierName": "arguments" + }, + "name": "arguments" + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 18, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 18, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/482/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/482/options.json deleted file mode 100644 index 439ffff53e89..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/482/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:41)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/482/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/482/output.json new file mode 100644 index 000000000000..35af060b7c6e --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/482/output.json @@ -0,0 +1,179 @@ +{ + "type": "File", + "start": 0, + "end": 53, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 53 + } + }, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:41)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 53, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 53 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 53, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 53 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 53, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 53 + } + }, + "body": [ + { + "type": "FunctionDeclaration", + "start": 32, + "end": 51, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 51 + } + }, + "id": { + "type": "Identifier", + "start": 41, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 41 + }, + "end": { + "line": 1, + "column": 45 + }, + "identifierName": "eval" + }, + "name": "eval" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 48, + "end": 51, + "loc": { + "start": { + "line": 1, + "column": 48 + }, + "end": { + "line": 1, + "column": 51 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 18, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 18, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/483/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/483/options.json deleted file mode 100644 index ad15b27f9b9a..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/483/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'arguments' in strict mode (1:41)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/483/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/483/output.json new file mode 100644 index 000000000000..7419ba446dc9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/483/output.json @@ -0,0 +1,179 @@ +{ + "type": "File", + "start": 0, + "end": 58, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 58 + } + }, + "errors": [ + "SyntaxError: Binding 'arguments' in strict mode (1:41)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 58, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 58 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 58, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 58 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 58, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 58 + } + }, + "body": [ + { + "type": "FunctionDeclaration", + "start": 32, + "end": 56, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 56 + } + }, + "id": { + "type": "Identifier", + "start": 41, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 41 + }, + "end": { + "line": 1, + "column": 50 + }, + "identifierName": "arguments" + }, + "name": "arguments" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 53, + "end": 56, + "loc": { + "start": { + "line": 1, + "column": 53 + }, + "end": { + "line": 1, + "column": 56 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 18, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 18, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/484/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/484/options.json deleted file mode 100644 index 1eb91299eb1b..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/484/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:9)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/484/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/484/output.json new file mode 100644 index 000000000000..ede15490b692 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/484/output.json @@ -0,0 +1,126 @@ +{ + "type": "File", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 13 + }, + "identifierName": "eval" + }, + "name": "eval" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 16, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 17, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 17, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/485/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/485/options.json deleted file mode 100644 index c903c1205ce8..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/485/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'arguments' in strict mode (1:9)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/485/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/485/output.json new file mode 100644 index 000000000000..aeccd1a07ed9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/485/output.json @@ -0,0 +1,126 @@ +{ + "type": "File", + "start": 0, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "errors": [ + "SyntaxError: Binding 'arguments' in strict mode (1:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 18 + }, + "identifierName": "arguments" + }, + "name": "arguments" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 21, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 22, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 22, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/486/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/486/options.json deleted file mode 100644 index 884ab94e3403..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/486/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:42)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/486/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/486/output.json new file mode 100644 index 000000000000..4e8af9c85d04 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/486/output.json @@ -0,0 +1,214 @@ +{ + "type": "File", + "start": 0, + "end": 57, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 57 + } + }, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:42)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 57, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 57 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 57, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 57 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 57, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 57 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 32, + "end": 55, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 55 + } + }, + "expression": { + "type": "CallExpression", + "start": 33, + "end": 54, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 54 + } + }, + "callee": { + "type": "FunctionExpression", + "start": 33, + "end": 52, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 52 + } + }, + "id": { + "type": "Identifier", + "start": 42, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 42 + }, + "end": { + "line": 1, + "column": 46 + }, + "identifierName": "eval" + }, + "name": "eval" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 49, + "end": 52, + "loc": { + "start": { + "line": 1, + "column": 49 + }, + "end": { + "line": 1, + "column": 52 + } + }, + "body": [], + "directives": [] + } + }, + "arguments": [], + "extra": { + "parenthesized": true, + "parenStart": 32 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 18, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 18, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/487/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/487/options.json deleted file mode 100644 index 58a98e4ca953..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/487/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'arguments' in strict mode (1:42)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/487/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/487/output.json new file mode 100644 index 000000000000..49a2e0086f28 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/487/output.json @@ -0,0 +1,214 @@ +{ + "type": "File", + "start": 0, + "end": 62, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 62 + } + }, + "errors": [ + "SyntaxError: Binding 'arguments' in strict mode (1:42)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 62, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 62 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 62, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 62 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 62, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 62 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 32, + "end": 60, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 60 + } + }, + "expression": { + "type": "CallExpression", + "start": 33, + "end": 59, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 59 + } + }, + "callee": { + "type": "FunctionExpression", + "start": 33, + "end": 57, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 57 + } + }, + "id": { + "type": "Identifier", + "start": 42, + "end": 51, + "loc": { + "start": { + "line": 1, + "column": 42 + }, + "end": { + "line": 1, + "column": 51 + }, + "identifierName": "arguments" + }, + "name": "arguments" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 54, + "end": 57, + "loc": { + "start": { + "line": 1, + "column": 54 + }, + "end": { + "line": 1, + "column": 57 + } + }, + "body": [], + "directives": [] + } + }, + "arguments": [], + "extra": { + "parenthesized": true, + "parenStart": 32 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 18, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 18, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/488/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/488/options.json deleted file mode 100644 index aa44c4aafa4d..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/488/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/488/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/488/output.json new file mode 100644 index 000000000000..6d1387258a3e --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/488/output.json @@ -0,0 +1,161 @@ +{ + "type": "File", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "expression": { + "type": "CallExpression", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "callee": { + "type": "FunctionExpression", + "start": 1, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "id": { + "type": "Identifier", + "start": 10, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "eval" + }, + "name": "eval" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 18, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 18, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + }, + "extra": { + "parenthesized": true, + "parenStart": 0 + } + }, + "arguments": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/489/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/489/options.json deleted file mode 100644 index 59ccf8eb8209..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/489/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'arguments' in strict mode (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/489/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/489/output.json new file mode 100644 index 000000000000..d3b5c3628386 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/489/output.json @@ -0,0 +1,161 @@ +{ + "type": "File", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "errors": [ + "SyntaxError: Binding 'arguments' in strict mode (1:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "expression": { + "type": "CallExpression", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "callee": { + "type": "FunctionExpression", + "start": 1, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "id": { + "type": "Identifier", + "start": 10, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 19 + }, + "identifierName": "arguments" + }, + "name": "arguments" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 22, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 23, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 23, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + }, + "extra": { + "parenthesized": true, + "parenStart": 0 + } + }, + "arguments": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/490/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/490/options.json deleted file mode 100644 index e95a2d7f7535..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/490/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:47)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/490/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/490/output.json new file mode 100644 index 000000000000..d0eb8e29b2a1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/490/output.json @@ -0,0 +1,250 @@ +{ + "type": "File", + "start": 0, + "end": 63, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 63 + } + }, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:47)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 63, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 63 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 63, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 63 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 63, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 63 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 32, + "end": 61, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 61 + } + }, + "expression": { + "type": "ObjectExpression", + "start": 33, + "end": 59, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 59 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 35, + "end": 57, + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 57 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 35, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 36 + }, + "identifierName": "s" + }, + "name": "s" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "FunctionExpression", + "start": 38, + "end": 57, + "loc": { + "start": { + "line": 1, + "column": 38 + }, + "end": { + "line": 1, + "column": 57 + } + }, + "id": { + "type": "Identifier", + "start": 47, + "end": 51, + "loc": { + "start": { + "line": 1, + "column": 47 + }, + "end": { + "line": 1, + "column": 51 + }, + "identifierName": "eval" + }, + "name": "eval" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 54, + "end": 57, + "loc": { + "start": { + "line": 1, + "column": 54 + }, + "end": { + "line": 1, + "column": 57 + } + }, + "body": [], + "directives": [] + } + } + } + ], + "extra": { + "parenthesized": true, + "parenStart": 32 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 18, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 18, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/491/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/491/options.json deleted file mode 100644 index e29c7aee6091..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/491/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'package' in strict mode (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/491/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/491/output.json new file mode 100644 index 000000000000..d6510094936e --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/491/output.json @@ -0,0 +1,161 @@ +{ + "type": "File", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "errors": [ + "SyntaxError: Binding 'package' in strict mode (1:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "expression": { + "type": "CallExpression", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "callee": { + "type": "FunctionExpression", + "start": 1, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "id": { + "type": "Identifier", + "start": 10, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 17 + }, + "identifierName": "package" + }, + "name": "package" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 20, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 21, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 21, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + }, + "extra": { + "parenthesized": true, + "parenStart": 0 + } + }, + "arguments": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/492/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/492/options.json deleted file mode 100644 index 43dc5662e1e5..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/492/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:48)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/492/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/492/output.json new file mode 100644 index 000000000000..98e096877880 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/492/output.json @@ -0,0 +1,292 @@ +{ + "type": "File", + "start": 0, + "end": 63, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 63 + } + }, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:48)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 63, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 63 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 63, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 63 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 63, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 63 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 32, + "end": 61, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 61 + } + }, + "expression": { + "type": "ObjectExpression", + "start": 33, + "end": 59, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 59 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 35, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 35, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 36 + }, + "identifierName": "i" + }, + "name": "i" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "NumericLiteral", + "start": 38, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 38 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "extra": { + "rawValue": 10, + "raw": "10" + }, + "value": 10 + } + }, + { + "type": "ObjectMethod", + "start": 42, + "end": 57, + "loc": { + "start": { + "line": 1, + "column": 42 + }, + "end": { + "line": 1, + "column": 57 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 46, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 46 + }, + "end": { + "line": 1, + "column": 47 + }, + "identifierName": "s" + }, + "name": "s" + }, + "computed": false, + "kind": "set", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 48, + "end": 52, + "loc": { + "start": { + "line": 1, + "column": 48 + }, + "end": { + "line": 1, + "column": 52 + }, + "identifierName": "eval" + }, + "name": "eval" + } + ], + "body": { + "type": "BlockStatement", + "start": 54, + "end": 57, + "loc": { + "start": { + "line": 1, + "column": 54 + }, + "end": { + "line": 1, + "column": 57 + } + }, + "body": [], + "directives": [] + } + } + ], + "extra": { + "parenthesized": true, + "parenStart": 32 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 18, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 18, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/493/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/493/options.json deleted file mode 100644 index 439ffff53e89..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/493/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:41)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/493/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/493/output.json new file mode 100644 index 000000000000..f974d83f5a98 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/493/output.json @@ -0,0 +1,237 @@ +{ + "type": "File", + "start": 0, + "end": 56, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 56 + } + }, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:41)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 56, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 56 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 56, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 56 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 56, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 56 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 32, + "end": 54, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 54 + } + }, + "expression": { + "type": "ObjectExpression", + "start": 33, + "end": 52, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 52 + } + }, + "properties": [ + { + "type": "ObjectMethod", + "start": 35, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 50 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 39, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 39 + }, + "end": { + "line": 1, + "column": 40 + }, + "identifierName": "s" + }, + "name": "s" + }, + "computed": false, + "kind": "set", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 41, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 41 + }, + "end": { + "line": 1, + "column": 45 + }, + "identifierName": "eval" + }, + "name": "eval" + } + ], + "body": { + "type": "BlockStatement", + "start": 47, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 47 + }, + "end": { + "line": 1, + "column": 50 + } + }, + "body": [], + "directives": [] + } + } + ], + "extra": { + "parenthesized": true, + "parenStart": 32 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 18, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 18, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/494/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/494/options.json deleted file mode 100644 index 8b18a4ec3e5a..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/494/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:49)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/494/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/494/output.json new file mode 100644 index 000000000000..2993cf648835 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/494/output.json @@ -0,0 +1,268 @@ +{ + "type": "File", + "start": 0, + "end": 64, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 64 + } + }, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:49)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 64, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 64 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 64, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 64 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 64, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 64 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 32, + "end": 62, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 62 + } + }, + "expression": { + "type": "ObjectExpression", + "start": 33, + "end": 60, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 60 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 35, + "end": 58, + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 58 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 35, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 36 + }, + "identifierName": "s" + }, + "name": "s" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "FunctionExpression", + "start": 38, + "end": 58, + "loc": { + "start": { + "line": 1, + "column": 38 + }, + "end": { + "line": 1, + "column": 58 + } + }, + "id": { + "type": "Identifier", + "start": 47, + "end": 48, + "loc": { + "start": { + "line": 1, + "column": 47 + }, + "end": { + "line": 1, + "column": 48 + }, + "identifierName": "s" + }, + "name": "s" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 49, + "end": 53, + "loc": { + "start": { + "line": 1, + "column": 49 + }, + "end": { + "line": 1, + "column": 53 + }, + "identifierName": "eval" + }, + "name": "eval" + } + ], + "body": { + "type": "BlockStatement", + "start": 55, + "end": 58, + "loc": { + "start": { + "line": 1, + "column": 55 + }, + "end": { + "line": 1, + "column": 58 + } + }, + "body": [], + "directives": [] + } + } + } + ], + "extra": { + "parenthesized": true, + "parenStart": 32 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 18, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 18, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/495/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/495/options.json deleted file mode 100644 index 794c4864d4e5..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/495/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:15)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/495/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/495/output.json new file mode 100644 index 000000000000..4534376b270a --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/495/output.json @@ -0,0 +1,144 @@ +{ + "type": "File", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:15)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 15, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 19 + }, + "identifierName": "eval" + }, + "name": "eval" + } + ], + "body": { + "type": "BlockStatement", + "start": 21, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 22, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 22, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/496/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/496/options.json deleted file mode 100644 index 212d35fcb5fe..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/496/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'arguments' in strict mode (1:15)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/496/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/496/output.json new file mode 100644 index 000000000000..cb41c2783446 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/496/output.json @@ -0,0 +1,144 @@ +{ + "type": "File", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "errors": [ + "SyntaxError: Binding 'arguments' in strict mode (1:15)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 15, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 24 + }, + "identifierName": "arguments" + }, + "name": "arguments" + } + ], + "body": { + "type": "BlockStatement", + "start": 26, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 27, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 27, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/497/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/497/options.json deleted file mode 100644 index 43dc5662e1e5..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/497/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:48)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/497/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/497/output.json new file mode 100644 index 000000000000..d8df2c1c2d07 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/497/output.json @@ -0,0 +1,197 @@ +{ + "type": "File", + "start": 0, + "end": 58, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 58 + } + }, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:48)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 58, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 58 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 58, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 58 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 58, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 58 + } + }, + "body": [ + { + "type": "FunctionDeclaration", + "start": 33, + "end": 56, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 56 + } + }, + "id": { + "type": "Identifier", + "start": 42, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 42 + }, + "end": { + "line": 1, + "column": 47 + }, + "identifierName": "inner" + }, + "name": "inner" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 48, + "end": 52, + "loc": { + "start": { + "line": 1, + "column": 48 + }, + "end": { + "line": 1, + "column": 52 + }, + "identifierName": "eval" + }, + "name": "eval" + } + ], + "body": { + "type": "BlockStatement", + "start": 54, + "end": 56, + "loc": { + "start": { + "line": 1, + "column": 54 + }, + "end": { + "line": 1, + "column": 56 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 19, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 19, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/498/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/498/options.json deleted file mode 100644 index 8370ba5c765f..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/498/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'arguments' in strict mode (1:48)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/498/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/498/output.json new file mode 100644 index 000000000000..a2fc6cb4db0e --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/498/output.json @@ -0,0 +1,197 @@ +{ + "type": "File", + "start": 0, + "end": 63, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 63 + } + }, + "errors": [ + "SyntaxError: Binding 'arguments' in strict mode (1:48)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 63, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 63 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 63, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 63 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 63, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 63 + } + }, + "body": [ + { + "type": "FunctionDeclaration", + "start": 33, + "end": 61, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 61 + } + }, + "id": { + "type": "Identifier", + "start": 42, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 42 + }, + "end": { + "line": 1, + "column": 47 + }, + "identifierName": "inner" + }, + "name": "inner" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 48, + "end": 57, + "loc": { + "start": { + "line": 1, + "column": 48 + }, + "end": { + "line": 1, + "column": 57 + }, + "identifierName": "arguments" + }, + "name": "arguments" + } + ], + "body": { + "type": "BlockStatement", + "start": 59, + "end": 61, + "loc": { + "start": { + "line": 1, + "column": 59 + }, + "end": { + "line": 1, + "column": 61 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 19, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 19, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/499/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/499/options.json deleted file mode 100644 index ae2bfab55c68..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/499/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Octal literal in strict mode (1:35)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/499/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/499/output.json new file mode 100644 index 000000000000..1504ace4ac5d --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/499/output.json @@ -0,0 +1,162 @@ +{ + "type": "File", + "start": 0, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "errors": [ + "SyntaxError: Octal literal in strict mode (1:35)", + "SyntaxError: Octal literal in strict mode (1:35)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 19, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 19, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + }, + { + "type": "Directive", + "start": 33, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 33, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "value": "\\1", + "extra": { + "raw": "\"\\1\"", + "rawValue": "\\1" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/500/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/500/options.json deleted file mode 100644 index 45ca229c1e8e..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/500/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Legacy octal literals are not allowed in strict mode (1:33)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/500/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/500/output.json new file mode 100644 index 000000000000..805c176e7856 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/500/output.json @@ -0,0 +1,163 @@ +{ + "type": "File", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "errors": [ + "SyntaxError: Legacy octal literals are not allowed in strict mode (1:33)", + "SyntaxError: Legacy octal literals are not allowed in strict mode (1:33)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 33, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 33, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "extra": { + "rawValue": 17, + "raw": "021" + }, + "value": 17 + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 19, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 19, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/501/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/501/options.json deleted file mode 100644 index 7e50b5f9165e..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/501/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Octal literal in strict mode (1:38)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/501/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/501/output.json new file mode 100644 index 000000000000..f73cb42cd9cf --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/501/output.json @@ -0,0 +1,221 @@ +{ + "type": "File", + "start": 0, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 50 + } + }, + "errors": [ + "SyntaxError: Octal literal in strict mode (1:38)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 50 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 50 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 50 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 33, + "end": 48, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 48 + } + }, + "expression": { + "type": "ObjectExpression", + "start": 34, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 36, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 44 + } + }, + "method": false, + "key": { + "type": "StringLiteral", + "start": 36, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "extra": { + "rawValue": "\u0001", + "raw": "\"\\1\"" + }, + "value": "\u0001" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "NumericLiteral", + "start": 42, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 42 + }, + "end": { + "line": 1, + "column": 44 + } + }, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + ], + "extra": { + "parenthesized": true, + "parenStart": 33 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 19, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 19, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/502/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/502/options.json deleted file mode 100644 index 8f6c8218f747..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/502/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Legacy octal literals are not allowed in strict mode (1:36)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/502/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/502/output.json new file mode 100644 index 000000000000..5eb3bcef0b18 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/502/output.json @@ -0,0 +1,221 @@ +{ + "type": "File", + "start": 0, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 49 + } + }, + "errors": [ + "SyntaxError: Legacy octal literals are not allowed in strict mode (1:36)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 49 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 49 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 49 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 33, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 47 + } + }, + "expression": { + "type": "ObjectExpression", + "start": 34, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 45 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 36, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "method": false, + "key": { + "type": "NumericLiteral", + "start": 36, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "extra": { + "rawValue": 17, + "raw": "021" + }, + "value": 17 + }, + "computed": false, + "shorthand": false, + "value": { + "type": "NumericLiteral", + "start": 41, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 41 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + ], + "extra": { + "parenthesized": true, + "parenStart": 33 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 19, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 19, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/503/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/503/options.json deleted file mode 100644 index 8389b2c726ca..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/503/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Octal literal in strict mode (1:69)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/503/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/503/output.json new file mode 100644 index 000000000000..e52fa38ccf73 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/503/output.json @@ -0,0 +1,215 @@ +{ + "type": "File", + "start": 0, + "end": 76, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 76 + } + }, + "errors": [ + "SyntaxError: Octal literal in strict mode (1:69)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 76, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 76 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 76, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 76 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 76, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 76 + } + }, + "body": [ + { + "type": "FunctionDeclaration", + "start": 33, + "end": 74, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 74 + } + }, + "id": { + "type": "Identifier", + "start": 42, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 42 + }, + "end": { + "line": 1, + "column": 47 + }, + "identifierName": "inner" + }, + "name": "inner" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 50, + "end": 74, + "loc": { + "start": { + "line": 1, + "column": 50 + }, + "end": { + "line": 1, + "column": 74 + } + }, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 52, + "end": 72, + "loc": { + "start": { + "line": 1, + "column": 52 + }, + "end": { + "line": 1, + "column": 72 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 52, + "end": 71, + "loc": { + "start": { + "line": 1, + "column": 52 + }, + "end": { + "line": 1, + "column": 71 + } + }, + "value": "octal directive\\1", + "extra": { + "raw": "\"octal directive\\1\"", + "rawValue": "octal directive\\1" + } + } + } + ] + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 19, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 19, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/504/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/504/options.json deleted file mode 100644 index 0641de45e29a..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/504/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected reserved word 'implements' (1:37)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/504/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/504/output.json new file mode 100644 index 000000000000..2201ea3de8c6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/504/output.json @@ -0,0 +1,178 @@ +{ + "type": "File", + "start": 0, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 50 + } + }, + "errors": [ + "SyntaxError: Unexpected reserved word 'implements' (1:37)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 50 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 50 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 50 + } + }, + "body": [ + { + "type": "VariableDeclaration", + "start": 33, + "end": 48, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 48 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 37, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 47 + } + }, + "id": { + "type": "Identifier", + "start": 37, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 47 + }, + "identifierName": "implements" + }, + "name": "implements" + }, + "init": null + } + ], + "kind": "var" + } + ], + "directives": [ + { + "type": "Directive", + "start": 19, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 19, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/505/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/505/options.json deleted file mode 100644 index 859238d0423f..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/505/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected reserved word 'interface' (1:37)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/505/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/505/output.json new file mode 100644 index 000000000000..be76deabc7a1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/505/output.json @@ -0,0 +1,178 @@ +{ + "type": "File", + "start": 0, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 49 + } + }, + "errors": [ + "SyntaxError: Unexpected reserved word 'interface' (1:37)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 49 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 49 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 49 + } + }, + "body": [ + { + "type": "VariableDeclaration", + "start": 33, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 47 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 37, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "id": { + "type": "Identifier", + "start": 37, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 46 + }, + "identifierName": "interface" + }, + "name": "interface" + }, + "init": null + } + ], + "kind": "var" + } + ], + "directives": [ + { + "type": "Directive", + "start": 19, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 19, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/506/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/506/options.json deleted file mode 100644 index 344c7075f4bf..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/506/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected reserved word 'package' (1:37)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/506/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/506/output.json new file mode 100644 index 000000000000..414e229fac38 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/506/output.json @@ -0,0 +1,178 @@ +{ + "type": "File", + "start": 0, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 47 + } + }, + "errors": [ + "SyntaxError: Unexpected reserved word 'package' (1:37)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 47 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 47 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 47 + } + }, + "body": [ + { + "type": "VariableDeclaration", + "start": 33, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 45 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 37, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 44 + } + }, + "id": { + "type": "Identifier", + "start": 37, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 44 + }, + "identifierName": "package" + }, + "name": "package" + }, + "init": null + } + ], + "kind": "var" + } + ], + "directives": [ + { + "type": "Directive", + "start": 19, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 19, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/507/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/507/options.json deleted file mode 100644 index 9fb9deaf9cba..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/507/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected reserved word 'private' (1:37)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/507/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/507/output.json new file mode 100644 index 000000000000..32efcd46a632 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/507/output.json @@ -0,0 +1,178 @@ +{ + "type": "File", + "start": 0, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 47 + } + }, + "errors": [ + "SyntaxError: Unexpected reserved word 'private' (1:37)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 47 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 47 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 47 + } + }, + "body": [ + { + "type": "VariableDeclaration", + "start": 33, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 45 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 37, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 44 + } + }, + "id": { + "type": "Identifier", + "start": 37, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 44 + }, + "identifierName": "private" + }, + "name": "private" + }, + "init": null + } + ], + "kind": "var" + } + ], + "directives": [ + { + "type": "Directive", + "start": 19, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 19, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/508/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/508/options.json deleted file mode 100644 index 292fb56f1cf3..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/508/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected reserved word 'protected' (1:37)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/508/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/508/output.json new file mode 100644 index 000000000000..e3d3f255c253 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/508/output.json @@ -0,0 +1,178 @@ +{ + "type": "File", + "start": 0, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 49 + } + }, + "errors": [ + "SyntaxError: Unexpected reserved word 'protected' (1:37)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 49 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 49 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 49 + } + }, + "body": [ + { + "type": "VariableDeclaration", + "start": 33, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 47 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 37, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "id": { + "type": "Identifier", + "start": 37, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 46 + }, + "identifierName": "protected" + }, + "name": "protected" + }, + "init": null + } + ], + "kind": "var" + } + ], + "directives": [ + { + "type": "Directive", + "start": 19, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 19, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/509/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/509/options.json deleted file mode 100644 index d5f48446906a..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/509/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected reserved word 'public' (1:37)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/509/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/509/output.json new file mode 100644 index 000000000000..2e801038c78d --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/509/output.json @@ -0,0 +1,178 @@ +{ + "type": "File", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "errors": [ + "SyntaxError: Unexpected reserved word 'public' (1:37)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "body": [ + { + "type": "VariableDeclaration", + "start": 33, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 44 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 37, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "id": { + "type": "Identifier", + "start": 37, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 43 + }, + "identifierName": "public" + }, + "name": "public" + }, + "init": null + } + ], + "kind": "var" + } + ], + "directives": [ + { + "type": "Directive", + "start": 19, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 19, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/510/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/510/options.json deleted file mode 100644 index 0f41ff2e6f24..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/510/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected reserved word 'static' (1:37)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/510/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/510/output.json new file mode 100644 index 000000000000..4ed420518d6d --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/510/output.json @@ -0,0 +1,178 @@ +{ + "type": "File", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "errors": [ + "SyntaxError: Unexpected reserved word 'static' (1:37)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "body": [ + { + "type": "VariableDeclaration", + "start": 33, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 44 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 37, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "id": { + "type": "Identifier", + "start": 37, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 43 + }, + "identifierName": "static" + }, + "name": "static" + }, + "init": null + } + ], + "kind": "var" + } + ], + "directives": [ + { + "type": "Directive", + "start": 19, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 19, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/511/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/511/options.json deleted file mode 100644 index 78c799ec6a49..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/511/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'static' in strict mode (1:15)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/511/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/511/output.json new file mode 100644 index 000000000000..ab669586dc27 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/511/output.json @@ -0,0 +1,144 @@ +{ + "type": "File", + "start": 0, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "errors": [ + "SyntaxError: Binding 'static' in strict mode (1:15)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 15, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 21 + }, + "identifierName": "static" + }, + "name": "static" + } + ], + "body": { + "type": "BlockStatement", + "start": 23, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 25, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 25, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/512/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/512/options.json deleted file mode 100644 index d4a2d92e5b45..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/512/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'static' in strict mode (1:9)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/512/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/512/output.json new file mode 100644 index 000000000000..be76a2099b54 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/512/output.json @@ -0,0 +1,126 @@ +{ + "type": "File", + "start": 0, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "errors": [ + "SyntaxError: Binding 'static' in strict mode (1:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 15 + }, + "identifierName": "static" + }, + "name": "static" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 18, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 20, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 20, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/513/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/513/options.json deleted file mode 100644 index 91bc36d3f360..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/513/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected reserved word 'static' (1:23)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/513/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/513/output.json new file mode 100644 index 000000000000..c249f39209bf --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/513/output.json @@ -0,0 +1,126 @@ +{ + "type": "File", + "start": 0, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "errors": [ + "SyntaxError: Unexpected reserved word 'static' (1:23)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 14, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "id": { + "type": "Identifier", + "start": 23, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 29 + }, + "identifierName": "static" + }, + "name": "static" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 32, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/514/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/514/options.json deleted file mode 100644 index 8b20b9a7df36..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/514/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Argument name clash (1:14)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/514/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/514/output.json new file mode 100644 index 000000000000..f945eeb57491 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/514/output.json @@ -0,0 +1,161 @@ +{ + "type": "File", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "errors": [ + "SyntaxError: Argument name clash (1:14)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "a" + }, + "name": "a" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 11, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "t" + }, + "name": "t" + }, + { + "type": "Identifier", + "start": 14, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + }, + "identifierName": "t" + }, + "name": "t" + } + ], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 19, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 19, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/515/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/515/options.json deleted file mode 100644 index 85fd3822f433..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/515/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:11)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/515/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/515/output.json new file mode 100644 index 000000000000..f2ff5d38de33 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/515/output.json @@ -0,0 +1,144 @@ +{ + "type": "File", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:11)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "a" + }, + "name": "a" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 11, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 15 + }, + "identifierName": "eval" + }, + "name": "eval" + } + ], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 19, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 19, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/516/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/516/options.json deleted file mode 100644 index 604b5896c2c5..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/516/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'package' in strict mode (1:11)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/516/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/516/output.json new file mode 100644 index 000000000000..2f734055a47a --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/516/output.json @@ -0,0 +1,144 @@ +{ + "type": "File", + "start": 0, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "errors": [ + "SyntaxError: Binding 'package' in strict mode (1:11)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "a" + }, + "name": "a" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 11, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 18 + }, + "identifierName": "package" + }, + "name": "package" + } + ], + "body": { + "type": "BlockStatement", + "start": 20, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 22, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 22, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/517/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/517/options.json deleted file mode 100644 index 9d2a58081596..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/517/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Argument name clash (1:43)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/517/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/517/output.json new file mode 100644 index 000000000000..60ac3ce8c98c --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/517/output.json @@ -0,0 +1,229 @@ +{ + "type": "File", + "start": 0, + "end": 52, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 52 + } + }, + "errors": [ + "SyntaxError: Argument name clash (1:43)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 52, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 52 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 52, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 52 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "a" + }, + "name": "a" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 13, + "end": 52, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 52 + } + }, + "body": [ + { + "type": "FunctionDeclaration", + "start": 29, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 49 + } + }, + "id": { + "type": "Identifier", + "start": 38, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 38 + }, + "end": { + "line": 1, + "column": 39 + }, + "identifierName": "b" + }, + "name": "b" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 40, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 40 + }, + "end": { + "line": 1, + "column": 41 + }, + "identifierName": "t" + }, + "name": "t" + }, + { + "type": "Identifier", + "start": 43, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 43 + }, + "end": { + "line": 1, + "column": 44 + }, + "identifierName": "t" + }, + "name": "t" + } + ], + "body": { + "type": "BlockStatement", + "start": 46, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 46 + }, + "end": { + "line": 1, + "column": 49 + } + }, + "body": [], + "directives": [] + } + }, + { + "type": "EmptyStatement", + "start": 49, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 49 + }, + "end": { + "line": 1, + "column": 50 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 15, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 15, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/518/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/518/options.json deleted file mode 100644 index 61c3bbb5abe0..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/518/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Argument name clash (1:15)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/518/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/518/output.json new file mode 100644 index 000000000000..766ec14c5a33 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/518/output.json @@ -0,0 +1,180 @@ +{ + "type": "File", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "errors": [ + "SyntaxError: Argument name clash (1:15)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "expression": { + "type": "FunctionExpression", + "start": 1, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "id": { + "type": "Identifier", + "start": 10, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + }, + "identifierName": "a" + }, + "name": "a" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 12, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + }, + "identifierName": "t" + }, + "name": "t" + }, + { + "type": "Identifier", + "start": 15, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + }, + "identifierName": "t" + }, + "name": "t" + } + ], + "body": { + "type": "BlockStatement", + "start": 18, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 20, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 20, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + }, + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/519/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/519/options.json deleted file mode 100644 index ae469fbd59da..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/519/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Argument name clash (1:44)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/519/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/519/output.json new file mode 100644 index 000000000000..0f2e3c5dce01 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/519/output.json @@ -0,0 +1,233 @@ +{ + "type": "File", + "start": 0, + "end": 54, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 54 + } + }, + "errors": [ + "SyntaxError: Argument name clash (1:44)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 54, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 54 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 54, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 54 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "a" + }, + "name": "a" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 13, + "end": 54, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 54 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 29, + "end": 52, + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 52 + } + }, + "expression": { + "type": "FunctionExpression", + "start": 30, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 50 + } + }, + "id": { + "type": "Identifier", + "start": 39, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 39 + }, + "end": { + "line": 1, + "column": 40 + }, + "identifierName": "b" + }, + "name": "b" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 41, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 41 + }, + "end": { + "line": 1, + "column": 42 + }, + "identifierName": "t" + }, + "name": "t" + }, + { + "type": "Identifier", + "start": 44, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 44 + }, + "end": { + "line": 1, + "column": 45 + }, + "identifierName": "t" + }, + "name": "t" + } + ], + "body": { + "type": "BlockStatement", + "start": 47, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 47 + }, + "end": { + "line": 1, + "column": 50 + } + }, + "body": [], + "directives": [] + }, + "extra": { + "parenthesized": true, + "parenStart": 29 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 15, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 15, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/520/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/520/options.json deleted file mode 100644 index b60957f217a4..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/520/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:12)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/520/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/520/output.json new file mode 100644 index 000000000000..7945e482ca86 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/520/output.json @@ -0,0 +1,163 @@ +{ + "type": "File", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:12)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "expression": { + "type": "FunctionExpression", + "start": 1, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "id": { + "type": "Identifier", + "start": 10, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + }, + "identifierName": "a" + }, + "name": "a" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 12, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 16 + }, + "identifierName": "eval" + }, + "name": "eval" + } + ], + "body": { + "type": "BlockStatement", + "start": 18, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 20, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 20, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + }, + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/521/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/521/options.json deleted file mode 100644 index 62075401e782..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/521/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'package' in strict mode (1:12)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/521/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/521/output.json new file mode 100644 index 000000000000..304b4237e9e7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/521/output.json @@ -0,0 +1,163 @@ +{ + "type": "File", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "errors": [ + "SyntaxError: Binding 'package' in strict mode (1:12)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "expression": { + "type": "FunctionExpression", + "start": 1, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "id": { + "type": "Identifier", + "start": 10, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + }, + "identifierName": "a" + }, + "name": "a" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 12, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 19 + }, + "identifierName": "package" + }, + "name": "package" + } + ], + "body": { + "type": "BlockStatement", + "start": 21, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 23, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 23, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + }, + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/522/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/522/options.json deleted file mode 100644 index 0b443b9bacfa..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/522/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Legacy octal literals are not allowed in strict mode (1:65)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/522/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/522/output.json new file mode 100644 index 000000000000..98d2e052715b --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/522/output.json @@ -0,0 +1,285 @@ +{ + "type": "File", + "start": 0, + "end": 69, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 69 + } + }, + "errors": [ + "SyntaxError: Legacy octal literals are not allowed in strict mode (1:65)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 69, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 69 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 13, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 42 + } + }, + "id": { + "type": "Identifier", + "start": 22, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 25 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 27, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 42 + } + }, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 28, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 28, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + }, + { + "type": "FunctionDeclaration", + "start": 42, + "end": 69, + "loc": { + "start": { + "line": 1, + "column": 42 + }, + "end": { + "line": 1, + "column": 69 + } + }, + "id": { + "type": "Identifier", + "start": 51, + "end": 54, + "loc": { + "start": { + "line": 1, + "column": 51 + }, + "end": { + "line": 1, + "column": 54 + }, + "identifierName": "bar" + }, + "name": "bar" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 56, + "end": 69, + "loc": { + "start": { + "line": 1, + "column": 56 + }, + "end": { + "line": 1, + "column": 69 + } + }, + "body": [ + { + "type": "VariableDeclaration", + "start": 57, + "end": 68, + "loc": { + "start": { + "line": 1, + "column": 57 + }, + "end": { + "line": 1, + "column": 68 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 61, + "end": 68, + "loc": { + "start": { + "line": 1, + "column": 61 + }, + "end": { + "line": 1, + "column": 68 + } + }, + "id": { + "type": "Identifier", + "start": 61, + "end": 62, + "loc": { + "start": { + "line": 1, + "column": 61 + }, + "end": { + "line": 1, + "column": 62 + }, + "identifierName": "v" + }, + "name": "v" + }, + "init": { + "type": "NumericLiteral", + "start": 65, + "end": 68, + "loc": { + "start": { + "line": 1, + "column": 65 + }, + "end": { + "line": 1, + "column": 68 + } + }, + "extra": { + "rawValue": 13, + "raw": "015" + }, + "value": 13 + } + } + ], + "kind": "var" + } + ], + "directives": [] + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/523/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/523/options.json deleted file mode 100644 index 60a9d5934bd2..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/523/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected keyword 'this' (1:4)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/523/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/523/output.json new file mode 100644 index 000000000000..90808a26c8be --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/523/output.json @@ -0,0 +1,108 @@ +{ + "type": "File", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "errors": [ + "SyntaxError: Unexpected keyword 'this' (1:4)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "id": { + "type": "Identifier", + "start": 4, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 8 + }, + "identifierName": "this" + }, + "name": "this" + }, + "init": { + "type": "NumericLiteral", + "start": 11, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "extra": { + "rawValue": 10, + "raw": "10" + }, + "value": 10 + } + } + ], + "kind": "var" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/524/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/524/options.json deleted file mode 100644 index d07b41872ba6..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/524/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Illegal newline after throw (1:5)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/524/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/524/output.json new file mode 100644 index 000000000000..55552e2994ca --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/524/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 3 + } + }, + "errors": [ + "SyntaxError: Illegal newline after throw (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 3 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ThrowStatement", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 3 + } + }, + "argument": { + "type": "NumericLiteral", + "start": 6, + "end": 8, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 2 + } + }, + "extra": { + "rawValue": 10, + "raw": "10" + }, + "value": 10 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/544/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/544/options.json deleted file mode 100644 index 37c243afff2a..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/544/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected reserved word 'public' (2:8)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/544/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/544/output.json new file mode 100644 index 000000000000..d3b1ca7ae09c --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/544/output.json @@ -0,0 +1,212 @@ +{ + "type": "File", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 25 + } + }, + "errors": [ + "SyntaxError: Unexpected reserved word 'public' (2:8)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 25 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 14, + "end": 39, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 25 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 20, + "end": 38, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 24 + } + }, + "id": { + "type": "ObjectPattern", + "start": 20, + "end": 30, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 22, + "end": 28, + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 22, + "end": 28, + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 14 + }, + "identifierName": "public" + }, + "name": "public" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start": 22, + "end": 28, + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 14 + }, + "identifierName": "public" + }, + "name": "public" + }, + "extra": { + "shorthand": true + } + } + ] + }, + "init": { + "type": "CallExpression", + "start": 33, + "end": 38, + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 24 + } + }, + "callee": { + "type": "Identifier", + "start": 33, + "end": 36, + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 22 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "arguments": [] + } + } + ], + "kind": "const" + } + ], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/545/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/545/options.json index b09fdddc9d0a..54925950e059 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/545/options.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/545/options.json @@ -1,4 +1,3 @@ { - "sourceType": "module", - "throws": "Unexpected reserved word 'public' (1:8)" -} + "sourceType": "module" +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/545/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/545/output.json new file mode 100644 index 000000000000..34af0a196c39 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/545/output.json @@ -0,0 +1,176 @@ +{ + "type": "File", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "errors": [ + "SyntaxError: Unexpected reserved word 'public' (1:8)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 6, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "id": { + "type": "ObjectPattern", + "start": 6, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 8, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 8, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "public" + }, + "name": "public" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start": 8, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "public" + }, + "name": "public" + }, + "extra": { + "shorthand": true + } + } + ] + }, + "init": { + "type": "CallExpression", + "start": 19, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "callee": { + "type": "Identifier", + "start": 19, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 22 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "arguments": [] + } + } + ], + "kind": "const" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/547/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/547/options.json deleted file mode 100644 index c2fb6377e80d..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/547/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected reserved word 'arguments' (2:8)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/547/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/547/output.json new file mode 100644 index 000000000000..39ef331a20b1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/547/output.json @@ -0,0 +1,213 @@ +{ + "type": "File", + "start": 0, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 28 + } + }, + "errors": [ + "SyntaxError: Unexpected reserved word 'arguments' (2:8)", + "SyntaxError: Binding 'arguments' in strict mode (2:8)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 28 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 14, + "end": 42, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 28 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 20, + "end": 41, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 27 + } + }, + "id": { + "type": "ObjectPattern", + "start": 20, + "end": 33, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 22, + "end": 31, + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 17 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 22, + "end": 31, + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 17 + }, + "identifierName": "arguments" + }, + "name": "arguments" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start": 22, + "end": 31, + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 17 + }, + "identifierName": "arguments" + }, + "name": "arguments" + }, + "extra": { + "shorthand": true + } + } + ] + }, + "init": { + "type": "CallExpression", + "start": 36, + "end": 41, + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 27 + } + }, + "callee": { + "type": "Identifier", + "start": 36, + "end": 39, + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 25 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "arguments": [] + } + } + ], + "kind": "const" + } + ], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/548/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/548/options.json index 4183c2e22534..54925950e059 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/548/options.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/548/options.json @@ -1,4 +1,3 @@ { - "sourceType": "module", - "throws": "Unexpected reserved word 'arguments' (1:8)" -} + "sourceType": "module" +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/548/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/548/output.json new file mode 100644 index 000000000000..132483692bbd --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/548/output.json @@ -0,0 +1,177 @@ +{ + "type": "File", + "start": 0, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "errors": [ + "SyntaxError: Unexpected reserved word 'arguments' (1:8)", + "SyntaxError: Binding 'arguments' in strict mode (1:8)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 6, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "id": { + "type": "ObjectPattern", + "start": 6, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 8, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 8, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 17 + }, + "identifierName": "arguments" + }, + "name": "arguments" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start": 8, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 17 + }, + "identifierName": "arguments" + }, + "name": "arguments" + }, + "extra": { + "shorthand": true + } + } + ] + }, + "init": { + "type": "CallExpression", + "start": 22, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "callee": { + "type": "Identifier", + "start": 22, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 25 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "arguments": [] + } + } + ], + "kind": "const" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/550/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/550/options.json deleted file mode 100644 index 5cee88d901e4..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/550/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Legacy octal literals are not allowed in strict mode (2:10)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/550/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/550/output.json new file mode 100644 index 000000000000..9b383cded8fd --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/550/output.json @@ -0,0 +1,144 @@ +{ + "type": "File", + "start": 0, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 13 + } + }, + "errors": [ + "SyntaxError: Legacy octal literals are not allowed in strict mode (2:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 13 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 14, + "end": 27, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 13 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 20, + "end": 26, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 12 + } + }, + "id": { + "type": "Identifier", + "start": 20, + "end": 21, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 7 + }, + "identifierName": "a" + }, + "name": "a" + }, + "init": { + "type": "NumericLiteral", + "start": 24, + "end": 26, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 12 + } + }, + "extra": { + "rawValue": 7, + "raw": "07" + }, + "value": 7 + } + } + ], + "kind": "const" + } + ], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/552/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/552/options.json deleted file mode 100644 index 5cee88d901e4..000000000000 --- a/packages/babel-parser/test/fixtures/core/uncategorised/552/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Legacy octal literals are not allowed in strict mode (2:10)" -} diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/552/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/552/output.json new file mode 100644 index 000000000000..a7d3e10860a2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/552/output.json @@ -0,0 +1,144 @@ +{ + "type": "File", + "start": 0, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 13 + } + }, + "errors": [ + "SyntaxError: Legacy octal literals are not allowed in strict mode (2:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 13 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 14, + "end": 27, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 13 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 20, + "end": 26, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 12 + } + }, + "id": { + "type": "Identifier", + "start": 20, + "end": 21, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 7 + }, + "identifierName": "a" + }, + "name": "a" + }, + "init": { + "type": "NumericLiteral", + "start": 24, + "end": 26, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 12 + } + }, + "extra": { + "rawValue": 8, + "raw": "08" + }, + "value": 8 + } + } + ], + "kind": "const" + } + ], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/556/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/556/options.json index eff49cbfba64..6d24025b8674 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/556/options.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/556/options.json @@ -1,4 +1,3 @@ { - "createParenthesizedExpressions": true, - "throws": "You're trying to assign to a parenthesized expression, eg. instead of `({a}) = 0` use `({a} = 0)` (1:1)" -} + "createParenthesizedExpressions": true +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/556/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/556/output.json new file mode 100644 index 000000000000..448578186a0a --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/556/output.json @@ -0,0 +1,228 @@ +{ + "type": "File", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "errors": [ + "SyntaxError: You're trying to assign to a parenthesized expression, eg. instead of `({a}) = 0` use `({a} = 0)` (1:1)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "operator": "=", + "left": { + "type": "ParenthesizedExpression", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "expression": { + "type": "ObjectPattern", + "start": 1, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 2, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 2, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + }, + "identifierName": "x" + }, + "name": "x" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start": 2, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + }, + "identifierName": "x" + }, + "name": "x" + }, + "extra": { + "shorthand": true + } + } + ] + } + }, + "right": { + "type": "ObjectExpression", + "start": 8, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 9, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "x" + }, + "name": "x" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "NumericLiteral", + "start": 12, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/558/options.json b/packages/babel-parser/test/fixtures/core/uncategorised/558/options.json index f37c4bc95c57..6d24025b8674 100644 --- a/packages/babel-parser/test/fixtures/core/uncategorised/558/options.json +++ b/packages/babel-parser/test/fixtures/core/uncategorised/558/options.json @@ -1,4 +1,3 @@ { - "createParenthesizedExpressions": true, - "throws": "You're trying to assign to a parenthesized expression, eg. instead of `([a]) = 0` use `([a] = 0)` (1:1)" -} + "createParenthesizedExpressions": true +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/core/uncategorised/558/output.json b/packages/babel-parser/test/fixtures/core/uncategorised/558/output.json new file mode 100644 index 000000000000..e2a0d2a8ba52 --- /dev/null +++ b/packages/babel-parser/test/fixtures/core/uncategorised/558/output.json @@ -0,0 +1,134 @@ +{ + "type": "File", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "errors": [ + "SyntaxError: You're trying to assign to a parenthesized expression, eg. instead of `([a]) = 0` use `([a] = 0)` (1:1)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "operator": "=", + "left": { + "type": "ParenthesizedExpression", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "expression": { + "type": "ArrayPattern", + "start": 1, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "elements": [ + { + "type": "Identifier", + "start": 2, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + }, + "identifierName": "a" + }, + "name": "a" + } + ] + } + }, + "right": { + "type": "ArrayExpression", + "start": 8, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "elements": [] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/array-rest-spread/comma-after-rest/options.json b/packages/babel-parser/test/fixtures/es2015/array-rest-spread/comma-after-rest/options.json deleted file mode 100644 index 7931fd924fcd..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/array-rest-spread/comma-after-rest/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected trailing comma after rest element (1:5)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/array-rest-spread/comma-after-rest/output.json b/packages/babel-parser/test/fixtures/es2015/array-rest-spread/comma-after-rest/output.json new file mode 100644 index 000000000000..3d5c2a07c806 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/array-rest-spread/comma-after-rest/output.json @@ -0,0 +1,137 @@ +{ + "type": "File", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "errors": [ + "SyntaxError: Unexpected trailing comma after rest element (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "operator": "=", + "left": { + "type": "ArrayPattern", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "extra": { + "trailingComma": 5 + }, + "elements": [ + { + "type": "RestElement", + "start": 1, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "argument": { + "type": "Identifier", + "start": 4, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "a" + }, + "name": "a" + } + } + ] + }, + "right": { + "type": "ArrayExpression", + "start": 10, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "elements": [] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/array-rest-spread/comma-after-spread-for-in/options.json b/packages/babel-parser/test/fixtures/es2015/array-rest-spread/comma-after-spread-for-in/options.json deleted file mode 100644 index 0b0d3c532d1e..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/array-rest-spread/comma-after-spread-for-in/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected trailing comma after rest element (1:10)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/array-rest-spread/comma-after-spread-for-in/output.json b/packages/babel-parser/test/fixtures/es2015/array-rest-spread/comma-after-spread-for-in/output.json new file mode 100644 index 000000000000..f97d7f0db889 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/array-rest-spread/comma-after-spread-for-in/output.json @@ -0,0 +1,136 @@ +{ + "type": "File", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "errors": [ + "SyntaxError: Unexpected trailing comma after rest element (1:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ForInStatement", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "left": { + "type": "ArrayPattern", + "start": 5, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "extra": { + "trailingComma": 10 + }, + "elements": [ + { + "type": "RestElement", + "start": 6, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "argument": { + "type": "Identifier", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "a" + }, + "name": "a" + } + } + ] + }, + "right": { + "type": "ArrayExpression", + "start": 16, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "elements": [] + }, + "body": { + "type": "EmptyStatement", + "start": 19, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/array-rest-spread/comma-after-spread-nested/options.json b/packages/babel-parser/test/fixtures/es2015/array-rest-spread/comma-after-spread-nested/options.json deleted file mode 100644 index 95a846d785a8..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/array-rest-spread/comma-after-spread-nested/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected trailing comma after rest element (1:6)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/array-rest-spread/comma-after-spread-nested/output.json b/packages/babel-parser/test/fixtures/es2015/array-rest-spread/comma-after-spread-nested/output.json new file mode 100644 index 000000000000..4cbc33abae7e --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/array-rest-spread/comma-after-spread-nested/output.json @@ -0,0 +1,154 @@ +{ + "type": "File", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "errors": [ + "SyntaxError: Unexpected trailing comma after rest element (1:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "operator": "=", + "left": { + "type": "ArrayPattern", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "elements": [ + { + "type": "ArrayPattern", + "start": 1, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "trailingComma": 6 + }, + "elements": [ + { + "type": "RestElement", + "start": 2, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "argument": { + "type": "Identifier", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "a" + }, + "name": "a" + } + } + ] + } + ] + }, + "right": { + "type": "ArrayExpression", + "start": 12, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "elements": [] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/arrow-functions/comma-after-rest-param/options.json b/packages/babel-parser/test/fixtures/es2015/arrow-functions/comma-after-rest-param/options.json index 38fec89ef15c..5ed0b104c003 100644 --- a/packages/babel-parser/test/fixtures/es2015/arrow-functions/comma-after-rest-param/options.json +++ b/packages/babel-parser/test/fixtures/es2015/arrow-functions/comma-after-rest-param/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected trailing comma after rest element (1:8)" -} + "throws": "Unexpected token, expected \")\" (1:8)" +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/class-methods/direct-super-in-object-method/options.json b/packages/babel-parser/test/fixtures/es2015/class-methods/direct-super-in-object-method/options.json deleted file mode 100644 index 660e644cf6a5..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/class-methods/direct-super-in-object-method/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "super is only allowed in object methods and classes (4:13)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/class-methods/direct-super-in-object-method/output.json b/packages/babel-parser/test/fixtures/es2015/class-methods/direct-super-in-object-method/output.json new file mode 100644 index 000000000000..6a343317ea61 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/class-methods/direct-super-in-object-method/output.json @@ -0,0 +1,340 @@ +{ + "type": "File", + "start": 0, + "end": 87, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 7, + "column": 3 + } + }, + "errors": [ + "SyntaxError: super is only allowed in object methods and classes (4:13)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 87, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 7, + "column": 3 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 87, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 7, + "column": 3 + } + }, + "expression": { + "type": "CallExpression", + "start": 0, + "end": 86, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 7, + "column": 2 + } + }, + "callee": { + "type": "MemberExpression", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "object": { + "type": "Identifier", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "Object" + }, + "name": "Object" + }, + "property": { + "type": "Identifier", + "start": 7, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 13 + }, + "identifierName": "create" + }, + "name": "create" + }, + "computed": false + }, + "arguments": [ + { + "type": "ObjectExpression", + "start": 14, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "properties": [] + }, + { + "type": "ObjectExpression", + "start": 18, + "end": 85, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 7, + "column": 1 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 22, + "end": 83, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 6, + "column": 3 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 22, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 5 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "ObjectExpression", + "start": 27, + "end": 83, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 6, + "column": 3 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 33, + "end": 79, + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 5, + "column": 5 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 33, + "end": 36, + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 7 + }, + "identifierName": "get" + }, + "name": "get" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "FunctionExpression", + "start": 38, + "end": 79, + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 5, + "column": 5 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 48, + "end": 79, + "loc": { + "start": { + "line": 3, + "column": 19 + }, + "end": { + "line": 5, + "column": 5 + } + }, + "body": [ + { + "type": "ReturnStatement", + "start": 56, + "end": 73, + "loc": { + "start": { + "line": 4, + "column": 6 + }, + "end": { + "line": 4, + "column": 23 + } + }, + "argument": { + "type": "MemberExpression", + "start": 63, + "end": 72, + "loc": { + "start": { + "line": 4, + "column": 13 + }, + "end": { + "line": 4, + "column": 22 + } + }, + "object": { + "type": "Super", + "start": 63, + "end": 68, + "loc": { + "start": { + "line": 4, + "column": 13 + }, + "end": { + "line": 4, + "column": 18 + } + } + }, + "property": { + "type": "Identifier", + "start": 69, + "end": 72, + "loc": { + "start": { + "line": 4, + "column": 19 + }, + "end": { + "line": 4, + "column": 22 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "computed": false + } + } + ], + "directives": [] + } + } + } + ] + } + } + ] + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/class-methods/direct-super-outside-constructor/options.json b/packages/babel-parser/test/fixtures/es2015/class-methods/direct-super-outside-constructor/options.json deleted file mode 100644 index 9461325c423a..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/class-methods/direct-super-outside-constructor/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "super() is only valid inside a class constructor of a subclass. Maybe a typo in the method name ('constructor') or not extending another class? (2:8)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/class-methods/direct-super-outside-constructor/output.json b/packages/babel-parser/test/fixtures/es2015/class-methods/direct-super-outside-constructor/output.json new file mode 100644 index 000000000000..65fe6001d2c6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/class-methods/direct-super-outside-constructor/output.json @@ -0,0 +1,191 @@ +{ + "type": "File", + "start": 0, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: super() is only valid inside a class constructor of a subclass. Maybe a typo in the method name ('constructor') or not extending another class? (2:8)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ClassMethod", + "start": 12, + "end": 26, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "static": false, + "key": { + "type": "Identifier", + "start": 12, + "end": 13, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 3 + }, + "identifierName": "x" + }, + "name": "x" + }, + "computed": false, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 26, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 18, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "expression": { + "type": "CallExpression", + "start": 18, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "callee": { + "type": "Super", + "start": 18, + "end": 23, + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 13 + } + } + }, + "arguments": [] + } + } + ], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/class-methods/disallow-duplicate-method-params/options.json b/packages/babel-parser/test/fixtures/es2015/class-methods/disallow-duplicate-method-params/options.json deleted file mode 100644 index a848b7de671a..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/class-methods/disallow-duplicate-method-params/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Argument name clash (2:11)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/class-methods/disallow-duplicate-method-params/output.json b/packages/babel-parser/test/fixtures/es2015/class-methods/disallow-duplicate-method-params/output.json new file mode 100644 index 000000000000..328e55a13f5d --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/class-methods/disallow-duplicate-method-params/output.json @@ -0,0 +1,179 @@ +{ + "type": "File", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Argument name clash (2:11)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + }, + "identifierName": "Foo" + }, + "name": "Foo" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 10, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ClassMethod", + "start": 16, + "end": 28, + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "static": false, + "key": { + "type": "Identifier", + "start": 16, + "end": 19, + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 7 + }, + "identifierName": "bar" + }, + "name": "bar" + }, + "computed": false, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 20, + "end": 21, + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 9 + }, + "identifierName": "a" + }, + "name": "a" + }, + { + "type": "Identifier", + "start": 23, + "end": 24, + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 12 + }, + "identifierName": "a" + }, + "name": "a" + } + ], + "body": { + "type": "BlockStatement", + "start": 26, + "end": 28, + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/class-methods/disallow-static-generator-prototype/options.json b/packages/babel-parser/test/fixtures/es2015/class-methods/disallow-static-generator-prototype/options.json deleted file mode 100644 index 524ed587e113..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/class-methods/disallow-static-generator-prototype/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Classes may not have static property named prototype (2:10)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/class-methods/disallow-static-generator-prototype/output.json b/packages/babel-parser/test/fixtures/es2015/class-methods/disallow-static-generator-prototype/output.json new file mode 100644 index 000000000000..0ffcd2fd0520 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/class-methods/disallow-static-generator-prototype/output.json @@ -0,0 +1,144 @@ +{ + "type": "File", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Classes may not have static property named prototype (2:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ClassMethod", + "start": 12, + "end": 34, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 24 + } + }, + "static": true, + "kind": "method", + "key": { + "type": "Identifier", + "start": 20, + "end": 29, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 19 + }, + "identifierName": "prototype" + }, + "name": "prototype" + }, + "computed": false, + "id": null, + "generator": true, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 32, + "end": 34, + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 24 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/class-methods/disallow-static-prototype/options.json b/packages/babel-parser/test/fixtures/es2015/class-methods/disallow-static-prototype/options.json deleted file mode 100644 index f30c8a49abd3..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/class-methods/disallow-static-prototype/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Classes may not have static property named prototype (2:9)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/class-methods/disallow-static-prototype/output.json b/packages/babel-parser/test/fixtures/es2015/class-methods/disallow-static-prototype/output.json new file mode 100644 index 000000000000..f78f786f6aa9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/class-methods/disallow-static-prototype/output.json @@ -0,0 +1,144 @@ +{ + "type": "File", + "start": 0, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Classes may not have static property named prototype (2:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ClassMethod", + "start": 12, + "end": 33, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 23 + } + }, + "static": true, + "key": { + "type": "Identifier", + "start": 19, + "end": 28, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 18 + }, + "identifierName": "prototype" + }, + "name": "prototype" + }, + "computed": false, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 31, + "end": 33, + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 23 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/class-methods/getter-signature/options.json b/packages/babel-parser/test/fixtures/es2015/class-methods/getter-signature/options.json deleted file mode 100644 index 65bc24a66fcd..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/class-methods/getter-signature/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "getter must not have any formal parameters (2:2)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/class-methods/getter-signature/output.json b/packages/babel-parser/test/fixtures/es2015/class-methods/getter-signature/output.json new file mode 100644 index 000000000000..1f5262e935f3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/class-methods/getter-signature/output.json @@ -0,0 +1,162 @@ +{ + "type": "File", + "start": 0, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: getter must not have any formal parameters (2:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ClassMethod", + "start": 12, + "end": 29, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "static": false, + "key": { + "type": "Identifier", + "start": 16, + "end": 20, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 10 + }, + "identifierName": "prop" + }, + "name": "prop" + }, + "computed": false, + "kind": "get", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 22, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 15 + }, + "identifierName": "arg" + }, + "name": "arg" + } + ], + "body": { + "type": "BlockStatement", + "start": 27, + "end": 29, + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/class-methods/malformed-super-expression/options.json b/packages/babel-parser/test/fixtures/es2015/class-methods/malformed-super-expression/options.json deleted file mode 100644 index dc41f0b14b5a..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/class-methods/malformed-super-expression/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected token (3:10)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/class-methods/malformed-super-expression/output.json b/packages/babel-parser/test/fixtures/es2015/class-methods/malformed-super-expression/output.json new file mode 100644 index 000000000000..6ecafb90e3ab --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/class-methods/malformed-super-expression/output.json @@ -0,0 +1,211 @@ +{ + "type": "File", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "errors": [ + "SyntaxError: super can only be used with function calls (i.e. super()) or in property accesses (i.e. super.prop or super[prop]) (3:4)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "body": [ + { + "type": "ClassMethod", + "start": 12, + "end": 37, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 4, + "column": 3 + } + }, + "static": false, + "key": { + "type": "Identifier", + "start": 12, + "end": 13, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 3 + }, + "identifierName": "x" + }, + "name": "x" + }, + "computed": false, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 37, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 4, + "column": 3 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 23, + "end": 33, + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 14 + } + }, + "expression": { + "type": "BinaryExpression", + "start": 23, + "end": 32, + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 13 + } + }, + "left": { + "type": "Super", + "start": 23, + "end": 28, + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 9 + } + } + }, + "operator": "-", + "right": { + "type": "NumericLiteral", + "start": 31, + "end": 32, + "loc": { + "start": { + "line": 3, + "column": 12 + }, + "end": { + "line": 3, + "column": 13 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + } + ], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/class/extends-strict/options.json b/packages/babel-parser/test/fixtures/es2015/class/extends-strict/options.json deleted file mode 100644 index 09a1c52e4354..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/class/extends-strict/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "'with' in strict mode (2:2)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/class/extends-strict/output.json b/packages/babel-parser/test/fixtures/es2015/class/extends-strict/output.json new file mode 100644 index 000000000000..efd21a8e7118 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/class/extends-strict/output.json @@ -0,0 +1,237 @@ +{ + "type": "File", + "start": 0, + "end": 64, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 7 + } + }, + "errors": [ + "SyntaxError: 'with' in strict mode (2:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 64, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 7 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 64, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 7 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "C" + }, + "name": "C" + }, + "superClass": { + "type": "CallExpression", + "start": 17, + "end": 60, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 4, + "column": 3 + } + }, + "callee": { + "type": "FunctionExpression", + "start": 17, + "end": 58, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 26, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 27 + }, + "identifierName": "B" + }, + "name": "B" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 30, + "end": 58, + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "WithStatement", + "start": 34, + "end": 44, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 12 + } + }, + "object": { + "type": "ObjectExpression", + "start": 40, + "end": 42, + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 10 + } + }, + "properties": [] + }, + "body": { + "type": "EmptyStatement", + "start": 43, + "end": 44, + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 12 + } + } + } + }, + { + "type": "ReturnStatement", + "start": 47, + "end": 56, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 11 + } + }, + "argument": { + "type": "Identifier", + "start": 54, + "end": 55, + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 10 + }, + "identifierName": "B" + }, + "name": "B" + } + } + ], + "directives": [] + } + }, + "arguments": [], + "extra": { + "parenthesized": true, + "parenStart": 16 + } + }, + "body": { + "type": "ClassBody", + "start": 62, + "end": 64, + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 7 + } + }, + "body": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/destructuring/binding-this/input.js b/packages/babel-parser/test/fixtures/es2015/destructuring/binding-this/input.js index 11cebfa18894..42403a50ea26 100644 --- a/packages/babel-parser/test/fixtures/es2015/destructuring/binding-this/input.js +++ b/packages/babel-parser/test/fixtures/es2015/destructuring/binding-this/input.js @@ -1 +1 @@ -var { this }; +var { this } = {}; diff --git a/packages/babel-parser/test/fixtures/es2015/destructuring/binding-this/options.json b/packages/babel-parser/test/fixtures/es2015/destructuring/binding-this/options.json deleted file mode 100644 index 1b54b61689e7..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/destructuring/binding-this/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected keyword 'this' (1:6)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/destructuring/binding-this/output.json b/packages/babel-parser/test/fixtures/es2015/destructuring/binding-this/output.json new file mode 100644 index 000000000000..7d830d569103 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/destructuring/binding-this/output.json @@ -0,0 +1,159 @@ +{ + "type": "File", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "errors": [ + "SyntaxError: Unexpected keyword 'this' (1:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "id": { + "type": "ObjectPattern", + "start": 4, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 6, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 6, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "this" + }, + "name": "this" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start": 6, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "this" + }, + "name": "this" + }, + "extra": { + "shorthand": true + } + } + ] + }, + "init": { + "type": "ObjectExpression", + "start": 15, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "properties": [] + } + } + ], + "kind": "var" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/destructuring/error-operator-for-default/options.json b/packages/babel-parser/test/fixtures/es2015/destructuring/error-operator-for-default/options.json deleted file mode 100644 index f52857170baa..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/destructuring/error-operator-for-default/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Only '=' operator can be used for specifying default value. (1:3)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/destructuring/error-operator-for-default/output.json b/packages/babel-parser/test/fixtures/es2015/destructuring/error-operator-for-default/output.json new file mode 100644 index 000000000000..5a29fd6b5f7b --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/destructuring/error-operator-for-default/output.json @@ -0,0 +1,156 @@ +{ + "type": "File", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "errors": [ + "SyntaxError: Only '=' operator can be used for specifying default value. (1:3)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 1, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "operator": "=", + "left": { + "type": "ArrayPattern", + "start": 1, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "elements": [ + { + "type": "AssignmentPattern", + "start": 2, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "left": { + "type": "Identifier", + "start": 2, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + }, + "identifierName": "a" + }, + "name": "a" + }, + "right": { + "type": "Identifier", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + }, + "identifierName": "a" + }, + "name": "a" + } + } + ] + }, + "right": { + "type": "Identifier", + "start": 12, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + }, + "identifierName": "a" + }, + "name": "a" + }, + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/destructuring/parenthesized-lhs-array/options.json b/packages/babel-parser/test/fixtures/es2015/destructuring/parenthesized-lhs-array/options.json deleted file mode 100644 index dfcad1b5cbf0..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/destructuring/parenthesized-lhs-array/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "You're trying to assign to a parenthesized expression, eg. instead of `([a]) = 0` use `([a] = 0)` (1:1)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/destructuring/parenthesized-lhs-array/output.json b/packages/babel-parser/test/fixtures/es2015/destructuring/parenthesized-lhs-array/output.json new file mode 100644 index 000000000000..111c55cd65bd --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/destructuring/parenthesized-lhs-array/output.json @@ -0,0 +1,127 @@ +{ + "type": "File", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "errors": [ + "SyntaxError: You're trying to assign to a parenthesized expression, eg. instead of `([a]) = 0` use `([a] = 0)` (1:1)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "operator": "=", + "left": { + "type": "ArrayPattern", + "start": 1, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "elements": [ + { + "type": "Identifier", + "start": 2, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + }, + "identifierName": "a" + }, + "name": "a" + } + ], + "extra": { + "parenthesized": true, + "parenStart": 0 + } + }, + "right": { + "type": "NumericLiteral", + "start": 8, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "extra": { + "rawValue": 2, + "raw": "2" + }, + "value": 2 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/destructuring/parenthesized-lhs-object/options.json b/packages/babel-parser/test/fixtures/es2015/destructuring/parenthesized-lhs-object/options.json deleted file mode 100644 index d0fb48924093..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/destructuring/parenthesized-lhs-object/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "You're trying to assign to a parenthesized expression, eg. instead of `({a}) = 0` use `({a} = 0)` (1:1)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/destructuring/parenthesized-lhs-object/output.json b/packages/babel-parser/test/fixtures/es2015/destructuring/parenthesized-lhs-object/output.json new file mode 100644 index 000000000000..34adca287e3e --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/destructuring/parenthesized-lhs-object/output.json @@ -0,0 +1,165 @@ +{ + "type": "File", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "errors": [ + "SyntaxError: You're trying to assign to a parenthesized expression, eg. instead of `({a}) = 0` use `({a} = 0)` (1:1)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "operator": "=", + "left": { + "type": "ObjectPattern", + "start": 1, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 2, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 2, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + }, + "identifierName": "a" + }, + "name": "a" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start": 2, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + }, + "identifierName": "a" + }, + "name": "a" + }, + "extra": { + "shorthand": true + } + } + ], + "extra": { + "parenthesized": true, + "parenStart": 0 + } + }, + "right": { + "type": "NumericLiteral", + "start": 8, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "extra": { + "rawValue": 2, + "raw": "2" + }, + "value": 2 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/for-in/bare-initializer/options.json b/packages/babel-parser/test/fixtures/es2015/for-in/bare-initializer/options.json deleted file mode 100644 index 2a64fa7c20ad..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/for-in/bare-initializer/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in for-loop (2:5)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/for-in/bare-initializer/output.json b/packages/babel-parser/test/fixtures/es2015/for-in/bare-initializer/output.json new file mode 100644 index 000000000000..bde13b8bdbda --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/for-in/bare-initializer/output.json @@ -0,0 +1,187 @@ +{ + "type": "File", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "errors": [ + "SyntaxError: Invalid left-hand side in for-loop (2:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "id": { + "type": "Identifier", + "start": 4, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "a" + }, + "name": "a" + }, + "init": null + } + ], + "kind": "var" + }, + { + "type": "ForInStatement", + "start": 7, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "left": { + "type": "AssignmentPattern", + "start": 12, + "end": 17, + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + }, + "left": { + "type": "Identifier", + "start": 12, + "end": 13, + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 6 + }, + "identifierName": "a" + }, + "name": "a" + }, + "right": { + "type": "NumericLiteral", + "start": 16, + "end": 17, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 10 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + }, + "right": { + "type": "ObjectExpression", + "start": 21, + "end": 23, + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "properties": [] + }, + "body": { + "type": "EmptyStatement", + "start": 24, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 18 + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/for-in/const-initializer/options.json b/packages/babel-parser/test/fixtures/es2015/for-in/const-initializer/options.json deleted file mode 100644 index 68677faac9b9..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/for-in/const-initializer/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "for-in loop variable declaration may not have an initializer (1:5)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/for-in/const-initializer/output.json b/packages/babel-parser/test/fixtures/es2015/for-in/const-initializer/output.json new file mode 100644 index 000000000000..b85f54f50027 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/for-in/const-initializer/output.json @@ -0,0 +1,154 @@ +{ + "type": "File", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "errors": [ + "SyntaxError: for-in loop variable declaration may not have an initializer (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ForInStatement", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "left": { + "type": "VariableDeclaration", + "start": 5, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 11, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "id": { + "type": "Identifier", + "start": 11, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "a" + }, + "name": "a" + }, + "init": { + "type": "NumericLiteral", + "start": 15, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + } + ], + "kind": "const" + }, + "right": { + "type": "ObjectExpression", + "start": 20, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "properties": [] + }, + "body": { + "type": "EmptyStatement", + "start": 23, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/for-in/let-initializer/options.json b/packages/babel-parser/test/fixtures/es2015/for-in/let-initializer/options.json deleted file mode 100644 index 68677faac9b9..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/for-in/let-initializer/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "for-in loop variable declaration may not have an initializer (1:5)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/for-in/let-initializer/output.json b/packages/babel-parser/test/fixtures/es2015/for-in/let-initializer/output.json new file mode 100644 index 000000000000..d890ea49e1da --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/for-in/let-initializer/output.json @@ -0,0 +1,154 @@ +{ + "type": "File", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "errors": [ + "SyntaxError: for-in loop variable declaration may not have an initializer (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ForInStatement", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "left": { + "type": "VariableDeclaration", + "start": 5, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "a" + }, + "name": "a" + }, + "init": { + "type": "NumericLiteral", + "start": 13, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + } + ], + "kind": "let" + }, + "right": { + "type": "ObjectExpression", + "start": 18, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "properties": [] + }, + "body": { + "type": "EmptyStatement", + "start": 21, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/for-in/strict-initializer/options.json b/packages/babel-parser/test/fixtures/es2015/for-in/strict-initializer/options.json deleted file mode 100644 index 1fa21b020d65..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/for-in/strict-initializer/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "for-in loop variable declaration may not have an initializer (2:5)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/for-in/strict-initializer/output.json b/packages/babel-parser/test/fixtures/es2015/for-in/strict-initializer/output.json new file mode 100644 index 000000000000..556eea44650d --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/for-in/strict-initializer/output.json @@ -0,0 +1,190 @@ +{ + "type": "File", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "errors": [ + "SyntaxError: for-in loop variable declaration may not have an initializer (2:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ForInStatement", + "start": 14, + "end": 36, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "left": { + "type": "VariableDeclaration", + "start": 19, + "end": 28, + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 23, + "end": 28, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "id": { + "type": "Identifier", + "start": 23, + "end": 24, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 10 + }, + "identifierName": "a" + }, + "name": "a" + }, + "init": { + "type": "NumericLiteral", + "start": 27, + "end": 28, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + } + ], + "kind": "var" + }, + "right": { + "type": "ObjectExpression", + "start": 32, + "end": 34, + "loc": { + "start": { + "line": 2, + "column": 18 + }, + "end": { + "line": 2, + "column": 20 + } + }, + "properties": [] + }, + "body": { + "type": "EmptyStatement", + "start": 35, + "end": 36, + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 22 + } + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/for-in/var-arraybindingpattern-initializer/options.json b/packages/babel-parser/test/fixtures/es2015/for-in/var-arraybindingpattern-initializer/options.json deleted file mode 100644 index 68677faac9b9..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/for-in/var-arraybindingpattern-initializer/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "for-in loop variable declaration may not have an initializer (1:5)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/for-in/var-arraybindingpattern-initializer/output.json b/packages/babel-parser/test/fixtures/es2015/for-in/var-arraybindingpattern-initializer/output.json new file mode 100644 index 000000000000..fbffb7c6994a --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/for-in/var-arraybindingpattern-initializer/output.json @@ -0,0 +1,171 @@ +{ + "type": "File", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "errors": [ + "SyntaxError: for-in loop variable declaration may not have an initializer (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ForInStatement", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "left": { + "type": "VariableDeclaration", + "start": 5, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 9, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "id": { + "type": "ArrayPattern", + "start": 9, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "elements": [ + { + "type": "Identifier", + "start": 10, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + }, + "identifierName": "a" + }, + "name": "a" + } + ] + }, + "init": { + "type": "NumericLiteral", + "start": 15, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + } + ], + "kind": "var" + }, + "right": { + "type": "ObjectExpression", + "start": 20, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "properties": [] + }, + "body": { + "type": "EmptyStatement", + "start": 23, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/for-in/var-objectbindingpattern-initializer/options.json b/packages/babel-parser/test/fixtures/es2015/for-in/var-objectbindingpattern-initializer/options.json deleted file mode 100644 index 68677faac9b9..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/for-in/var-objectbindingpattern-initializer/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "for-in loop variable declaration may not have an initializer (1:5)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/for-in/var-objectbindingpattern-initializer/output.json b/packages/babel-parser/test/fixtures/es2015/for-in/var-objectbindingpattern-initializer/output.json new file mode 100644 index 000000000000..0afdc7b4d271 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/for-in/var-objectbindingpattern-initializer/output.json @@ -0,0 +1,209 @@ +{ + "type": "File", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "errors": [ + "SyntaxError: for-in loop variable declaration may not have an initializer (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ForInStatement", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "left": { + "type": "VariableDeclaration", + "start": 5, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 9, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "id": { + "type": "ObjectPattern", + "start": 9, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 10, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 10, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + }, + "identifierName": "a" + }, + "name": "a" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start": 10, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + }, + "identifierName": "a" + }, + "name": "a" + }, + "extra": { + "shorthand": true + } + } + ] + }, + "init": { + "type": "NumericLiteral", + "start": 15, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + } + ], + "kind": "var" + }, + "right": { + "type": "ObjectExpression", + "start": 20, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "properties": [] + }, + "body": { + "type": "EmptyStatement", + "start": 23, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/for-of/bare-initializer/options.json b/packages/babel-parser/test/fixtures/es2015/for-of/bare-initializer/options.json deleted file mode 100644 index 2a64fa7c20ad..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/for-of/bare-initializer/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in for-loop (2:5)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/for-of/bare-initializer/output.json b/packages/babel-parser/test/fixtures/es2015/for-of/bare-initializer/output.json new file mode 100644 index 000000000000..936a7b0183e3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/for-of/bare-initializer/output.json @@ -0,0 +1,188 @@ +{ + "type": "File", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "errors": [ + "SyntaxError: Invalid left-hand side in for-loop (2:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "id": { + "type": "Identifier", + "start": 4, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "a" + }, + "name": "a" + }, + "init": null + } + ], + "kind": "var" + }, + { + "type": "ForOfStatement", + "start": 7, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "await": false, + "left": { + "type": "AssignmentPattern", + "start": 12, + "end": 17, + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + }, + "left": { + "type": "Identifier", + "start": 12, + "end": 13, + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 6 + }, + "identifierName": "a" + }, + "name": "a" + }, + "right": { + "type": "NumericLiteral", + "start": 16, + "end": 17, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 10 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + }, + "right": { + "type": "ObjectExpression", + "start": 21, + "end": 23, + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "properties": [] + }, + "body": { + "type": "EmptyStatement", + "start": 24, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 18 + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/generators/invalid-escape-yield/input.js b/packages/babel-parser/test/fixtures/es2015/generators/invalid-escape-yield/input.js index 521b91facbbc..8a89e37a1275 100644 --- a/packages/babel-parser/test/fixtures/es2015/generators/invalid-escape-yield/input.js +++ b/packages/babel-parser/test/fixtures/es2015/generators/invalid-escape-yield/input.js @@ -1 +1 @@ -(function* () { y\u0069eld 10 }) +(function* () { y\u0069eld; }) diff --git a/packages/babel-parser/test/fixtures/es2015/generators/invalid-escape-yield/options.json b/packages/babel-parser/test/fixtures/es2015/generators/invalid-escape-yield/options.json deleted file mode 100644 index 67305b830e87..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/generators/invalid-escape-yield/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Can not use 'yield' as identifier inside a generator (1:16)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/generators/invalid-escape-yield/output.json b/packages/babel-parser/test/fixtures/es2015/generators/invalid-escape-yield/output.json new file mode 100644 index 000000000000..6d1a2d6c3fce --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/generators/invalid-escape-yield/output.json @@ -0,0 +1,126 @@ +{ + "type": "File", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "errors": [ + "SyntaxError: Can not use 'yield' as identifier inside a generator (1:16)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "expression": { + "type": "FunctionExpression", + "start": 1, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "id": null, + "generator": true, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 14, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 16, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "expression": { + "type": "Identifier", + "start": 16, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 26 + }, + "identifierName": "yield" + }, + "name": "yield" + } + } + ], + "directives": [] + }, + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/generators/invalid-hanging/options.json b/packages/babel-parser/test/fixtures/es2015/generators/invalid-hanging/options.json deleted file mode 100644 index 8cdac51705a1..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/generators/invalid-hanging/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Generators can only be declared at the top level or inside a block (1:16)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/generators/invalid-hanging/output.json b/packages/babel-parser/test/fixtures/es2015/generators/invalid-hanging/output.json new file mode 100644 index 000000000000..0059c885f4d8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/generators/invalid-hanging/output.json @@ -0,0 +1,126 @@ +{ + "type": "File", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "errors": [ + "SyntaxError: Generators can only be declared at the top level or inside a block (1:16)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "IfStatement", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "test": { + "type": "NumericLiteral", + "start": 4, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + }, + "consequent": { + "type": "FunctionDeclaration", + "start": 7, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "id": { + "type": "Identifier", + "start": 17, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 20 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "generator": true, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 23, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "body": [], + "directives": [] + } + }, + "alternate": null + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-const/input.js b/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-const/input.js index 7db67c0d2dc7..3ec83f02b2f4 100644 --- a/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-const/input.js +++ b/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-const/input.js @@ -1 +1,3 @@ var co\u{6e}st = 123; + +co\u{6e}st x = 2; diff --git a/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-const/options.json b/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-const/options.json deleted file mode 100644 index d6c0b22e3090..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-const/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Escape sequence in keyword const (1:14)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-const/output.json b/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-const/output.json new file mode 100644 index 000000000000..f5d632c23ace --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-const/output.json @@ -0,0 +1,180 @@ +{ + "type": "File", + "start": 0, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 17 + } + }, + "errors": [ + "SyntaxError: Unexpected keyword 'const' (1:4)", + "SyntaxError: Escape sequence in keyword const (1:4)", + "SyntaxError: Escape sequence in keyword const (3:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 17 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "id": { + "type": "Identifier", + "start": 4, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "const" + }, + "name": "const" + }, + "init": { + "type": "NumericLiteral", + "start": 17, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "extra": { + "rawValue": 123, + "raw": "123" + }, + "value": 123 + } + } + ], + "kind": "var" + }, + { + "type": "VariableDeclaration", + "start": 23, + "end": 40, + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 17 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 34, + "end": 39, + "loc": { + "start": { + "line": 3, + "column": 11 + }, + "end": { + "line": 3, + "column": 16 + } + }, + "id": { + "type": "Identifier", + "start": 34, + "end": 35, + "loc": { + "start": { + "line": 3, + "column": 11 + }, + "end": { + "line": 3, + "column": 12 + }, + "identifierName": "x" + }, + "name": "x" + }, + "init": { + "type": "NumericLiteral", + "start": 38, + "end": 39, + "loc": { + "start": { + "line": 3, + "column": 15 + }, + "end": { + "line": 3, + "column": 16 + } + }, + "extra": { + "rawValue": 2, + "raw": "2" + }, + "value": 2 + } + } + ], + "kind": "const" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-export/input.js b/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-export/input.js index 2c49151ea912..c9bc4e4c28d9 100644 --- a/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-export/input.js +++ b/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-export/input.js @@ -1 +1,4 @@ var expor\u{74} = 123; + +var x; +expor\u{74} { x }; diff --git a/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-export/options.json b/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-export/options.json index 80870219d5cc..54925950e059 100644 --- a/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-export/options.json +++ b/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-export/options.json @@ -1,3 +1,3 @@ { - "throws": "Escape sequence in keyword export (1:15)" -} + "sourceType": "module" +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-export/output.json b/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-export/output.json new file mode 100644 index 000000000000..236b7dc15afa --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-export/output.json @@ -0,0 +1,229 @@ +{ + "type": "File", + "start": 0, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 18 + } + }, + "errors": [ + "SyntaxError: Unexpected keyword 'export' (1:4)", + "SyntaxError: Escape sequence in keyword export (1:4)", + "SyntaxError: Escape sequence in keyword export (4:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 18 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "id": { + "type": "Identifier", + "start": 4, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 15 + }, + "identifierName": "export" + }, + "name": "export" + }, + "init": { + "type": "NumericLiteral", + "start": 18, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "extra": { + "rawValue": 123, + "raw": "123" + }, + "value": 123 + } + } + ], + "kind": "var" + }, + { + "type": "VariableDeclaration", + "start": 24, + "end": 30, + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 6 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 28, + "end": 29, + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 5 + } + }, + "id": { + "type": "Identifier", + "start": 28, + "end": 29, + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 5 + }, + "identifierName": "x" + }, + "name": "x" + }, + "init": null + } + ], + "kind": "var" + }, + { + "type": "ExportNamedDeclaration", + "start": 31, + "end": 49, + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 18 + } + }, + "specifiers": [ + { + "type": "ExportSpecifier", + "start": 45, + "end": 46, + "loc": { + "start": { + "line": 4, + "column": 14 + }, + "end": { + "line": 4, + "column": 15 + } + }, + "local": { + "type": "Identifier", + "start": 45, + "end": 46, + "loc": { + "start": { + "line": 4, + "column": 14 + }, + "end": { + "line": 4, + "column": 15 + }, + "identifierName": "x" + }, + "name": "x" + }, + "exported": { + "type": "Identifier", + "start": 45, + "end": 46, + "loc": { + "start": { + "line": 4, + "column": 14 + }, + "end": { + "line": 4, + "column": 15 + }, + "identifierName": "x" + }, + "name": "x" + } + } + ], + "source": null, + "declaration": null + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-if/options.json b/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-if/options.json deleted file mode 100644 index 52faf91d3656..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-if/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Escape sequence in keyword if (1:12)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-if/output.json b/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-if/output.json new file mode 100644 index 000000000000..d95df678e8c4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-if/output.json @@ -0,0 +1,87 @@ +{ + "type": "File", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "errors": [ + "SyntaxError: Escape sequence in keyword if (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "IfStatement", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "test": { + "type": "BooleanLiteral", + "start": 14, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "value": true + }, + "consequent": { + "type": "BlockStatement", + "start": 20, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "body": [], + "directives": [] + }, + "alternate": null + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-import/input.js b/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-import/input.js index f23c79e20fb1..df174d0e56d1 100644 --- a/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-import/input.js +++ b/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-import/input.js @@ -1 +1,3 @@ var \u{69}\u{6d}\u{70}\u{6f}\u{72}\u{74} = 123; + +\u{69}\u{6d}\u{70}\u{6f}\u{72}\u{74} "x"; diff --git a/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-import/options.json b/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-import/options.json index 45763ffa389b..54925950e059 100644 --- a/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-import/options.json +++ b/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-import/options.json @@ -1,3 +1,3 @@ { - "throws": "Escape sequence in keyword import (1:40)" -} + "sourceType": "module" +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-import/output.json b/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-import/output.json new file mode 100644 index 000000000000..8842ac412ce6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-import/output.json @@ -0,0 +1,146 @@ +{ + "type": "File", + "start": 0, + "end": 90, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 41 + } + }, + "errors": [ + "SyntaxError: Unexpected keyword 'import' (1:4)", + "SyntaxError: Escape sequence in keyword import (1:4)", + "SyntaxError: Escape sequence in keyword import (3:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 90, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 41 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 47 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "id": { + "type": "Identifier", + "start": 4, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 40 + }, + "identifierName": "import" + }, + "name": "import" + }, + "init": { + "type": "NumericLiteral", + "start": 43, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 43 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "extra": { + "rawValue": 123, + "raw": "123" + }, + "value": 123 + } + } + ], + "kind": "var" + }, + { + "type": "ImportDeclaration", + "start": 49, + "end": 90, + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 41 + } + }, + "specifiers": [], + "source": { + "type": "StringLiteral", + "start": 86, + "end": 89, + "loc": { + "start": { + "line": 3, + "column": 37 + }, + "end": { + "line": 3, + "column": 40 + } + }, + "extra": { + "rawValue": "x", + "raw": "\"x\"" + }, + "value": "x" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-null/options.json b/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-null/options.json deleted file mode 100644 index 34db9f6413ed..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-null/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Escape sequence in keyword null (1:9)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-null/output.json b/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-null/output.json new file mode 100644 index 000000000000..17c1ae03468e --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-null/output.json @@ -0,0 +1,68 @@ +{ + "type": "File", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "errors": [ + "SyntaxError: Escape sequence in keyword null (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "expression": { + "type": "NullLiteral", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-true/options.json b/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-true/options.json deleted file mode 100644 index c1c2620da097..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-true/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Escape sequence in keyword true (1:9)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-true/output.json b/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-true/output.json new file mode 100644 index 000000000000..609a782c235a --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/identifiers/invalid-escape-seq-true/output.json @@ -0,0 +1,69 @@ +{ + "type": "File", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "errors": [ + "SyntaxError: Escape sequence in keyword true (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "expression": { + "type": "BooleanLiteral", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "value": true + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/let/let-as-identifier-strict-fail/options.json b/packages/babel-parser/test/fixtures/es2015/let/let-as-identifier-strict-fail/options.json deleted file mode 100644 index ab238c8bbff9..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/let/let-as-identifier-strict-fail/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected reserved word 'let' (2:0)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/let/let-as-identifier-strict-fail/output.json b/packages/babel-parser/test/fixtures/es2015/let/let-as-identifier-strict-fail/output.json new file mode 100644 index 000000000000..85fa32674b37 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/let/let-as-identifier-strict-fail/output.json @@ -0,0 +1,142 @@ +{ + "type": "File", + "start": 0, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 7 + } + }, + "errors": [ + "SyntaxError: Unexpected reserved word 'let' (2:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 7 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 14, + "end": 21, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 7 + } + }, + "expression": { + "type": "BinaryExpression", + "start": 14, + "end": 21, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 7 + } + }, + "left": { + "type": "Identifier", + "start": 14, + "end": 17, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 3 + }, + "identifierName": "let" + }, + "name": "let" + }, + "operator": "+", + "right": { + "type": "NumericLiteral", + "start": 20, + "end": 21, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 7 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/let/let-at-binding-list-fail-1/options.json b/packages/babel-parser/test/fixtures/es2015/let/let-at-binding-list-fail-1/options.json deleted file mode 100644 index 75f41b260f56..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/let/let-at-binding-list-fail-1/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "'let' is not allowed to be used as a name in 'let' or 'const' declarations. (1:6)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/let/let-at-binding-list-fail-1/output.json b/packages/babel-parser/test/fixtures/es2015/let/let-at-binding-list-fail-1/output.json new file mode 100644 index 000000000000..e6e2ced3bb0c --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/let/let-at-binding-list-fail-1/output.json @@ -0,0 +1,159 @@ +{ + "type": "File", + "start": 0, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "errors": [ + "SyntaxError: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. (1:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "id": { + "type": "ObjectPattern", + "start": 4, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 6, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 6, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + }, + "identifierName": "let" + }, + "name": "let" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start": 6, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + }, + "identifierName": "let" + }, + "name": "let" + }, + "extra": { + "shorthand": true + } + } + ] + }, + "init": { + "type": "ObjectExpression", + "start": 14, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "properties": [] + } + } + ], + "kind": "let" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/let/let-at-binding-list-fail-2/options.json b/packages/babel-parser/test/fixtures/es2015/let/let-at-binding-list-fail-2/options.json deleted file mode 100644 index 0a2459ae24fc..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/let/let-at-binding-list-fail-2/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "'let' is not allowed to be used as a name in 'let' or 'const' declarations. (1:8)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/let/let-at-binding-list-fail-2/output.json b/packages/babel-parser/test/fixtures/es2015/let/let-at-binding-list-fail-2/output.json new file mode 100644 index 000000000000..2c3d3871ec80 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/let/let-at-binding-list-fail-2/output.json @@ -0,0 +1,159 @@ +{ + "type": "File", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "errors": [ + "SyntaxError: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. (1:8)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 6, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "id": { + "type": "ObjectPattern", + "start": 6, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 8, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 8, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + }, + "identifierName": "let" + }, + "name": "let" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start": 8, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + }, + "identifierName": "let" + }, + "name": "let" + }, + "extra": { + "shorthand": true + } + } + ] + }, + "init": { + "type": "ObjectExpression", + "start": 16, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "properties": [] + } + } + ], + "kind": "const" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/let/let-at-binding-list-fail-3/options.json b/packages/babel-parser/test/fixtures/es2015/let/let-at-binding-list-fail-3/options.json deleted file mode 100644 index 80b209cf3816..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/let/let-at-binding-list-fail-3/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "'let' is not allowed to be used as a name in 'let' or 'const' declarations. (1:5)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/let/let-at-binding-list-fail-3/output.json b/packages/babel-parser/test/fixtures/es2015/let/let-at-binding-list-fail-3/output.json new file mode 100644 index 000000000000..4354932c617c --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/let/let-at-binding-list-fail-3/output.json @@ -0,0 +1,121 @@ +{ + "type": "File", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "errors": [ + "SyntaxError: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "id": { + "type": "ArrayPattern", + "start": 4, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "elements": [ + { + "type": "Identifier", + "start": 5, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 8 + }, + "identifierName": "let" + }, + "name": "let" + } + ] + }, + "init": { + "type": "ArrayExpression", + "start": 12, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "elements": [] + } + } + ], + "kind": "let" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/let/let-at-binding-list-fail-4/options.json b/packages/babel-parser/test/fixtures/es2015/let/let-at-binding-list-fail-4/options.json deleted file mode 100644 index ccbcbd4b6bbc..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/let/let-at-binding-list-fail-4/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "'let' is not allowed to be used as a name in 'let' or 'const' declarations. (1:7)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/let/let-at-binding-list-fail-4/output.json b/packages/babel-parser/test/fixtures/es2015/let/let-at-binding-list-fail-4/output.json new file mode 100644 index 000000000000..720c37df7a15 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/let/let-at-binding-list-fail-4/output.json @@ -0,0 +1,121 @@ +{ + "type": "File", + "start": 0, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "errors": [ + "SyntaxError: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. (1:7)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 6, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "id": { + "type": "ArrayPattern", + "start": 6, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "elements": [ + { + "type": "Identifier", + "start": 7, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "let" + }, + "name": "let" + } + ] + }, + "init": { + "type": "ArrayExpression", + "start": 14, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "elements": [] + } + } + ], + "kind": "const" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/let/let-at-binding-list-fail-5/options.json b/packages/babel-parser/test/fixtures/es2015/let/let-at-binding-list-fail-5/options.json deleted file mode 100644 index 6152a659dcca..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/let/let-at-binding-list-fail-5/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "'let' is not allowed to be used as a name in 'let' or 'const' declarations. (1:4)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/let/let-at-binding-list-fail-5/output.json b/packages/babel-parser/test/fixtures/es2015/let/let-at-binding-list-fail-5/output.json new file mode 100644 index 000000000000..93d70aa80f8b --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/let/let-at-binding-list-fail-5/output.json @@ -0,0 +1,89 @@ +{ + "type": "File", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "errors": [ + "SyntaxError: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. (1:4)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "id": { + "type": "Identifier", + "start": 4, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "let" + }, + "name": "let" + }, + "init": null + } + ], + "kind": "let" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/let/let-at-binding-list-fail-6/options.json b/packages/babel-parser/test/fixtures/es2015/let/let-at-binding-list-fail-6/options.json deleted file mode 100644 index 75f41b260f56..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/let/let-at-binding-list-fail-6/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "'let' is not allowed to be used as a name in 'let' or 'const' declarations. (1:6)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/let/let-at-binding-list-fail-6/output.json b/packages/babel-parser/test/fixtures/es2015/let/let-at-binding-list-fail-6/output.json new file mode 100644 index 000000000000..77846750f6ed --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/let/let-at-binding-list-fail-6/output.json @@ -0,0 +1,108 @@ +{ + "type": "File", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "errors": [ + "SyntaxError: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. (1:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 6, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + }, + "identifierName": "let" + }, + "name": "let" + }, + "init": { + "type": "StringLiteral", + "start": 12, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "extra": { + "rawValue": "", + "raw": "''" + }, + "value": "" + } + } + ], + "kind": "const" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/let/let-at-catch-block/options.json b/packages/babel-parser/test/fixtures/es2015/let/let-at-catch-block/options.json deleted file mode 100644 index 2c54a7452db9..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/let/let-at-catch-block/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "'let' is not allowed to be used as a name in 'let' or 'const' declarations. (2:6)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/let/let-at-catch-block/output.json b/packages/babel-parser/test/fixtures/es2015/let/let-at-catch-block/output.json new file mode 100644 index 000000000000..ecd45f67f5c5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/let/let-at-catch-block/output.json @@ -0,0 +1,172 @@ +{ + "type": "File", + "start": 0, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. (2:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "TryStatement", + "start": 0, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "block": { + "type": "BlockStatement", + "start": 4, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "body": [], + "directives": [] + }, + "handler": { + "type": "CatchClause", + "start": 7, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "param": { + "type": "Identifier", + "start": 14, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 17 + }, + "identifierName": "err" + }, + "name": "err" + }, + "body": { + "type": "BlockStatement", + "start": 19, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "VariableDeclaration", + "start": 23, + "end": 31, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 10 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 27, + "end": 30, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 9 + } + }, + "id": { + "type": "Identifier", + "start": 27, + "end": 30, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 9 + }, + "identifierName": "let" + }, + "name": "let" + }, + "init": null + } + ], + "kind": "let" + } + ], + "directives": [] + } + }, + "finalizer": null + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/meta-properties/invalid-arrow-function/options.json b/packages/babel-parser/test/fixtures/es2015/meta-properties/invalid-arrow-function/options.json deleted file mode 100644 index 4931a93f395d..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/meta-properties/invalid-arrow-function/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "new.target can only be used in functions (2:2)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/meta-properties/invalid-arrow-function/output.json b/packages/babel-parser/test/fixtures/es2015/meta-properties/invalid-arrow-function/output.json new file mode 100644 index 000000000000..64d4a8d35758 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/meta-properties/invalid-arrow-function/output.json @@ -0,0 +1,189 @@ +{ + "type": "File", + "start": 0, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: new.target can only be used in functions (2:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 6, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "init": { + "type": "ArrowFunctionExpression", + "start": 10, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 16, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 20, + "end": 31, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 13 + } + }, + "expression": { + "type": "MetaProperty", + "start": 20, + "end": 30, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 12 + } + }, + "meta": { + "type": "Identifier", + "start": 20, + "end": 23, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 5 + }, + "identifierName": "new" + }, + "name": "new" + }, + "property": { + "type": "Identifier", + "start": 24, + "end": 30, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 12 + }, + "identifierName": "target" + }, + "name": "target" + } + } + } + ], + "directives": [] + } + } + } + ], + "kind": "const" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/meta-properties/new-invalid-prop/input.js b/packages/babel-parser/test/fixtures/es2015/meta-properties/new-invalid-prop/input.js index d775807ddef1..1f159ebd65d2 100644 --- a/packages/babel-parser/test/fixtures/es2015/meta-properties/new-invalid-prop/input.js +++ b/packages/babel-parser/test/fixtures/es2015/meta-properties/new-invalid-prop/input.js @@ -1 +1,3 @@ -new.prop \ No newline at end of file +function f() { + new.prop +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/meta-properties/new-invalid-prop/options.json b/packages/babel-parser/test/fixtures/es2015/meta-properties/new-invalid-prop/options.json deleted file mode 100644 index 8a88f91714d0..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/meta-properties/new-invalid-prop/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "The only valid meta property for new is new.target (1:4)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/meta-properties/new-invalid-prop/output.json b/packages/babel-parser/test/fixtures/es2015/meta-properties/new-invalid-prop/output.json new file mode 100644 index 000000000000..214b3e5417fe --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/meta-properties/new-invalid-prop/output.json @@ -0,0 +1,155 @@ +{ + "type": "File", + "start": 0, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: The only valid meta property for new is new.target (2:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "f" + }, + "name": "f" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 13, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 17, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 10 + } + }, + "expression": { + "type": "MetaProperty", + "start": 17, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 10 + } + }, + "meta": { + "type": "Identifier", + "start": 17, + "end": 20, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 5 + }, + "identifierName": "new" + }, + "name": "new" + }, + "property": { + "type": "Identifier", + "start": 21, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 10 + }, + "identifierName": "prop" + }, + "name": "prop" + } + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/meta-properties/new-target-invalid-escaped-new/options.json b/packages/babel-parser/test/fixtures/es2015/meta-properties/new-target-invalid-escaped-new/options.json deleted file mode 100644 index 112b0adc3e61..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/meta-properties/new-target-invalid-escaped-new/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Escape sequence in keyword new (1:23)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/meta-properties/new-target-invalid-escaped-new/output.json b/packages/babel-parser/test/fixtures/es2015/meta-properties/new-target-invalid-escaped-new/output.json new file mode 100644 index 000000000000..1394b19bdb01 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/meta-properties/new-target-invalid-escaped-new/output.json @@ -0,0 +1,155 @@ +{ + "type": "File", + "start": 0, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "errors": [ + "SyntaxError: Escape sequence in keyword new (1:15)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "f" + }, + "name": "f" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 13, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 15, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "expression": { + "type": "MetaProperty", + "start": 15, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "meta": { + "type": "Identifier", + "start": 15, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 23 + }, + "identifierName": "new" + }, + "name": "new" + }, + "property": { + "type": "Identifier", + "start": 24, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 30 + }, + "identifierName": "target" + }, + "name": "target" + } + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/meta-properties/new-target-invalid-escaped-target/options.json b/packages/babel-parser/test/fixtures/es2015/meta-properties/new-target-invalid-escaped-target/options.json deleted file mode 100644 index 09a27d63dba1..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/meta-properties/new-target-invalid-escaped-target/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "The only valid meta property for new is new.target (1:19)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/meta-properties/new-target-invalid-escaped-target/output.json b/packages/babel-parser/test/fixtures/es2015/meta-properties/new-target-invalid-escaped-target/output.json new file mode 100644 index 000000000000..2fa8e1dd5500 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/meta-properties/new-target-invalid-escaped-target/output.json @@ -0,0 +1,155 @@ +{ + "type": "File", + "start": 0, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "errors": [ + "SyntaxError: The only valid meta property for new is new.target (1:19)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "f" + }, + "name": "f" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 13, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 15, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "expression": { + "type": "MetaProperty", + "start": 15, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "meta": { + "type": "Identifier", + "start": 15, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 18 + }, + "identifierName": "new" + }, + "name": "new" + }, + "property": { + "type": "Identifier", + "start": 19, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 30 + }, + "identifierName": "target" + }, + "name": "target" + } + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/meta-properties/new-target-invalid/options.json b/packages/babel-parser/test/fixtures/es2015/meta-properties/new-target-invalid/options.json deleted file mode 100644 index 092a825444ad..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/meta-properties/new-target-invalid/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "new.target can only be used in functions (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/meta-properties/new-target-invalid/output.json b/packages/babel-parser/test/fixtures/es2015/meta-properties/new-target-invalid/output.json new file mode 100644 index 000000000000..4283f53e7dea --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/meta-properties/new-target-invalid/output.json @@ -0,0 +1,102 @@ +{ + "type": "File", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "errors": [ + "SyntaxError: new.target can only be used in functions (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "expression": { + "type": "MetaProperty", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "meta": { + "type": "Identifier", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + }, + "identifierName": "new" + }, + "name": "new" + }, + "property": { + "type": "Identifier", + "start": 4, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "target" + }, + "name": "target" + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-export-default-and-export-as-default/options.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-export-default-and-export-as-default/options.json index 275e6a57f95f..54925950e059 100644 --- a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-export-default-and-export-as-default/options.json +++ b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-export-default-and-export-as-default/options.json @@ -1,3 +1,3 @@ { - "throws": "Only one default export allowed per module. (2:9)" -} + "sourceType": "module" +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-export-default-and-export-as-default/output.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-export-default-and-export-as-default/output.json new file mode 100644 index 000000000000..019d83e37ab4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-export-default-and-export-as-default/output.json @@ -0,0 +1,173 @@ +{ + "type": "File", + "start": 0, + "end": 56, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 26 + } + }, + "errors": [ + "SyntaxError: Only one default export allowed per module. (2:9)", + "SyntaxError: Export 'foo' is not defined (2:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 56, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 26 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportDefaultDeclaration", + "start": 0, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "declaration": { + "type": "FunctionDeclaration", + "start": 15, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 26, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "body": [], + "directives": [] + } + } + }, + { + "type": "EmptyStatement", + "start": 28, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + { + "type": "ExportNamedDeclaration", + "start": 30, + "end": 56, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 26 + } + }, + "specifiers": [ + { + "type": "ExportSpecifier", + "start": 39, + "end": 53, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 23 + } + }, + "local": { + "type": "Identifier", + "start": 39, + "end": 42, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 12 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "exported": { + "type": "Identifier", + "start": 46, + "end": 53, + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 23 + }, + "identifierName": "default" + }, + "name": "default" + } + } + ], + "source": null, + "declaration": null + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-export-default/options.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-export-default/options.json index 1ec6a5168f14..54925950e059 100644 --- a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-export-default/options.json +++ b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-export-default/options.json @@ -1,3 +1,3 @@ { - "throws": "Only one default export allowed per module. (2:0)" -} + "sourceType": "module" +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-export-default/output.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-export-default/output.json new file mode 100644 index 000000000000..d8e83bc56d6e --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-export-default/output.json @@ -0,0 +1,135 @@ +{ + "type": "File", + "start": 0, + "end": 48, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 29 + } + }, + "errors": [ + "SyntaxError: Only one default export allowed per module. (2:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 48, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 29 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportDefaultDeclaration", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "declaration": { + "type": "ObjectExpression", + "start": 15, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "properties": [] + } + }, + { + "type": "ExportDefaultDeclaration", + "start": 19, + "end": 47, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 28 + } + }, + "declaration": { + "type": "FunctionDeclaration", + "start": 34, + "end": 47, + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 28 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 45, + "end": 47, + "loc": { + "start": { + "line": 2, + "column": 26 + }, + "end": { + "line": 2, + "column": 28 + } + }, + "body": [], + "directives": [] + } + } + }, + { + "type": "EmptyStatement", + "start": 47, + "end": 48, + "loc": { + "start": { + "line": 2, + "column": 28 + }, + "end": { + "line": 2, + "column": 29 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-class-declaration/options.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-class-declaration/options.json index 3bdafe893282..54925950e059 100644 --- a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-class-declaration/options.json +++ b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-class-declaration/options.json @@ -1,3 +1,3 @@ { - "throws": "`Foo` has already been exported. Exported identifiers must be unique. (2:0)" -} + "sourceType": "module" +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-class-declaration/output.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-class-declaration/output.json new file mode 100644 index 000000000000..cf1a59d2669e --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-class-declaration/output.json @@ -0,0 +1,187 @@ +{ + "type": "File", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 20 + } + }, + "errors": [ + "SyntaxError: `Foo` has already been exported. Exported identifiers must be unique. (2:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 20 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "specifiers": [ + { + "type": "ExportSpecifier", + "start": 9, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "local": { + "type": "Identifier", + "start": 9, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "Foo" + }, + "name": "Foo" + }, + "exported": { + "type": "Identifier", + "start": 9, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "Foo" + }, + "name": "Foo" + } + } + ], + "source": null, + "declaration": null + }, + { + "type": "ExportNamedDeclaration", + "start": 16, + "end": 35, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "specifiers": [], + "source": null, + "declaration": { + "type": "ClassDeclaration", + "start": 23, + "end": 35, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "id": { + "type": "Identifier", + "start": 29, + "end": 32, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 16 + }, + "identifierName": "Foo" + }, + "name": "Foo" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 33, + "end": 35, + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "body": [] + } + } + }, + { + "type": "EmptyStatement", + "start": 35, + "end": 36, + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 20 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring-assignment/options.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring-assignment/options.json index ea1f7f46f967..54925950e059 100644 --- a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring-assignment/options.json +++ b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring-assignment/options.json @@ -1,4 +1,3 @@ { - "sourceType": "module", - "throws": "`foo` has already been exported. Exported identifiers must be unique. (2:15)" -} + "sourceType": "module" +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring-assignment/output.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring-assignment/output.json new file mode 100644 index 000000000000..ae3e358fbe8c --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring-assignment/output.json @@ -0,0 +1,280 @@ +{ + "type": "File", + "start": 0, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 31 + } + }, + "errors": [ + "SyntaxError: `foo` has already been exported. Exported identifiers must be unique. (2:15)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 31 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "specifiers": [ + { + "type": "ExportSpecifier", + "start": 9, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "local": { + "type": "Identifier", + "start": 9, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "exported": { + "type": "Identifier", + "start": 9, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "foo" + }, + "name": "foo" + } + } + ], + "source": null, + "declaration": null + }, + { + "type": "ExportNamedDeclaration", + "start": 16, + "end": 47, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 31 + } + }, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start": 23, + "end": 47, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 31 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 29, + "end": 46, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 30 + } + }, + "id": { + "type": "ObjectPattern", + "start": 29, + "end": 40, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 24 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 31, + "end": 38, + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 31, + "end": 34, + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 18 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "AssignmentPattern", + "start": 31, + "end": 38, + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "left": { + "type": "Identifier", + "start": 31, + "end": 34, + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 18 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "right": { + "type": "NumericLiteral", + "start": 37, + "end": 38, + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + }, + "extra": { + "shorthand": true + } + } + ] + }, + "init": { + "type": "Identifier", + "start": 43, + "end": 46, + "loc": { + "start": { + "line": 2, + "column": 27 + }, + "end": { + "line": 2, + "column": 30 + }, + "identifierName": "bar" + }, + "name": "bar" + } + } + ], + "kind": "const" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring10/options.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring10/options.json deleted file mode 100644 index 446a980f5409..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring10/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'foo' has already been declared (2:20)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring10/output.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring10/output.json new file mode 100644 index 000000000000..ba018d66dfd9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring10/output.json @@ -0,0 +1,331 @@ +{ + "type": "File", + "start": 0, + "end": 60, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 34 + } + }, + "errors": [ + "SyntaxError: Identifier 'foo' has already been declared (2:20)", + "SyntaxError: `foo` has already been exported. Exported identifiers must be unique. (2:20)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 60, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 34 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "specifiers": [], + "source": null, + "declaration": { + "type": "FunctionDeclaration", + "start": 7, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "id": { + "type": "Identifier", + "start": 16, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 19 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 22, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "body": [], + "directives": [] + } + } + }, + { + "type": "EmptyStatement", + "start": 24, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + { + "type": "ExportNamedDeclaration", + "start": 26, + "end": 60, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 34 + } + }, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start": 33, + "end": 60, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 34 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 39, + "end": 59, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 33 + } + }, + "id": { + "type": "ObjectPattern", + "start": 39, + "end": 53, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 27 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 41, + "end": 51, + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 25 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 41, + "end": 42, + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 16 + }, + "identifierName": "a" + }, + "name": "a" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "ArrayPattern", + "start": 44, + "end": 51, + "loc": { + "start": { + "line": 2, + "column": 18 + }, + "end": { + "line": 2, + "column": 25 + } + }, + "elements": [ + { + "type": "ObjectPattern", + "start": 45, + "end": 50, + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 24 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 46, + "end": 49, + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 23 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 46, + "end": 49, + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 23 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start": 46, + "end": 49, + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 23 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "extra": { + "shorthand": true + } + } + ] + } + ] + } + } + ] + }, + "init": { + "type": "Identifier", + "start": 56, + "end": 59, + "loc": { + "start": { + "line": 2, + "column": 30 + }, + "end": { + "line": 2, + "column": 33 + }, + "identifierName": "bar" + }, + "name": "bar" + } + } + ], + "kind": "const" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring11/options.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring11/options.json deleted file mode 100644 index 09b3fa97a0d1..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring11/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'foo4' has already been declared (2:50)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring11/output.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring11/output.json new file mode 100644 index 000000000000..853a21053688 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring11/output.json @@ -0,0 +1,521 @@ +{ + "type": "File", + "start": 0, + "end": 96, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 69 + } + }, + "errors": [ + "SyntaxError: Identifier 'foo4' has already been declared (2:50)", + "SyntaxError: `foo4` has already been exported. Exported identifiers must be unique. (2:50)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 96, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 69 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "specifiers": [], + "source": null, + "declaration": { + "type": "FunctionDeclaration", + "start": 7, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "id": { + "type": "Identifier", + "start": 16, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 20 + }, + "identifierName": "foo4" + }, + "name": "foo4" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 23, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "body": [], + "directives": [] + } + } + }, + { + "type": "EmptyStatement", + "start": 25, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + { + "type": "ExportNamedDeclaration", + "start": 27, + "end": 96, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 69 + } + }, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start": 34, + "end": 96, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 69 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 40, + "end": 95, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 68 + } + }, + "id": { + "type": "ArrayPattern", + "start": 40, + "end": 89, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 62 + } + }, + "elements": [ + { + "type": "ObjectPattern", + "start": 41, + "end": 88, + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 61 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 43, + "end": 55, + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 28 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 43, + "end": 44, + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 17 + }, + "identifierName": "a" + }, + "name": "a" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "ArrayPattern", + "start": 46, + "end": 55, + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 28 + } + }, + "elements": [ + { + "type": "ObjectPattern", + "start": 47, + "end": 54, + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 27 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 49, + "end": 52, + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 25 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 49, + "end": 52, + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 25 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start": 49, + "end": 52, + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 25 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "extra": { + "shorthand": true + } + } + ] + } + ] + } + }, + { + "type": "ObjectProperty", + "start": 57, + "end": 86, + "loc": { + "start": { + "line": 2, + "column": 30 + }, + "end": { + "line": 2, + "column": 59 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 57, + "end": 58, + "loc": { + "start": { + "line": 2, + "column": 30 + }, + "end": { + "line": 2, + "column": 31 + }, + "identifierName": "b" + }, + "name": "b" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "ObjectPattern", + "start": 60, + "end": 86, + "loc": { + "start": { + "line": 2, + "column": 33 + }, + "end": { + "line": 2, + "column": 59 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 62, + "end": 84, + "loc": { + "start": { + "line": 2, + "column": 35 + }, + "end": { + "line": 2, + "column": 57 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 62, + "end": 66, + "loc": { + "start": { + "line": 2, + "column": 35 + }, + "end": { + "line": 2, + "column": 39 + }, + "identifierName": "foo2" + }, + "name": "foo2" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "ArrayPattern", + "start": 68, + "end": 84, + "loc": { + "start": { + "line": 2, + "column": 41 + }, + "end": { + "line": 2, + "column": 57 + } + }, + "elements": [ + { + "type": "ObjectPattern", + "start": 69, + "end": 83, + "loc": { + "start": { + "line": 2, + "column": 42 + }, + "end": { + "line": 2, + "column": 56 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 71, + "end": 81, + "loc": { + "start": { + "line": 2, + "column": 44 + }, + "end": { + "line": 2, + "column": 54 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 71, + "end": 75, + "loc": { + "start": { + "line": 2, + "column": 44 + }, + "end": { + "line": 2, + "column": 48 + }, + "identifierName": "foo3" + }, + "name": "foo3" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "Identifier", + "start": 77, + "end": 81, + "loc": { + "start": { + "line": 2, + "column": 50 + }, + "end": { + "line": 2, + "column": 54 + }, + "identifierName": "foo4" + }, + "name": "foo4" + } + } + ] + } + ] + } + } + ] + } + } + ] + } + ] + }, + "init": { + "type": "Identifier", + "start": 92, + "end": 95, + "loc": { + "start": { + "line": 2, + "column": 65 + }, + "end": { + "line": 2, + "column": 68 + }, + "identifierName": "bar" + }, + "name": "bar" + } + } + ], + "kind": "const" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring12/options.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring12/options.json deleted file mode 100644 index 3a7173c837e3..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring12/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'foo4' has already been declared (2:49)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring12/output.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring12/output.json new file mode 100644 index 000000000000..9100976f570c --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring12/output.json @@ -0,0 +1,504 @@ +{ + "type": "File", + "start": 0, + "end": 94, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 67 + } + }, + "errors": [ + "SyntaxError: Identifier 'foo4' has already been declared (2:49)", + "SyntaxError: `foo4` has already been exported. Exported identifiers must be unique. (2:49)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 94, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 67 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "specifiers": [], + "source": null, + "declaration": { + "type": "FunctionDeclaration", + "start": 7, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "id": { + "type": "Identifier", + "start": 16, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 20 + }, + "identifierName": "foo4" + }, + "name": "foo4" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 23, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "body": [], + "directives": [] + } + } + }, + { + "type": "EmptyStatement", + "start": 25, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + { + "type": "ExportNamedDeclaration", + "start": 27, + "end": 94, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 67 + } + }, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start": 34, + "end": 94, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 67 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 40, + "end": 93, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 66 + } + }, + "id": { + "type": "ObjectPattern", + "start": 40, + "end": 87, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 60 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 42, + "end": 54, + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 27 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 42, + "end": 43, + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 16 + }, + "identifierName": "a" + }, + "name": "a" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "ArrayPattern", + "start": 45, + "end": 54, + "loc": { + "start": { + "line": 2, + "column": 18 + }, + "end": { + "line": 2, + "column": 27 + } + }, + "elements": [ + { + "type": "ObjectPattern", + "start": 46, + "end": 53, + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 26 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 48, + "end": 51, + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 24 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 48, + "end": 51, + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 24 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start": 48, + "end": 51, + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 24 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "extra": { + "shorthand": true + } + } + ] + } + ] + } + }, + { + "type": "ObjectProperty", + "start": 56, + "end": 85, + "loc": { + "start": { + "line": 2, + "column": 29 + }, + "end": { + "line": 2, + "column": 58 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 56, + "end": 57, + "loc": { + "start": { + "line": 2, + "column": 29 + }, + "end": { + "line": 2, + "column": 30 + }, + "identifierName": "b" + }, + "name": "b" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "ObjectPattern", + "start": 59, + "end": 85, + "loc": { + "start": { + "line": 2, + "column": 32 + }, + "end": { + "line": 2, + "column": 58 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 61, + "end": 83, + "loc": { + "start": { + "line": 2, + "column": 34 + }, + "end": { + "line": 2, + "column": 56 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 61, + "end": 65, + "loc": { + "start": { + "line": 2, + "column": 34 + }, + "end": { + "line": 2, + "column": 38 + }, + "identifierName": "foo2" + }, + "name": "foo2" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "ArrayPattern", + "start": 67, + "end": 83, + "loc": { + "start": { + "line": 2, + "column": 40 + }, + "end": { + "line": 2, + "column": 56 + } + }, + "elements": [ + { + "type": "ObjectPattern", + "start": 68, + "end": 82, + "loc": { + "start": { + "line": 2, + "column": 41 + }, + "end": { + "line": 2, + "column": 55 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 70, + "end": 80, + "loc": { + "start": { + "line": 2, + "column": 43 + }, + "end": { + "line": 2, + "column": 53 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 70, + "end": 74, + "loc": { + "start": { + "line": 2, + "column": 43 + }, + "end": { + "line": 2, + "column": 47 + }, + "identifierName": "foo3" + }, + "name": "foo3" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "Identifier", + "start": 76, + "end": 80, + "loc": { + "start": { + "line": 2, + "column": 49 + }, + "end": { + "line": 2, + "column": 53 + }, + "identifierName": "foo4" + }, + "name": "foo4" + } + } + ] + } + ] + } + } + ] + } + } + ] + }, + "init": { + "type": "Identifier", + "start": 90, + "end": 93, + "loc": { + "start": { + "line": 2, + "column": 63 + }, + "end": { + "line": 2, + "column": 66 + }, + "identifierName": "bar" + }, + "name": "bar" + } + } + ], + "kind": "const" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring13/options.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring13/options.json deleted file mode 100644 index d3fc42a61ba1..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring13/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'foo4' has already been declared (2:58)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring13/output.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring13/output.json new file mode 100644 index 000000000000..63e32c488670 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring13/output.json @@ -0,0 +1,556 @@ +{ + "type": "File", + "start": 0, + "end": 103, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 76 + } + }, + "errors": [ + "SyntaxError: Identifier 'foo4' has already been declared (2:58)", + "SyntaxError: `foo4` has already been exported. Exported identifiers must be unique. (2:58)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 103, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 76 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "specifiers": [], + "source": null, + "declaration": { + "type": "FunctionDeclaration", + "start": 7, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "id": { + "type": "Identifier", + "start": 16, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 20 + }, + "identifierName": "foo4" + }, + "name": "foo4" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 23, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "body": [], + "directives": [] + } + } + }, + { + "type": "EmptyStatement", + "start": 25, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + { + "type": "ExportNamedDeclaration", + "start": 27, + "end": 103, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 76 + } + }, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start": 34, + "end": 103, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 76 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 40, + "end": 102, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 75 + } + }, + "id": { + "type": "ObjectPattern", + "start": 40, + "end": 96, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 69 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 42, + "end": 60, + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 33 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 42, + "end": 43, + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 16 + }, + "identifierName": "a" + }, + "name": "a" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "ArrayPattern", + "start": 45, + "end": 60, + "loc": { + "start": { + "line": 2, + "column": 18 + }, + "end": { + "line": 2, + "column": 33 + } + }, + "elements": [ + { + "type": "ObjectPattern", + "start": 46, + "end": 59, + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 32 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 48, + "end": 57, + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 30 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 48, + "end": 52, + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 25 + }, + "identifierName": "foo4" + }, + "name": "foo4" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "Identifier", + "start": 54, + "end": 57, + "loc": { + "start": { + "line": 2, + "column": 27 + }, + "end": { + "line": 2, + "column": 30 + }, + "identifierName": "foo" + }, + "name": "foo" + } + } + ] + } + ] + } + }, + { + "type": "ObjectProperty", + "start": 62, + "end": 63, + "loc": { + "start": { + "line": 2, + "column": 35 + }, + "end": { + "line": 2, + "column": 36 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 62, + "end": 63, + "loc": { + "start": { + "line": 2, + "column": 35 + }, + "end": { + "line": 2, + "column": 36 + }, + "identifierName": "b" + }, + "name": "b" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start": 62, + "end": 63, + "loc": { + "start": { + "line": 2, + "column": 35 + }, + "end": { + "line": 2, + "column": 36 + }, + "identifierName": "b" + }, + "name": "b" + }, + "extra": { + "shorthand": true + } + }, + { + "type": "ObjectProperty", + "start": 65, + "end": 94, + "loc": { + "start": { + "line": 2, + "column": 38 + }, + "end": { + "line": 2, + "column": 67 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 65, + "end": 66, + "loc": { + "start": { + "line": 2, + "column": 38 + }, + "end": { + "line": 2, + "column": 39 + }, + "identifierName": "c" + }, + "name": "c" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "ObjectPattern", + "start": 68, + "end": 94, + "loc": { + "start": { + "line": 2, + "column": 41 + }, + "end": { + "line": 2, + "column": 67 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 70, + "end": 92, + "loc": { + "start": { + "line": 2, + "column": 43 + }, + "end": { + "line": 2, + "column": 65 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 70, + "end": 74, + "loc": { + "start": { + "line": 2, + "column": 43 + }, + "end": { + "line": 2, + "column": 47 + }, + "identifierName": "foo2" + }, + "name": "foo2" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "ArrayPattern", + "start": 76, + "end": 92, + "loc": { + "start": { + "line": 2, + "column": 49 + }, + "end": { + "line": 2, + "column": 65 + } + }, + "elements": [ + { + "type": "ObjectPattern", + "start": 77, + "end": 91, + "loc": { + "start": { + "line": 2, + "column": 50 + }, + "end": { + "line": 2, + "column": 64 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 79, + "end": 89, + "loc": { + "start": { + "line": 2, + "column": 52 + }, + "end": { + "line": 2, + "column": 62 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 79, + "end": 83, + "loc": { + "start": { + "line": 2, + "column": 52 + }, + "end": { + "line": 2, + "column": 56 + }, + "identifierName": "foo3" + }, + "name": "foo3" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "Identifier", + "start": 85, + "end": 89, + "loc": { + "start": { + "line": 2, + "column": 58 + }, + "end": { + "line": 2, + "column": 62 + }, + "identifierName": "foo4" + }, + "name": "foo4" + } + } + ] + } + ] + } + } + ] + } + } + ] + }, + "init": { + "type": "Identifier", + "start": 99, + "end": 102, + "loc": { + "start": { + "line": 2, + "column": 72 + }, + "end": { + "line": 2, + "column": 75 + }, + "identifierName": "bar" + }, + "name": "bar" + } + } + ], + "kind": "const" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring14/options.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring14/options.json deleted file mode 100644 index 80640e0ce127..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring14/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'foo' has already been declared (2:21)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring14/output.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring14/output.json new file mode 100644 index 000000000000..1d699b58133a --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring14/output.json @@ -0,0 +1,262 @@ +{ + "type": "File", + "start": 0, + "end": 55, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 33 + } + }, + "errors": [ + "SyntaxError: Identifier 'foo' has already been declared (2:21)", + "SyntaxError: `foo` has already been exported. Exported identifiers must be unique. (2:21)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 55, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 33 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start": 0, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start": 7, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 13, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "id": { + "type": "Identifier", + "start": 13, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 16 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "init": { + "type": "NumericLiteral", + "start": 19, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "const" + } + }, + { + "type": "ExportNamedDeclaration", + "start": 22, + "end": 55, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 33 + } + }, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start": 29, + "end": 55, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 33 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 35, + "end": 54, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 32 + } + }, + "id": { + "type": "ObjectPattern", + "start": 35, + "end": 48, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 26 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 37, + "end": 46, + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 24 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 37, + "end": 41, + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 19 + }, + "identifierName": "foo2" + }, + "name": "foo2" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "Identifier", + "start": 43, + "end": 46, + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 24 + }, + "identifierName": "foo" + }, + "name": "foo" + } + } + ] + }, + "init": { + "type": "Identifier", + "start": 51, + "end": 54, + "loc": { + "start": { + "line": 2, + "column": 29 + }, + "end": { + "line": 2, + "column": 32 + }, + "identifierName": "bar" + }, + "name": "bar" + } + } + ], + "kind": "const" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring15/options.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring15/options.json deleted file mode 100644 index ea3a9b62f493..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring15/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'foo2' has already been declared (2:13)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring15/output.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring15/output.json new file mode 100644 index 000000000000..140798f03a2d --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring15/output.json @@ -0,0 +1,262 @@ +{ + "type": "File", + "start": 0, + "end": 56, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "errors": [ + "SyntaxError: Identifier 'foo2' has already been declared (2:13)", + "SyntaxError: `foo2` has already been exported. Exported identifiers must be unique. (2:13)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 56, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start": 0, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start": 7, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 13, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "id": { + "type": "ObjectPattern", + "start": 13, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 15, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 15, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 18 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "Identifier", + "start": 20, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 24 + }, + "identifierName": "foo2" + }, + "name": "foo2" + } + } + ] + }, + "init": { + "type": "Identifier", + "start": 29, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 32 + }, + "identifierName": "bar" + }, + "name": "bar" + } + } + ], + "kind": "const" + } + }, + { + "type": "ExportNamedDeclaration", + "start": 34, + "end": 56, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start": 41, + "end": 56, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 47, + "end": 55, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 21 + } + }, + "id": { + "type": "Identifier", + "start": 47, + "end": 51, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 17 + }, + "identifierName": "foo2" + }, + "name": "foo2" + }, + "init": { + "type": "NumericLiteral", + "start": 54, + "end": 55, + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 21 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "const" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring16/options.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring16/options.json deleted file mode 100644 index 42c862ad273a..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring16/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'foo' has already been declared (2:22)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring16/output.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring16/output.json new file mode 100644 index 000000000000..d51c3a34e349 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring16/output.json @@ -0,0 +1,259 @@ +{ + "type": "File", + "start": 0, + "end": 55, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 33 + } + }, + "errors": [ + "SyntaxError: Identifier 'foo' has already been declared (2:22)", + "SyntaxError: `foo` has already been exported. Exported identifiers must be unique. (2:22)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 55, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 33 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start": 0, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start": 7, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 13, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "id": { + "type": "Identifier", + "start": 13, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 16 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "init": { + "type": "NumericLiteral", + "start": 19, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "const" + } + }, + { + "type": "ExportNamedDeclaration", + "start": 22, + "end": 55, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 33 + } + }, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start": 29, + "end": 55, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 33 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 35, + "end": 54, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 32 + } + }, + "id": { + "type": "ArrayPattern", + "start": 35, + "end": 48, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 26 + } + }, + "elements": [ + { + "type": "Identifier", + "start": 36, + "end": 39, + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 17 + }, + "identifierName": "bar" + }, + "name": "bar" + }, + { + "type": "RestElement", + "start": 41, + "end": 47, + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 25 + } + }, + "argument": { + "type": "Identifier", + "start": 44, + "end": 47, + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 25 + }, + "identifierName": "foo" + }, + "name": "foo" + } + } + ] + }, + "init": { + "type": "Identifier", + "start": 51, + "end": 54, + "loc": { + "start": { + "line": 2, + "column": 29 + }, + "end": { + "line": 2, + "column": 32 + }, + "identifierName": "baz" + }, + "name": "baz" + } + } + ], + "kind": "const" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring17/options.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring17/options.json deleted file mode 100644 index 125c2618435d..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring17/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'bar' has already been declared (2:13)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring17/output.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring17/output.json new file mode 100644 index 000000000000..5d56b3c37e96 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring17/output.json @@ -0,0 +1,259 @@ +{ + "type": "File", + "start": 0, + "end": 55, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 21 + } + }, + "errors": [ + "SyntaxError: Identifier 'bar' has already been declared (2:13)", + "SyntaxError: `bar` has already been exported. Exported identifiers must be unique. (2:13)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 55, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 21 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start": 0, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start": 7, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 13, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "id": { + "type": "ArrayPattern", + "start": 13, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "elements": [ + { + "type": "Identifier", + "start": 14, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 17 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + { + "type": "RestElement", + "start": 19, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "argument": { + "type": "Identifier", + "start": 22, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 25 + }, + "identifierName": "bar" + }, + "name": "bar" + } + } + ] + }, + "init": { + "type": "Identifier", + "start": 29, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 32 + }, + "identifierName": "baz" + }, + "name": "baz" + } + } + ], + "kind": "const" + } + }, + { + "type": "ExportNamedDeclaration", + "start": 34, + "end": 55, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 21 + } + }, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start": 41, + "end": 55, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 21 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 47, + "end": 54, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 20 + } + }, + "id": { + "type": "Identifier", + "start": 47, + "end": 50, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 16 + }, + "identifierName": "bar" + }, + "name": "bar" + }, + "init": { + "type": "NumericLiteral", + "start": 53, + "end": 54, + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 20 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "const" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring18/options.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring18/options.json deleted file mode 100644 index bf345ea77127..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring18/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'foo' has already been declared (2:28)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring18/output.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring18/output.json new file mode 100644 index 000000000000..0378d078ec4f --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring18/output.json @@ -0,0 +1,293 @@ +{ + "type": "File", + "start": 0, + "end": 62, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 40 + } + }, + "errors": [ + "SyntaxError: Identifier 'foo' has already been declared (2:28)", + "SyntaxError: `foo` has already been exported. Exported identifiers must be unique. (2:28)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 62, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 40 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start": 0, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start": 7, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 13, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "id": { + "type": "Identifier", + "start": 13, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 16 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "init": { + "type": "NumericLiteral", + "start": 19, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "const" + } + }, + { + "type": "ExportNamedDeclaration", + "start": 22, + "end": 62, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 40 + } + }, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start": 29, + "end": 62, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 40 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 35, + "end": 61, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 39 + } + }, + "id": { + "type": "ArrayPattern", + "start": 35, + "end": 55, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 33 + } + }, + "elements": [ + { + "type": "Identifier", + "start": 36, + "end": 39, + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 17 + }, + "identifierName": "bar" + }, + "name": "bar" + }, + { + "type": "ArrayPattern", + "start": 41, + "end": 54, + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 32 + } + }, + "elements": [ + { + "type": "Identifier", + "start": 42, + "end": 45, + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 23 + }, + "identifierName": "baz" + }, + "name": "baz" + }, + { + "type": "RestElement", + "start": 47, + "end": 53, + "loc": { + "start": { + "line": 2, + "column": 25 + }, + "end": { + "line": 2, + "column": 31 + } + }, + "argument": { + "type": "Identifier", + "start": 50, + "end": 53, + "loc": { + "start": { + "line": 2, + "column": 28 + }, + "end": { + "line": 2, + "column": 31 + }, + "identifierName": "foo" + }, + "name": "foo" + } + } + ] + } + ] + }, + "init": { + "type": "Identifier", + "start": 58, + "end": 61, + "loc": { + "start": { + "line": 2, + "column": 36 + }, + "end": { + "line": 2, + "column": 39 + }, + "identifierName": "qux" + }, + "name": "qux" + } + } + ], + "kind": "const" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring19/options.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring19/options.json deleted file mode 100644 index bf2483362193..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring19/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'foo' has already been declared (2:29)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring19/output.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring19/output.json new file mode 100644 index 000000000000..e185b7f4186f --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring19/output.json @@ -0,0 +1,311 @@ +{ + "type": "File", + "start": 0, + "end": 64, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 42 + } + }, + "errors": [ + "SyntaxError: Identifier 'foo' has already been declared (2:29)", + "SyntaxError: `foo` has already been exported. Exported identifiers must be unique. (2:29)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 64, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 42 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start": 0, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start": 7, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 13, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "id": { + "type": "Identifier", + "start": 13, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 16 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "init": { + "type": "NumericLiteral", + "start": 19, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "const" + } + }, + { + "type": "ExportNamedDeclaration", + "start": 22, + "end": 64, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 42 + } + }, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start": 29, + "end": 64, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 42 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 35, + "end": 63, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 41 + } + }, + "id": { + "type": "ObjectPattern", + "start": 35, + "end": 57, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 35 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 37, + "end": 55, + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 33 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 37, + "end": 40, + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 18 + }, + "identifierName": "bar" + }, + "name": "bar" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "ArrayPattern", + "start": 42, + "end": 55, + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 33 + } + }, + "elements": [ + { + "type": "Identifier", + "start": 43, + "end": 46, + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 24 + }, + "identifierName": "baz" + }, + "name": "baz" + }, + { + "type": "RestElement", + "start": 48, + "end": 54, + "loc": { + "start": { + "line": 2, + "column": 26 + }, + "end": { + "line": 2, + "column": 32 + } + }, + "argument": { + "type": "Identifier", + "start": 51, + "end": 54, + "loc": { + "start": { + "line": 2, + "column": 29 + }, + "end": { + "line": 2, + "column": 32 + }, + "identifierName": "foo" + }, + "name": "foo" + } + } + ] + } + } + ] + }, + "init": { + "type": "Identifier", + "start": 60, + "end": 63, + "loc": { + "start": { + "line": 2, + "column": 38 + }, + "end": { + "line": 2, + "column": 41 + }, + "identifierName": "qux" + }, + "name": "qux" + } + } + ], + "kind": "const" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring2/options.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring2/options.json deleted file mode 100644 index 2cbe06c40914..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring2/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'foo' has already been declared (2:15)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring2/output.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring2/output.json new file mode 100644 index 000000000000..8e8c195325fc --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring2/output.json @@ -0,0 +1,262 @@ +{ + "type": "File", + "start": 0, + "end": 53, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 27 + } + }, + "errors": [ + "SyntaxError: Identifier 'foo' has already been declared (2:15)", + "SyntaxError: `foo` has already been exported. Exported identifiers must be unique. (2:15)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 53, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 27 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "specifiers": [], + "source": null, + "declaration": { + "type": "FunctionDeclaration", + "start": 7, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "id": { + "type": "Identifier", + "start": 16, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 19 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 22, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "body": [], + "directives": [] + } + } + }, + { + "type": "EmptyStatement", + "start": 24, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + { + "type": "ExportNamedDeclaration", + "start": 26, + "end": 53, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 27 + } + }, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start": 33, + "end": 53, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 27 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 39, + "end": 52, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 26 + } + }, + "id": { + "type": "ObjectPattern", + "start": 39, + "end": 46, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 20 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 41, + "end": 44, + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 41, + "end": 44, + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 18 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start": 41, + "end": 44, + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 18 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "extra": { + "shorthand": true + } + } + ] + }, + "init": { + "type": "Identifier", + "start": 49, + "end": 52, + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 26 + }, + "identifierName": "bar" + }, + "name": "bar" + } + } + ], + "kind": "const" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring3/options.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring3/options.json deleted file mode 100644 index d36390356990..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring3/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'foo' has already been declared (2:16)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring3/output.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring3/output.json new file mode 100644 index 000000000000..f862a6a420c6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring3/output.json @@ -0,0 +1,262 @@ +{ + "type": "File", + "start": 0, + "end": 53, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 25 + } + }, + "errors": [ + "SyntaxError: Identifier 'foo' has already been declared (2:16)", + "SyntaxError: `foo` has already been exported. Exported identifiers must be unique. (2:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 53, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 25 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start": 0, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start": 7, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 13, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "id": { + "type": "ObjectPattern", + "start": 13, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 15, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 15, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 18 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start": 15, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 18 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "extra": { + "shorthand": true + } + } + ] + }, + "init": { + "type": "Identifier", + "start": 23, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 26 + }, + "identifierName": "bar" + }, + "name": "bar" + } + } + ], + "kind": "const" + } + }, + { + "type": "ExportNamedDeclaration", + "start": 28, + "end": 52, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 24 + } + }, + "specifiers": [], + "source": null, + "declaration": { + "type": "FunctionDeclaration", + "start": 35, + "end": 52, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 24 + } + }, + "id": { + "type": "Identifier", + "start": 44, + "end": 47, + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 19 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 50, + "end": 52, + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 24 + } + }, + "body": [], + "directives": [] + } + } + }, + { + "type": "EmptyStatement", + "start": 52, + "end": 53, + "loc": { + "start": { + "line": 2, + "column": 24 + }, + "end": { + "line": 2, + "column": 25 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring4/options.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring4/options.json deleted file mode 100644 index 46358493589c..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring4/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'foo' has already been declared (2:14)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring4/output.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring4/output.json new file mode 100644 index 000000000000..401baa93a85a --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring4/output.json @@ -0,0 +1,224 @@ +{ + "type": "File", + "start": 0, + "end": 51, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 25 + } + }, + "errors": [ + "SyntaxError: Identifier 'foo' has already been declared (2:14)", + "SyntaxError: `foo` has already been exported. Exported identifiers must be unique. (2:14)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 51, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 25 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "specifiers": [], + "source": null, + "declaration": { + "type": "FunctionDeclaration", + "start": 7, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "id": { + "type": "Identifier", + "start": 16, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 19 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 22, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "body": [], + "directives": [] + } + } + }, + { + "type": "EmptyStatement", + "start": 24, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + { + "type": "ExportNamedDeclaration", + "start": 26, + "end": 51, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 25 + } + }, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start": 33, + "end": 51, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 25 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 39, + "end": 50, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 24 + } + }, + "id": { + "type": "ArrayPattern", + "start": 39, + "end": 44, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "elements": [ + { + "type": "Identifier", + "start": 40, + "end": 43, + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 17 + }, + "identifierName": "foo" + }, + "name": "foo" + } + ] + }, + "init": { + "type": "Identifier", + "start": 47, + "end": 50, + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 24 + }, + "identifierName": "bar" + }, + "name": "bar" + } + } + ], + "kind": "const" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring5/options.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring5/options.json deleted file mode 100644 index d36390356990..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring5/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'foo' has already been declared (2:16)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring5/output.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring5/output.json new file mode 100644 index 000000000000..39b035aada97 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring5/output.json @@ -0,0 +1,224 @@ +{ + "type": "File", + "start": 0, + "end": 51, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 25 + } + }, + "errors": [ + "SyntaxError: Identifier 'foo' has already been declared (2:16)", + "SyntaxError: `foo` has already been exported. Exported identifiers must be unique. (2:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 51, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 25 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start": 7, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 13, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "id": { + "type": "ArrayPattern", + "start": 13, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "elements": [ + { + "type": "Identifier", + "start": 14, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 17 + }, + "identifierName": "foo" + }, + "name": "foo" + } + ] + }, + "init": { + "type": "Identifier", + "start": 21, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 24 + }, + "identifierName": "bar" + }, + "name": "bar" + } + } + ], + "kind": "const" + } + }, + { + "type": "ExportNamedDeclaration", + "start": 26, + "end": 50, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 24 + } + }, + "specifiers": [], + "source": null, + "declaration": { + "type": "FunctionDeclaration", + "start": 33, + "end": 50, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 24 + } + }, + "id": { + "type": "Identifier", + "start": 42, + "end": 45, + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 19 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 48, + "end": 50, + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 24 + } + }, + "body": [], + "directives": [] + } + } + }, + { + "type": "EmptyStatement", + "start": 50, + "end": 51, + "loc": { + "start": { + "line": 2, + "column": 24 + }, + "end": { + "line": 2, + "column": 25 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring6/options.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring6/options.json deleted file mode 100644 index 46358493589c..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring6/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'foo' has already been declared (2:14)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring6/output.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring6/output.json new file mode 100644 index 000000000000..d4856c9023d7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring6/output.json @@ -0,0 +1,279 @@ +{ + "type": "File", + "start": 0, + "end": 54, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 26 + } + }, + "errors": [ + "SyntaxError: Identifier 'foo' has already been declared (2:14)", + "SyntaxError: `foo` has already been exported. Exported identifiers must be unique. (2:14)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 54, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 26 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start": 0, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start": 7, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 13, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "id": { + "type": "ObjectPattern", + "start": 13, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 15, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 15, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 18 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start": 15, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 18 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "extra": { + "shorthand": true + } + } + ] + }, + "init": { + "type": "Identifier", + "start": 23, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 26 + }, + "identifierName": "bar" + }, + "name": "bar" + } + } + ], + "kind": "const" + } + }, + { + "type": "ExportNamedDeclaration", + "start": 28, + "end": 54, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 26 + } + }, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start": 35, + "end": 54, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 26 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 41, + "end": 53, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 25 + } + }, + "id": { + "type": "ArrayPattern", + "start": 41, + "end": 46, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "elements": [ + { + "type": "Identifier", + "start": 42, + "end": 45, + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 17 + }, + "identifierName": "foo" + }, + "name": "foo" + } + ] + }, + "init": { + "type": "Identifier", + "start": 49, + "end": 53, + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 25 + }, + "identifierName": "bar2" + }, + "name": "bar2" + } + } + ], + "kind": "const" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring7/options.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring7/options.json deleted file mode 100644 index 2cbe06c40914..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring7/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'foo' has already been declared (2:15)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring7/output.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring7/output.json new file mode 100644 index 000000000000..3bfd361f5286 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring7/output.json @@ -0,0 +1,279 @@ +{ + "type": "File", + "start": 0, + "end": 54, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 28 + } + }, + "errors": [ + "SyntaxError: Identifier 'foo' has already been declared (2:15)", + "SyntaxError: `foo` has already been exported. Exported identifiers must be unique. (2:15)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 54, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 28 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start": 7, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 13, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "id": { + "type": "ArrayPattern", + "start": 13, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "elements": [ + { + "type": "Identifier", + "start": 14, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 17 + }, + "identifierName": "foo" + }, + "name": "foo" + } + ] + }, + "init": { + "type": "Identifier", + "start": 21, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 24 + }, + "identifierName": "bar" + }, + "name": "bar" + } + } + ], + "kind": "const" + } + }, + { + "type": "ExportNamedDeclaration", + "start": 26, + "end": 54, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 28 + } + }, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start": 33, + "end": 54, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 28 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 39, + "end": 53, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 27 + } + }, + "id": { + "type": "ObjectPattern", + "start": 39, + "end": 46, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 20 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 41, + "end": 44, + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 41, + "end": 44, + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 18 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start": 41, + "end": 44, + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 18 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "extra": { + "shorthand": true + } + } + ] + }, + "init": { + "type": "Identifier", + "start": 49, + "end": 53, + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 27 + }, + "identifierName": "bar2" + }, + "name": "bar2" + } + } + ], + "kind": "const" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring8/options.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring8/options.json deleted file mode 100644 index 982078d803c6..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring8/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'Foo' has already been declared (2:15)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring8/output.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring8/output.json new file mode 100644 index 000000000000..5826aac519d7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring8/output.json @@ -0,0 +1,259 @@ +{ + "type": "File", + "start": 0, + "end": 48, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 27 + } + }, + "errors": [ + "SyntaxError: Identifier 'Foo' has already been declared (2:15)", + "SyntaxError: `Foo` has already been exported. Exported identifiers must be unique. (2:15)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 48, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 27 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "specifiers": [], + "source": null, + "declaration": { + "type": "ClassDeclaration", + "start": 7, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "id": { + "type": "Identifier", + "start": 13, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 16 + }, + "identifierName": "Foo" + }, + "name": "Foo" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 17, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "body": [] + } + } + }, + { + "type": "EmptyStatement", + "start": 19, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "ExportNamedDeclaration", + "start": 21, + "end": 48, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 27 + } + }, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start": 28, + "end": 48, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 27 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 34, + "end": 47, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 26 + } + }, + "id": { + "type": "ObjectPattern", + "start": 34, + "end": 41, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 20 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 36, + "end": 39, + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 36, + "end": 39, + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 18 + }, + "identifierName": "Foo" + }, + "name": "Foo" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start": 36, + "end": 39, + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 18 + }, + "identifierName": "Foo" + }, + "name": "Foo" + }, + "extra": { + "shorthand": true + } + } + ] + }, + "init": { + "type": "Identifier", + "start": 44, + "end": 47, + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 26 + }, + "identifierName": "bar" + }, + "name": "bar" + } + } + ], + "kind": "const" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring9/options.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring9/options.json deleted file mode 100644 index f79b5469b1c0..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring9/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'Foo' has already been declared (2:14)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring9/output.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring9/output.json new file mode 100644 index 000000000000..4ee921df359a --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-destructuring9/output.json @@ -0,0 +1,221 @@ +{ + "type": "File", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 25 + } + }, + "errors": [ + "SyntaxError: Identifier 'Foo' has already been declared (2:14)", + "SyntaxError: `Foo` has already been exported. Exported identifiers must be unique. (2:14)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 25 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "specifiers": [], + "source": null, + "declaration": { + "type": "ClassDeclaration", + "start": 7, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "id": { + "type": "Identifier", + "start": 13, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 16 + }, + "identifierName": "Foo" + }, + "name": "Foo" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 17, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "body": [] + } + } + }, + { + "type": "EmptyStatement", + "start": 19, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "ExportNamedDeclaration", + "start": 21, + "end": 46, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 25 + } + }, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start": 28, + "end": 46, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 25 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 34, + "end": 45, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 24 + } + }, + "id": { + "type": "ArrayPattern", + "start": 34, + "end": 39, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "elements": [ + { + "type": "Identifier", + "start": 35, + "end": 38, + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 17 + }, + "identifierName": "Foo" + }, + "name": "Foo" + } + ] + }, + "init": { + "type": "Identifier", + "start": 42, + "end": 45, + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 24 + }, + "identifierName": "bar" + }, + "name": "bar" + } + } + ], + "kind": "const" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-function-declaration/options.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-function-declaration/options.json index 1923e4752336..54925950e059 100644 --- a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-function-declaration/options.json +++ b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-function-declaration/options.json @@ -1,3 +1,3 @@ { - "throws": "`foo` has already been exported. Exported identifiers must be unique. (2:0)" -} + "sourceType": "module" +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-function-declaration/output.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-function-declaration/output.json new file mode 100644 index 000000000000..ac8f210f8ba9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-function-declaration/output.json @@ -0,0 +1,190 @@ +{ + "type": "File", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 25 + } + }, + "errors": [ + "SyntaxError: `foo` has already been exported. Exported identifiers must be unique. (2:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 25 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "specifiers": [ + { + "type": "ExportSpecifier", + "start": 9, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "local": { + "type": "Identifier", + "start": 9, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "exported": { + "type": "Identifier", + "start": 9, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "foo" + }, + "name": "foo" + } + } + ], + "source": null, + "declaration": null + }, + { + "type": "ExportNamedDeclaration", + "start": 16, + "end": 40, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 24 + } + }, + "specifiers": [], + "source": null, + "declaration": { + "type": "FunctionDeclaration", + "start": 23, + "end": 40, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 24 + } + }, + "id": { + "type": "Identifier", + "start": 32, + "end": 35, + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 19 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 38, + "end": 40, + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 24 + } + }, + "body": [], + "directives": [] + } + } + }, + { + "type": "EmptyStatement", + "start": 40, + "end": 41, + "loc": { + "start": { + "line": 2, + "column": 24 + }, + "end": { + "line": 2, + "column": 25 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-variable-declaration/options.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-variable-declaration/options.json index 9fdf7082da17..54925950e059 100644 --- a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-variable-declaration/options.json +++ b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-variable-declaration/options.json @@ -1,3 +1,3 @@ { - "throws": "`foo` has already been exported. Exported identifiers must be unique. (2:13)" -} + "sourceType": "module" +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-variable-declaration/output.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-variable-declaration/output.json new file mode 100644 index 000000000000..981050ec6112 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export-variable-declaration/output.json @@ -0,0 +1,190 @@ +{ + "type": "File", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 23 + } + }, + "errors": [ + "SyntaxError: `foo` has already been exported. Exported identifiers must be unique. (2:13)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 23 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "specifiers": [ + { + "type": "ExportSpecifier", + "start": 9, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "local": { + "type": "Identifier", + "start": 9, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "exported": { + "type": "Identifier", + "start": 9, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "foo" + }, + "name": "foo" + } + } + ], + "source": null, + "declaration": null + }, + { + "type": "ExportNamedDeclaration", + "start": 16, + "end": 39, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 23 + } + }, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start": 23, + "end": 39, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 23 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 29, + "end": 38, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "id": { + "type": "Identifier", + "start": 29, + "end": 32, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 16 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "init": { + "type": "Identifier", + "start": 35, + "end": 38, + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 22 + }, + "identifierName": "bar" + }, + "name": "bar" + } + } + ], + "kind": "const" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export/options.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export/options.json index 9bb46f4778eb..54925950e059 100644 --- a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export/options.json +++ b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export/options.json @@ -1,3 +1,3 @@ { - "throws": "`foo` has already been exported. Exported identifiers must be unique. (2:9)" -} + "sourceType": "module" +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export/output.json b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export/output.json new file mode 100644 index 000000000000..b6476d620353 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/modules/duplicate-named-export/output.json @@ -0,0 +1,176 @@ +{ + "type": "File", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "errors": [ + "SyntaxError: `foo` has already been exported. Exported identifiers must be unique. (2:9)", + "SyntaxError: Export 'foo' is not defined (1:9)", + "SyntaxError: Export 'bar' is not defined (2:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "specifiers": [ + { + "type": "ExportSpecifier", + "start": 9, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "local": { + "type": "Identifier", + "start": 9, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "exported": { + "type": "Identifier", + "start": 9, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "foo" + }, + "name": "foo" + } + } + ], + "source": null, + "declaration": null + }, + { + "type": "ExportNamedDeclaration", + "start": 16, + "end": 38, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "specifiers": [ + { + "type": "ExportSpecifier", + "start": 25, + "end": 35, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "local": { + "type": "Identifier", + "start": 25, + "end": 28, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 12 + }, + "identifierName": "bar" + }, + "name": "bar" + }, + "exported": { + "type": "Identifier", + "start": 32, + "end": 35, + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 19 + }, + "identifierName": "foo" + }, + "name": "foo" + } + } + ], + "source": null, + "declaration": null + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/modules/import-invalid-keyword-flow/options.json b/packages/babel-parser/test/fixtures/es2015/modules/import-invalid-keyword-flow/options.json index 379fb1f86234..3c8ee8805e34 100644 --- a/packages/babel-parser/test/fixtures/es2015/modules/import-invalid-keyword-flow/options.json +++ b/packages/babel-parser/test/fixtures/es2015/modules/import-invalid-keyword-flow/options.json @@ -1,4 +1,6 @@ { - "plugins": ["flow"], - "throws": "Unexpected keyword 'default' (1:9)" -} + "sourceType": "module", + "plugins": [ + "flow" + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/modules/import-invalid-keyword-flow/output.json b/packages/babel-parser/test/fixtures/es2015/modules/import-invalid-keyword-flow/output.json new file mode 100644 index 000000000000..d1f169eb7647 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/modules/import-invalid-keyword-flow/output.json @@ -0,0 +1,126 @@ +{ + "type": "File", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "errors": [ + "SyntaxError: Unexpected keyword 'default' (1:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ImportDeclaration", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "specifiers": [ + { + "type": "ImportSpecifier", + "start": 9, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "imported": { + "type": "Identifier", + "start": 9, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 16 + }, + "identifierName": "default" + }, + "name": "default" + }, + "importKind": null, + "local": { + "type": "Identifier", + "start": 9, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 16 + }, + "identifierName": "default" + }, + "name": "default" + } + } + ], + "importKind": "value", + "source": { + "type": "StringLiteral", + "start": 24, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "extra": { + "rawValue": "foo", + "raw": "\"foo\"" + }, + "value": "foo" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/modules/import-invalid-keyword-typeof-flow/options.json b/packages/babel-parser/test/fixtures/es2015/modules/import-invalid-keyword-typeof-flow/options.json index cda01e8412c3..3c8ee8805e34 100644 --- a/packages/babel-parser/test/fixtures/es2015/modules/import-invalid-keyword-typeof-flow/options.json +++ b/packages/babel-parser/test/fixtures/es2015/modules/import-invalid-keyword-typeof-flow/options.json @@ -1,4 +1,6 @@ { - "plugins": ["flow"], - "throws": "Unexpected keyword 'typeof' (1:9)" -} + "sourceType": "module", + "plugins": [ + "flow" + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/modules/import-invalid-keyword-typeof-flow/output.json b/packages/babel-parser/test/fixtures/es2015/modules/import-invalid-keyword-typeof-flow/output.json new file mode 100644 index 000000000000..62e2b403628d --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/modules/import-invalid-keyword-typeof-flow/output.json @@ -0,0 +1,126 @@ +{ + "type": "File", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "errors": [ + "SyntaxError: Unexpected keyword 'typeof' (1:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ImportDeclaration", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "specifiers": [ + { + "type": "ImportSpecifier", + "start": 9, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "imported": { + "type": "Identifier", + "start": 9, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 15 + }, + "identifierName": "typeof" + }, + "name": "typeof" + }, + "importKind": null, + "local": { + "type": "Identifier", + "start": 9, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 15 + }, + "identifierName": "typeof" + }, + "name": "typeof" + } + } + ], + "importKind": "value", + "source": { + "type": "StringLiteral", + "start": 23, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "extra": { + "rawValue": "foo", + "raw": "\"foo\"" + }, + "value": "foo" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/modules/import-invalid-keyword-typeof/options.json b/packages/babel-parser/test/fixtures/es2015/modules/import-invalid-keyword-typeof/options.json index a45cdb986dd1..54925950e059 100644 --- a/packages/babel-parser/test/fixtures/es2015/modules/import-invalid-keyword-typeof/options.json +++ b/packages/babel-parser/test/fixtures/es2015/modules/import-invalid-keyword-typeof/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected keyword 'typeof' (1:9)" -} + "sourceType": "module" +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/modules/import-invalid-keyword-typeof/output.json b/packages/babel-parser/test/fixtures/es2015/modules/import-invalid-keyword-typeof/output.json new file mode 100644 index 000000000000..cd60a3c49fe9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/modules/import-invalid-keyword-typeof/output.json @@ -0,0 +1,124 @@ +{ + "type": "File", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "errors": [ + "SyntaxError: Unexpected keyword 'typeof' (1:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ImportDeclaration", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "specifiers": [ + { + "type": "ImportSpecifier", + "start": 9, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "imported": { + "type": "Identifier", + "start": 9, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 15 + }, + "identifierName": "typeof" + }, + "name": "typeof" + }, + "local": { + "type": "Identifier", + "start": 9, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 15 + }, + "identifierName": "typeof" + }, + "name": "typeof" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 23, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "extra": { + "rawValue": "foo", + "raw": "\"foo\"" + }, + "value": "foo" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/modules/import-invalid-keyword/options.json b/packages/babel-parser/test/fixtures/es2015/modules/import-invalid-keyword/options.json index 2c6a46df3f6e..54925950e059 100644 --- a/packages/babel-parser/test/fixtures/es2015/modules/import-invalid-keyword/options.json +++ b/packages/babel-parser/test/fixtures/es2015/modules/import-invalid-keyword/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected keyword 'debugger' (1:9)" -} + "sourceType": "module" +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/modules/import-invalid-keyword/output.json b/packages/babel-parser/test/fixtures/es2015/modules/import-invalid-keyword/output.json new file mode 100644 index 000000000000..40242124c0c4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/modules/import-invalid-keyword/output.json @@ -0,0 +1,124 @@ +{ + "type": "File", + "start": 0, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "errors": [ + "SyntaxError: Unexpected keyword 'debugger' (1:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ImportDeclaration", + "start": 0, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "specifiers": [ + { + "type": "ImportSpecifier", + "start": 9, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "imported": { + "type": "Identifier", + "start": 9, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 17 + }, + "identifierName": "debugger" + }, + "name": "debugger" + }, + "local": { + "type": "Identifier", + "start": 9, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 17 + }, + "identifierName": "debugger" + }, + "name": "debugger" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 25, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "extra": { + "rawValue": "foo", + "raw": "\"foo\"" + }, + "value": "foo" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/object/disallow-duplicate-method-params/options.json b/packages/babel-parser/test/fixtures/es2015/object/disallow-duplicate-method-params/options.json deleted file mode 100644 index a848b7de671a..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/object/disallow-duplicate-method-params/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Argument name clash (2:11)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/object/disallow-duplicate-method-params/output.json b/packages/babel-parser/test/fixtures/es2015/object/disallow-duplicate-method-params/output.json new file mode 100644 index 000000000000..b9fa1b56ec84 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/object/disallow-duplicate-method-params/output.json @@ -0,0 +1,165 @@ +{ + "type": "File", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 2 + } + }, + "errors": [ + "SyntaxError: Argument name clash (2:11)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 2 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 2 + } + }, + "expression": { + "type": "ObjectExpression", + "start": 1, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "properties": [ + { + "type": "ObjectMethod", + "start": 7, + "end": 19, + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "method": true, + "key": { + "type": "Identifier", + "start": 7, + "end": 10, + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 7 + }, + "identifierName": "bar" + }, + "name": "bar" + }, + "computed": false, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 11, + "end": 12, + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 9 + }, + "identifierName": "a" + }, + "name": "a" + }, + { + "type": "Identifier", + "start": 14, + "end": 15, + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 12 + }, + "identifierName": "a" + }, + "name": "a" + } + ], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 19, + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "body": [], + "directives": [] + } + } + ], + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/regex/duplicate-flags/options.json b/packages/babel-parser/test/fixtures/es2015/regex/duplicate-flags/options.json deleted file mode 100644 index 86670c5168d0..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/regex/duplicate-flags/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Duplicate regular expression flag (1:6)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/regex/duplicate-flags/output.json b/packages/babel-parser/test/fixtures/es2015/regex/duplicate-flags/output.json new file mode 100644 index 000000000000..86ec306e13d1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/regex/duplicate-flags/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "errors": [ + "SyntaxError: Duplicate regular expression flag (1:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "expression": { + "type": "RegExpLiteral", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "extra": { + "raw": "/./gii" + }, + "pattern": ".", + "flags": "gii" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/shorthand/1/options.json b/packages/babel-parser/test/fixtures/es2015/shorthand/1/options.json deleted file mode 100644 index eaa26955dc77..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/shorthand/1/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected keyword 'const' (1:11)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/shorthand/1/output.json b/packages/babel-parser/test/fixtures/es2015/shorthand/1/output.json new file mode 100644 index 000000000000..712caaafe1a1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/shorthand/1/output.json @@ -0,0 +1,164 @@ +{ + "type": "File", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "errors": [ + "SyntaxError: Unexpected keyword 'const' (1:11)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "id": { + "type": "Identifier", + "start": 4, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "x" + }, + "name": "x" + }, + "init": { + "type": "ObjectExpression", + "start": 9, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 11, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 11, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 16 + }, + "identifierName": "const" + }, + "name": "const" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start": 11, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 16 + }, + "identifierName": "const" + }, + "name": "const" + }, + "extra": { + "shorthand": true + } + } + ], + "extra": { + "parenthesized": true, + "parenStart": 8 + } + } + } + ], + "kind": "var" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/shorthand/2/options.json b/packages/babel-parser/test/fixtures/es2015/shorthand/2/options.json deleted file mode 100644 index be39a4451388..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/shorthand/2/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected keyword 'this' (1:8)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/shorthand/2/output.json b/packages/babel-parser/test/fixtures/es2015/shorthand/2/output.json new file mode 100644 index 000000000000..c91daf2f66d8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/shorthand/2/output.json @@ -0,0 +1,240 @@ +{ + "type": "File", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "errors": [ + "SyntaxError: Unexpected keyword 'this' (1:8)", + "SyntaxError: Unexpected keyword 'if' (1:14)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "expression": { + "type": "ObjectExpression", + "start": 1, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 3, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 3, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "get" + }, + "name": "get" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start": 3, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "get" + }, + "name": "get" + }, + "extra": { + "shorthand": true + } + }, + { + "type": "ObjectProperty", + "start": 8, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 8, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "this" + }, + "name": "this" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start": 8, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "this" + }, + "name": "this" + }, + "extra": { + "shorthand": true + } + }, + { + "type": "ObjectProperty", + "start": 14, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 14, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 16 + }, + "identifierName": "if" + }, + "name": "if" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start": 14, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 16 + }, + "identifierName": "if" + }, + "name": "if" + }, + "extra": { + "shorthand": true + } + } + ], + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/statements/label-invalid-const/options.json b/packages/babel-parser/test/fixtures/es2015/statements/label-invalid-const/options.json deleted file mode 100644 index a064a678e553..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/statements/label-invalid-const/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Lexical declaration cannot appear in a single-statement context (1:5)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/statements/label-invalid-const/output.json b/packages/babel-parser/test/fixtures/es2015/statements/label-invalid-const/output.json new file mode 100644 index 000000000000..b0dd4fe9c6d0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/statements/label-invalid-const/output.json @@ -0,0 +1,135 @@ +{ + "type": "File", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "errors": [ + "SyntaxError: Lexical declaration cannot appear in a single-statement context (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "LabeledStatement", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "body": { + "type": "VariableDeclaration", + "start": 5, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 11, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "id": { + "type": "Identifier", + "start": 11, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "bar" + }, + "name": "bar" + }, + "init": { + "type": "NullLiteral", + "start": 17, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 21 + } + } + } + } + ], + "kind": "const" + }, + "label": { + "type": "Identifier", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + }, + "identifierName": "foo" + }, + "name": "foo" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/statements/label-invalid-func-async/options.json b/packages/babel-parser/test/fixtures/es2015/statements/label-invalid-func-async/options.json deleted file mode 100644 index 95aaacb458f8..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/statements/label-invalid-func-async/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Async functions can only be declared at the top level or inside a block (1:5)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/statements/label-invalid-func-async/output.json b/packages/babel-parser/test/fixtures/es2015/statements/label-invalid-func-async/output.json new file mode 100644 index 000000000000..31af7aa06caf --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/statements/label-invalid-func-async/output.json @@ -0,0 +1,122 @@ +{ + "type": "File", + "start": 0, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "errors": [ + "SyntaxError: Async functions can only be declared at the top level or inside a block (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "LabeledStatement", + "start": 0, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "body": { + "type": "FunctionDeclaration", + "start": 5, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "id": { + "type": "Identifier", + "start": 20, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 23 + }, + "identifierName": "bar" + }, + "name": "bar" + }, + "generator": false, + "async": true, + "params": [], + "body": { + "type": "BlockStatement", + "start": 26, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "body": [], + "directives": [] + } + }, + "label": { + "type": "Identifier", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + }, + "identifierName": "foo" + }, + "name": "foo" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/statements/label-invalid-func-generator/options.json b/packages/babel-parser/test/fixtures/es2015/statements/label-invalid-func-generator/options.json deleted file mode 100644 index 3f6e90c7cd27..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/statements/label-invalid-func-generator/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Generators can only be declared at the top level or inside a block (1:13)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/statements/label-invalid-func-generator/output.json b/packages/babel-parser/test/fixtures/es2015/statements/label-invalid-func-generator/output.json new file mode 100644 index 000000000000..5dd39402a92b --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/statements/label-invalid-func-generator/output.json @@ -0,0 +1,122 @@ +{ + "type": "File", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "errors": [ + "SyntaxError: Generators can only be declared at the top level or inside a block (1:13)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "LabeledStatement", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "body": { + "type": "FunctionDeclaration", + "start": 5, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "id": { + "type": "Identifier", + "start": 15, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 18 + }, + "identifierName": "bar" + }, + "name": "bar" + }, + "generator": true, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 21, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "body": [], + "directives": [] + } + }, + "label": { + "type": "Identifier", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + }, + "identifierName": "foo" + }, + "name": "foo" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/statements/label-invalid-func-strict/options.json b/packages/babel-parser/test/fixtures/es2015/statements/label-invalid-func-strict/options.json deleted file mode 100644 index 1eebe15c408e..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/statements/label-invalid-func-strict/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "In strict mode code, functions can only be declared at top level or inside a block (1:35)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/statements/label-invalid-func-strict/output.json b/packages/babel-parser/test/fixtures/es2015/statements/label-invalid-func-strict/output.json new file mode 100644 index 000000000000..782989ece4c8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/statements/label-invalid-func-strict/output.json @@ -0,0 +1,211 @@ +{ + "type": "File", + "start": 0, + "end": 53, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 53 + } + }, + "errors": [ + "SyntaxError: In strict mode code, functions can only be declared at top level or inside a block (1:35)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 53, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 53 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 53, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 53 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 15, + "end": 53, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 53 + } + }, + "body": [ + { + "type": "LabeledStatement", + "start": 30, + "end": 52, + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 52 + } + }, + "body": { + "type": "FunctionDeclaration", + "start": 35, + "end": 52, + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 52 + } + }, + "id": { + "type": "Identifier", + "start": 44, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 44 + }, + "end": { + "line": 1, + "column": 47 + }, + "identifierName": "baz" + }, + "name": "baz" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 50, + "end": 52, + "loc": { + "start": { + "line": 1, + "column": 50 + }, + "end": { + "line": 1, + "column": 52 + } + }, + "body": [], + "directives": [] + } + }, + "label": { + "type": "Identifier", + "start": 30, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 33 + }, + "identifierName": "bar" + }, + "name": "bar" + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 16, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 16, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/109/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/109/options.json deleted file mode 100644 index 1fc5db8949ff..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/109/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "for-of loop variable declaration may not have an initializer (1:5)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/109/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/109/output.json new file mode 100644 index 000000000000..1bc303096308 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/109/output.json @@ -0,0 +1,207 @@ +{ + "type": "File", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "errors": [ + "SyntaxError: for-of loop variable declaration may not have an initializer (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ForOfStatement", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "await": false, + "left": { + "type": "VariableDeclaration", + "start": 5, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 9, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "x" + }, + "name": "x" + }, + "init": { + "type": "NumericLiteral", + "start": 13, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + ], + "kind": "var" + }, + "right": { + "type": "Identifier", + "start": 19, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 23 + }, + "identifierName": "list" + }, + "name": "list" + }, + "body": { + "type": "ExpressionStatement", + "start": 25, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "expression": { + "type": "CallExpression", + "start": 25, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "callee": { + "type": "Identifier", + "start": 25, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 32 + }, + "identifierName": "process" + }, + "name": "process" + }, + "arguments": [ + { + "type": "Identifier", + "start": 33, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 34 + }, + "identifierName": "x" + }, + "name": "x" + } + ] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/123/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/123/options.json deleted file mode 100644 index 42317f2b92ee..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/123/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "super() is only valid inside a class constructor of a subclass. Maybe a typo in the method name ('constructor') or not extending another class? (1:40)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/123/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/123/output.json new file mode 100644 index 000000000000..fcaa1ad31779 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/123/output.json @@ -0,0 +1,246 @@ +{ + "type": "File", + "start": 0, + "end": 51, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 51 + } + }, + "errors": [ + "SyntaxError: super() is only valid inside a class constructor of a subclass. Maybe a typo in the method name ('constructor') or not extending another class? (1:40)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 51, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 51 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 14, + "end": 51, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 51 + } + }, + "expression": { + "type": "ClassExpression", + "start": 15, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 50 + } + }, + "id": { + "type": "Identifier", + "start": 21, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 23, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 50 + } + }, + "body": [ + { + "type": "ClassMethod", + "start": 24, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 49 + } + }, + "static": false, + "key": { + "type": "Identifier", + "start": 24, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 35 + }, + "identifierName": "constructor" + }, + "name": "constructor" + }, + "computed": false, + "kind": "constructor", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 38, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 38 + }, + "end": { + "line": 1, + "column": 49 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 40, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 40 + }, + "end": { + "line": 1, + "column": 47 + } + }, + "expression": { + "type": "CallExpression", + "start": 40, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 40 + }, + "end": { + "line": 1, + "column": 47 + } + }, + "callee": { + "type": "Super", + "start": 40, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 40 + }, + "end": { + "line": 1, + "column": 45 + } + } + }, + "arguments": [] + } + } + ], + "directives": [] + } + } + ] + }, + "extra": { + "parenthesized": true, + "parenStart": 14 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/125/input.js b/packages/babel-parser/test/fixtures/es2015/uncategorised/125/input.js index a7bd428bbfce..83b8fa3b72d4 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/125/input.js +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/125/input.js @@ -1 +1 @@ -class A { constructor() {} 'constructor'() } \ No newline at end of file +class A { constructor() {} 'constructor'() {} } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/125/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/125/options.json deleted file mode 100644 index 09e50a3d71c3..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/125/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Duplicate constructor in the same class (1:27)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/125/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/125/output.json new file mode 100644 index 000000000000..d4cca9c08ac4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/125/output.json @@ -0,0 +1,203 @@ +{ + "type": "File", + "start": 0, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 47 + } + }, + "errors": [ + "SyntaxError: Duplicate constructor in the same class (1:27)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 47 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 47 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 47 + } + }, + "body": [ + { + "type": "ClassMethod", + "start": 10, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "static": false, + "key": { + "type": "Identifier", + "start": 10, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 21 + }, + "identifierName": "constructor" + }, + "name": "constructor" + }, + "computed": false, + "kind": "constructor", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 24, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "body": [], + "directives": [] + } + }, + { + "type": "ClassMethod", + "start": 27, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 45 + } + }, + "static": false, + "key": { + "type": "StringLiteral", + "start": 27, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "extra": { + "rawValue": "constructor", + "raw": "'constructor'" + }, + "value": "constructor" + }, + "computed": false, + "kind": "constructor", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 43, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 43 + }, + "end": { + "line": 1, + "column": 45 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/126/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/126/options.json deleted file mode 100644 index 38e87b07044c..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/126/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Constructor can't have get/set modifier (1:14)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/126/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/126/output.json new file mode 100644 index 000000000000..b1c776635e95 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/126/output.json @@ -0,0 +1,144 @@ +{ + "type": "File", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "errors": [ + "SyntaxError: Constructor can't have get/set modifier (1:14)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "body": [ + { + "type": "ClassMethod", + "start": 10, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "static": false, + "key": { + "type": "Identifier", + "start": 14, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 25 + }, + "identifierName": "constructor" + }, + "name": "constructor" + }, + "computed": false, + "kind": "get", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 28, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/127/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/127/options.json deleted file mode 100644 index becf560010f4..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/127/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Constructor can't be a generator (1:11)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/127/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/127/output.json new file mode 100644 index 000000000000..8eb2f5bd2f58 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/127/output.json @@ -0,0 +1,144 @@ +{ + "type": "File", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "errors": [ + "SyntaxError: Constructor can't be a generator (1:11)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "body": [ + { + "type": "ClassMethod", + "start": 10, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "static": false, + "kind": "method", + "key": { + "type": "Identifier", + "start": 11, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 22 + }, + "identifierName": "constructor" + }, + "name": "constructor" + }, + "computed": false, + "id": null, + "generator": true, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 25, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/166/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/166/options.json deleted file mode 100644 index b25685c6eac5..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/166/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Argument name clash (1:16)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/166/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/166/output.json new file mode 100644 index 000000000000..62466668edcb --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/166/output.json @@ -0,0 +1,180 @@ +{ + "type": "File", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "errors": [ + "SyntaxError: Argument name clash (1:16)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "x" + }, + "name": "x" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 11, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "a" + }, + "name": "a" + }, + { + "type": "ObjectPattern", + "start": 14, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 16, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 16, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + }, + "identifierName": "a" + }, + "name": "a" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start": 16, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + }, + "identifierName": "a" + }, + "name": "a" + }, + "extra": { + "shorthand": true + } + } + ] + } + ], + "body": { + "type": "BlockStatement", + "start": 20, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/198/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/198/options.json deleted file mode 100644 index 3f09c36a5f1c..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/198/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Expected number in radix 8 (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/198/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/198/output.json new file mode 100644 index 000000000000..12a024fb2c03 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/198/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "errors": [ + "SyntaxError: Expected number in radix 8 (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "extra": { + "rawValue": null, + "raw": "0o" + }, + "value": null + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/200/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/200/options.json deleted file mode 100644 index 3f09c36a5f1c..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/200/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Expected number in radix 8 (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/200/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/200/output.json new file mode 100644 index 000000000000..4b91f320f950 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/200/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "errors": [ + "SyntaxError: Expected number in radix 8 (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "extra": { + "rawValue": 0, + "raw": "0o9" + }, + "value": 0 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/201/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/201/options.json deleted file mode 100644 index d52d9cfac4bc..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/201/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected token, expected \";\" (1:3)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/201/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/201/output.json new file mode 100644 index 000000000000..9978c5342ef3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/201/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "errors": [ + "SyntaxError: Expected number in radix 8 (1:3)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "extra": { + "rawValue": 8, + "raw": "0o18" + }, + "value": 8 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/202/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/202/options.json deleted file mode 100644 index 3f09c36a5f1c..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/202/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Expected number in radix 8 (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/202/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/202/output.json new file mode 100644 index 000000000000..5d2ed2d91388 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/202/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "errors": [ + "SyntaxError: Expected number in radix 8 (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "extra": { + "rawValue": null, + "raw": "0O" + }, + "value": null + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/204/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/204/options.json deleted file mode 100644 index 3f09c36a5f1c..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/204/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Expected number in radix 8 (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/204/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/204/output.json new file mode 100644 index 000000000000..af4105738ef8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/204/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "errors": [ + "SyntaxError: Expected number in radix 8 (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "extra": { + "rawValue": 0, + "raw": "0O9" + }, + "value": 0 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/205/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/205/options.json deleted file mode 100644 index d52d9cfac4bc..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/205/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected token, expected \";\" (1:3)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/205/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/205/output.json new file mode 100644 index 000000000000..617cc13b6615 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/205/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "errors": [ + "SyntaxError: Expected number in radix 8 (1:3)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "extra": { + "rawValue": 8, + "raw": "0O18" + }, + "value": 8 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/206/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/206/options.json deleted file mode 100644 index 40dc3da9a8f4..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/206/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Expected number in radix 2 (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/206/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/206/output.json new file mode 100644 index 000000000000..0688a297c669 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/206/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "errors": [ + "SyntaxError: Expected number in radix 2 (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "extra": { + "rawValue": null, + "raw": "0b" + }, + "value": null + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/208/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/208/options.json deleted file mode 100644 index 40dc3da9a8f4..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/208/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Expected number in radix 2 (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/208/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/208/output.json new file mode 100644 index 000000000000..7281fb745a17 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/208/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "errors": [ + "SyntaxError: Expected number in radix 2 (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "extra": { + "rawValue": 0, + "raw": "0b9" + }, + "value": 0 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/209/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/209/options.json deleted file mode 100644 index d52d9cfac4bc..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/209/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected token, expected \";\" (1:3)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/209/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/209/output.json new file mode 100644 index 000000000000..25d711669b8b --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/209/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "errors": [ + "SyntaxError: Expected number in radix 2 (1:3)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "extra": { + "rawValue": 2, + "raw": "0b18" + }, + "value": 2 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/210/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/210/options.json deleted file mode 100644 index d52d9cfac4bc..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/210/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected token, expected \";\" (1:3)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/210/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/210/output.json new file mode 100644 index 000000000000..379e9db894c0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/210/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "errors": [ + "SyntaxError: Expected number in radix 2 (1:3)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "extra": { + "rawValue": 2, + "raw": "0b12" + }, + "value": 2 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/211/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/211/options.json deleted file mode 100644 index 40dc3da9a8f4..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/211/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Expected number in radix 2 (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/211/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/211/output.json new file mode 100644 index 000000000000..c87719ade97e --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/211/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "errors": [ + "SyntaxError: Expected number in radix 2 (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "extra": { + "rawValue": null, + "raw": "0B" + }, + "value": null + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/213/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/213/options.json deleted file mode 100644 index 40dc3da9a8f4..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/213/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Expected number in radix 2 (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/213/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/213/output.json new file mode 100644 index 000000000000..e82ab6ace61a --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/213/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "errors": [ + "SyntaxError: Expected number in radix 2 (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "extra": { + "rawValue": 0, + "raw": "0B9" + }, + "value": 0 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/214/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/214/options.json deleted file mode 100644 index d52d9cfac4bc..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/214/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected token, expected \";\" (1:3)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/214/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/214/output.json new file mode 100644 index 000000000000..3726afdc10d4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/214/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "errors": [ + "SyntaxError: Expected number in radix 2 (1:3)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "extra": { + "rawValue": 2, + "raw": "0B18" + }, + "value": 2 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/215/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/215/options.json deleted file mode 100644 index d52d9cfac4bc..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/215/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected token, expected \";\" (1:3)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/215/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/215/output.json new file mode 100644 index 000000000000..402fcffc9e54 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/215/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "errors": [ + "SyntaxError: Expected number in radix 2 (1:3)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "extra": { + "rawValue": 2, + "raw": "0B12" + }, + "value": 2 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/216/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/216/options.json index 77b813987217..8dfd231d943b 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/216/options.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/216/options.json @@ -1,3 +1,3 @@ { - "throws": "Code point out of bounds (1:4)" -} + "throws": "Invalid code point 1114112" +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/217/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/217/options.json deleted file mode 100644 index efaa7d304ccc..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/217/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Bad character escape sequence (1:4)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/217/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/217/output.json new file mode 100644 index 000000000000..6052cbe571f5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/217/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "errors": [ + "SyntaxError: Bad character escape sequence (1:4)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "value": "\\u{}", + "extra": { + "raw": "\"\\u{}\"", + "rawValue": "\\u{}" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/218/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/218/options.json deleted file mode 100644 index efaa7d304ccc..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/218/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Bad character escape sequence (1:4)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/218/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/218/output.json new file mode 100644 index 000000000000..781e807d0c94 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/218/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "errors": [ + "SyntaxError: Bad character escape sequence (1:4)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "value": "\\u{FFFF", + "extra": { + "raw": "\"\\u{FFFF\"", + "rawValue": "\\u{FFFF" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/219/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/219/options.json deleted file mode 100644 index efaa7d304ccc..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/219/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Bad character escape sequence (1:4)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/219/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/219/output.json new file mode 100644 index 000000000000..fcf4254c7a65 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/219/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "errors": [ + "SyntaxError: Bad character escape sequence (1:4)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "value": "\\u{FFZ}", + "extra": { + "raw": "\"\\u{FFZ}\"", + "rawValue": "\\u{FFZ}" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/220/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/220/options.json deleted file mode 100644 index 6010e96ed144..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/220/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in assignment expression (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/220/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/220/output.json new file mode 100644 index 000000000000..51d63380296a --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/220/output.json @@ -0,0 +1,120 @@ +{ + "type": "File", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "errors": [ + "SyntaxError: Invalid left-hand side in assignment expression (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "operator": "+=", + "left": { + "type": "ArrayExpression", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "elements": [ + { + "type": "Identifier", + "start": 1, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + }, + "identifierName": "v" + }, + "name": "v" + } + ] + }, + "right": { + "type": "Identifier", + "start": 7, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "ary" + }, + "name": "ary" + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/221/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/221/options.json deleted file mode 100644 index 7c5f08eb9ba6..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/221/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in assignment expression (1:1)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/221/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/221/output.json new file mode 100644 index 000000000000..58fa4ffd7fb9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/221/output.json @@ -0,0 +1,126 @@ +{ + "type": "File", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "errors": [ + "SyntaxError: Invalid left-hand side in array destructuring pattern (1:1)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "operator": "=", + "left": { + "type": "ArrayPattern", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "elements": [ + { + "type": "NumericLiteral", + "start": 1, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "extra": { + "rawValue": 2, + "raw": "2" + }, + "value": 2 + } + ] + }, + "right": { + "type": "NumericLiteral", + "start": 6, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/222/input.js b/packages/babel-parser/test/fixtures/es2015/uncategorised/222/input.js index 67f4e9ae35f3..2e33b3f144ba 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/222/input.js +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/222/input.js @@ -1 +1 @@ -({ obj:20 }) = 42 \ No newline at end of file +({ obj:20 } = 42) \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/222/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/222/options.json deleted file mode 100644 index e6630c3da3e8..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/222/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in object destructuring pattern (1:7)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/222/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/222/output.json new file mode 100644 index 000000000000..e758dffee7fa --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/222/output.json @@ -0,0 +1,165 @@ +{ + "type": "File", + "start": 0, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "errors": [ + "SyntaxError: Invalid left-hand side in object destructuring pattern (1:7)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 1, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "operator": "=", + "left": { + "type": "ObjectPattern", + "start": 1, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 3, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 3, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "obj" + }, + "name": "obj" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "NumericLiteral", + "start": 7, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "extra": { + "rawValue": 20, + "raw": "20" + }, + "value": 20 + } + } + ] + }, + "right": { + "type": "NumericLiteral", + "start": 14, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + }, + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/223/input.js b/packages/babel-parser/test/fixtures/es2015/uncategorised/223/input.js index 6c808fb17ea6..7cf8d0fb9429 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/223/input.js +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/223/input.js @@ -1 +1 @@ -( { get x() {} } ) = 0 \ No newline at end of file +( { get x() {} } = 0 ) \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/223/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/223/options.json deleted file mode 100644 index da1e10744904..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/223/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Object pattern can't contain getter or setter (1:8)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/223/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/223/output.json new file mode 100644 index 000000000000..426006b7cdfb --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/223/output.json @@ -0,0 +1,166 @@ +{ + "type": "File", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "errors": [ + "SyntaxError: Object pattern can't contain getter or setter (1:8)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 2, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "operator": "=", + "left": { + "type": "ObjectPattern", + "start": 2, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "properties": [ + { + "type": "ObjectMethod", + "start": 4, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 8, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + }, + "identifierName": "x" + }, + "name": "x" + }, + "computed": false, + "kind": "get", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 12, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "body": [], + "directives": [] + } + } + ] + }, + "right": { + "type": "NumericLiteral", + "start": 19, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + }, + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/226/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/226/options.json deleted file mode 100644 index 74c1a72d5030..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/226/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected keyword 'default' (1:9)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/226/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/226/output.json new file mode 100644 index 000000000000..c725f1875b33 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/226/output.json @@ -0,0 +1,90 @@ +{ + "type": "File", + "start": 0, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "errors": [ + "SyntaxError: Unexpected keyword 'default' (1:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 16 + }, + "identifierName": "default" + }, + "name": "default" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 19, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/227/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/227/options.json deleted file mode 100644 index 3f171f03c70c..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/227/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:44)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/227/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/227/output.json new file mode 100644 index 000000000000..2a794ddc885e --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/227/output.json @@ -0,0 +1,292 @@ +{ + "type": "File", + "start": 0, + "end": 59, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 59 + } + }, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:44)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 59, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 59 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 59, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 59 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 59, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 59 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 32, + "end": 57, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 57 + } + }, + "expression": { + "type": "ObjectExpression", + "start": 33, + "end": 55, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 55 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 35, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 35, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 36 + }, + "identifierName": "i" + }, + "name": "i" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "NumericLiteral", + "start": 38, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 38 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "extra": { + "rawValue": 10, + "raw": "10" + }, + "value": 10 + } + }, + { + "type": "ObjectMethod", + "start": 42, + "end": 53, + "loc": { + "start": { + "line": 1, + "column": 42 + }, + "end": { + "line": 1, + "column": 53 + } + }, + "method": true, + "key": { + "type": "Identifier", + "start": 42, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 42 + }, + "end": { + "line": 1, + "column": 43 + }, + "identifierName": "s" + }, + "name": "s" + }, + "computed": false, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 44, + "end": 48, + "loc": { + "start": { + "line": 1, + "column": 44 + }, + "end": { + "line": 1, + "column": 48 + }, + "identifierName": "eval" + }, + "name": "eval" + } + ], + "body": { + "type": "BlockStatement", + "start": 50, + "end": 53, + "loc": { + "start": { + "line": 1, + "column": 50 + }, + "end": { + "line": 1, + "column": 53 + } + }, + "body": [], + "directives": [] + } + } + ], + "extra": { + "parenthesized": true, + "parenStart": 32 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 18, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 18, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/228/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/228/options.json deleted file mode 100644 index a33dde469094..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/228/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Argument name clash (1:37)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/228/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/228/output.json new file mode 100644 index 000000000000..73e7c59a8b68 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/228/output.json @@ -0,0 +1,254 @@ +{ + "type": "File", + "start": 0, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 49 + } + }, + "errors": [ + "SyntaxError: Argument name clash (1:37)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 49 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 49 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "a" + }, + "name": "a" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 13, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 49 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 29, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 47 + } + }, + "expression": { + "type": "ObjectExpression", + "start": 30, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 45 + } + }, + "properties": [ + { + "type": "ObjectMethod", + "start": 32, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "method": true, + "key": { + "type": "Identifier", + "start": 32, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 33 + }, + "identifierName": "b" + }, + "name": "b" + }, + "computed": false, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 34, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 35 + }, + "identifierName": "t" + }, + "name": "t" + }, + { + "type": "Identifier", + "start": 37, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 38 + }, + "identifierName": "t" + }, + "name": "t" + } + ], + "body": { + "type": "BlockStatement", + "start": 40, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 40 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "body": [], + "directives": [] + } + } + ], + "extra": { + "parenthesized": true, + "parenStart": 29 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 15, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 15, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/229/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/229/options.json deleted file mode 100644 index 5c79fd4f4ff2..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/229/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected keyword 'super' (1:4)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/229/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/229/output.json new file mode 100644 index 000000000000..c129c3fce1d1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/229/output.json @@ -0,0 +1,89 @@ +{ + "type": "File", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "errors": [ + "SyntaxError: Unexpected keyword 'super' (1:4)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "id": { + "type": "Identifier", + "start": 4, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 9 + }, + "identifierName": "super" + }, + "name": "super" + }, + "init": null + } + ], + "kind": "var" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/230/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/230/options.json deleted file mode 100644 index 8a17d90eba69..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/230/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected keyword 'default' (1:4)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/230/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/230/output.json new file mode 100644 index 000000000000..e901e11e9473 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/230/output.json @@ -0,0 +1,89 @@ +{ + "type": "File", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "errors": [ + "SyntaxError: Unexpected keyword 'default' (1:4)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "id": { + "type": "Identifier", + "start": 4, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 11 + }, + "identifierName": "default" + }, + "name": "default" + }, + "init": null + } + ], + "kind": "var" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/231/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/231/options.json deleted file mode 100644 index 8a17d90eba69..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/231/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected keyword 'default' (1:4)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/231/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/231/output.json new file mode 100644 index 000000000000..635346ad81de --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/231/output.json @@ -0,0 +1,89 @@ +{ + "type": "File", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "errors": [ + "SyntaxError: Unexpected keyword 'default' (1:4)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "id": { + "type": "Identifier", + "start": 4, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 11 + }, + "identifierName": "default" + }, + "name": "default" + }, + "init": null + } + ], + "kind": "let" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/232/input.js b/packages/babel-parser/test/fixtures/es2015/uncategorised/232/input.js index 49ff0434557a..5b6b54d778e4 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/232/input.js +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/232/input.js @@ -1 +1 @@ -const default \ No newline at end of file +const default = 2 \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/232/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/232/options.json deleted file mode 100644 index d91e2a5bbc25..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/232/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected keyword 'default' (1:6)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/232/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/232/output.json new file mode 100644 index 000000000000..760cb15ffdeb --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/232/output.json @@ -0,0 +1,108 @@ +{ + "type": "File", + "start": 0, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "errors": [ + "SyntaxError: Unexpected keyword 'default' (1:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 6, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 13 + }, + "identifierName": "default" + }, + "name": "default" + }, + "init": { + "type": "NumericLiteral", + "start": 16, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "extra": { + "rawValue": 2, + "raw": "2" + }, + "value": 2 + } + } + ], + "kind": "const" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/233/input.js b/packages/babel-parser/test/fixtures/es2015/uncategorised/233/input.js index 40ac1e2b4639..7afe6af895a0 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/233/input.js +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/233/input.js @@ -1 +1 @@ -"use strict"; ({ v: eval }) = obj \ No newline at end of file +"use strict"; ({ v: eval } = obj) \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/233/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/233/options.json deleted file mode 100644 index 084570ac7584..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/233/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Assigning to 'eval' in strict mode (1:20)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/233/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/233/output.json new file mode 100644 index 000000000000..bd58e38aa176 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/233/output.json @@ -0,0 +1,195 @@ +{ + "type": "File", + "start": 0, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "errors": [ + "SyntaxError: Assigning to 'eval' in strict mode (1:20)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 14, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 15, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "operator": "=", + "left": { + "type": "ObjectPattern", + "start": 15, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 17, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 17, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + }, + "identifierName": "v" + }, + "name": "v" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "Identifier", + "start": 20, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 24 + }, + "identifierName": "eval" + }, + "name": "eval" + } + } + ] + }, + "right": { + "type": "Identifier", + "start": 29, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 32 + }, + "identifierName": "obj" + }, + "name": "obj" + }, + "extra": { + "parenthesized": true, + "parenStart": 14 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/234/input.js b/packages/babel-parser/test/fixtures/es2015/uncategorised/234/input.js index cb924f3bb153..2e399474efe9 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/234/input.js +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/234/input.js @@ -1 +1 @@ -"use strict"; ({ v: arguments }) = obj \ No newline at end of file +"use strict"; ({ v: arguments } = obj) \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/234/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/234/options.json deleted file mode 100644 index bfa460f59bbd..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/234/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Assigning to 'arguments' in strict mode (1:20)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/234/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/234/output.json new file mode 100644 index 000000000000..60d3496c8663 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/234/output.json @@ -0,0 +1,195 @@ +{ + "type": "File", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "errors": [ + "SyntaxError: Assigning to 'arguments' in strict mode (1:20)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 14, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 15, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "operator": "=", + "left": { + "type": "ObjectPattern", + "start": 15, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 17, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 17, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + }, + "identifierName": "v" + }, + "name": "v" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "Identifier", + "start": 20, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 29 + }, + "identifierName": "arguments" + }, + "name": "arguments" + } + } + ] + }, + "right": { + "type": "Identifier", + "start": 34, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 37 + }, + "identifierName": "obj" + }, + "name": "obj" + }, + "extra": { + "parenthesized": true, + "parenStart": 14 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/235/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/235/options.json deleted file mode 100644 index 68677faac9b9..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/235/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "for-in loop variable declaration may not have an initializer (1:5)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/235/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/235/output.json new file mode 100644 index 000000000000..f42607bf0849 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/235/output.json @@ -0,0 +1,206 @@ +{ + "type": "File", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "errors": [ + "SyntaxError: for-in loop variable declaration may not have an initializer (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ForInStatement", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "left": { + "type": "VariableDeclaration", + "start": 5, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 9, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "x" + }, + "name": "x" + }, + "init": { + "type": "NumericLiteral", + "start": 13, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + ], + "kind": "let" + }, + "right": { + "type": "Identifier", + "start": 19, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 23 + }, + "identifierName": "list" + }, + "name": "list" + }, + "body": { + "type": "ExpressionStatement", + "start": 25, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "expression": { + "type": "CallExpression", + "start": 25, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "callee": { + "type": "Identifier", + "start": 25, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 32 + }, + "identifierName": "process" + }, + "name": "process" + }, + "arguments": [ + { + "type": "Identifier", + "start": 33, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 34 + }, + "identifierName": "x" + }, + "name": "x" + } + ] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/236/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/236/options.json deleted file mode 100644 index 1fc5db8949ff..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/236/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "for-of loop variable declaration may not have an initializer (1:5)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/236/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/236/output.json new file mode 100644 index 000000000000..1679566d43da --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/236/output.json @@ -0,0 +1,207 @@ +{ + "type": "File", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "errors": [ + "SyntaxError: for-of loop variable declaration may not have an initializer (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ForOfStatement", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "await": false, + "left": { + "type": "VariableDeclaration", + "start": 5, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 9, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "x" + }, + "name": "x" + }, + "init": { + "type": "NumericLiteral", + "start": 13, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + ], + "kind": "let" + }, + "right": { + "type": "Identifier", + "start": 19, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 23 + }, + "identifierName": "list" + }, + "name": "list" + }, + "body": { + "type": "ExpressionStatement", + "start": 25, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "expression": { + "type": "CallExpression", + "start": 25, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "callee": { + "type": "Identifier", + "start": 25, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 32 + }, + "identifierName": "process" + }, + "name": "process" + }, + "arguments": [ + { + "type": "Identifier", + "start": 33, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 34 + }, + "identifierName": "x" + }, + "name": "x" + } + ] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/242/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/242/options.json deleted file mode 100644 index 92845f5f2081..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/242/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Assigning to 'eval' in strict mode (1:15)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/242/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/242/output.json new file mode 100644 index 000000000000..3731ec6d7b75 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/242/output.json @@ -0,0 +1,182 @@ +{ + "type": "File", + "start": 0, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "errors": [ + "SyntaxError: Assigning to 'eval' in strict mode (1:15)", + "SyntaxError: Binding 'eval' in strict mode (1:15)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 14, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 14, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "AssignmentPattern", + "start": 15, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "left": { + "type": "Identifier", + "start": 15, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 19 + }, + "identifierName": "eval" + }, + "name": "eval" + }, + "right": { + "type": "NumericLiteral", + "start": 22, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "extra": { + "rawValue": 10, + "raw": "10" + }, + "value": 10 + } + } + ], + "body": { + "type": "NumericLiteral", + "start": 29, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/243/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/243/options.json deleted file mode 100644 index ad54c428a2f9..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/243/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:14)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/243/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/243/output.json new file mode 100644 index 000000000000..dbffe6547ab5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/243/output.json @@ -0,0 +1,146 @@ +{ + "type": "File", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:14)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 14, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 14, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 14, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 18 + }, + "identifierName": "eval" + }, + "name": "eval" + } + ], + "body": { + "type": "NumericLiteral", + "start": 22, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/244/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/244/options.json deleted file mode 100644 index bfa08eae293e..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/244/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'arguments' in strict mode (1:14)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/244/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/244/output.json new file mode 100644 index 000000000000..1b3ed15f002e --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/244/output.json @@ -0,0 +1,146 @@ +{ + "type": "File", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "errors": [ + "SyntaxError: Binding 'arguments' in strict mode (1:14)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 14, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 14, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 14, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 23 + }, + "identifierName": "arguments" + }, + "name": "arguments" + } + ], + "body": { + "type": "NumericLiteral", + "start": 27, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/245/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/245/options.json deleted file mode 100644 index 794c4864d4e5..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/245/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:15)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/245/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/245/output.json new file mode 100644 index 000000000000..6b7ae83c0ad2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/245/output.json @@ -0,0 +1,163 @@ +{ + "type": "File", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:15)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 14, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 14, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 15, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 19 + }, + "identifierName": "eval" + }, + "name": "eval" + }, + { + "type": "Identifier", + "start": 21, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + }, + "identifierName": "a" + }, + "name": "a" + } + ], + "body": { + "type": "NumericLiteral", + "start": 27, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/246/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/246/options.json deleted file mode 100644 index 212d35fcb5fe..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/246/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'arguments' in strict mode (1:15)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/246/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/246/output.json new file mode 100644 index 000000000000..c681755fb108 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/246/output.json @@ -0,0 +1,163 @@ +{ + "type": "File", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "errors": [ + "SyntaxError: Binding 'arguments' in strict mode (1:15)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 14, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 14, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 15, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 24 + }, + "identifierName": "arguments" + }, + "name": "arguments" + }, + { + "type": "Identifier", + "start": 26, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 27 + }, + "identifierName": "a" + }, + "name": "a" + } + ], + "body": { + "type": "NumericLiteral", + "start": 32, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/247/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/247/options.json deleted file mode 100644 index 794c4864d4e5..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/247/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:15)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/247/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/247/output.json new file mode 100644 index 000000000000..b8b375182e2c --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/247/output.json @@ -0,0 +1,198 @@ +{ + "type": "File", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:15)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 14, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 14, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 15, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 19 + }, + "identifierName": "eval" + }, + "name": "eval" + }, + { + "type": "AssignmentPattern", + "start": 21, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "left": { + "type": "Identifier", + "start": 21, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + }, + "identifierName": "a" + }, + "name": "a" + }, + "right": { + "type": "NumericLiteral", + "start": 25, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "extra": { + "rawValue": 10, + "raw": "10" + }, + "value": 10 + } + } + ], + "body": { + "type": "NumericLiteral", + "start": 32, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/248/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/248/options.json deleted file mode 100644 index b99fd35222b1..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/248/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Argument name clash (1:18)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/248/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/248/output.json new file mode 100644 index 000000000000..3a5f60bdddea --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/248/output.json @@ -0,0 +1,163 @@ +{ + "type": "File", + "start": 0, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "errors": [ + "SyntaxError: Argument name clash (1:18)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 14, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 14, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 15, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + }, + "identifierName": "a" + }, + "name": "a" + }, + { + "type": "Identifier", + "start": 18, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + }, + "identifierName": "a" + }, + "name": "a" + } + ], + "body": { + "type": "NumericLiteral", + "start": 24, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/249/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/249/options.json deleted file mode 100644 index 79a05e62290e..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/249/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Legacy octal literals are not allowed in strict mode (1:21)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/249/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/249/output.json new file mode 100644 index 000000000000..18c0889f74b8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/249/output.json @@ -0,0 +1,146 @@ +{ + "type": "File", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "errors": [ + "SyntaxError: Legacy octal literals are not allowed in strict mode (1:21)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 14, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 14, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 15, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + }, + "identifierName": "a" + }, + "name": "a" + } + ], + "body": { + "type": "NumericLiteral", + "start": 21, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "extra": { + "rawValue": 0, + "raw": "00" + }, + "value": 0 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/251/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/251/options.json deleted file mode 100644 index 99ffc0de0153..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/251/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in arrow function parameters (1:1)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/251/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/251/output.json new file mode 100644 index 000000000000..a7c444dfbcdc --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/251/output.json @@ -0,0 +1,113 @@ +{ + "type": "File", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "errors": [ + "SyntaxError: Binding invalid left-hand side in function parameter list (1:1)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "NumericLiteral", + "start": 1, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "extra": { + "rawValue": 10, + "raw": "10" + }, + "value": 10 + } + ], + "body": { + "type": "NumericLiteral", + "start": 8, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "extra": { + "rawValue": 0, + "raw": "00" + }, + "value": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/252/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/252/options.json deleted file mode 100644 index 99ffc0de0153..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/252/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in arrow function parameters (1:1)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/252/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/252/output.json new file mode 100644 index 000000000000..2d80f047d283 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/252/output.json @@ -0,0 +1,134 @@ +{ + "type": "File", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "errors": [ + "SyntaxError: Binding invalid left-hand side in function parameter list (1:1)", + "SyntaxError: Binding invalid left-hand side in function parameter list (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "NumericLiteral", + "start": 1, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "extra": { + "rawValue": 10, + "raw": "10" + }, + "value": 10 + }, + { + "type": "NumericLiteral", + "start": 5, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "extra": { + "rawValue": 20, + "raw": "20" + }, + "value": 20 + } + ], + "body": { + "type": "NumericLiteral", + "start": 12, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "extra": { + "rawValue": 0, + "raw": "00" + }, + "value": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/280/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/280/options.json deleted file mode 100644 index 5cbee309bd50..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/280/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Argument name clash (1:30)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/280/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/280/output.json new file mode 100644 index 000000000000..299c0dabdaa1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/280/output.json @@ -0,0 +1,216 @@ +{ + "type": "File", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "errors": [ + "SyntaxError: Argument name clash (1:30)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 14, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "id": { + "type": "Identifier", + "start": 23, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + }, + "identifierName": "x" + }, + "name": "x" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 25, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + }, + "identifierName": "a" + }, + "name": "a" + }, + { + "type": "ObjectPattern", + "start": 28, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 30, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 30, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 31 + }, + "identifierName": "a" + }, + "name": "a" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start": 30, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 31 + }, + "identifierName": "a" + }, + "name": "a" + }, + "extra": { + "shorthand": true + } + } + ] + } + ], + "body": { + "type": "BlockStatement", + "start": 34, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/281/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/281/options.json deleted file mode 100644 index 8dba9882c0dc..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/281/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Argument name clash (1:47)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/281/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/281/output.json new file mode 100644 index 000000000000..50b6eca3fddd --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/281/output.json @@ -0,0 +1,392 @@ +{ + "type": "File", + "start": 0, + "end": 56, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 56 + } + }, + "errors": [ + "SyntaxError: Argument name clash (1:47)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 56, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 56 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 14, + "end": 56, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 56 + } + }, + "id": { + "type": "Identifier", + "start": 23, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + }, + "identifierName": "x" + }, + "name": "x" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "ObjectPattern", + "start": 25, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 27, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 27, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + }, + "identifierName": "b" + }, + "name": "b" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "ObjectPattern", + "start": 30, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 32, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 32, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 33 + }, + "identifierName": "a" + }, + "name": "a" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start": 32, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 33 + }, + "identifierName": "a" + }, + "name": "a" + }, + "extra": { + "shorthand": true + } + } + ] + } + } + ] + }, + { + "type": "ArrayPattern", + "start": 39, + "end": 53, + "loc": { + "start": { + "line": 1, + "column": 39 + }, + "end": { + "line": 1, + "column": 53 + } + }, + "elements": [ + { + "type": "ObjectPattern", + "start": 40, + "end": 52, + "loc": { + "start": { + "line": 1, + "column": 40 + }, + "end": { + "line": 1, + "column": 52 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 42, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 42 + }, + "end": { + "line": 1, + "column": 50 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 42, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 42 + }, + "end": { + "line": 1, + "column": 43 + }, + "identifierName": "b" + }, + "name": "b" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "ObjectPattern", + "start": 45, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 45 + }, + "end": { + "line": 1, + "column": 50 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 47, + "end": 48, + "loc": { + "start": { + "line": 1, + "column": 47 + }, + "end": { + "line": 1, + "column": 48 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 47, + "end": 48, + "loc": { + "start": { + "line": 1, + "column": 47 + }, + "end": { + "line": 1, + "column": 48 + }, + "identifierName": "a" + }, + "name": "a" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start": 47, + "end": 48, + "loc": { + "start": { + "line": 1, + "column": 47 + }, + "end": { + "line": 1, + "column": 48 + }, + "identifierName": "a" + }, + "name": "a" + }, + "extra": { + "shorthand": true + } + } + ] + } + } + ] + } + ] + } + ], + "body": { + "type": "BlockStatement", + "start": 54, + "end": 56, + "loc": { + "start": { + "line": 1, + "column": 54 + }, + "end": { + "line": 1, + "column": 56 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/284/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/284/options.json deleted file mode 100644 index 71f5061aff9a..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/284/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in arrow function parameters (1:3)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/284/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/284/output.json new file mode 100644 index 000000000000..68f6ccb7cefc --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/284/output.json @@ -0,0 +1,127 @@ +{ + "type": "File", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "errors": [ + "SyntaxError: Binding invalid left-hand side in array destructuring pattern (1:3)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "ArrayPattern", + "start": 1, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "elements": [ + { + "type": "NumericLiteral", + "start": 3, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "extra": { + "rawValue": 5, + "raw": "5" + }, + "value": 5 + } + ] + } + ], + "body": { + "type": "BlockStatement", + "start": 11, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "body": [], + "directives": [] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/289/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/289/options.json deleted file mode 100644 index a8f0b3c33031..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/289/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:5)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/289/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/289/output.json new file mode 100644 index 000000000000..db0bdfa5417b --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/289/output.json @@ -0,0 +1,184 @@ +{ + "type": "File", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "expression": { + "type": "ObjectExpression", + "start": 1, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "properties": [ + { + "type": "ObjectMethod", + "start": 3, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "method": true, + "key": { + "type": "Identifier", + "start": 3, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + }, + "identifierName": "t" + }, + "name": "t" + }, + "computed": false, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 5, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 9 + }, + "identifierName": "eval" + }, + "name": "eval" + } + ], + "body": { + "type": "BlockStatement", + "start": 11, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 13, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 13, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/290/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/290/options.json deleted file mode 100644 index 473cd470d4f1..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/290/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:23)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/290/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/290/output.json new file mode 100644 index 000000000000..34fe89ec4c5a --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/290/output.json @@ -0,0 +1,165 @@ +{ + "type": "File", + "start": 0, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:23)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 14, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 14, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "expressions": [ + { + "type": "Identifier", + "start": 17, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 21 + }, + "identifierName": "test" + }, + "name": "test" + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start": 15, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "value": { + "raw": "", + "cooked": "" + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 22, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "value": { + "raw": "\\02", + "cooked": null + }, + "tail": true + } + ] + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/291/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/291/options.json deleted file mode 100644 index ae24fbee33c8..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/291/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "'import' and 'export' may only appear at the top level (1:7)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/291/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/291/output.json new file mode 100644 index 000000000000..42655f4b978c --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/291/output.json @@ -0,0 +1,111 @@ +{ + "type": "File", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "errors": [ + "SyntaxError: 'import' and 'export' may only appear at the top level (1:7)", + "SyntaxError: 'import' and 'export' may appear only with 'sourceType: \"module\"' (1:7)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "IfStatement", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "test": { + "type": "NumericLiteral", + "start": 4, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + }, + "consequent": { + "type": "ImportDeclaration", + "start": 7, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "specifiers": [], + "source": { + "type": "StringLiteral", + "start": 14, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "extra": { + "rawValue": "acorn", + "raw": "\"acorn\"" + }, + "value": "acorn" + } + }, + "alternate": null + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/296/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/296/options.json deleted file mode 100644 index 794c4864d4e5..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/296/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:15)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/296/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/296/output.json new file mode 100644 index 000000000000..49e0835c1bfc --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/296/output.json @@ -0,0 +1,146 @@ +{ + "type": "File", + "start": 0, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:15)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 14, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 14, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 15, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 19 + }, + "identifierName": "eval" + }, + "name": "eval" + } + ], + "body": { + "type": "NumericLiteral", + "start": 24, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/297/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/297/options.json deleted file mode 100644 index cc2bef2a9a34..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/297/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:1)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/297/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/297/output.json new file mode 100644 index 000000000000..85866aeddd23 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/297/output.json @@ -0,0 +1,179 @@ +{ + "type": "File", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:1)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 1, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "eval" + }, + "name": "eval" + } + ], + "body": { + "type": "BlockStatement", + "start": 10, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 26, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 26, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 12, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 12, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/298/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/298/options.json deleted file mode 100644 index 49d27a1476b0..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/298/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Object pattern can't contain getter or setter (1:7)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/298/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/298/output.json new file mode 100644 index 000000000000..fd0a014544e3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/298/output.json @@ -0,0 +1,166 @@ +{ + "type": "File", + "start": 0, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "errors": [ + "SyntaxError: Object pattern can't contain getter or setter (1:7)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 0, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "ObjectPattern", + "start": 1, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "properties": [ + { + "type": "ObjectMethod", + "start": 3, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 7, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 11 + }, + "identifierName": "test" + }, + "name": "test" + }, + "computed": false, + "kind": "get", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 14, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "body": [], + "directives": [] + } + } + ] + } + ], + "body": { + "type": "NumericLiteral", + "start": 24, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/324/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/324/options.json deleted file mode 100644 index d921abda8ff6..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/324/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Complex binding patterns require an initialization value (1:7)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/324/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/324/output.json new file mode 100644 index 000000000000..09ca9d8754be --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/324/output.json @@ -0,0 +1,106 @@ +{ + "type": "File", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "errors": [ + "SyntaxError: Complex binding patterns require an initialization value (1:7)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "id": { + "type": "ArrayPattern", + "start": 4, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "elements": [ + { + "type": "Identifier", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "x" + }, + "name": "x" + } + ] + }, + "init": null + } + ], + "kind": "let" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/325/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/325/options.json deleted file mode 100644 index d921abda8ff6..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/325/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Complex binding patterns require an initialization value (1:7)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/325/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/325/output.json new file mode 100644 index 000000000000..6d0d7ab1d050 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/325/output.json @@ -0,0 +1,106 @@ +{ + "type": "File", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "errors": [ + "SyntaxError: Complex binding patterns require an initialization value (1:7)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "id": { + "type": "ArrayPattern", + "start": 4, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "elements": [ + { + "type": "Identifier", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "x" + }, + "name": "x" + } + ] + }, + "init": null + } + ], + "kind": "var" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/329/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/329/options.json deleted file mode 100644 index 97818d2eea7e..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/329/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Lexical declaration cannot appear in a single-statement context (1:9)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/329/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/329/output.json new file mode 100644 index 000000000000..9b5c4b8b1857 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/329/output.json @@ -0,0 +1,126 @@ +{ + "type": "File", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "errors": [ + "SyntaxError: Lexical declaration cannot appear in a single-statement context (1:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ForStatement", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "init": null, + "test": null, + "update": null, + "body": { + "type": "VariableDeclaration", + "start": 9, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 15, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "id": { + "type": "Identifier", + "start": 15, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + }, + "identifierName": "x" + }, + "name": "x" + }, + "init": { + "type": "NumericLiteral", + "start": 19, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "extra": { + "rawValue": 10, + "raw": "10" + }, + "value": 10 + } + } + ], + "kind": "const" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/332/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/332/options.json deleted file mode 100644 index 5718d0551359..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/332/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Assigning to 'eval' in strict mode (1:18)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/332/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/332/output.json new file mode 100644 index 000000000000..cc9bdf3e164e --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/332/output.json @@ -0,0 +1,171 @@ +{ + "type": "File", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "errors": [ + "SyntaxError: Assigning to 'eval' in strict mode (1:18)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 14, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 14, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "operator": "=", + "left": { + "type": "ArrayPattern", + "start": 14, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "elements": [ + { + "type": "RestElement", + "start": 15, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "argument": { + "type": "Identifier", + "start": 18, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 22 + }, + "identifierName": "eval" + }, + "name": "eval" + } + } + ] + }, + "right": { + "type": "Identifier", + "start": 26, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 29 + }, + "identifierName": "arr" + }, + "name": "arr" + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/333/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/333/options.json deleted file mode 100644 index 567e40541c5b..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/333/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected reserved word 'eval' (1:16)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/333/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/333/output.json new file mode 100644 index 000000000000..5d9acaecea9b --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/333/output.json @@ -0,0 +1,231 @@ +{ + "type": "File", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "errors": [ + "SyntaxError: Unexpected reserved word 'eval' (1:16)", + "SyntaxError: Assigning to 'eval' in strict mode (1:16)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 14, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 15, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "operator": "=", + "left": { + "type": "ObjectPattern", + "start": 15, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 16, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 16, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 20 + }, + "identifierName": "eval" + }, + "name": "eval" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "AssignmentPattern", + "start": 16, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "left": { + "type": "Identifier", + "start": 16, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 20 + }, + "identifierName": "eval" + }, + "name": "eval" + }, + "right": { + "type": "Identifier", + "start": 23, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 31 + }, + "identifierName": "defValue" + }, + "name": "defValue" + } + }, + "extra": { + "shorthand": true + } + } + ] + }, + "right": { + "type": "Identifier", + "start": 35, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 38 + }, + "identifierName": "obj" + }, + "name": "obj" + }, + "extra": { + "parenthesized": true, + "parenStart": 14 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/334/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/334/options.json index e31fbe3a64b9..54925950e059 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/334/options.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/334/options.json @@ -1,4 +1,3 @@ { - "sourceType": "module", - "throws": "Assigning to 'eval' in strict mode (1:4)" -} + "sourceType": "module" +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/334/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/334/output.json new file mode 100644 index 000000000000..a1414d86bbf6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/334/output.json @@ -0,0 +1,135 @@ +{ + "type": "File", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "errors": [ + "SyntaxError: Assigning to 'eval' in strict mode (1:4)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "operator": "=", + "left": { + "type": "ArrayPattern", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "elements": [ + { + "type": "RestElement", + "start": 1, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "argument": { + "type": "Identifier", + "start": 4, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 8 + }, + "identifierName": "eval" + }, + "name": "eval" + } + } + ] + }, + "right": { + "type": "Identifier", + "start": 12, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 15 + }, + "identifierName": "arr" + }, + "name": "arr" + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/339/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/339/options.json deleted file mode 100644 index fd4da953a419..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/339/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/339/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/339/output.json new file mode 100644 index 000000000000..86383c01feb1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/339/output.json @@ -0,0 +1,91 @@ +{ + "type": "File", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "expressions": [], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "value": { + "raw": "\\07", + "cooked": null + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/344/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/344/options.json deleted file mode 100644 index ad3fdc7d73f7..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/344/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "super is only allowed in object methods and classes (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/344/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/344/output.json new file mode 100644 index 000000000000..ee3b4cb3552b --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/344/output.json @@ -0,0 +1,69 @@ +{ + "type": "File", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "errors": [ + "SyntaxError: super is only allowed in object methods and classes (1:0)", + "SyntaxError: super can only be used with function calls (i.e. super()) or in property accesses (i.e. super.prop or super[prop]) (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "expression": { + "type": "Super", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/347/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/347/options.json deleted file mode 100644 index 9a137564eed4..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/347/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "setter must have exactly one formal parameter (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/347/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/347/output.json new file mode 100644 index 000000000000..31975621dcf1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/347/output.json @@ -0,0 +1,179 @@ +{ + "type": "File", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "errors": [ + "SyntaxError: setter must have exactly one formal parameter (1:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "body": [ + { + "type": "ClassMethod", + "start": 10, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "static": false, + "key": { + "type": "Identifier", + "start": 14, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 18 + }, + "identifierName": "prop" + }, + "name": "prop" + }, + "computed": false, + "kind": "set", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 19, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + }, + "identifierName": "x" + }, + "name": "x" + }, + { + "type": "Identifier", + "start": 22, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + }, + "identifierName": "y" + }, + "name": "y" + } + ], + "body": { + "type": "BlockStatement", + "start": 25, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/348/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/348/options.json deleted file mode 100644 index c1ac8e1d138d..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/348/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Redefinition of __proto__ property (1:17)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/348/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/348/output.json new file mode 100644 index 000000000000..49d20172fcc8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/348/output.json @@ -0,0 +1,184 @@ +{ + "type": "File", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "errors": [ + "SyntaxError: Redefinition of __proto__ property (1:17)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "expression": { + "type": "ObjectExpression", + "start": 1, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 3, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 3, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "__proto__" + }, + "name": "__proto__" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "NumericLiteral", + "start": 14, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + }, + { + "type": "ObjectProperty", + "start": 17, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 17, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 26 + }, + "identifierName": "__proto__" + }, + "name": "__proto__" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "NumericLiteral", + "start": 28, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "extra": { + "rawValue": 2, + "raw": "2" + }, + "value": 2 + } + } + ], + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/349/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/349/options.json deleted file mode 100644 index 0d3bc321ef03..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/349/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Redefinition of __proto__ property (1:19)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/349/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/349/output.json new file mode 100644 index 000000000000..ba254dda4d93 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/349/output.json @@ -0,0 +1,187 @@ +{ + "type": "File", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "errors": [ + "SyntaxError: Redefinition of __proto__ property (1:19)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "expression": { + "type": "ObjectExpression", + "start": 1, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 3, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "method": false, + "key": { + "type": "StringLiteral", + "start": 3, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "extra": { + "rawValue": "__proto__", + "raw": "'__proto__'" + }, + "value": "__proto__" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "NumericLiteral", + "start": 16, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + }, + { + "type": "ObjectProperty", + "start": 19, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 19, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 28 + }, + "identifierName": "__proto__" + }, + "name": "__proto__" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "NumericLiteral", + "start": 30, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "extra": { + "rawValue": 2, + "raw": "2" + }, + "value": 2 + } + } + ], + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/357/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/357/options.json index c148ada0c73a..54925950e059 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/357/options.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/357/options.json @@ -1,4 +1,3 @@ { - "sourceType": "module", - "throws": "Can not use keyword 'await' outside an async function (1:0)" -} + "sourceType": "module" +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/357/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/357/output.json new file mode 100644 index 000000000000..b5f573a72f13 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/357/output.json @@ -0,0 +1,119 @@ +{ + "type": "File", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "errors": [ + "SyntaxError: Can not use keyword 'await' outside an async function (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "operator": "=", + "left": { + "type": "Identifier", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "await" + }, + "name": "await" + }, + "right": { + "type": "CallExpression", + "start": 8, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "callee": { + "type": "Identifier", + "start": 8, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "arguments": [] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/359/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/359/options.json index fa250ba921b1..54925950e059 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/359/options.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/359/options.json @@ -1,4 +1,3 @@ { - "sourceType": "module", - "throws": "Can not use keyword 'await' outside an async function (1:6)" -} + "sourceType": "module" +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/359/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/359/output.json new file mode 100644 index 000000000000..cc297fab6b9f --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/359/output.json @@ -0,0 +1,121 @@ +{ + "type": "File", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "errors": [ + "SyntaxError: Can not use keyword 'await' outside an async function (1:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 6, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 11 + }, + "identifierName": "await" + }, + "name": "await" + }, + "init": { + "type": "CallExpression", + "start": 14, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "callee": { + "type": "Identifier", + "start": 14, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 17 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "arguments": [] + } + } + ], + "kind": "const" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/361/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/361/options.json index fd81c5071d1d..54925950e059 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/361/options.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/361/options.json @@ -1,4 +1,3 @@ { - "sourceType": "module", - "throws": "Can not use keyword 'await' outside an async function (1:8)" -} + "sourceType": "module" +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/361/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/361/output.json new file mode 100644 index 000000000000..1bbb6a10ec2c --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/361/output.json @@ -0,0 +1,176 @@ +{ + "type": "File", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "errors": [ + "SyntaxError: Can not use keyword 'await' outside an async function (1:8)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 6, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "id": { + "type": "ObjectPattern", + "start": 6, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 8, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 8, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 13 + }, + "identifierName": "await" + }, + "name": "await" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start": 8, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 13 + }, + "identifierName": "await" + }, + "name": "await" + }, + "extra": { + "shorthand": true + } + } + ] + }, + "init": { + "type": "CallExpression", + "start": 18, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "callee": { + "type": "Identifier", + "start": 18, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 21 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "arguments": [] + } + } + ], + "kind": "const" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/363/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/363/options.json index a72d4ab0ff7f..54925950e059 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/363/options.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/363/options.json @@ -1,4 +1,3 @@ { - "sourceType": "module", - "throws": "Can not use keyword 'await' outside an async function (1:15)" -} + "sourceType": "module" +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/363/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/363/output.json new file mode 100644 index 000000000000..8734398fed74 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/363/output.json @@ -0,0 +1,163 @@ +{ + "type": "File", + "start": 0, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "errors": [ + "SyntaxError: Can not use keyword 'await' outside an async function (1:15)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "ObjectPattern", + "start": 13, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 15, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 15, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 20 + }, + "identifierName": "await" + }, + "name": "await" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start": 15, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 20 + }, + "identifierName": "await" + }, + "name": "await" + }, + "extra": { + "shorthand": true + } + } + ] + } + ], + "body": { + "type": "BlockStatement", + "start": 24, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/365/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/365/options.json index 18d9310bd147..54925950e059 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/365/options.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/365/options.json @@ -1,4 +1,3 @@ { - "sourceType": "module", - "throws": "Can not use keyword 'await' outside an async function (1:9)" -} + "sourceType": "module" +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/365/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/365/output.json new file mode 100644 index 000000000000..9f69841ee631 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/365/output.json @@ -0,0 +1,90 @@ +{ + "type": "File", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "errors": [ + "SyntaxError: Can not use keyword 'await' outside an async function (1:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "await" + }, + "name": "await" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/367/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/367/options.json index fa250ba921b1..54925950e059 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/367/options.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/367/options.json @@ -1,4 +1,3 @@ { - "sourceType": "module", - "throws": "Can not use keyword 'await' outside an async function (1:6)" -} + "sourceType": "module" +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/367/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/367/output.json new file mode 100644 index 000000000000..12f2a4f35608 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/367/output.json @@ -0,0 +1,87 @@ +{ + "type": "File", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "errors": [ + "SyntaxError: Can not use keyword 'await' outside an async function (1:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 11 + }, + "identifierName": "await" + }, + "name": "await" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 12, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "body": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/368/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/368/options.json index 8e557dcc53af..53135cabff8f 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/368/options.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/368/options.json @@ -1,4 +1,3 @@ { - "sourceType": "script", - "throws": "Unexpected reserved word 'enum' (1:0)" -} + "sourceType": "script" +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/368/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/368/output.json new file mode 100644 index 000000000000..db0bfd7b2d15 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/368/output.json @@ -0,0 +1,119 @@ +{ + "type": "File", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "errors": [ + "SyntaxError: Unexpected reserved word 'enum' (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "operator": "=", + "left": { + "type": "Identifier", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + }, + "identifierName": "enum" + }, + "name": "enum" + }, + "right": { + "type": "CallExpression", + "start": 7, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "callee": { + "type": "Identifier", + "start": 7, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "arguments": [] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/369/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/369/options.json index 9ef8cae21e3e..54925950e059 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/369/options.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/369/options.json @@ -1,4 +1,3 @@ { - "sourceType": "module", - "throws": "Unexpected reserved word 'enum' (1:0)" -} + "sourceType": "module" +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/369/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/369/output.json new file mode 100644 index 000000000000..7f7235704637 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/369/output.json @@ -0,0 +1,119 @@ +{ + "type": "File", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "errors": [ + "SyntaxError: Unexpected reserved word 'enum' (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "operator": "=", + "left": { + "type": "Identifier", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + }, + "identifierName": "enum" + }, + "name": "enum" + }, + "right": { + "type": "CallExpression", + "start": 7, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "callee": { + "type": "Identifier", + "start": 7, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "arguments": [] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/37/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/37/options.json deleted file mode 100644 index 401518851fb6..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/37/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in arrow function parameters (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/37/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/37/output.json new file mode 100644 index 000000000000..074d84652acc --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/37/output.json @@ -0,0 +1,160 @@ +{ + "type": "File", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "errors": [ + "SyntaxError: Binding member expression (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "ArrayPattern", + "start": 1, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "elements": [ + { + "type": "MemberExpression", + "start": 2, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "object": { + "type": "Identifier", + "start": 2, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + }, + "identifierName": "a" + }, + "name": "a" + }, + "property": { + "type": "Identifier", + "start": 4, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "a" + }, + "name": "a" + }, + "computed": false + } + ] + } + ], + "body": { + "type": "NumericLiteral", + "start": 11, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/370/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/370/options.json index 55bc1ec84f4a..53135cabff8f 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/370/options.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/370/options.json @@ -1,4 +1,3 @@ { - "sourceType": "script", - "throws": "Unexpected reserved word 'enum' (1:6)" -} + "sourceType": "script" +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/370/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/370/output.json new file mode 100644 index 000000000000..6f19d31ea58f --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/370/output.json @@ -0,0 +1,121 @@ +{ + "type": "File", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "errors": [ + "SyntaxError: Unexpected reserved word 'enum' (1:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 6, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "enum" + }, + "name": "enum" + }, + "init": { + "type": "CallExpression", + "start": 13, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "callee": { + "type": "Identifier", + "start": 13, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 16 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "arguments": [] + } + } + ], + "kind": "const" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/371/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/371/options.json index e6801417951e..54925950e059 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/371/options.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/371/options.json @@ -1,4 +1,3 @@ { - "sourceType": "module", - "throws": "Unexpected reserved word 'enum' (1:6)" -} + "sourceType": "module" +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/371/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/371/output.json new file mode 100644 index 000000000000..c6e70262550d --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/371/output.json @@ -0,0 +1,121 @@ +{ + "type": "File", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "errors": [ + "SyntaxError: Unexpected reserved word 'enum' (1:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 6, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "enum" + }, + "name": "enum" + }, + "init": { + "type": "CallExpression", + "start": 13, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "callee": { + "type": "Identifier", + "start": 13, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 16 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "arguments": [] + } + } + ], + "kind": "const" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/372/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/372/options.json index 3ef9cf1c71bb..53135cabff8f 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/372/options.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/372/options.json @@ -1,4 +1,3 @@ { - "sourceType": "script", - "throws": "Unexpected reserved word 'enum' (1:8)" -} + "sourceType": "script" +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/372/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/372/output.json new file mode 100644 index 000000000000..7da63dd7a987 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/372/output.json @@ -0,0 +1,176 @@ +{ + "type": "File", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "errors": [ + "SyntaxError: Unexpected reserved word 'enum' (1:8)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 6, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "id": { + "type": "ObjectPattern", + "start": 6, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 8, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 8, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "enum" + }, + "name": "enum" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start": 8, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "enum" + }, + "name": "enum" + }, + "extra": { + "shorthand": true + } + } + ] + }, + "init": { + "type": "CallExpression", + "start": 17, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "callee": { + "type": "Identifier", + "start": 17, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 20 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "arguments": [] + } + } + ], + "kind": "const" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/373/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/373/options.json index 91d0958e3d0b..54925950e059 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/373/options.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/373/options.json @@ -1,4 +1,3 @@ { - "sourceType": "module", - "throws": "Unexpected reserved word 'enum' (1:8)" -} + "sourceType": "module" +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/373/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/373/output.json new file mode 100644 index 000000000000..f906a9f99eba --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/373/output.json @@ -0,0 +1,176 @@ +{ + "type": "File", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "errors": [ + "SyntaxError: Unexpected reserved word 'enum' (1:8)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 6, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "id": { + "type": "ObjectPattern", + "start": 6, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 8, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 8, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "enum" + }, + "name": "enum" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start": 8, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "enum" + }, + "name": "enum" + }, + "extra": { + "shorthand": true + } + } + ] + }, + "init": { + "type": "CallExpression", + "start": 17, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "callee": { + "type": "Identifier", + "start": 17, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 20 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "arguments": [] + } + } + ], + "kind": "const" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/374/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/374/options.json index be1d10ebd92c..53135cabff8f 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/374/options.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/374/options.json @@ -1,4 +1,3 @@ { - "sourceType": "script", - "throws": "Unexpected reserved word 'enum' (1:15)" -} + "sourceType": "script" +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/374/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/374/output.json new file mode 100644 index 000000000000..339a9b1d9aef --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/374/output.json @@ -0,0 +1,163 @@ +{ + "type": "File", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "errors": [ + "SyntaxError: Unexpected reserved word 'enum' (1:15)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "ObjectPattern", + "start": 13, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 15, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 15, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 19 + }, + "identifierName": "enum" + }, + "name": "enum" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start": 15, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 19 + }, + "identifierName": "enum" + }, + "name": "enum" + }, + "extra": { + "shorthand": true + } + } + ] + } + ], + "body": { + "type": "BlockStatement", + "start": 23, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/375/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/375/options.json index f3a107c75be7..54925950e059 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/375/options.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/375/options.json @@ -1,4 +1,3 @@ { - "sourceType": "module", - "throws": "Unexpected reserved word 'enum' (1:15)" -} + "sourceType": "module" +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/375/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/375/output.json new file mode 100644 index 000000000000..9ad60d6cf403 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/375/output.json @@ -0,0 +1,163 @@ +{ + "type": "File", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "errors": [ + "SyntaxError: Unexpected reserved word 'enum' (1:15)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "ObjectPattern", + "start": 13, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 15, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 15, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 19 + }, + "identifierName": "enum" + }, + "name": "enum" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start": 15, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 19 + }, + "identifierName": "enum" + }, + "name": "enum" + }, + "extra": { + "shorthand": true + } + } + ] + } + ], + "body": { + "type": "BlockStatement", + "start": 23, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/376/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/376/options.json index de270bbb0542..53135cabff8f 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/376/options.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/376/options.json @@ -1,4 +1,3 @@ { - "sourceType": "script", - "throws": "Unexpected reserved word 'enum' (1:9)" -} + "sourceType": "script" +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/376/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/376/output.json new file mode 100644 index 000000000000..ed7ac1e2953c --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/376/output.json @@ -0,0 +1,90 @@ +{ + "type": "File", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "errors": [ + "SyntaxError: Unexpected reserved word 'enum' (1:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 13 + }, + "identifierName": "enum" + }, + "name": "enum" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 16, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/377/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/377/options.json index 27f9ea278f30..54925950e059 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/377/options.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/377/options.json @@ -1,4 +1,3 @@ { - "sourceType": "module", - "throws": "Unexpected reserved word 'enum' (1:9)" -} + "sourceType": "module" +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/377/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/377/output.json new file mode 100644 index 000000000000..7a06864215ea --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/377/output.json @@ -0,0 +1,90 @@ +{ + "type": "File", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "errors": [ + "SyntaxError: Unexpected reserved word 'enum' (1:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 13 + }, + "identifierName": "enum" + }, + "name": "enum" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 16, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/378/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/378/options.json index 55bc1ec84f4a..53135cabff8f 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/378/options.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/378/options.json @@ -1,4 +1,3 @@ { - "sourceType": "script", - "throws": "Unexpected reserved word 'enum' (1:6)" -} + "sourceType": "script" +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/378/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/378/output.json new file mode 100644 index 000000000000..04f287aef702 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/378/output.json @@ -0,0 +1,87 @@ +{ + "type": "File", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "errors": [ + "SyntaxError: Unexpected reserved word 'enum' (1:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "enum" + }, + "name": "enum" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 11, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "body": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/379/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/379/options.json index e6801417951e..54925950e059 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/379/options.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/379/options.json @@ -1,4 +1,3 @@ { - "sourceType": "module", - "throws": "Unexpected reserved word 'enum' (1:6)" -} + "sourceType": "module" +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/379/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/379/output.json new file mode 100644 index 000000000000..0619ba17f596 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/379/output.json @@ -0,0 +1,87 @@ +{ + "type": "File", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "errors": [ + "SyntaxError: Unexpected reserved word 'enum' (1:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "enum" + }, + "name": "enum" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 11, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "body": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/395/options.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/395/options.json index db72a6af957d..6d24025b8674 100644 --- a/packages/babel-parser/test/fixtures/es2015/uncategorised/395/options.json +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/395/options.json @@ -1,4 +1,3 @@ { - "createParenthesizedExpressions": true, - "throws": "Invalid left-hand side in arrow function parameters (1:2)" -} + "createParenthesizedExpressions": true +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/uncategorised/395/output.json b/packages/babel-parser/test/fixtures/es2015/uncategorised/395/output.json new file mode 100644 index 000000000000..074d84652acc --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/uncategorised/395/output.json @@ -0,0 +1,160 @@ +{ + "type": "File", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "errors": [ + "SyntaxError: Binding member expression (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "ArrayPattern", + "start": 1, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "elements": [ + { + "type": "MemberExpression", + "start": 2, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "object": { + "type": "Identifier", + "start": 2, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + }, + "identifierName": "a" + }, + "name": "a" + }, + "property": { + "type": "Identifier", + "start": 4, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "a" + }, + "name": "a" + }, + "computed": false + } + ] + } + ], + "body": { + "type": "NumericLiteral", + "start": 11, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/yield/function-name-function-declaration-inside-generator/options.json b/packages/babel-parser/test/fixtures/es2015/yield/function-name-function-declaration-inside-generator/options.json deleted file mode 100644 index 37d7f62549c6..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/yield/function-name-function-declaration-inside-generator/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Can not use 'yield' as identifier inside a generator (2:11)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/yield/function-name-function-declaration-inside-generator/output.json b/packages/babel-parser/test/fixtures/es2015/yield/function-name-function-declaration-inside-generator/output.json new file mode 100644 index 000000000000..a545b4a024b1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/yield/function-name-function-declaration-inside-generator/output.json @@ -0,0 +1,143 @@ +{ + "type": "File", + "start": 0, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Can not use 'yield' as identifier inside a generator (2:11)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 10, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "fn" + }, + "name": "fn" + }, + "generator": true, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 15, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "FunctionDeclaration", + "start": 19, + "end": 38, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 21 + } + }, + "id": { + "type": "Identifier", + "start": 28, + "end": 33, + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 16 + }, + "identifierName": "yield" + }, + "name": "yield" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 36, + "end": 38, + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 21 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/yield/function-name-generator-expression/options.json b/packages/babel-parser/test/fixtures/es2015/yield/function-name-generator-expression/options.json deleted file mode 100644 index 72f8d0e0e4c3..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/yield/function-name-generator-expression/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Can not use 'yield' as identifier inside a generator (1:11)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/yield/function-name-generator-expression/output.json b/packages/babel-parser/test/fixtures/es2015/yield/function-name-generator-expression/output.json new file mode 100644 index 000000000000..39554296d4c3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/yield/function-name-generator-expression/output.json @@ -0,0 +1,122 @@ +{ + "type": "File", + "start": 0, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "errors": [ + "SyntaxError: Can not use 'yield' as identifier inside a generator (1:11)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "expression": { + "type": "UnaryExpression", + "start": 0, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "operator": "+", + "prefix": true, + "argument": { + "type": "FunctionExpression", + "start": 1, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "id": { + "type": "Identifier", + "start": 11, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 16 + }, + "identifierName": "yield" + }, + "name": "yield" + }, + "generator": true, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 19, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "body": [], + "directives": [] + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/yield/function-name-strict-body/options.json b/packages/babel-parser/test/fixtures/es2015/yield/function-name-strict-body/options.json deleted file mode 100644 index e55b18eb4f07..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/yield/function-name-strict-body/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'yield' in strict mode (1:9)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/yield/function-name-strict-body/output.json b/packages/babel-parser/test/fixtures/es2015/yield/function-name-strict-body/output.json new file mode 100644 index 000000000000..1a8500a416fb --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/yield/function-name-strict-body/output.json @@ -0,0 +1,126 @@ +{ + "type": "File", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "errors": [ + "SyntaxError: Binding 'yield' in strict mode (1:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "yield" + }, + "name": "yield" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 19, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 19, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/yield/function-name-strict/options.json b/packages/babel-parser/test/fixtures/es2015/yield/function-name-strict/options.json deleted file mode 100644 index 320734ea2ef7..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/yield/function-name-strict/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected reserved word 'yield' (2:9)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/yield/function-name-strict/output.json b/packages/babel-parser/test/fixtures/es2015/yield/function-name-strict/output.json new file mode 100644 index 000000000000..19d96b67a349 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/yield/function-name-strict/output.json @@ -0,0 +1,126 @@ +{ + "type": "File", + "start": 0, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "errors": [ + "SyntaxError: Unexpected reserved word 'yield' (2:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 14, + "end": 33, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "id": { + "type": "Identifier", + "start": 23, + "end": 28, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 14 + }, + "identifierName": "yield" + }, + "name": "yield" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 31, + "end": 33, + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/yield/in-class-heritage/options.json b/packages/babel-parser/test/fixtures/es2015/yield/in-class-heritage/options.json index e817f30acb5c..23c503c046ad 100644 --- a/packages/babel-parser/test/fixtures/es2015/yield/in-class-heritage/options.json +++ b/packages/babel-parser/test/fixtures/es2015/yield/in-class-heritage/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected reserved word 'yield' (1:16)" -} + "throws": "Unexpected token, expected \"{\" (1:22)" +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/yield/in-iterator-stmt/options.json b/packages/babel-parser/test/fixtures/es2015/yield/in-iterator-stmt/options.json index ad46a65e5082..589316ba5b14 100644 --- a/packages/babel-parser/test/fixtures/es2015/yield/in-iterator-stmt/options.json +++ b/packages/babel-parser/test/fixtures/es2015/yield/in-iterator-stmt/options.json @@ -1,3 +1,3 @@ { - "throws": "Invalid left-hand side in for-in statement (2:7)" -} + "throws": "Unexpected token, expected \")\" (2:21)" +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-1/options.json b/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-1/options.json deleted file mode 100644 index 75b3f62fdacb..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-1/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Yield cannot be used as name inside a generator function (2:7)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-1/output.json b/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-1/output.json new file mode 100644 index 000000000000..6639d749ab68 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-1/output.json @@ -0,0 +1,192 @@ +{ + "type": "File", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Yield cannot be used as name inside a generator function (2:7)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 10, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "fn" + }, + "name": "fn" + }, + "generator": true, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 15, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 19, + "end": 37, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 20 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 19, + "end": 36, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "AssignmentPattern", + "start": 20, + "end": 29, + "loc": { + "start": { + "line": 2, + "column": 3 + }, + "end": { + "line": 2, + "column": 12 + } + }, + "left": { + "type": "Identifier", + "start": 20, + "end": 21, + "loc": { + "start": { + "line": 2, + "column": 3 + }, + "end": { + "line": 2, + "column": 4 + }, + "identifierName": "x" + }, + "name": "x" + }, + "right": { + "type": "YieldExpression", + "start": 24, + "end": 29, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 12 + } + }, + "delegate": false, + "argument": null + } + } + ], + "body": { + "type": "BlockStatement", + "start": 34, + "end": 36, + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "body": [], + "directives": [] + } + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-2/options.json b/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-2/options.json deleted file mode 100644 index 9d35f54190c8..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-2/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Yield cannot be used as name inside a generator function (2:15)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-2/output.json b/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-2/output.json new file mode 100644 index 000000000000..b029ca9f0ce9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-2/output.json @@ -0,0 +1,331 @@ +{ + "type": "File", + "start": 0, + "end": 53, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Yield cannot be used as name inside a generator function (2:15)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 53, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 53, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 10, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "fn" + }, + "name": "fn" + }, + "generator": true, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 15, + "end": 53, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 19, + "end": 51, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 34 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 19, + "end": 50, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 33 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "AssignmentPattern", + "start": 20, + "end": 43, + "loc": { + "start": { + "line": 2, + "column": 3 + }, + "end": { + "line": 2, + "column": 26 + } + }, + "left": { + "type": "Identifier", + "start": 20, + "end": 21, + "loc": { + "start": { + "line": 2, + "column": 3 + }, + "end": { + "line": 2, + "column": 4 + }, + "identifierName": "x" + }, + "name": "x" + }, + "right": { + "type": "BinaryExpression", + "start": 24, + "end": 43, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 26 + } + }, + "left": { + "type": "NumericLiteral", + "start": 24, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 8 + } + }, + "extra": { + "rawValue": 3, + "raw": "3" + }, + "value": 3 + }, + "operator": "+", + "right": { + "type": "BinaryExpression", + "start": 28, + "end": 43, + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 26 + } + }, + "left": { + "type": "CallExpression", + "start": 28, + "end": 38, + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 21 + } + }, + "callee": { + "type": "MemberExpression", + "start": 28, + "end": 31, + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "object": { + "type": "Identifier", + "start": 28, + "end": 29, + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 12 + }, + "identifierName": "a" + }, + "name": "a" + }, + "property": { + "type": "Identifier", + "start": 30, + "end": 31, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 14 + }, + "identifierName": "b" + }, + "name": "b" + }, + "computed": false + }, + "arguments": [ + { + "type": "YieldExpression", + "start": 32, + "end": 37, + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 20 + } + }, + "delegate": false, + "argument": null + } + ] + }, + "operator": "**", + "right": { + "type": "NumericLiteral", + "start": 42, + "end": 43, + "loc": { + "start": { + "line": 2, + "column": 25 + }, + "end": { + "line": 2, + "column": 26 + } + }, + "extra": { + "rawValue": 2, + "raw": "2" + }, + "value": 2 + } + } + } + } + ], + "body": { + "type": "BlockStatement", + "start": 48, + "end": 50, + "loc": { + "start": { + "line": 2, + "column": 31 + }, + "end": { + "line": 2, + "column": 33 + } + }, + "body": [], + "directives": [] + } + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-3/options.json b/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-3/options.json deleted file mode 100644 index 75b3f62fdacb..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-3/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Yield cannot be used as name inside a generator function (2:7)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-3/output.json b/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-3/output.json new file mode 100644 index 000000000000..7ce61876e0a8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-3/output.json @@ -0,0 +1,208 @@ +{ + "type": "File", + "start": 0, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Yield cannot be used as name inside a generator function (2:7)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 10, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "fn" + }, + "name": "fn" + }, + "generator": true, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 15, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 19, + "end": 40, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 23 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 19, + "end": 39, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "AssignmentPattern", + "start": 20, + "end": 32, + "loc": { + "start": { + "line": 2, + "column": 3 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "left": { + "type": "Identifier", + "start": 20, + "end": 21, + "loc": { + "start": { + "line": 2, + "column": 3 + }, + "end": { + "line": 2, + "column": 4 + }, + "identifierName": "x" + }, + "name": "x" + }, + "right": { + "type": "YieldExpression", + "start": 24, + "end": 32, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "delegate": false, + "argument": { + "type": "Identifier", + "start": 30, + "end": 32, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 15 + }, + "identifierName": "fn" + }, + "name": "fn" + } + } + } + ], + "body": { + "type": "BlockStatement", + "start": 37, + "end": 39, + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "body": [], + "directives": [] + } + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-4/options.json b/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-4/options.json deleted file mode 100644 index b3ac060855bb..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-4/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Yield cannot be used as name inside a generator function (2:17)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-4/output.json b/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-4/output.json new file mode 100644 index 000000000000..e88af5b40a30 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-4/output.json @@ -0,0 +1,261 @@ +{ + "type": "File", + "start": 0, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Yield cannot be used as name inside a generator function (2:17)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 10, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "fn" + }, + "name": "fn" + }, + "generator": true, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 15, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 19, + "end": 47, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 30 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 19, + "end": 46, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 29 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 20, + "end": 21, + "loc": { + "start": { + "line": 2, + "column": 3 + }, + "end": { + "line": 2, + "column": 4 + }, + "identifierName": "a" + }, + "name": "a" + }, + { + "type": "AssignmentPattern", + "start": 23, + "end": 28, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "left": { + "type": "Identifier", + "start": 23, + "end": 24, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 7 + }, + "identifierName": "b" + }, + "name": "b" + }, + "right": { + "type": "NumericLiteral", + "start": 27, + "end": 28, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "extra": { + "rawValue": 3, + "raw": "3" + }, + "value": 3 + } + }, + { + "type": "AssignmentPattern", + "start": 30, + "end": 39, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "left": { + "type": "Identifier", + "start": 30, + "end": 31, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 14 + }, + "identifierName": "x" + }, + "name": "x" + }, + "right": { + "type": "YieldExpression", + "start": 34, + "end": 39, + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "delegate": false, + "argument": null + } + } + ], + "body": { + "type": "BlockStatement", + "start": 44, + "end": 46, + "loc": { + "start": { + "line": 2, + "column": 27 + }, + "end": { + "line": 2, + "column": 29 + } + }, + "body": [], + "directives": [] + } + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-5/options.json b/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-5/options.json deleted file mode 100644 index 379c08c57e90..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-5/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Yield cannot be used as name inside a generator function (2:8)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-5/output.json b/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-5/output.json new file mode 100644 index 000000000000..30bb59f8c609 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-5/output.json @@ -0,0 +1,230 @@ +{ + "type": "File", + "start": 0, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Yield cannot be used as name inside a generator function (2:8)", + "SyntaxError: Binding invalid left-hand side in function parameter list (2:8)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 10, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "fn" + }, + "name": "fn" + }, + "generator": true, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 15, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 19, + "end": 45, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 28 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 19, + "end": 44, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 27 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "AssignmentPattern", + "start": 20, + "end": 37, + "loc": { + "start": { + "line": 2, + "column": 3 + }, + "end": { + "line": 2, + "column": 20 + } + }, + "left": { + "type": "Identifier", + "start": 20, + "end": 21, + "loc": { + "start": { + "line": 2, + "column": 3 + }, + "end": { + "line": 2, + "column": 4 + }, + "identifierName": "x" + }, + "name": "x" + }, + "right": { + "type": "ArrowFunctionExpression", + "start": 24, + "end": 37, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 20 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "YieldExpression", + "start": 25, + "end": 30, + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 13 + } + }, + "delegate": false, + "argument": null + } + ], + "body": { + "type": "BlockStatement", + "start": 35, + "end": 37, + "loc": { + "start": { + "line": 2, + "column": 18 + }, + "end": { + "line": 2, + "column": 20 + } + }, + "body": [], + "directives": [] + } + } + } + ], + "body": { + "type": "BlockStatement", + "start": 42, + "end": 44, + "loc": { + "start": { + "line": 2, + "column": 25 + }, + "end": { + "line": 2, + "column": 27 + } + }, + "body": [], + "directives": [] + } + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-6/options.json b/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-6/options.json deleted file mode 100644 index 379c08c57e90..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-6/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Yield cannot be used as name inside a generator function (2:8)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-6/output.json b/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-6/output.json new file mode 100644 index 000000000000..ce92441a5734 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-arrow-inside-generator-6/output.json @@ -0,0 +1,196 @@ +{ + "type": "File", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Yield cannot be used as name inside a generator function (2:8)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 10, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "fn" + }, + "name": "fn" + }, + "generator": true, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 15, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 19, + "end": 39, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 19, + "end": 38, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 21 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "AssignmentPattern", + "start": 20, + "end": 31, + "loc": { + "start": { + "line": 2, + "column": 3 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "left": { + "type": "Identifier", + "start": 20, + "end": 21, + "loc": { + "start": { + "line": 2, + "column": 3 + }, + "end": { + "line": 2, + "column": 4 + }, + "identifierName": "x" + }, + "name": "x" + }, + "right": { + "type": "YieldExpression", + "start": 25, + "end": 30, + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 13 + } + }, + "delegate": false, + "argument": null, + "extra": { + "parenthesized": true, + "parenStart": 24 + } + } + } + ], + "body": { + "type": "BlockStatement", + "start": 36, + "end": 38, + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 21 + } + }, + "body": [], + "directives": [] + } + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-generator-method/options.json b/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-generator-method/options.json deleted file mode 100644 index 6f5bd40fe357..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-generator-method/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "yield is not allowed in generator parameters (1:15)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-generator-method/output.json b/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-generator-method/output.json new file mode 100644 index 000000000000..a2234a6938db --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-generator-method/output.json @@ -0,0 +1,180 @@ +{ + "type": "File", + "start": 0, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "errors": [ + "SyntaxError: yield is not allowed in generator parameters (1:15)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "expression": { + "type": "ObjectExpression", + "start": 1, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "properties": [ + { + "type": "ObjectMethod", + "start": 3, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "method": true, + "key": { + "type": "Identifier", + "start": 4, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "method" + }, + "name": "method" + }, + "computed": false, + "kind": "method", + "id": null, + "generator": true, + "async": false, + "params": [ + { + "type": "AssignmentPattern", + "start": 11, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "left": { + "type": "Identifier", + "start": 11, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "x" + }, + "name": "x" + }, + "right": { + "type": "YieldExpression", + "start": 15, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "delegate": false, + "argument": null + } + } + ], + "body": { + "type": "BlockStatement", + "start": 22, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "body": [], + "directives": [] + } + } + ], + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-generator/options.json b/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-generator/options.json deleted file mode 100644 index dd9a684ef928..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-generator/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "yield is not allowed in generator parameters (1:17)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-generator/output.json b/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-generator/output.json new file mode 100644 index 000000000000..b21c88bc4f9f --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-inside-generator/output.json @@ -0,0 +1,140 @@ +{ + "type": "File", + "start": 0, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "errors": [ + "SyntaxError: yield is not allowed in generator parameters (1:17)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "id": { + "type": "Identifier", + "start": 10, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "fn" + }, + "name": "fn" + }, + "generator": true, + "async": false, + "params": [ + { + "type": "AssignmentPattern", + "start": 13, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "left": { + "type": "Identifier", + "start": 13, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "x" + }, + "name": "x" + }, + "right": { + "type": "YieldExpression", + "start": 17, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "delegate": false, + "argument": null + } + } + ], + "body": { + "type": "BlockStatement", + "start": 24, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-strict/options.json b/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-strict/options.json deleted file mode 100644 index ecc179f974cb..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-strict/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected reserved word 'yield' (2:16)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-strict/output.json b/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-strict/output.json new file mode 100644 index 000000000000..e051b9ac1378 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/yield/parameter-default-strict/output.json @@ -0,0 +1,176 @@ +{ + "type": "File", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 25 + } + }, + "errors": [ + "SyntaxError: Unexpected reserved word 'yield' (2:16)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 25 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 14, + "end": 39, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 25 + } + }, + "id": { + "type": "Identifier", + "start": 23, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 11 + }, + "identifierName": "fn" + }, + "name": "fn" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "AssignmentPattern", + "start": 26, + "end": 35, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 21 + } + }, + "left": { + "type": "Identifier", + "start": 26, + "end": 27, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 13 + }, + "identifierName": "x" + }, + "name": "x" + }, + "right": { + "type": "Identifier", + "start": 30, + "end": 35, + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 21 + }, + "identifierName": "yield" + }, + "name": "yield" + } + } + ], + "body": { + "type": "BlockStatement", + "start": 37, + "end": 39, + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 25 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-arrow-inside-generator-1/options.json b/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-arrow-inside-generator-1/options.json deleted file mode 100644 index b566d4944c2c..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-arrow-inside-generator-1/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Yield cannot be used as name inside a generator function (2:3)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-arrow-inside-generator-1/output.json b/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-arrow-inside-generator-1/output.json new file mode 100644 index 000000000000..1bec942c71ac --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-arrow-inside-generator-1/output.json @@ -0,0 +1,161 @@ +{ + "type": "File", + "start": 0, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Yield cannot be used as name inside a generator function (2:3)", + "SyntaxError: Binding invalid left-hand side in function parameter list (2:3)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 10, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "fn" + }, + "name": "fn" + }, + "generator": true, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 15, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 19, + "end": 33, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 19, + "end": 32, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "YieldExpression", + "start": 20, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 3 + }, + "end": { + "line": 2, + "column": 8 + } + }, + "delegate": false, + "argument": null + } + ], + "body": { + "type": "BlockStatement", + "start": 30, + "end": 32, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "body": [], + "directives": [] + } + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-arrow-inside-generator-2/options.json b/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-arrow-inside-generator-2/options.json deleted file mode 100644 index b566d4944c2c..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-arrow-inside-generator-2/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Yield cannot be used as name inside a generator function (2:3)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-arrow-inside-generator-2/output.json b/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-arrow-inside-generator-2/output.json new file mode 100644 index 000000000000..3c16beba8cdf --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-arrow-inside-generator-2/output.json @@ -0,0 +1,177 @@ +{ + "type": "File", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Yield cannot be used as name inside a generator function (2:3)", + "SyntaxError: Binding invalid left-hand side in function parameter list (2:3)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 10, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "fn" + }, + "name": "fn" + }, + "generator": true, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 15, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 19, + "end": 36, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 19, + "end": 35, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "YieldExpression", + "start": 20, + "end": 28, + "loc": { + "start": { + "line": 2, + "column": 3 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "delegate": false, + "argument": { + "type": "Identifier", + "start": 26, + "end": 28, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 11 + }, + "identifierName": "fn" + }, + "name": "fn" + } + } + ], + "body": { + "type": "BlockStatement", + "start": 33, + "end": 35, + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "body": [], + "directives": [] + } + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-arrow-inside-generator-3/options.json b/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-arrow-inside-generator-3/options.json deleted file mode 100644 index 479a9a79f900..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-arrow-inside-generator-3/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Yield cannot be used as name inside a generator function (2:9)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-arrow-inside-generator-3/output.json b/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-arrow-inside-generator-3/output.json new file mode 100644 index 000000000000..18209649f3a6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-arrow-inside-generator-3/output.json @@ -0,0 +1,195 @@ +{ + "type": "File", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Yield cannot be used as name inside a generator function (2:9)", + "SyntaxError: Binding invalid left-hand side in function parameter list (2:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 10, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "fn" + }, + "name": "fn" + }, + "generator": true, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 15, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 19, + "end": 39, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 19, + "end": 38, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 21 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 20, + "end": 21, + "loc": { + "start": { + "line": 2, + "column": 3 + }, + "end": { + "line": 2, + "column": 4 + }, + "identifierName": "a" + }, + "name": "a" + }, + { + "type": "Identifier", + "start": 23, + "end": 24, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 7 + }, + "identifierName": "b" + }, + "name": "b" + }, + { + "type": "YieldExpression", + "start": 26, + "end": 31, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "delegate": false, + "argument": null + } + ], + "body": { + "type": "BlockStatement", + "start": 36, + "end": 38, + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 21 + } + }, + "body": [], + "directives": [] + } + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-generator-method/options.json b/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-generator-method/options.json deleted file mode 100644 index 72f8d0e0e4c3..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-generator-method/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Can not use 'yield' as identifier inside a generator (1:11)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-generator-method/output.json b/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-generator-method/output.json new file mode 100644 index 000000000000..2a15b906e992 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-generator-method/output.json @@ -0,0 +1,148 @@ +{ + "type": "File", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "errors": [ + "SyntaxError: Can not use 'yield' as identifier inside a generator (1:11)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "expression": { + "type": "ObjectExpression", + "start": 1, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "properties": [ + { + "type": "ObjectMethod", + "start": 3, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "method": true, + "key": { + "type": "Identifier", + "start": 4, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "method" + }, + "name": "method" + }, + "computed": false, + "kind": "method", + "id": null, + "generator": true, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 11, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 16 + }, + "identifierName": "yield" + }, + "name": "yield" + } + ], + "body": { + "type": "BlockStatement", + "start": 18, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "body": [], + "directives": [] + } + } + ], + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-generator/options.json b/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-generator/options.json deleted file mode 100644 index dcab4205d32f..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-generator/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Can not use 'yield' as identifier inside a generator (1:13)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-generator/output.json b/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-generator/output.json new file mode 100644 index 000000000000..a8a1424ee419 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-generator/output.json @@ -0,0 +1,108 @@ +{ + "type": "File", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "errors": [ + "SyntaxError: Can not use 'yield' as identifier inside a generator (1:13)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "id": { + "type": "Identifier", + "start": 10, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "fn" + }, + "name": "fn" + }, + "generator": true, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 13, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 18 + }, + "identifierName": "yield" + }, + "name": "yield" + } + ], + "body": { + "type": "BlockStatement", + "start": 20, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-strict-body/options.json b/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-strict-body/options.json deleted file mode 100644 index 0329a317f084..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-strict-body/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'yield' in strict mode (1:12)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-strict-body/output.json b/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-strict-body/output.json new file mode 100644 index 000000000000..ad17fc3ec47d --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-strict-body/output.json @@ -0,0 +1,144 @@ +{ + "type": "File", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "errors": [ + "SyntaxError: Binding 'yield' in strict mode (1:12)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 11 + }, + "identifierName": "fn" + }, + "name": "fn" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 12, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 17 + }, + "identifierName": "yield" + }, + "name": "yield" + } + ], + "body": { + "type": "BlockStatement", + "start": 19, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 21, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 21, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-strict/options.json b/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-strict/options.json deleted file mode 100644 index 75bdf3d53d6e..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-strict/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected reserved word 'yield' (2:12)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-strict/output.json b/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-strict/output.json new file mode 100644 index 000000000000..ac0ac6a92f89 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/yield/parameter-name-strict/output.json @@ -0,0 +1,144 @@ +{ + "type": "File", + "start": 0, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 21 + } + }, + "errors": [ + "SyntaxError: Unexpected reserved word 'yield' (2:12)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 21 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 14, + "end": 35, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 21 + } + }, + "id": { + "type": "Identifier", + "start": 23, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 11 + }, + "identifierName": "fn" + }, + "name": "fn" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 26, + "end": 31, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 17 + }, + "identifierName": "yield" + }, + "name": "yield" + } + ], + "body": { + "type": "BlockStatement", + "start": 33, + "end": 35, + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 21 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2015/yield/yield-star-parameter-default-inside-generator/options.json b/packages/babel-parser/test/fixtures/es2015/yield/yield-star-parameter-default-inside-generator/options.json deleted file mode 100644 index dd9a684ef928..000000000000 --- a/packages/babel-parser/test/fixtures/es2015/yield/yield-star-parameter-default-inside-generator/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "yield is not allowed in generator parameters (1:17)" -} diff --git a/packages/babel-parser/test/fixtures/es2015/yield/yield-star-parameter-default-inside-generator/output.json b/packages/babel-parser/test/fixtures/es2015/yield/yield-star-parameter-default-inside-generator/output.json new file mode 100644 index 000000000000..77a0a58b8e3b --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2015/yield/yield-star-parameter-default-inside-generator/output.json @@ -0,0 +1,157 @@ +{ + "type": "File", + "start": 0, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "errors": [ + "SyntaxError: yield is not allowed in generator parameters (1:17)", + "SyntaxError: yield is not allowed in generator parameters (1:24)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "id": { + "type": "Identifier", + "start": 10, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "fn" + }, + "name": "fn" + }, + "generator": true, + "async": false, + "params": [ + { + "type": "AssignmentPattern", + "start": 13, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "left": { + "type": "Identifier", + "start": 13, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "x" + }, + "name": "x" + }, + "right": { + "type": "YieldExpression", + "start": 17, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "delegate": true, + "argument": { + "type": "YieldExpression", + "start": 24, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "delegate": false, + "argument": null + } + } + } + ], + "body": { + "type": "BlockStatement", + "start": 31, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/10/options.json b/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/10/options.json deleted file mode 100644 index 2c624e8cec70..000000000000 --- a/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/10/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Illegal expression. Wrap left hand side or entire exponentiation in parentheses. (1:1)" -} diff --git a/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/10/output.json b/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/10/output.json new file mode 100644 index 000000000000..99a1c0eac6e6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/10/output.json @@ -0,0 +1,126 @@ +{ + "type": "File", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "errors": [ + "SyntaxError: Illegal expression. Wrap left hand side or entire exponentiation in parentheses. (1:1)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "expression": { + "type": "BinaryExpression", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "left": { + "type": "UnaryExpression", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "operator": "-", + "prefix": true, + "argument": { + "type": "NumericLiteral", + "start": 1, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "extra": { + "rawValue": 5, + "raw": "5" + }, + "value": 5 + } + }, + "operator": "**", + "right": { + "type": "NumericLiteral", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "extra": { + "rawValue": 6, + "raw": "6" + }, + "value": 6 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/11/options.json b/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/11/options.json deleted file mode 100644 index f04c5c035abb..000000000000 --- a/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/11/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Illegal expression. Wrap left hand side or entire exponentiation in parentheses. (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/11/output.json b/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/11/output.json new file mode 100644 index 000000000000..8bfc60ddbdbc --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/11/output.json @@ -0,0 +1,128 @@ +{ + "type": "File", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "errors": [ + "SyntaxError: Illegal expression. Wrap left hand side or entire exponentiation in parentheses. (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "expression": { + "type": "BinaryExpression", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "left": { + "type": "UnaryExpression", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "operator": "-", + "prefix": true, + "argument": { + "type": "NumericLiteral", + "start": 2, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "extra": { + "rawValue": 5, + "raw": "5", + "parenthesized": true, + "parenStart": 1 + }, + "value": 5 + } + }, + "operator": "**", + "right": { + "type": "NumericLiteral", + "start": 8, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "extra": { + "rawValue": 6, + "raw": "6" + }, + "value": 6 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/12/options.json b/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/12/options.json deleted file mode 100644 index f04c5c035abb..000000000000 --- a/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/12/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Illegal expression. Wrap left hand side or entire exponentiation in parentheses. (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/12/output.json b/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/12/output.json new file mode 100644 index 000000000000..1a7be0b48b55 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/12/output.json @@ -0,0 +1,130 @@ +{ + "type": "File", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "errors": [ + "SyntaxError: Illegal expression. Wrap left hand side or entire exponentiation in parentheses. (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "expression": { + "type": "BinaryExpression", + "start": 1, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "left": { + "type": "UnaryExpression", + "start": 1, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "operator": "-", + "prefix": true, + "argument": { + "type": "NumericLiteral", + "start": 2, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "extra": { + "rawValue": 5, + "raw": "5" + }, + "value": 5 + } + }, + "operator": "**", + "right": { + "type": "NumericLiteral", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 6, + "raw": "6" + }, + "value": 6 + }, + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/15/options.json b/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/15/options.json index c694133bf2b1..6d24025b8674 100644 --- a/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/15/options.json +++ b/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/15/options.json @@ -1,4 +1,3 @@ { - "createParenthesizedExpressions": true, - "throws": "Illegal expression. Wrap left hand side or entire exponentiation in parentheses. (1:1)" -} + "createParenthesizedExpressions": true +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/15/output.json b/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/15/output.json new file mode 100644 index 000000000000..56e0b17f480e --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/15/output.json @@ -0,0 +1,141 @@ +{ + "type": "File", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "errors": [ + "SyntaxError: Illegal expression. Wrap left hand side or entire exponentiation in parentheses. (1:1)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "expression": { + "type": "BinaryExpression", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "left": { + "type": "UnaryExpression", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "operator": "-", + "prefix": true, + "argument": { + "type": "ParenthesizedExpression", + "start": 1, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 2, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "extra": { + "rawValue": 5, + "raw": "5" + }, + "value": 5 + } + } + }, + "operator": "**", + "right": { + "type": "NumericLiteral", + "start": 8, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "extra": { + "rawValue": 6, + "raw": "6" + }, + "value": 6 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/16/options.json b/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/16/options.json index 19687fbe197a..6d24025b8674 100644 --- a/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/16/options.json +++ b/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/16/options.json @@ -1,4 +1,3 @@ { - "createParenthesizedExpressions": true, - "throws": "Illegal expression. Wrap left hand side or entire exponentiation in parentheses. (1:2)" -} + "createParenthesizedExpressions": true +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/16/output.json b/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/16/output.json new file mode 100644 index 000000000000..5fd8ad0e4fbd --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2016/exponentiation-operator/16/output.json @@ -0,0 +1,141 @@ +{ + "type": "File", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "errors": [ + "SyntaxError: Illegal expression. Wrap left hand side or entire exponentiation in parentheses. (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "expression": { + "type": "ParenthesizedExpression", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "expression": { + "type": "BinaryExpression", + "start": 1, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "left": { + "type": "UnaryExpression", + "start": 1, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "operator": "-", + "prefix": true, + "argument": { + "type": "NumericLiteral", + "start": 2, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "extra": { + "rawValue": 5, + "raw": "5" + }, + "value": 5 + } + }, + "operator": "**", + "right": { + "type": "NumericLiteral", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 6, + "raw": "6" + }, + "value": 6 + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/array-pattern-default/options.json b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/array-pattern-default/options.json deleted file mode 100644 index 12b18792fcc4..000000000000 --- a/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/array-pattern-default/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Illegal 'use strict' directive in function with non-simple parameter list (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/array-pattern-default/output.json b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/array-pattern-default/output.json new file mode 100644 index 000000000000..5c66e79b6581 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/array-pattern-default/output.json @@ -0,0 +1,209 @@ +{ + "type": "File", + "start": 0, + "end": 57, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Illegal 'use strict' directive in function with non-simple parameter list (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 57, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 57, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "a" + }, + "name": "a" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "AssignmentPattern", + "start": 11, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "left": { + "type": "ArrayPattern", + "start": 11, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "elements": [ + { + "type": "Identifier", + "start": 13, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 20 + }, + "identifierName": "option1" + }, + "name": "option1" + }, + { + "type": "Identifier", + "start": 22, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 29 + }, + "identifierName": "option2" + }, + "name": "option2" + } + ] + }, + "right": { + "type": "ArrayExpression", + "start": 34, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "elements": [] + } + } + ], + "body": { + "type": "BlockStatement", + "start": 38, + "end": 57, + "loc": { + "start": { + "line": 1, + "column": 38 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 42, + "end": 55, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 42, + "end": 54, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/array-pattern/options.json b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/array-pattern/options.json deleted file mode 100644 index 12b18792fcc4..000000000000 --- a/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/array-pattern/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Illegal 'use strict' directive in function with non-simple parameter list (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/array-pattern/output.json b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/array-pattern/output.json new file mode 100644 index 000000000000..21f903177a3d --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/array-pattern/output.json @@ -0,0 +1,178 @@ +{ + "type": "File", + "start": 0, + "end": 52, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Illegal 'use strict' directive in function with non-simple parameter list (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 52, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 52, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "a" + }, + "name": "a" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "ArrayPattern", + "start": 11, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "elements": [ + { + "type": "Identifier", + "start": 13, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 20 + }, + "identifierName": "option1" + }, + "name": "option1" + }, + { + "type": "Identifier", + "start": 22, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 29 + }, + "identifierName": "option2" + }, + "name": "option2" + } + ] + } + ], + "body": { + "type": "BlockStatement", + "start": 33, + "end": 52, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 37, + "end": 50, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 37, + "end": 49, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/arrow-function/options.json b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/arrow-function/options.json deleted file mode 100644 index 089b542c3704..000000000000 --- a/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/arrow-function/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Illegal 'use strict' directive in function with non-simple parameter list (1:8)" -} diff --git a/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/arrow-function/output.json b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/arrow-function/output.json new file mode 100644 index 000000000000..c63422a6be79 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/arrow-function/output.json @@ -0,0 +1,209 @@ +{ + "type": "File", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 2 + } + }, + "errors": [ + "SyntaxError: Illegal 'use strict' directive in function with non-simple parameter list (1:8)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 2 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 2 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 4, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "a" + }, + "name": "a" + }, + "init": { + "type": "ArrowFunctionExpression", + "start": 8, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "AssignmentPattern", + "start": 9, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "left": { + "type": "Identifier", + "start": 9, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 16 + }, + "identifierName": "options" + }, + "name": "options" + }, + "right": { + "type": "ObjectExpression", + "start": 19, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "properties": [] + } + } + ], + "body": { + "type": "BlockStatement", + "start": 26, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 30, + "end": 43, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 30, + "end": 42, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + } + ], + "kind": "var" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/async-arrow-function/options.json b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/async-arrow-function/options.json deleted file mode 100644 index 089b542c3704..000000000000 --- a/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/async-arrow-function/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Illegal 'use strict' directive in function with non-simple parameter list (1:8)" -} diff --git a/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/async-arrow-function/output.json b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/async-arrow-function/output.json new file mode 100644 index 000000000000..6183a084c384 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/async-arrow-function/output.json @@ -0,0 +1,209 @@ +{ + "type": "File", + "start": 0, + "end": 52, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 2 + } + }, + "errors": [ + "SyntaxError: Illegal 'use strict' directive in function with non-simple parameter list (1:8)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 52, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 2 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 52, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 2 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 51, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 4, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "a" + }, + "name": "a" + }, + "init": { + "type": "ArrowFunctionExpression", + "start": 8, + "end": 51, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": null, + "generator": false, + "async": true, + "params": [ + { + "type": "AssignmentPattern", + "start": 15, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "left": { + "type": "Identifier", + "start": 15, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 22 + }, + "identifierName": "options" + }, + "name": "options" + }, + "right": { + "type": "ObjectExpression", + "start": 25, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "properties": [] + } + } + ], + "body": { + "type": "BlockStatement", + "start": 32, + "end": 51, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 36, + "end": 49, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 36, + "end": 48, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + } + ], + "kind": "var" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/async-function/options.json b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/async-function/options.json deleted file mode 100644 index 12b18792fcc4..000000000000 --- a/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/async-function/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Illegal 'use strict' directive in function with non-simple parameter list (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/async-function/output.json b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/async-function/output.json new file mode 100644 index 000000000000..324b53bc26ec --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/async-function/output.json @@ -0,0 +1,175 @@ +{ + "type": "File", + "start": 0, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Illegal 'use strict' directive in function with non-simple parameter list (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 15, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + }, + "identifierName": "a" + }, + "name": "a" + }, + "generator": false, + "async": true, + "params": [ + { + "type": "AssignmentPattern", + "start": 17, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "left": { + "type": "Identifier", + "start": 17, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 24 + }, + "identifierName": "options" + }, + "name": "options" + }, + "right": { + "type": "ObjectExpression", + "start": 27, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "properties": [] + } + } + ], + "body": { + "type": "BlockStatement", + "start": 31, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 35, + "end": 48, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 35, + "end": 47, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/default/options.json b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/default/options.json deleted file mode 100644 index 12b18792fcc4..000000000000 --- a/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/default/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Illegal 'use strict' directive in function with non-simple parameter list (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/default/output.json b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/default/output.json new file mode 100644 index 000000000000..f40df83751ba --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/default/output.json @@ -0,0 +1,175 @@ +{ + "type": "File", + "start": 0, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Illegal 'use strict' directive in function with non-simple parameter list (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "a" + }, + "name": "a" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "AssignmentPattern", + "start": 11, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "left": { + "type": "Identifier", + "start": 11, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 18 + }, + "identifierName": "options" + }, + "name": "options" + }, + "right": { + "type": "ObjectExpression", + "start": 21, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "properties": [] + } + } + ], + "body": { + "type": "BlockStatement", + "start": 25, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 29, + "end": 42, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 29, + "end": 41, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/generator-function/options.json b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/generator-function/options.json deleted file mode 100644 index 12b18792fcc4..000000000000 --- a/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/generator-function/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Illegal 'use strict' directive in function with non-simple parameter list (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/generator-function/output.json b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/generator-function/output.json new file mode 100644 index 000000000000..4d433d4b0bc1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/generator-function/output.json @@ -0,0 +1,175 @@ +{ + "type": "File", + "start": 0, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Illegal 'use strict' directive in function with non-simple parameter list (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 10, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + }, + "identifierName": "a" + }, + "name": "a" + }, + "generator": true, + "async": false, + "params": [ + { + "type": "AssignmentPattern", + "start": 12, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "left": { + "type": "Identifier", + "start": 12, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 19 + }, + "identifierName": "options" + }, + "name": "options" + }, + "right": { + "type": "ObjectExpression", + "start": 22, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "properties": [] + } + } + ], + "body": { + "type": "BlockStatement", + "start": 26, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 30, + "end": 43, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 30, + "end": 42, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/generator-method/options.json b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/generator-method/options.json deleted file mode 100644 index 9908b496fd2a..000000000000 --- a/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/generator-method/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Illegal 'use strict' directive in function with non-simple parameter list (2:5)" -} diff --git a/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/generator-method/output.json b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/generator-method/output.json new file mode 100644 index 000000000000..393540b1fa01 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/generator-method/output.json @@ -0,0 +1,246 @@ +{ + "type": "File", + "start": 0, + "end": 58, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 2 + } + }, + "errors": [ + "SyntaxError: Illegal 'use strict' directive in function with non-simple parameter list (2:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 58, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 2 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 58, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 2 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 57, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 4, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "obj" + }, + "name": "obj" + }, + "init": { + "type": "ObjectExpression", + "start": 10, + "end": 57, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "properties": [ + { + "type": "ObjectMethod", + "start": 14, + "end": 55, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 4, + "column": 3 + } + }, + "method": true, + "key": { + "type": "Identifier", + "start": 16, + "end": 17, + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 5 + }, + "identifierName": "a" + }, + "name": "a" + }, + "computed": false, + "kind": "method", + "id": null, + "generator": true, + "async": false, + "params": [ + { + "type": "AssignmentPattern", + "start": 18, + "end": 30, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "left": { + "type": "Identifier", + "start": 18, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 13 + }, + "identifierName": "options" + }, + "name": "options" + }, + "right": { + "type": "ObjectExpression", + "start": 28, + "end": 30, + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "properties": [] + } + } + ], + "body": { + "type": "BlockStatement", + "start": 32, + "end": 55, + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 4, + "column": 3 + } + }, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 38, + "end": 51, + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 17 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 38, + "end": 50, + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 16 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ] + } + } + ], + "kind": "var" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/method/options.json b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/method/options.json deleted file mode 100644 index 5d0e394f2b9d..000000000000 --- a/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/method/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Illegal 'use strict' directive in function with non-simple parameter list (2:3)" -} diff --git a/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/method/output.json b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/method/output.json new file mode 100644 index 000000000000..99d18df924f2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/method/output.json @@ -0,0 +1,246 @@ +{ + "type": "File", + "start": 0, + "end": 56, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 2 + } + }, + "errors": [ + "SyntaxError: Illegal 'use strict' directive in function with non-simple parameter list (2:3)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 56, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 2 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 56, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 2 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 55, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 4, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "obj" + }, + "name": "obj" + }, + "init": { + "type": "ObjectExpression", + "start": 10, + "end": 55, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "properties": [ + { + "type": "ObjectMethod", + "start": 14, + "end": 53, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 4, + "column": 3 + } + }, + "method": true, + "key": { + "type": "Identifier", + "start": 14, + "end": 15, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 3 + }, + "identifierName": "a" + }, + "name": "a" + }, + "computed": false, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "AssignmentPattern", + "start": 16, + "end": 28, + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "left": { + "type": "Identifier", + "start": 16, + "end": 23, + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 11 + }, + "identifierName": "options" + }, + "name": "options" + }, + "right": { + "type": "ObjectExpression", + "start": 26, + "end": 28, + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "properties": [] + } + } + ], + "body": { + "type": "BlockStatement", + "start": 30, + "end": 53, + "loc": { + "start": { + "line": 2, + "column": 18 + }, + "end": { + "line": 4, + "column": 3 + } + }, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 36, + "end": 49, + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 17 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 36, + "end": 48, + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 16 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ] + } + } + ], + "kind": "var" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/object-pattern-default/options.json b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/object-pattern-default/options.json deleted file mode 100644 index 12b18792fcc4..000000000000 --- a/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/object-pattern-default/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Illegal 'use strict' directive in function with non-simple parameter list (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/object-pattern-default/output.json b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/object-pattern-default/output.json new file mode 100644 index 000000000000..f6c0442d811a --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/object-pattern-default/output.json @@ -0,0 +1,285 @@ +{ + "type": "File", + "start": 0, + "end": 57, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Illegal 'use strict' directive in function with non-simple parameter list (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 57, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 57, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "a" + }, + "name": "a" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "AssignmentPattern", + "start": 11, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "left": { + "type": "ObjectPattern", + "start": 11, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 13, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 13, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 20 + }, + "identifierName": "option1" + }, + "name": "option1" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start": 13, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 20 + }, + "identifierName": "option1" + }, + "name": "option1" + }, + "extra": { + "shorthand": true + } + }, + { + "type": "ObjectProperty", + "start": 22, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 22, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 29 + }, + "identifierName": "option2" + }, + "name": "option2" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start": 22, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 29 + }, + "identifierName": "option2" + }, + "name": "option2" + }, + "extra": { + "shorthand": true + } + } + ] + }, + "right": { + "type": "ObjectExpression", + "start": 34, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "properties": [] + } + } + ], + "body": { + "type": "BlockStatement", + "start": 38, + "end": 57, + "loc": { + "start": { + "line": 1, + "column": 38 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 42, + "end": 55, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 42, + "end": 54, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/object-pattern/options.json b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/object-pattern/options.json deleted file mode 100644 index 12b18792fcc4..000000000000 --- a/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/object-pattern/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Illegal 'use strict' directive in function with non-simple parameter list (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/object-pattern/output.json b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/object-pattern/output.json new file mode 100644 index 000000000000..2089ba375f3e --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/object-pattern/output.json @@ -0,0 +1,254 @@ +{ + "type": "File", + "start": 0, + "end": 52, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Illegal 'use strict' directive in function with non-simple parameter list (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 52, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 52, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "a" + }, + "name": "a" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "ObjectPattern", + "start": 11, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 13, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 13, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 20 + }, + "identifierName": "option1" + }, + "name": "option1" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start": 13, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 20 + }, + "identifierName": "option1" + }, + "name": "option1" + }, + "extra": { + "shorthand": true + } + }, + { + "type": "ObjectProperty", + "start": 22, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 22, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 29 + }, + "identifierName": "option2" + }, + "name": "option2" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start": 22, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 29 + }, + "identifierName": "option2" + }, + "name": "option2" + }, + "extra": { + "shorthand": true + } + } + ] + } + ], + "body": { + "type": "BlockStatement", + "start": 33, + "end": 52, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 37, + "end": 50, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 37, + "end": 49, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/rest/options.json b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/rest/options.json deleted file mode 100644 index 12b18792fcc4..000000000000 --- a/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/rest/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Illegal 'use strict' directive in function with non-simple parameter list (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/rest/output.json b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/rest/output.json new file mode 100644 index 000000000000..9c23ba0225c7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2016/simple-parameter-list/rest/output.json @@ -0,0 +1,159 @@ +{ + "type": "File", + "start": 0, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Illegal 'use strict' directive in function with non-simple parameter list (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "a" + }, + "name": "a" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "RestElement", + "start": 11, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "argument": { + "type": "Identifier", + "start": 14, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 21 + }, + "identifierName": "options" + }, + "name": "options" + } + } + ], + "body": { + "type": "BlockStatement", + "start": 23, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 27, + "end": 40, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 27, + "end": 39, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/2/options.json b/packages/babel-parser/test/fixtures/es2017/async-functions/2/options.json deleted file mode 100644 index c6f19067ee66..000000000000 --- a/packages/babel-parser/test/fixtures/es2017/async-functions/2/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "await* has been removed from the async functions proposal. Use Promise.all() instead. (2:2)" -} diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/2/output.json b/packages/babel-parser/test/fixtures/es2017/async-functions/2/output.json new file mode 100644 index 000000000000..d6708279fdcb --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/2/output.json @@ -0,0 +1,154 @@ +{ + "type": "File", + "start": 0, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: await* has been removed from the async functions proposal. Use Promise.all() instead. (2:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 15, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 18 + }, + "identifierName": "bar" + }, + "name": "bar" + }, + "generator": false, + "async": true, + "params": [], + "body": { + "type": "BlockStatement", + "start": 21, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 25, + "end": 38, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "expression": { + "type": "AwaitExpression", + "start": 25, + "end": 37, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "argument": { + "type": "CallExpression", + "start": 32, + "end": 37, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "callee": { + "type": "Identifier", + "start": 32, + "end": 35, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 12 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "arguments": [] + } + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/await-async-function-expression-name/options.json b/packages/babel-parser/test/fixtures/es2017/async-functions/await-async-function-expression-name/options.json deleted file mode 100644 index 022428647fee..000000000000 --- a/packages/babel-parser/test/fixtures/es2017/async-functions/await-async-function-expression-name/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Can not use 'await' as identifier inside an async function (1:16)" -} diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/await-async-function-expression-name/output.json b/packages/babel-parser/test/fixtures/es2017/async-functions/await-async-function-expression-name/output.json new file mode 100644 index 000000000000..34fa5d9a8d4f --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/await-async-function-expression-name/output.json @@ -0,0 +1,109 @@ +{ + "type": "File", + "start": 0, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "errors": [ + "SyntaxError: Can not use 'await' as identifier inside an async function (1:16)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "expression": { + "type": "FunctionExpression", + "start": 1, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "id": { + "type": "Identifier", + "start": 16, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 21 + }, + "identifierName": "await" + }, + "name": "await" + }, + "generator": false, + "async": true, + "params": [], + "body": { + "type": "BlockStatement", + "start": 24, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "body": [], + "directives": [] + }, + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/await-binding-inside-arrow-params-inside-async-arrow-params/options.json b/packages/babel-parser/test/fixtures/es2017/async-functions/await-binding-inside-arrow-params-inside-async-arrow-params/options.json deleted file mode 100644 index c066100759e2..000000000000 --- a/packages/babel-parser/test/fixtures/es2017/async-functions/await-binding-inside-arrow-params-inside-async-arrow-params/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Await cannot be used as name inside an async function (1:20)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/await-binding-inside-arrow-params-inside-async-arrow-params/output.json b/packages/babel-parser/test/fixtures/es2017/async-functions/await-binding-inside-arrow-params-inside-async-arrow-params/output.json new file mode 100644 index 000000000000..c9a8709666e7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/await-binding-inside-arrow-params-inside-async-arrow-params/output.json @@ -0,0 +1,231 @@ +{ + "type": "File", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "errors": [ + "SyntaxError: Await cannot be used as name inside an async function (1:20)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 0, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "id": null, + "generator": false, + "async": true, + "params": [ + { + "type": "AssignmentPattern", + "start": 7, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "left": { + "type": "Identifier", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + }, + "identifierName": "a" + }, + "name": "a" + }, + "right": { + "type": "ArrowFunctionExpression", + "start": 11, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "ObjectPattern", + "start": 12, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 14, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 14, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 19 + }, + "identifierName": "await" + }, + "name": "await" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start": 14, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 19 + }, + "identifierName": "await" + }, + "name": "await" + }, + "extra": { + "shorthand": true + } + } + ] + } + ], + "body": { + "type": "BlockStatement", + "start": 26, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "body": [], + "directives": [] + } + } + } + ], + "body": { + "type": "BlockStatement", + "start": 33, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "body": [], + "directives": [] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/await-function-declaration-name-inside-async-function/options.json b/packages/babel-parser/test/fixtures/es2017/async-functions/await-function-declaration-name-inside-async-function/options.json deleted file mode 100644 index d45274982dc1..000000000000 --- a/packages/babel-parser/test/fixtures/es2017/async-functions/await-function-declaration-name-inside-async-function/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Can not use 'await' as identifier inside an async function (2:11)" -} diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/await-function-declaration-name-inside-async-function/output.json b/packages/babel-parser/test/fixtures/es2017/async-functions/await-function-declaration-name-inside-async-function/output.json new file mode 100644 index 000000000000..3d543c665be5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/await-function-declaration-name-inside-async-function/output.json @@ -0,0 +1,143 @@ +{ + "type": "File", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Can not use 'await' as identifier inside an async function (2:11)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 15, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 18 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "generator": false, + "async": true, + "params": [], + "body": { + "type": "BlockStatement", + "start": 21, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "FunctionDeclaration", + "start": 25, + "end": 44, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 21 + } + }, + "id": { + "type": "Identifier", + "start": 34, + "end": 39, + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 16 + }, + "identifierName": "await" + }, + "name": "await" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 42, + "end": 44, + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 21 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-arguments-of-async-call-inside-parameters-of-async-arrow-function/options.json b/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-arguments-of-async-call-inside-parameters-of-async-arrow-function/options.json deleted file mode 100644 index 9a4cb65743b5..000000000000 --- a/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-arguments-of-async-call-inside-parameters-of-async-arrow-function/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Await cannot be used as name inside an async function (2:23)" -} diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-arguments-of-async-call-inside-parameters-of-async-arrow-function/output.json b/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-arguments-of-async-call-inside-parameters-of-async-arrow-function/output.json new file mode 100644 index 000000000000..281c41288873 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-arguments-of-async-call-inside-parameters-of-async-arrow-function/output.json @@ -0,0 +1,277 @@ +{ + "type": "File", + "start": 0, + "end": 63, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Await cannot be used as name inside an async function (2:23)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 63, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 63, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 15, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 17 + }, + "identifierName": "fn" + }, + "name": "fn" + }, + "generator": false, + "async": true, + "params": [], + "body": { + "type": "BlockStatement", + "start": 20, + "end": 63, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 24, + "end": 61, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 39 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 24, + "end": 60, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 38 + } + }, + "id": null, + "generator": false, + "async": true, + "params": [ + { + "type": "AssignmentPattern", + "start": 31, + "end": 53, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 31 + } + }, + "left": { + "type": "Identifier", + "start": 31, + "end": 32, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 10 + }, + "identifierName": "x" + }, + "name": "x" + }, + "right": { + "type": "CallExpression", + "start": 35, + "end": 53, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 31 + } + }, + "callee": { + "type": "Identifier", + "start": 35, + "end": 40, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 18 + }, + "identifierName": "async" + }, + "name": "async" + }, + "arguments": [ + { + "type": "AssignmentExpression", + "start": 41, + "end": 52, + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 30 + } + }, + "operator": "=", + "left": { + "type": "Identifier", + "start": 41, + "end": 42, + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 20 + }, + "identifierName": "y" + }, + "name": "y" + }, + "right": { + "type": "AwaitExpression", + "start": 45, + "end": 52, + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 30 + } + }, + "argument": { + "type": "NumericLiteral", + "start": 51, + "end": 52, + "loc": { + "start": { + "line": 2, + "column": 29 + }, + "end": { + "line": 2, + "column": 30 + } + }, + "extra": { + "rawValue": 2, + "raw": "2" + }, + "value": 2 + } + } + } + ] + } + } + ], + "body": { + "type": "BlockStatement", + "start": 58, + "end": 60, + "loc": { + "start": { + "line": 2, + "column": 36 + }, + "end": { + "line": 2, + "column": 38 + } + }, + "body": [], + "directives": [] + } + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-parameters-of-nested-arrow-function/options.json b/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-parameters-of-nested-arrow-function/options.json deleted file mode 100644 index 7cec39290c2a..000000000000 --- a/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-parameters-of-nested-arrow-function/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Await cannot be used as name inside an async function (2:7)" -} diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-parameters-of-nested-arrow-function/output.json b/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-parameters-of-nested-arrow-function/output.json new file mode 100644 index 000000000000..329e0670c59a --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-parameters-of-nested-arrow-function/output.json @@ -0,0 +1,210 @@ +{ + "type": "File", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Await cannot be used as name inside an async function (2:7)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 15, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 17 + }, + "identifierName": "fn" + }, + "name": "fn" + }, + "generator": false, + "async": true, + "params": [], + "body": { + "type": "BlockStatement", + "start": 20, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 24, + "end": 44, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 24, + "end": 43, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 21 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "AssignmentPattern", + "start": 25, + "end": 36, + "loc": { + "start": { + "line": 2, + "column": 3 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "left": { + "type": "Identifier", + "start": 25, + "end": 26, + "loc": { + "start": { + "line": 2, + "column": 3 + }, + "end": { + "line": 2, + "column": 4 + }, + "identifierName": "x" + }, + "name": "x" + }, + "right": { + "type": "AwaitExpression", + "start": 29, + "end": 36, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "argument": { + "type": "NumericLiteral", + "start": 35, + "end": 36, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "extra": { + "rawValue": 2, + "raw": "2" + }, + "value": 2 + } + } + } + ], + "body": { + "type": "BlockStatement", + "start": 41, + "end": 43, + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 21 + } + }, + "body": [], + "directives": [] + } + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-parameters-of-nested-async-arrow-function/options.json b/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-parameters-of-nested-async-arrow-function/options.json deleted file mode 100644 index b45bba7cab4a..000000000000 --- a/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-parameters-of-nested-async-arrow-function/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Await cannot be used as name inside an async function (2:13)" -} diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-parameters-of-nested-async-arrow-function/output.json b/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-parameters-of-nested-async-arrow-function/output.json new file mode 100644 index 000000000000..39796387c784 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-parameters-of-nested-async-arrow-function/output.json @@ -0,0 +1,210 @@ +{ + "type": "File", + "start": 0, + "end": 52, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Await cannot be used as name inside an async function (2:13)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 52, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 52, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 15, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 17 + }, + "identifierName": "fn" + }, + "name": "fn" + }, + "generator": false, + "async": true, + "params": [], + "body": { + "type": "BlockStatement", + "start": 20, + "end": 52, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 24, + "end": 50, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 28 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 24, + "end": 49, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 27 + } + }, + "id": null, + "generator": false, + "async": true, + "params": [ + { + "type": "AssignmentPattern", + "start": 31, + "end": 42, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 20 + } + }, + "left": { + "type": "Identifier", + "start": 31, + "end": 32, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 10 + }, + "identifierName": "x" + }, + "name": "x" + }, + "right": { + "type": "AwaitExpression", + "start": 35, + "end": 42, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 20 + } + }, + "argument": { + "type": "NumericLiteral", + "start": 41, + "end": 42, + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 20 + } + }, + "extra": { + "rawValue": 2, + "raw": "2" + }, + "value": 2 + } + } + } + ], + "body": { + "type": "BlockStatement", + "start": 47, + "end": 49, + "loc": { + "start": { + "line": 2, + "column": 25 + }, + "end": { + "line": 2, + "column": 27 + } + }, + "body": [], + "directives": [] + } + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-parameters/options.json b/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-parameters/options.json deleted file mode 100644 index f4af75f31164..000000000000 --- a/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-parameters/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "await is not allowed in async function parameters (1:22)" -} diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-parameters/output.json b/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-parameters/output.json new file mode 100644 index 000000000000..be635254c883 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-parameters/output.json @@ -0,0 +1,158 @@ +{ + "type": "File", + "start": 0, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "errors": [ + "SyntaxError: await is not allowed in async function parameters (1:22)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "id": { + "type": "Identifier", + "start": 15, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 17 + }, + "identifierName": "fn" + }, + "name": "fn" + }, + "generator": false, + "async": true, + "params": [ + { + "type": "AssignmentPattern", + "start": 18, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "left": { + "type": "Identifier", + "start": 18, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + }, + "identifierName": "x" + }, + "name": "x" + }, + "right": { + "type": "AwaitExpression", + "start": 22, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "argument": { + "type": "NumericLiteral", + "start": 28, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "extra": { + "rawValue": 2, + "raw": "2" + }, + "value": 2 + } + } + } + ], + "body": { + "type": "BlockStatement", + "start": 31, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-escape-await/options.json b/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-escape-await/options.json index 9e964f0047f8..1780992b49c5 100644 --- a/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-escape-await/options.json +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-escape-await/options.json @@ -1,3 +1,3 @@ { - "throws": "Can not use 'await' as identifier inside an async function (1:20)" -} + "throws": "Unexpected token, expected \";\" (1:31)" +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-inside-loop/options.json b/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-inside-loop/options.json deleted file mode 100644 index 4bcd823e98be..000000000000 --- a/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-inside-loop/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Async functions can only be declared at the top level or inside a block (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-inside-loop/output.json b/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-inside-loop/output.json new file mode 100644 index 000000000000..e4933140f380 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/invalid-inside-loop/output.json @@ -0,0 +1,125 @@ +{ + "type": "File", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "errors": [ + "SyntaxError: Async functions can only be declared at the top level or inside a block (1:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "WhileStatement", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "test": { + "type": "NumericLiteral", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + }, + "body": { + "type": "FunctionDeclaration", + "start": 10, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "id": { + "type": "Identifier", + "start": 25, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 28 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "generator": false, + "async": true, + "params": [], + "body": { + "type": "BlockStatement", + "start": 30, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "body": [], + "directives": [] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/no-constructor/options.json b/packages/babel-parser/test/fixtures/es2017/async-functions/no-constructor/options.json deleted file mode 100644 index 49a2f478c663..000000000000 --- a/packages/babel-parser/test/fixtures/es2017/async-functions/no-constructor/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Constructor can't be an async function (2:8)" -} diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/no-constructor/output.json b/packages/babel-parser/test/fixtures/es2017/async-functions/no-constructor/output.json new file mode 100644 index 000000000000..8a46002d51c7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/no-constructor/output.json @@ -0,0 +1,144 @@ +{ + "type": "File", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Constructor can't be an async function (2:8)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ClassMethod", + "start": 12, + "end": 34, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 24 + } + }, + "static": false, + "key": { + "type": "Identifier", + "start": 18, + "end": 29, + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 19 + }, + "identifierName": "constructor" + }, + "name": "constructor" + }, + "computed": false, + "kind": "method", + "id": null, + "generator": false, + "async": true, + "params": [], + "body": { + "type": "BlockStatement", + "start": 32, + "end": 34, + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 24 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/params-invalid-rest-trailing-comma/options.json b/packages/babel-parser/test/fixtures/es2017/async-functions/params-invalid-rest-trailing-comma/options.json deleted file mode 100644 index bc7331763bfa..000000000000 --- a/packages/babel-parser/test/fixtures/es2017/async-functions/params-invalid-rest-trailing-comma/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected trailing comma after rest element (1:11)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/params-invalid-rest-trailing-comma/output.json b/packages/babel-parser/test/fixtures/es2017/async-functions/params-invalid-rest-trailing-comma/output.json new file mode 100644 index 000000000000..009f7252316f --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/params-invalid-rest-trailing-comma/output.json @@ -0,0 +1,122 @@ +{ + "type": "File", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "errors": [ + "SyntaxError: Unexpected trailing comma after rest element (1:11)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "id": null, + "generator": false, + "async": true, + "params": [ + { + "type": "RestElement", + "start": 7, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "argument": { + "type": "Identifier", + "start": 10, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + }, + "identifierName": "a" + }, + "name": "a" + } + } + ], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "body": [], + "directives": [] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2018/object-rest-spread/11/options.json b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/11/options.json index 6dad74eebd16..54925950e059 100644 --- a/packages/babel-parser/test/fixtures/es2018/object-rest-spread/11/options.json +++ b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/11/options.json @@ -1,4 +1,3 @@ { - "sourceType": "module", - "throws": "Identifier 'foo' has already been declared (2:23)" -} + "sourceType": "module" +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2018/object-rest-spread/11/output.json b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/11/output.json new file mode 100644 index 000000000000..8e0284f73c05 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/11/output.json @@ -0,0 +1,297 @@ +{ + "type": "File", + "start": 0, + "end": 57, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 35 + } + }, + "errors": [ + "SyntaxError: Identifier 'foo' has already been declared (2:23)", + "SyntaxError: `foo` has already been exported. Exported identifiers must be unique. (2:23)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 57, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 35 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start": 0, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start": 7, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 13, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "id": { + "type": "Identifier", + "start": 13, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 16 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "init": { + "type": "NumericLiteral", + "start": 19, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "const" + } + }, + { + "type": "ExportNamedDeclaration", + "start": 22, + "end": 57, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 35 + } + }, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start": 29, + "end": 57, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 35 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 35, + "end": 56, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 34 + } + }, + "id": { + "type": "ObjectPattern", + "start": 35, + "end": 50, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 28 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 37, + "end": 40, + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 37, + "end": 40, + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 18 + }, + "identifierName": "bar" + }, + "name": "bar" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start": 37, + "end": 40, + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 18 + }, + "identifierName": "bar" + }, + "name": "bar" + }, + "extra": { + "shorthand": true + } + }, + { + "type": "RestElement", + "start": 42, + "end": 48, + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 26 + } + }, + "argument": { + "type": "Identifier", + "start": 45, + "end": 48, + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 26 + }, + "identifierName": "foo" + }, + "name": "foo" + } + } + ] + }, + "init": { + "type": "Identifier", + "start": 53, + "end": 56, + "loc": { + "start": { + "line": 2, + "column": 31 + }, + "end": { + "line": 2, + "column": 34 + }, + "identifierName": "baz" + }, + "name": "baz" + } + } + ], + "kind": "const" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2018/object-rest-spread/12/options.json b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/12/options.json index 165223a448a3..54925950e059 100644 --- a/packages/babel-parser/test/fixtures/es2018/object-rest-spread/12/options.json +++ b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/12/options.json @@ -1,4 +1,3 @@ { - "sourceType": "module", - "throws": "Identifier 'bar' has already been declared (2:13)" -} + "sourceType": "module" +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2018/object-rest-spread/12/output.json b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/12/output.json new file mode 100644 index 000000000000..dd11a6812a7b --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/12/output.json @@ -0,0 +1,297 @@ +{ + "type": "File", + "start": 0, + "end": 57, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 21 + } + }, + "errors": [ + "SyntaxError: Identifier 'bar' has already been declared (2:13)", + "SyntaxError: `bar` has already been exported. Exported identifiers must be unique. (2:13)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 57, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 21 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start": 0, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start": 7, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 13, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "id": { + "type": "ObjectPattern", + "start": 13, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 15, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 15, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 18 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start": 15, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 18 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "extra": { + "shorthand": true + } + }, + { + "type": "RestElement", + "start": 20, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "argument": { + "type": "Identifier", + "start": 23, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 26 + }, + "identifierName": "bar" + }, + "name": "bar" + } + } + ] + }, + "init": { + "type": "Identifier", + "start": 31, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 34 + }, + "identifierName": "baz" + }, + "name": "baz" + } + } + ], + "kind": "const" + } + }, + { + "type": "ExportNamedDeclaration", + "start": 36, + "end": 57, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 21 + } + }, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start": 43, + "end": 57, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 21 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 49, + "end": 56, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 20 + } + }, + "id": { + "type": "Identifier", + "start": 49, + "end": 52, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 16 + }, + "identifierName": "bar" + }, + "name": "bar" + }, + "init": { + "type": "NumericLiteral", + "start": 55, + "end": 56, + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 20 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "const" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2018/object-rest-spread/13/options.json b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/13/options.json index 68df28e41c41..54925950e059 100644 --- a/packages/babel-parser/test/fixtures/es2018/object-rest-spread/13/options.json +++ b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/13/options.json @@ -1,4 +1,3 @@ { - "sourceType": "module", - "throws": "Identifier 'foo' has already been declared (2:30)" -} + "sourceType": "module" +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2018/object-rest-spread/13/output.json b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/13/output.json new file mode 100644 index 000000000000..a591bf90155e --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/13/output.json @@ -0,0 +1,349 @@ +{ + "type": "File", + "start": 0, + "end": 66, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 44 + } + }, + "errors": [ + "SyntaxError: Identifier 'foo' has already been declared (2:30)", + "SyntaxError: `foo` has already been exported. Exported identifiers must be unique. (2:30)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 66, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 44 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start": 0, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start": 7, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 13, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "id": { + "type": "Identifier", + "start": 13, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 16 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "init": { + "type": "NumericLiteral", + "start": 19, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "const" + } + }, + { + "type": "ExportNamedDeclaration", + "start": 22, + "end": 66, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 44 + } + }, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start": 29, + "end": 66, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 44 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 35, + "end": 65, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 43 + } + }, + "id": { + "type": "ObjectPattern", + "start": 35, + "end": 59, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 37 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 37, + "end": 57, + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 35 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 37, + "end": 40, + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 18 + }, + "identifierName": "bar" + }, + "name": "bar" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "ObjectPattern", + "start": 42, + "end": 57, + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 35 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 44, + "end": 47, + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 25 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 44, + "end": 47, + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 25 + }, + "identifierName": "baz" + }, + "name": "baz" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start": 44, + "end": 47, + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 25 + }, + "identifierName": "baz" + }, + "name": "baz" + }, + "extra": { + "shorthand": true + } + }, + { + "type": "RestElement", + "start": 49, + "end": 55, + "loc": { + "start": { + "line": 2, + "column": 27 + }, + "end": { + "line": 2, + "column": 33 + } + }, + "argument": { + "type": "Identifier", + "start": 52, + "end": 55, + "loc": { + "start": { + "line": 2, + "column": 30 + }, + "end": { + "line": 2, + "column": 33 + }, + "identifierName": "foo" + }, + "name": "foo" + } + } + ] + } + } + ] + }, + "init": { + "type": "Identifier", + "start": 62, + "end": 65, + "loc": { + "start": { + "line": 2, + "column": 40 + }, + "end": { + "line": 2, + "column": 43 + }, + "identifierName": "qux" + }, + "name": "qux" + } + } + ], + "kind": "const" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2018/object-rest-spread/14/options.json b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/14/options.json index 280073b140f0..54925950e059 100644 --- a/packages/babel-parser/test/fixtures/es2018/object-rest-spread/14/options.json +++ b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/14/options.json @@ -1,4 +1,3 @@ { - "sourceType": "module", - "throws": "Identifier 'foo' has already been declared (2:29)" -} + "sourceType": "module" +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2018/object-rest-spread/14/output.json b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/14/output.json new file mode 100644 index 000000000000..d092e82a47c3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/14/output.json @@ -0,0 +1,331 @@ +{ + "type": "File", + "start": 0, + "end": 64, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 42 + } + }, + "errors": [ + "SyntaxError: Identifier 'foo' has already been declared (2:29)", + "SyntaxError: `foo` has already been exported. Exported identifiers must be unique. (2:29)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 64, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 42 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start": 0, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start": 7, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 13, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "id": { + "type": "Identifier", + "start": 13, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 16 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "init": { + "type": "NumericLiteral", + "start": 19, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "const" + } + }, + { + "type": "ExportNamedDeclaration", + "start": 22, + "end": 64, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 42 + } + }, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start": 29, + "end": 64, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 42 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 35, + "end": 63, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 41 + } + }, + "id": { + "type": "ArrayPattern", + "start": 35, + "end": 57, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 35 + } + }, + "elements": [ + { + "type": "Identifier", + "start": 36, + "end": 39, + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 17 + }, + "identifierName": "bar" + }, + "name": "bar" + }, + { + "type": "ObjectPattern", + "start": 41, + "end": 56, + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 34 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 43, + "end": 46, + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 24 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 43, + "end": 46, + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 24 + }, + "identifierName": "baz" + }, + "name": "baz" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start": 43, + "end": 46, + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 24 + }, + "identifierName": "baz" + }, + "name": "baz" + }, + "extra": { + "shorthand": true + } + }, + { + "type": "RestElement", + "start": 48, + "end": 54, + "loc": { + "start": { + "line": 2, + "column": 26 + }, + "end": { + "line": 2, + "column": 32 + } + }, + "argument": { + "type": "Identifier", + "start": 51, + "end": 54, + "loc": { + "start": { + "line": 2, + "column": 29 + }, + "end": { + "line": 2, + "column": 32 + }, + "identifierName": "foo" + }, + "name": "foo" + } + } + ] + } + ] + }, + "init": { + "type": "Identifier", + "start": 60, + "end": 63, + "loc": { + "start": { + "line": 2, + "column": 38 + }, + "end": { + "line": 2, + "column": 41 + }, + "identifierName": "qux" + }, + "name": "qux" + } + } + ], + "kind": "const" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2018/object-rest-spread/15/options.json b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/15/options.json index 68df28e41c41..54925950e059 100644 --- a/packages/babel-parser/test/fixtures/es2018/object-rest-spread/15/options.json +++ b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/15/options.json @@ -1,4 +1,3 @@ { - "sourceType": "module", - "throws": "Identifier 'foo' has already been declared (2:30)" -} + "sourceType": "module" +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2018/object-rest-spread/15/output.json b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/15/output.json new file mode 100644 index 000000000000..a35595b31013 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/15/output.json @@ -0,0 +1,348 @@ +{ + "type": "File", + "start": 0, + "end": 66, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 44 + } + }, + "errors": [ + "SyntaxError: Identifier 'foo' has already been declared (2:30)", + "SyntaxError: `foo` has already been exported. Exported identifiers must be unique. (2:30)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 66, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 44 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start": 0, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start": 7, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 13, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "id": { + "type": "Identifier", + "start": 13, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 16 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "init": { + "type": "NumericLiteral", + "start": 19, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "const" + } + }, + { + "type": "ExportNamedDeclaration", + "start": 22, + "end": 66, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 44 + } + }, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start": 29, + "end": 66, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 44 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 35, + "end": 65, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 43 + } + }, + "id": { + "type": "ArrayPattern", + "start": 35, + "end": 59, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 37 + } + }, + "elements": [ + { + "type": "Identifier", + "start": 36, + "end": 39, + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 17 + }, + "identifierName": "bar" + }, + "name": "bar" + }, + { + "type": "ArrayPattern", + "start": 41, + "end": 58, + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 36 + } + }, + "elements": [ + { + "type": "ObjectPattern", + "start": 42, + "end": 57, + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 35 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 44, + "end": 47, + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 25 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 44, + "end": 47, + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 25 + }, + "identifierName": "baz" + }, + "name": "baz" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start": 44, + "end": 47, + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 25 + }, + "identifierName": "baz" + }, + "name": "baz" + }, + "extra": { + "shorthand": true + } + }, + { + "type": "RestElement", + "start": 49, + "end": 55, + "loc": { + "start": { + "line": 2, + "column": 27 + }, + "end": { + "line": 2, + "column": 33 + } + }, + "argument": { + "type": "Identifier", + "start": 52, + "end": 55, + "loc": { + "start": { + "line": 2, + "column": 30 + }, + "end": { + "line": 2, + "column": 33 + }, + "identifierName": "foo" + }, + "name": "foo" + } + } + ] + } + ] + } + ] + }, + "init": { + "type": "Identifier", + "start": 62, + "end": 65, + "loc": { + "start": { + "line": 2, + "column": 40 + }, + "end": { + "line": 2, + "column": 43 + }, + "identifierName": "qux" + }, + "name": "qux" + } + } + ], + "kind": "const" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2018/object-rest-spread/18/options.json b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/18/options.json deleted file mode 100644 index b447c590ab2c..000000000000 --- a/packages/babel-parser/test/fixtures/es2018/object-rest-spread/18/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid rest operator's argument (1:5)" -} diff --git a/packages/babel-parser/test/fixtures/es2018/object-rest-spread/18/output.json b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/18/output.json new file mode 100644 index 000000000000..9a9ef9274914 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/18/output.json @@ -0,0 +1,137 @@ +{ + "type": "File", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "errors": [ + "SyntaxError: Invalid rest operator's argument (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 1, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "operator": "=", + "left": { + "type": "ObjectPattern", + "start": 1, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "properties": [ + { + "type": "RestElement", + "start": 2, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "argument": { + "type": "ObjectPattern", + "start": 5, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "properties": [] + } + } + ] + }, + "right": { + "type": "ObjectExpression", + "start": 11, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "properties": [] + }, + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2018/object-rest-spread/21/options.json b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/21/options.json deleted file mode 100644 index b447c590ab2c..000000000000 --- a/packages/babel-parser/test/fixtures/es2018/object-rest-spread/21/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid rest operator's argument (1:5)" -} diff --git a/packages/babel-parser/test/fixtures/es2018/object-rest-spread/21/output.json b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/21/output.json new file mode 100644 index 000000000000..09b6d303c4ac --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/21/output.json @@ -0,0 +1,173 @@ +{ + "type": "File", + "start": 0, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "errors": [ + "SyntaxError: Invalid rest operator's argument (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 1, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "operator": "=", + "left": { + "type": "ObjectPattern", + "start": 1, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "properties": [ + { + "type": "RestElement", + "start": 2, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "argument": { + "type": "AssignmentPattern", + "start": 5, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "left": { + "type": "Identifier", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "x" + }, + "name": "x" + }, + "right": { + "type": "NumericLiteral", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + } + ] + }, + "right": { + "type": "ObjectExpression", + "start": 14, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "properties": [] + }, + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2018/object-rest-spread/24/options.json b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/24/options.json deleted file mode 100644 index b447c590ab2c..000000000000 --- a/packages/babel-parser/test/fixtures/es2018/object-rest-spread/24/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid rest operator's argument (1:5)" -} diff --git a/packages/babel-parser/test/fixtures/es2018/object-rest-spread/24/output.json b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/24/output.json new file mode 100644 index 000000000000..2f80e2925775 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/24/output.json @@ -0,0 +1,137 @@ +{ + "type": "File", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "errors": [ + "SyntaxError: Invalid rest operator's argument (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 1, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "operator": "=", + "left": { + "type": "ObjectPattern", + "start": 1, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "properties": [ + { + "type": "RestElement", + "start": 2, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "argument": { + "type": "ArrayPattern", + "start": 5, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "elements": [] + } + } + ] + }, + "right": { + "type": "ObjectExpression", + "start": 11, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "properties": [] + }, + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2018/object-rest-spread/8/options.json b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/8/options.json deleted file mode 100644 index c44d69275adb..000000000000 --- a/packages/babel-parser/test/fixtures/es2018/object-rest-spread/8/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected trailing comma after rest element (1:16)" -} diff --git a/packages/babel-parser/test/fixtures/es2018/object-rest-spread/8/output.json b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/8/output.json new file mode 100644 index 000000000000..c7ff07e0d0df --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2018/object-rest-spread/8/output.json @@ -0,0 +1,250 @@ +{ + "type": "File", + "start": 0, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "errors": [ + "SyntaxError: Unexpected trailing comma after rest element (1:16)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "id": { + "type": "ObjectPattern", + "start": 4, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "x" + }, + "name": "x" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "x" + }, + "name": "x" + }, + "extra": { + "shorthand": true + } + }, + { + "type": "ObjectProperty", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "y" + }, + "name": "y" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "y" + }, + "name": "y" + }, + "extra": { + "shorthand": true + } + }, + { + "type": "RestElement", + "start": 12, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "argument": { + "type": "Identifier", + "start": 15, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + }, + "identifierName": "z" + }, + "name": "z" + } + } + ], + "extra": { + "trailingComma": 16 + } + }, + "init": { + "type": "Identifier", + "start": 22, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 25 + }, + "identifierName": "obj" + }, + "name": "obj" + } + } + ], + "kind": "let" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/declaration-function/dupe-param/options.json b/packages/babel-parser/test/fixtures/esprima/declaration-function/dupe-param/options.json deleted file mode 100644 index 8b20b9a7df36..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/declaration-function/dupe-param/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Argument name clash (1:14)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/declaration-function/dupe-param/output.json b/packages/babel-parser/test/fixtures/esprima/declaration-function/dupe-param/output.json new file mode 100644 index 000000000000..aa4301697cf8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/declaration-function/dupe-param/output.json @@ -0,0 +1,161 @@ +{ + "type": "File", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "errors": [ + "SyntaxError: Argument name clash (1:14)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "a" + }, + "name": "a" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 11, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "x" + }, + "name": "x" + }, + { + "type": "Identifier", + "start": 14, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + }, + "identifierName": "x" + }, + "name": "x" + } + ], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 18, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 18, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-array-binding-pattern/invalid-dup-param/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-array-binding-pattern/invalid-dup-param/options.json deleted file mode 100644 index a4a6e207d28c..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-array-binding-pattern/invalid-dup-param/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Argument name clash (1:11)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-array-binding-pattern/invalid-dup-param/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-array-binding-pattern/invalid-dup-param/output.json new file mode 100644 index 000000000000..09552b591b3f --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-array-binding-pattern/invalid-dup-param/output.json @@ -0,0 +1,193 @@ +{ + "type": "File", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "errors": [ + "SyntaxError: Argument name clash (1:11)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 0, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "ArrayPattern", + "start": 1, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "elements": [ + { + "type": "Identifier", + "start": 2, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + }, + "identifierName": "a" + }, + "name": "a" + }, + { + "type": "ArrayPattern", + "start": 4, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "elements": [ + { + "type": "Identifier", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "b" + }, + "name": "b" + } + ] + }, + { + "type": "RestElement", + "start": 8, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "argument": { + "type": "Identifier", + "start": 11, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "b" + }, + "name": "b" + } + } + ] + } + ], + "body": { + "type": "NumericLiteral", + "start": 16, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-array-pattern/dupe-param-1/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-array-pattern/dupe-param-1/options.json deleted file mode 100644 index 49e8d8e86314..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-array-pattern/dupe-param-1/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Argument name clash (2:14)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-array-pattern/dupe-param-1/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-array-pattern/dupe-param-1/output.json new file mode 100644 index 000000000000..57442d5cb4fd --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-array-pattern/dupe-param-1/output.json @@ -0,0 +1,178 @@ +{ + "type": "File", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 20 + } + }, + "errors": [ + "SyntaxError: Argument name clash (2:14)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 20 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 14, + "end": 34, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 20 + } + }, + "id": { + "type": "Identifier", + "start": 23, + "end": 24, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 10 + }, + "identifierName": "a" + }, + "name": "a" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "ArrayPattern", + "start": 25, + "end": 30, + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "elements": [ + { + "type": "Identifier", + "start": 26, + "end": 27, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 13 + }, + "identifierName": "a" + }, + "name": "a" + }, + { + "type": "Identifier", + "start": 28, + "end": 29, + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 15 + }, + "identifierName": "a" + }, + "name": "a" + } + ] + } + ], + "body": { + "type": "BlockStatement", + "start": 31, + "end": 34, + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 20 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-array-pattern/dupe-param-2/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-array-pattern/dupe-param-2/options.json deleted file mode 100644 index 3829082a4878..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-array-pattern/dupe-param-2/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Argument name clash (2:17)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-array-pattern/dupe-param-2/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-array-pattern/dupe-param-2/output.json new file mode 100644 index 000000000000..4242da8e09f7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-array-pattern/dupe-param-2/output.json @@ -0,0 +1,193 @@ +{ + "type": "File", + "start": 0, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 23 + } + }, + "errors": [ + "SyntaxError: Argument name clash (2:17)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 23 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 14, + "end": 37, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 23 + } + }, + "id": { + "type": "Identifier", + "start": 23, + "end": 24, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 10 + }, + "identifierName": "a" + }, + "name": "a" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "ArrayPattern", + "start": 25, + "end": 33, + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "elements": [ + { + "type": "Identifier", + "start": 26, + "end": 27, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 13 + }, + "identifierName": "a" + }, + "name": "a" + }, + { + "type": "RestElement", + "start": 28, + "end": 32, + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "argument": { + "type": "Identifier", + "start": 31, + "end": 32, + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 18 + }, + "identifierName": "a" + }, + "name": "a" + } + } + ] + } + ], + "body": { + "type": "BlockStatement", + "start": 34, + "end": 37, + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 23 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-array-pattern/dupe-param-3/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-array-pattern/dupe-param-3/options.json deleted file mode 100644 index 782073313a19..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-array-pattern/dupe-param-3/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Argument name clash (2:19)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-array-pattern/dupe-param-3/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-array-pattern/dupe-param-3/output.json new file mode 100644 index 000000000000..00b0c28f58c6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-array-pattern/dupe-param-3/output.json @@ -0,0 +1,248 @@ +{ + "type": "File", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 25 + } + }, + "errors": [ + "SyntaxError: Argument name clash (2:19)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 25 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 14, + "end": 39, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 25 + } + }, + "id": { + "type": "Identifier", + "start": 23, + "end": 24, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 10 + }, + "identifierName": "a" + }, + "name": "a" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "ArrayPattern", + "start": 25, + "end": 35, + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 21 + } + }, + "elements": [ + { + "type": "ObjectPattern", + "start": 26, + "end": 29, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 27, + "end": 28, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 27, + "end": 28, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 14 + }, + "identifierName": "a" + }, + "name": "a" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start": 27, + "end": 28, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 14 + }, + "identifierName": "a" + }, + "name": "a" + }, + "extra": { + "shorthand": true + } + } + ] + }, + { + "type": "RestElement", + "start": 30, + "end": 34, + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 20 + } + }, + "argument": { + "type": "Identifier", + "start": 33, + "end": 34, + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 20 + }, + "identifierName": "a" + }, + "name": "a" + } + } + ] + } + ], + "body": { + "type": "BlockStatement", + "start": 36, + "end": 39, + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 25 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/complex-rest-in-arrow-not-allowed/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/complex-rest-in-arrow-not-allowed/options.json deleted file mode 100644 index fd74c5228531..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/complex-rest-in-arrow-not-allowed/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Argument name clash (1:7)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/complex-rest-in-arrow-not-allowed/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/complex-rest-in-arrow-not-allowed/output.json new file mode 100644 index 000000000000..34fec649661b --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/complex-rest-in-arrow-not-allowed/output.json @@ -0,0 +1,159 @@ +{ + "type": "File", + "start": 0, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "errors": [ + "SyntaxError: Argument name clash (1:7)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 1, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + }, + "identifierName": "a" + }, + "name": "a" + }, + { + "type": "RestElement", + "start": 3, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "argument": { + "type": "ArrayPattern", + "start": 6, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "elements": [ + { + "type": "Identifier", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + }, + "identifierName": "a" + }, + "name": "a" + } + ] + } + } + ], + "body": { + "type": "NumericLiteral", + "start": 14, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/invalid-duplicated-params/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/invalid-duplicated-params/options.json deleted file mode 100644 index 368006ae58bd..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/invalid-duplicated-params/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Argument name clash (1:4)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/invalid-duplicated-params/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/invalid-duplicated-params/output.json new file mode 100644 index 000000000000..5456b40fe86d --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/invalid-duplicated-params/output.json @@ -0,0 +1,124 @@ +{ + "type": "File", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "errors": [ + "SyntaxError: Argument name clash (1:4)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 1, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + }, + "identifierName": "x" + }, + "name": "x" + }, + { + "type": "Identifier", + "start": 4, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "x" + }, + "name": "x" + } + ], + "body": { + "type": "Identifier", + "start": 10, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + }, + "identifierName": "y" + }, + "name": "y" + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/invalid-param-strict-mode/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/invalid-param-strict-mode/options.json deleted file mode 100644 index 8f5ca9d5da67..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/invalid-param-strict-mode/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/invalid-param-strict-mode/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/invalid-param-strict-mode/output.json new file mode 100644 index 000000000000..1daa964b52b1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/invalid-param-strict-mode/output.json @@ -0,0 +1,143 @@ +{ + "type": "File", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + }, + "identifierName": "eval" + }, + "name": "eval" + } + ], + "body": { + "type": "BlockStatement", + "start": 8, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 9, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 9, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/object-binding-pattern-invalid-member-expr/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/object-binding-pattern-invalid-member-expr/options.json deleted file mode 100644 index bf0f292caad2..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/object-binding-pattern-invalid-member-expr/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in object destructuring pattern (1:4)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/object-binding-pattern-invalid-member-expr/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/object-binding-pattern-invalid-member-expr/output.json new file mode 100644 index 000000000000..9e8858777646 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/object-binding-pattern-invalid-member-expr/output.json @@ -0,0 +1,198 @@ +{ + "type": "File", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "errors": [ + "SyntaxError: Binding member expression (1:4)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "ObjectPattern", + "start": 1, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 2, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 2, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + }, + "identifierName": "a" + }, + "name": "a" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "MemberExpression", + "start": 4, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "object": { + "type": "Identifier", + "start": 4, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "b" + }, + "name": "b" + }, + "property": { + "type": "NumericLiteral", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + }, + "computed": true + } + } + ] + } + ], + "body": { + "type": "NumericLiteral", + "start": 12, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/object-binding-pattern-invalid-method-in-pattern/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/object-binding-pattern-invalid-method-in-pattern/options.json deleted file mode 100644 index 559cc4e11a41..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/object-binding-pattern-invalid-method-in-pattern/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Object pattern can't contain getter or setter (1:6)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/object-binding-pattern-invalid-method-in-pattern/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/object-binding-pattern-invalid-method-in-pattern/output.json new file mode 100644 index 000000000000..d391e09c2dfe --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/object-binding-pattern-invalid-method-in-pattern/output.json @@ -0,0 +1,166 @@ +{ + "type": "File", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "errors": [ + "SyntaxError: Object pattern can't contain getter or setter (1:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "ObjectPattern", + "start": 1, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "properties": [ + { + "type": "ObjectMethod", + "start": 2, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "a" + }, + "name": "a" + }, + "computed": false, + "kind": "get", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 9, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "body": [], + "directives": [] + } + } + ] + } + ], + "body": { + "type": "NumericLiteral", + "start": 17, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/object-binding-pattern-invalid-nested-param/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/object-binding-pattern-invalid-nested-param/options.json deleted file mode 100644 index 30f209db8f07..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/object-binding-pattern-invalid-nested-param/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in object destructuring pattern (1:24)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/object-binding-pattern-invalid-nested-param/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/object-binding-pattern-invalid-nested-param/output.json new file mode 100644 index 000000000000..a0f4f6168da6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-arrow-function/object-binding-pattern-invalid-nested-param/output.json @@ -0,0 +1,538 @@ +{ + "type": "File", + "start": 0, + "end": 54, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 54 + } + }, + "errors": [ + "SyntaxError: Binding member expression (1:24)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 54, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 54 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 54, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 54 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 0, + "end": 53, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 53 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "ArrayPattern", + "start": 1, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 49 + } + }, + "elements": [ + { + "type": "ArrayPattern", + "start": 2, + "end": 48, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 48 + } + }, + "elements": [ + { + "type": "ArrayPattern", + "start": 3, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 47 + } + }, + "elements": [ + { + "type": "ArrayPattern", + "start": 4, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "elements": [ + { + "type": "ArrayPattern", + "start": 5, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 45 + } + }, + "elements": [ + { + "type": "ArrayPattern", + "start": 6, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 44 + } + }, + "elements": [ + { + "type": "ArrayPattern", + "start": 7, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "elements": [ + { + "type": "ArrayPattern", + "start": 8, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 42 + } + }, + "elements": [ + { + "type": "ArrayPattern", + "start": 9, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "elements": [ + { + "type": "ArrayPattern", + "start": 10, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "elements": [ + { + "type": "ArrayPattern", + "start": 11, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "elements": [ + { + "type": "ArrayPattern", + "start": 12, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "elements": [ + { + "type": "ArrayPattern", + "start": 13, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "elements": [ + { + "type": "ArrayPattern", + "start": 14, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "elements": [ + { + "type": "ArrayPattern", + "start": 15, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "elements": [ + { + "type": "ArrayPattern", + "start": 16, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "elements": [ + { + "type": "ArrayPattern", + "start": 17, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "elements": [ + { + "type": "ArrayPattern", + "start": 18, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "elements": [ + { + "type": "ArrayPattern", + "start": 19, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "elements": [ + { + "type": "ArrayPattern", + "start": 20, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "elements": [ + { + "type": "ObjectPattern", + "start": 21, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 22, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 22, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + }, + "identifierName": "a" + }, + "name": "a" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "MemberExpression", + "start": 24, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "object": { + "type": "Identifier", + "start": 24, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + }, + "identifierName": "b" + }, + "name": "b" + }, + "property": { + "type": "NumericLiteral", + "start": 26, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + }, + "computed": true + } + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + } + ], + "body": { + "type": "NumericLiteral", + "start": 52, + "end": 53, + "loc": { + "start": { + "line": 1, + "column": 52 + }, + "end": { + "line": 1, + "column": 53 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-object-pattern/invalid-lhs-01/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-object-pattern/invalid-lhs-01/options.json deleted file mode 100644 index bf0f292caad2..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-object-pattern/invalid-lhs-01/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in object destructuring pattern (1:4)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-object-pattern/invalid-lhs-01/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-object-pattern/invalid-lhs-01/output.json new file mode 100644 index 000000000000..b71ec1a70153 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-object-pattern/invalid-lhs-01/output.json @@ -0,0 +1,160 @@ +{ + "type": "File", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "errors": [ + "SyntaxError: Invalid left-hand side in object destructuring pattern (1:4)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 1, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "operator": "=", + "left": { + "type": "ObjectPattern", + "start": 1, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 2, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 2, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + }, + "identifierName": "a" + }, + "name": "a" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "ThisExpression", + "start": 4, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 8 + } + } + } + } + ] + }, + "right": { + "type": "NumericLiteral", + "start": 10, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + }, + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-object-pattern/invalid-lhs-02/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-object-pattern/invalid-lhs-02/options.json deleted file mode 100644 index 2cfe61cdc033..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-object-pattern/invalid-lhs-02/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in object destructuring pattern (1:5)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-object-pattern/invalid-lhs-02/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-object-pattern/invalid-lhs-02/output.json new file mode 100644 index 000000000000..0282d2b2a59c --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-object-pattern/invalid-lhs-02/output.json @@ -0,0 +1,160 @@ +{ + "type": "File", + "start": 0, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "errors": [ + "SyntaxError: Invalid left-hand side in object destructuring pattern (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 1, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "operator": "=", + "left": { + "type": "ObjectPattern", + "start": 1, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 2, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 2, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + }, + "identifierName": "a" + }, + "name": "a" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "ThisExpression", + "start": 5, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 9 + } + } + } + } + ] + }, + "right": { + "type": "NumericLiteral", + "start": 13, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + }, + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-object-pattern/invalid-pattern-with-method/input.js b/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-object-pattern/invalid-pattern-with-method/input.js index 1dcb7ce683e6..dd21753e3550 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-object-pattern/invalid-pattern-with-method/input.js +++ b/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-object-pattern/invalid-pattern-with-method/input.js @@ -1 +1 @@ -({a(){}})=0 +({a(){}}=0) diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-object-pattern/invalid-pattern-with-method/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-object-pattern/invalid-pattern-with-method/options.json deleted file mode 100644 index 081535f854c6..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-object-pattern/invalid-pattern-with-method/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Object pattern can't contain methods (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-object-pattern/invalid-pattern-with-method/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-object-pattern/invalid-pattern-with-method/output.json new file mode 100644 index 000000000000..4f63aa8f3c12 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment-object-pattern/invalid-pattern-with-method/output.json @@ -0,0 +1,166 @@ +{ + "type": "File", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "errors": [ + "SyntaxError: Object pattern can't contain methods (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 1, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "operator": "=", + "left": { + "type": "ObjectPattern", + "start": 1, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "properties": [ + { + "type": "ObjectMethod", + "start": 2, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "method": true, + "key": { + "type": "Identifier", + "start": 2, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + }, + "identifierName": "a" + }, + "name": "a" + }, + "computed": false, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 5, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "body": [], + "directives": [] + } + } + ] + }, + "right": { + "type": "NumericLiteral", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + }, + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment/invalid-group-assignment/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment/invalid-group-assignment/options.json deleted file mode 100644 index 7c5f08eb9ba6..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment/invalid-group-assignment/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in assignment expression (1:1)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment/invalid-group-assignment/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment/invalid-group-assignment/output.json new file mode 100644 index 000000000000..a6616604e7dd --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-destructuring-assignment/invalid-group-assignment/output.json @@ -0,0 +1,179 @@ +{ + "type": "File", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "errors": [ + "SyntaxError: Invalid left-hand side in assignment expression (1:1)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "operator": "=", + "left": { + "type": "SequenceExpression", + "start": 1, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "expressions": [ + { + "type": "Identifier", + "start": 1, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + }, + "identifierName": "a" + }, + "name": "a" + }, + { + "type": "Identifier", + "start": 3, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + }, + "identifierName": "b" + }, + "name": "b" + } + ], + "extra": { + "parenthesized": true, + "parenStart": 0 + } + }, + "right": { + "type": "SequenceExpression", + "start": 7, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "expressions": [ + { + "type": "Identifier", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + }, + "identifierName": "c" + }, + "name": "c" + }, + { + "type": "Identifier", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "d" + }, + "name": "d" + } + ], + "extra": { + "parenthesized": true, + "parenStart": 6 + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/invalid-export-named-default/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/invalid-export-named-default/options.json index 9371e19769ce..54925950e059 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/invalid-export-named-default/options.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/invalid-export-named-default/options.json @@ -1,4 +1,3 @@ { - "sourceType": "module", - "throws": "Unexpected keyword 'default' (1:8)" -} + "sourceType": "module" +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/invalid-export-named-default/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/invalid-export-named-default/output.json new file mode 100644 index 000000000000..0b3a95c25658 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-export-declaration/invalid-export-named-default/output.json @@ -0,0 +1,107 @@ +{ + "type": "File", + "start": 0, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "errors": [ + "SyntaxError: Unexpected keyword 'default' (1:8)", + "SyntaxError: Export 'default' is not defined (1:8)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start": 0, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "specifiers": [ + { + "type": "ExportSpecifier", + "start": 8, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "local": { + "type": "Identifier", + "start": 8, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 15 + }, + "identifierName": "default" + }, + "name": "default" + }, + "exported": { + "type": "Identifier", + "start": 8, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 15 + }, + "identifierName": "default" + }, + "name": "default" + } + } + ], + "source": null, + "declaration": null + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-for-of/invalid-const-init/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-for-of/invalid-const-init/options.json deleted file mode 100644 index 1fc5db8949ff..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-for-of/invalid-const-init/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "for-of loop variable declaration may not have an initializer (1:5)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-for-of/invalid-const-init/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-for-of/invalid-const-init/output.json new file mode 100644 index 000000000000..9addc13c958b --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-for-of/invalid-const-init/output.json @@ -0,0 +1,156 @@ +{ + "type": "File", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "errors": [ + "SyntaxError: for-of loop variable declaration may not have an initializer (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ForOfStatement", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "await": false, + "left": { + "type": "VariableDeclaration", + "start": 5, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 11, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "id": { + "type": "Identifier", + "start": 11, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "x" + }, + "name": "x" + }, + "init": { + "type": "NumericLiteral", + "start": 15, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "const" + }, + "right": { + "type": "Identifier", + "start": 20, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + }, + "identifierName": "y" + }, + "name": "y" + }, + "body": { + "type": "EmptyStatement", + "start": 22, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-for-of/invalid-let-init/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-for-of/invalid-let-init/options.json deleted file mode 100644 index 1fc5db8949ff..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-for-of/invalid-let-init/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "for-of loop variable declaration may not have an initializer (1:5)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-for-of/invalid-let-init/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-for-of/invalid-let-init/output.json new file mode 100644 index 000000000000..e7720b34974c --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-for-of/invalid-let-init/output.json @@ -0,0 +1,156 @@ +{ + "type": "File", + "start": 0, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "errors": [ + "SyntaxError: for-of loop variable declaration may not have an initializer (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ForOfStatement", + "start": 0, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "await": false, + "left": { + "type": "VariableDeclaration", + "start": 5, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "x" + }, + "name": "x" + }, + "init": { + "type": "NumericLiteral", + "start": 13, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "let" + }, + "right": { + "type": "Identifier", + "start": 18, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + }, + "identifierName": "y" + }, + "name": "y" + }, + "body": { + "type": "EmptyStatement", + "start": 20, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-for-of/invalid-lhs-init/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-for-of/invalid-lhs-init/options.json deleted file mode 100644 index a4dd545935e8..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-for-of/invalid-lhs-init/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in for-of statement (1:5)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-for-of/invalid-lhs-init/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-for-of/invalid-lhs-init/output.json new file mode 100644 index 000000000000..bdb80af26d26 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-for-of/invalid-lhs-init/output.json @@ -0,0 +1,101 @@ +{ + "type": "File", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "errors": [ + "SyntaxError: Invalid left-hand side in for-of statement (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ForOfStatement", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "await": false, + "left": { + "type": "ThisExpression", + "start": 5, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "right": { + "type": "Identifier", + "start": 13, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 17 + }, + "identifierName": "that" + }, + "name": "that" + }, + "body": { + "type": "EmptyStatement", + "start": 18, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-for-of/invalid-var-init/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-for-of/invalid-var-init/options.json deleted file mode 100644 index 1fc5db8949ff..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-for-of/invalid-var-init/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "for-of loop variable declaration may not have an initializer (1:5)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-for-of/invalid-var-init/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-for-of/invalid-var-init/output.json new file mode 100644 index 000000000000..5c95e7b34186 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-for-of/invalid-var-init/output.json @@ -0,0 +1,156 @@ +{ + "type": "File", + "start": 0, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "errors": [ + "SyntaxError: for-of loop variable declaration may not have an initializer (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ForOfStatement", + "start": 0, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "await": false, + "left": { + "type": "VariableDeclaration", + "start": 5, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "x" + }, + "name": "x" + }, + "init": { + "type": "NumericLiteral", + "start": 13, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "var" + }, + "right": { + "type": "Identifier", + "start": 18, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + }, + "identifierName": "y" + }, + "name": "y" + }, + "body": { + "type": "EmptyStatement", + "start": 20, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-identifier/invalid_escaped_surrogate_pairs/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-identifier/invalid_escaped_surrogate_pairs/options.json deleted file mode 100644 index df97a8ee679f..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-identifier/invalid_escaped_surrogate_pairs/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid Unicode escape (1:4)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-identifier/invalid_escaped_surrogate_pairs/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-identifier/invalid_escaped_surrogate_pairs/output.json new file mode 100644 index 000000000000..111d8eb97b43 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-identifier/invalid_escaped_surrogate_pairs/output.json @@ -0,0 +1,90 @@ +{ + "type": "File", + "start": 0, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "errors": [ + "SyntaxError: Invalid Unicode escape (1:4)", + "SyntaxError: Invalid Unicode escape (1:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "id": { + "type": "Identifier", + "start": 4, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 16 + }, + "identifierName": "𞸀" + }, + "name": "𞸀" + }, + "init": null + } + ], + "kind": "var" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-identifier/invalid_expression_await/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-identifier/invalid_expression_await/options.json deleted file mode 100644 index afbed324e92a..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-identifier/invalid_expression_await/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "'import' and 'export' may appear only with 'sourceType: \"module\"' (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-identifier/invalid_expression_await/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-identifier/invalid_expression_await/output.json new file mode 100644 index 000000000000..a6d558c93efe --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-identifier/invalid_expression_await/output.json @@ -0,0 +1,158 @@ +{ + "type": "File", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "errors": [ + "SyntaxError: 'import' and 'export' may appear only with 'sourceType: \"module\"' (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start": 7, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 11, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "id": { + "type": "Identifier", + "start": 11, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 17 + }, + "identifierName": "answer" + }, + "name": "answer" + }, + "init": { + "type": "BinaryExpression", + "start": 20, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "left": { + "type": "Identifier", + "start": 20, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 25 + }, + "identifierName": "await" + }, + "name": "await" + }, + "operator": "+", + "right": { + "type": "NumericLiteral", + "start": 28, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + } + ], + "kind": "var" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-identifier/invalid_var_await/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-identifier/invalid_var_await/options.json deleted file mode 100644 index afbed324e92a..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-identifier/invalid_var_await/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "'import' and 'export' may appear only with 'sourceType: \"module\"' (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-identifier/invalid_var_await/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-identifier/invalid_var_await/output.json new file mode 100644 index 000000000000..514e8e0f0abe --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-identifier/invalid_var_await/output.json @@ -0,0 +1,106 @@ +{ + "type": "File", + "start": 0, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "errors": [ + "SyntaxError: 'import' and 'export' may appear only with 'sourceType: \"module\"' (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExportNamedDeclaration", + "start": 0, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start": 7, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 11, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "id": { + "type": "Identifier", + "start": 11, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 16 + }, + "identifierName": "await" + }, + "name": "await" + }, + "init": null + } + ], + "kind": "var" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-lexical-declaration/invalid_complex_binding_without_init/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-lexical-declaration/invalid_complex_binding_without_init/options.json deleted file mode 100644 index 57893e4eee56..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-lexical-declaration/invalid_complex_binding_without_init/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Complex binding patterns require an initialization value (1:6)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-lexical-declaration/invalid_complex_binding_without_init/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-lexical-declaration/invalid_complex_binding_without_init/output.json new file mode 100644 index 000000000000..fe814362c2c8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-lexical-declaration/invalid_complex_binding_without_init/output.json @@ -0,0 +1,88 @@ +{ + "type": "File", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "errors": [ + "SyntaxError: Complex binding patterns require an initialization value (1:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "id": { + "type": "ArrayPattern", + "start": 4, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "elements": [] + }, + "init": null + } + ], + "kind": "let" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-lexical-declaration/invalid_const_forin/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-lexical-declaration/invalid_const_forin/options.json deleted file mode 100644 index 68677faac9b9..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-lexical-declaration/invalid_const_forin/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "for-in loop variable declaration may not have an initializer (1:5)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-lexical-declaration/invalid_const_forin/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-lexical-declaration/invalid_const_forin/output.json new file mode 100644 index 000000000000..f2fe5561bb8d --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-lexical-declaration/invalid_const_forin/output.json @@ -0,0 +1,157 @@ +{ + "type": "File", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "errors": [ + "SyntaxError: for-in loop variable declaration may not have an initializer (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ForInStatement", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "left": { + "type": "VariableDeclaration", + "start": 5, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 11, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "id": { + "type": "Identifier", + "start": 11, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "x" + }, + "name": "x" + }, + "init": { + "type": "NumericLiteral", + "start": 15, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + } + ], + "kind": "const" + }, + "right": { + "type": "Identifier", + "start": 20, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + }, + "identifierName": "y" + }, + "name": "y" + }, + "body": { + "type": "BlockStatement", + "start": 22, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-lexical-declaration/invalid_let_forin/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-lexical-declaration/invalid_let_forin/options.json deleted file mode 100644 index 68677faac9b9..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-lexical-declaration/invalid_let_forin/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "for-in loop variable declaration may not have an initializer (1:5)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-lexical-declaration/invalid_let_forin/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-lexical-declaration/invalid_let_forin/output.json new file mode 100644 index 000000000000..3a3a8f1230c5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-lexical-declaration/invalid_let_forin/output.json @@ -0,0 +1,157 @@ +{ + "type": "File", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "errors": [ + "SyntaxError: for-in loop variable declaration may not have an initializer (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ForInStatement", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "left": { + "type": "VariableDeclaration", + "start": 5, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "x" + }, + "name": "x" + }, + "init": { + "type": "NumericLiteral", + "start": 13, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + } + ], + "kind": "let" + }, + "right": { + "type": "Identifier", + "start": 18, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + }, + "identifierName": "y" + }, + "name": "y" + }, + "body": { + "type": "BlockStatement", + "start": 20, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-meta-property/invalid-new-target/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-meta-property/invalid-new-target/options.json deleted file mode 100644 index a8a536e737f3..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-meta-property/invalid-new-target/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "new.target can only be used in functions (1:8)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-meta-property/invalid-new-target/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-meta-property/invalid-new-target/output.json new file mode 100644 index 000000000000..e02e90a31d33 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-meta-property/invalid-new-target/output.json @@ -0,0 +1,137 @@ +{ + "type": "File", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "errors": [ + "SyntaxError: new.target can only be used in functions (1:8)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "id": { + "type": "Identifier", + "start": 4, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "x" + }, + "name": "x" + }, + "init": { + "type": "MetaProperty", + "start": 8, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "meta": { + "type": "Identifier", + "start": 8, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + }, + "identifierName": "new" + }, + "name": "new" + }, + "property": { + "type": "Identifier", + "start": 12, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 18 + }, + "identifierName": "target" + }, + "name": "target" + } + } + } + ], + "kind": "var" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-meta-property/unknown-property/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-meta-property/unknown-property/options.json deleted file mode 100644 index f1d291c3e468..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-meta-property/unknown-property/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "The only valid meta property for new is new.target (1:25)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-meta-property/unknown-property/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-meta-property/unknown-property/output.json new file mode 100644 index 000000000000..4bcbca3b0d36 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-meta-property/unknown-property/output.json @@ -0,0 +1,189 @@ +{ + "type": "File", + "start": 0, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 44 + } + }, + "errors": [ + "SyntaxError: The only valid meta property for new is new.target (1:25)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 44 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 44 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 44 + } + }, + "id": { + "type": "Identifier", + "start": 4, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "f" + }, + "name": "f" + }, + "init": { + "type": "FunctionExpression", + "start": 8, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 44 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 19, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 44 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 21, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 42 + } + }, + "expression": { + "type": "MetaProperty", + "start": 21, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "meta": { + "type": "Identifier", + "start": 21, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 24 + }, + "identifierName": "new" + }, + "name": "new" + }, + "property": { + "type": "Identifier", + "start": 25, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 41 + }, + "identifierName": "unknown_property" + }, + "name": "unknown_property" + } + } + } + ], + "directives": [] + } + } + } + ], + "kind": "var" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/invalid-proto-getter-literal-identifier/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/invalid-proto-getter-literal-identifier/options.json deleted file mode 100644 index de857a114a82..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/invalid-proto-getter-literal-identifier/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Redefinition of __proto__ property (1:39)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/invalid-proto-getter-literal-identifier/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/invalid-proto-getter-literal-identifier/output.json new file mode 100644 index 000000000000..8316c5f97f85 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/invalid-proto-getter-literal-identifier/output.json @@ -0,0 +1,234 @@ +{ + "type": "File", + "start": 0, + "end": 58, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 58 + } + }, + "errors": [ + "SyntaxError: Redefinition of __proto__ property (1:39)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 58, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 58 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 58, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 58 + } + }, + "expression": { + "type": "ObjectExpression", + "start": 1, + "end": 57, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 57 + } + }, + "properties": [ + { + "type": "ObjectMethod", + "start": 3, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 7, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "__proto" + }, + "name": "__proto" + }, + "computed": false, + "kind": "get", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 16, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "body": [], + "directives": [] + } + }, + { + "type": "ObjectProperty", + "start": 20, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "method": false, + "key": { + "type": "StringLiteral", + "start": 20, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "extra": { + "rawValue": "__proto__", + "raw": "\"__proto__\"" + }, + "value": "__proto__" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "NullLiteral", + "start": 33, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 37 + } + } + } + }, + { + "type": "ObjectProperty", + "start": 39, + "end": 54, + "loc": { + "start": { + "line": 1, + "column": 39 + }, + "end": { + "line": 1, + "column": 54 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 39, + "end": 48, + "loc": { + "start": { + "line": 1, + "column": 39 + }, + "end": { + "line": 1, + "column": 48 + }, + "identifierName": "__proto__" + }, + "name": "__proto__" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "NullLiteral", + "start": 50, + "end": 54, + "loc": { + "start": { + "line": 1, + "column": 50 + }, + "end": { + "line": 1, + "column": 54 + } + } + } + } + ], + "extra": { + "trailingComma": 54, + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/invalid-proto-identifier-literal/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/invalid-proto-identifier-literal/options.json deleted file mode 100644 index 5c966843f4fa..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/invalid-proto-identifier-literal/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Redefinition of __proto__ property (1:20)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/invalid-proto-identifier-literal/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/invalid-proto-identifier-literal/output.json new file mode 100644 index 000000000000..5e3da9129e41 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/invalid-proto-identifier-literal/output.json @@ -0,0 +1,177 @@ +{ + "type": "File", + "start": 0, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "errors": [ + "SyntaxError: Redefinition of __proto__ property (1:20)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "expression": { + "type": "ObjectExpression", + "start": 1, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 3, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 3, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "__proto__" + }, + "name": "__proto__" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "NullLiteral", + "start": 14, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 18 + } + } + } + }, + { + "type": "ObjectProperty", + "start": 20, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "method": false, + "key": { + "type": "StringLiteral", + "start": 20, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "extra": { + "rawValue": "__proto__", + "raw": "\"__proto__\"" + }, + "value": "__proto__" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "NullLiteral", + "start": 33, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 37 + } + } + } + } + ], + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/invalid-proto-identifiers/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/invalid-proto-identifiers/options.json deleted file mode 100644 index 5c966843f4fa..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/invalid-proto-identifiers/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Redefinition of __proto__ property (1:20)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/invalid-proto-identifiers/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/invalid-proto-identifiers/output.json new file mode 100644 index 000000000000..f0884a922d47 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/invalid-proto-identifiers/output.json @@ -0,0 +1,174 @@ +{ + "type": "File", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "errors": [ + "SyntaxError: Redefinition of __proto__ property (1:20)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "expression": { + "type": "ObjectExpression", + "start": 1, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 3, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 3, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "__proto__" + }, + "name": "__proto__" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "NullLiteral", + "start": 14, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 18 + } + } + } + }, + { + "type": "ObjectProperty", + "start": 20, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 20, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 29 + }, + "identifierName": "__proto__" + }, + "name": "__proto__" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "NullLiteral", + "start": 31, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 35 + } + } + } + } + ], + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/invalid-proto-literal-identifier/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/invalid-proto-literal-identifier/options.json deleted file mode 100644 index e19950ad14df..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/invalid-proto-literal-identifier/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Redefinition of __proto__ property (1:22)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/invalid-proto-literal-identifier/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/invalid-proto-literal-identifier/output.json new file mode 100644 index 000000000000..7b8c0af8927c --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/invalid-proto-literal-identifier/output.json @@ -0,0 +1,177 @@ +{ + "type": "File", + "start": 0, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "errors": [ + "SyntaxError: Redefinition of __proto__ property (1:22)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "expression": { + "type": "ObjectExpression", + "start": 1, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 3, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "method": false, + "key": { + "type": "StringLiteral", + "start": 3, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "extra": { + "rawValue": "__proto__", + "raw": "\"__proto__\"" + }, + "value": "__proto__" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "NullLiteral", + "start": 16, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 20 + } + } + } + }, + { + "type": "ObjectProperty", + "start": 22, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 22, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 31 + }, + "identifierName": "__proto__" + }, + "name": "__proto__" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "NullLiteral", + "start": 33, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 37 + } + } + } + } + ], + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/invalid-proto-literals/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/invalid-proto-literals/options.json deleted file mode 100644 index e19950ad14df..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/invalid-proto-literals/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Redefinition of __proto__ property (1:22)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/invalid-proto-literals/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/invalid-proto-literals/output.json new file mode 100644 index 000000000000..a9e0e52b80af --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/invalid-proto-literals/output.json @@ -0,0 +1,180 @@ +{ + "type": "File", + "start": 0, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 42 + } + }, + "errors": [ + "SyntaxError: Redefinition of __proto__ property (1:22)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 42 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 42 + } + }, + "expression": { + "type": "ObjectExpression", + "start": 1, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 3, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "method": false, + "key": { + "type": "StringLiteral", + "start": 3, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "extra": { + "rawValue": "__proto__", + "raw": "\"__proto__\"" + }, + "value": "__proto__" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "NullLiteral", + "start": 16, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 20 + } + } + } + }, + { + "type": "ObjectProperty", + "start": 22, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "method": false, + "key": { + "type": "StringLiteral", + "start": 22, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "extra": { + "rawValue": "__proto__", + "raw": "'__proto__'" + }, + "value": "__proto__" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "NullLiteral", + "start": 35, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 39 + } + } + } + } + ], + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/invalid-proto-setter-literal-identifier/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/invalid-proto-setter-literal-identifier/options.json deleted file mode 100644 index f364ee918462..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/invalid-proto-setter-literal-identifier/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Redefinition of __proto__ property (1:42)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/invalid-proto-setter-literal-identifier/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/invalid-proto-setter-literal-identifier/output.json new file mode 100644 index 000000000000..1a77efa6deef --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-object-initialiser/invalid-proto-setter-literal-identifier/output.json @@ -0,0 +1,252 @@ +{ + "type": "File", + "start": 0, + "end": 61, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 61 + } + }, + "errors": [ + "SyntaxError: Redefinition of __proto__ property (1:42)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 61, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 61 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 61, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 61 + } + }, + "expression": { + "type": "ObjectExpression", + "start": 1, + "end": 60, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 60 + } + }, + "properties": [ + { + "type": "ObjectMethod", + "start": 3, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 7, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 16 + }, + "identifierName": "__proto__" + }, + "name": "__proto__" + }, + "computed": false, + "kind": "set", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 17, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + }, + "identifierName": "x" + }, + "name": "x" + } + ], + "body": { + "type": "BlockStatement", + "start": 19, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "body": [], + "directives": [] + } + }, + { + "type": "ObjectProperty", + "start": 23, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "method": false, + "key": { + "type": "StringLiteral", + "start": 23, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "extra": { + "rawValue": "__proto__", + "raw": "\"__proto__\"" + }, + "value": "__proto__" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "NullLiteral", + "start": 36, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 40 + } + } + } + }, + { + "type": "ObjectProperty", + "start": 42, + "end": 57, + "loc": { + "start": { + "line": 1, + "column": 42 + }, + "end": { + "line": 1, + "column": 57 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 42, + "end": 51, + "loc": { + "start": { + "line": 1, + "column": 42 + }, + "end": { + "line": 1, + "column": 51 + }, + "identifierName": "__proto__" + }, + "name": "__proto__" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "NullLiteral", + "start": 53, + "end": 57, + "loc": { + "start": { + "line": 1, + "column": 53 + }, + "end": { + "line": 1, + "column": 57 + } + } + } + } + ], + "extra": { + "trailingComma": 57, + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-super-property/invalid_super_not_inside_function/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-super-property/invalid_super_not_inside_function/options.json deleted file mode 100644 index cf468e48541b..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-super-property/invalid_super_not_inside_function/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "super is only allowed in object methods and classes (1:8)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-super-property/invalid_super_not_inside_function/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-super-property/invalid_super_not_inside_function/output.json new file mode 100644 index 000000000000..94b7917cd389 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-super-property/invalid_super_not_inside_function/output.json @@ -0,0 +1,119 @@ +{ + "type": "File", + "start": 0, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "errors": [ + "SyntaxError: super() is only valid inside a class constructor of a subclass. Maybe a typo in the method name ('constructor') or not extending another class? (1:8)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "id": { + "type": "Identifier", + "start": 4, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "x" + }, + "name": "x" + }, + "init": { + "type": "CallExpression", + "start": 8, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "callee": { + "type": "Super", + "start": 8, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + "arguments": [] + } + } + ], + "kind": "var" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-template-literals/invalid-escape/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-template-literals/invalid-escape/options.json deleted file mode 100644 index fd4da953a419..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-template-literals/invalid-escape/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-template-literals/invalid-escape/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-template-literals/invalid-escape/output.json new file mode 100644 index 000000000000..3f3cd6596907 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-template-literals/invalid-escape/output.json @@ -0,0 +1,91 @@ +{ + "type": "File", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "expressions": [], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "value": { + "raw": "\\1", + "cooked": null + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-arrow-default/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-arrow-default/options.json deleted file mode 100644 index f81e206da65d..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-arrow-default/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Yield cannot be used as name inside a generator function (1:21)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-arrow-default/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-arrow-default/output.json new file mode 100644 index 000000000000..93f29667086b --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-arrow-default/output.json @@ -0,0 +1,211 @@ +{ + "type": "File", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "errors": [ + "SyntaxError: Yield cannot be used as name inside a generator function (1:21)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "id": { + "type": "Identifier", + "start": 10, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + }, + "identifierName": "g" + }, + "name": "g" + }, + "generator": true, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 14, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 16, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 16, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "AssignmentPattern", + "start": 17, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "left": { + "type": "Identifier", + "start": 17, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + }, + "identifierName": "x" + }, + "name": "x" + }, + "right": { + "type": "YieldExpression", + "start": 21, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "delegate": false, + "argument": { + "type": "NumericLiteral", + "start": 27, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + } + ], + "body": { + "type": "BlockStatement", + "start": 34, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "body": [], + "directives": [] + } + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-arrow-parameter/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-arrow-parameter/options.json deleted file mode 100644 index efa8ac523c48..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-arrow-parameter/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Yield cannot be used as name inside a generator function (1:16)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-arrow-parameter/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-arrow-parameter/output.json new file mode 100644 index 000000000000..dfdc04d3c48b --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-arrow-parameter/output.json @@ -0,0 +1,164 @@ +{ + "type": "File", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "errors": [ + "SyntaxError: Yield cannot be used as name inside a generator function (1:16)", + "SyntaxError: Binding invalid left-hand side in function parameter list (1:16)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "id": { + "type": "Identifier", + "start": 10, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + }, + "identifierName": "g" + }, + "name": "g" + }, + "generator": true, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 13, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 15, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 15, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "YieldExpression", + "start": 16, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "delegate": false, + "argument": null + } + ], + "body": { + "type": "NumericLiteral", + "start": 26, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-arrow-parameters/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-arrow-parameters/options.json deleted file mode 100644 index 185008241333..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-arrow-parameters/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Yield cannot be used as name inside a generator function (1:25)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-arrow-parameters/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-arrow-parameters/output.json new file mode 100644 index 000000000000..6bf7ee0d6108 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-arrow-parameters/output.json @@ -0,0 +1,215 @@ +{ + "type": "File", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "errors": [ + "SyntaxError: Yield cannot be used as name inside a generator function (1:25)", + "SyntaxError: Binding invalid left-hand side in function parameter list (1:25)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "id": { + "type": "Identifier", + "start": 10, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + }, + "identifierName": "g" + }, + "name": "g" + }, + "generator": true, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 13, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 15, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 15, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 16, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + }, + "identifierName": "a" + }, + "name": "a" + }, + { + "type": "Identifier", + "start": 19, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + }, + "identifierName": "b" + }, + "name": "b" + }, + { + "type": "Identifier", + "start": 22, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + }, + "identifierName": "c" + }, + "name": "c" + }, + { + "type": "YieldExpression", + "start": 25, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "delegate": false, + "argument": null + } + ], + "body": { + "type": "NumericLiteral", + "start": 35, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-catch/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-catch/options.json deleted file mode 100644 index 8c287a1d5b36..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-catch/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Can not use 'yield' as identifier inside a generator (1:30)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-catch/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-catch/output.json new file mode 100644 index 000000000000..638788f4405b --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-catch/output.json @@ -0,0 +1,173 @@ +{ + "type": "File", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "errors": [ + "SyntaxError: Can not use 'yield' as identifier inside a generator (1:30)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "id": { + "type": "Identifier", + "start": 10, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + }, + "identifierName": "g" + }, + "name": "g" + }, + "generator": true, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 14, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "body": [ + { + "type": "TryStatement", + "start": 16, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "block": { + "type": "BlockStatement", + "start": 20, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "body": [], + "directives": [] + }, + "handler": { + "type": "CatchClause", + "start": 23, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "param": { + "type": "Identifier", + "start": 30, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 35 + }, + "identifierName": "yield" + }, + "name": "yield" + }, + "body": { + "type": "BlockStatement", + "start": 37, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "body": [], + "directives": [] + } + }, + "finalizer": null + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-declaration/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-declaration/options.json deleted file mode 100644 index 3ceff8546d37..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-declaration/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Can not use 'yield' as identifier inside a generator (1:26)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-declaration/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-declaration/output.json new file mode 100644 index 000000000000..30846cf74293 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-declaration/output.json @@ -0,0 +1,143 @@ +{ + "type": "File", + "start": 0, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "errors": [ + "SyntaxError: Can not use 'yield' as identifier inside a generator (1:26)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "id": { + "type": "Identifier", + "start": 10, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + }, + "identifierName": "g" + }, + "name": "g" + }, + "generator": true, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 14, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "body": [ + { + "type": "FunctionDeclaration", + "start": 16, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "id": { + "type": "Identifier", + "start": 26, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 31 + }, + "identifierName": "yield" + }, + "name": "yield" + }, + "generator": true, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 33, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-export-default/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-export-default/options.json index 23a96f285fe4..54925950e059 100644 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-export-default/options.json +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-export-default/options.json @@ -1,4 +1,3 @@ { - "sourceType": "module", - "throws": "Unexpected reserved word 'yield' (1:25)" -} + "sourceType": "module" +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-export-default/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-export-default/output.json new file mode 100644 index 000000000000..273c4fcdf066 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-export-default/output.json @@ -0,0 +1,105 @@ +{ + "type": "File", + "start": 0, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "errors": [ + "SyntaxError: Unexpected reserved word 'yield' (1:25)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportDefaultDeclaration", + "start": 0, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "declaration": { + "type": "FunctionDeclaration", + "start": 15, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "id": { + "type": "Identifier", + "start": 25, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 30 + }, + "identifierName": "yield" + }, + "name": "yield" + }, + "generator": true, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 33, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "body": [], + "directives": [] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-expression-name/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-expression-name/options.json deleted file mode 100644 index c32eaf81f281..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-expression-name/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Can not use 'yield' as identifier inside a generator (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-expression-name/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-expression-name/output.json new file mode 100644 index 000000000000..0eca9154c92a --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-expression-name/output.json @@ -0,0 +1,109 @@ +{ + "type": "File", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "errors": [ + "SyntaxError: Can not use 'yield' as identifier inside a generator (1:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "expression": { + "type": "FunctionExpression", + "start": 1, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "id": { + "type": "Identifier", + "start": 10, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 15 + }, + "identifierName": "yield" + }, + "name": "yield" + }, + "generator": true, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "body": [], + "directives": [] + }, + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-expression-parameter/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-expression-parameter/options.json deleted file mode 100644 index 28b734910647..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-expression-parameter/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Can not use 'yield' as identifier inside a generator (1:12)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-expression-parameter/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-expression-parameter/output.json new file mode 100644 index 000000000000..dbee42bd9873 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-expression-parameter/output.json @@ -0,0 +1,111 @@ +{ + "type": "File", + "start": 0, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "errors": [ + "SyntaxError: Can not use 'yield' as identifier inside a generator (1:12)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "expression": { + "type": "FunctionExpression", + "start": 1, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "id": null, + "generator": true, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 12, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 17 + }, + "identifierName": "yield" + }, + "name": "yield" + } + ], + "body": { + "type": "BlockStatement", + "start": 18, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "body": [], + "directives": [] + }, + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-expression-rest/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-expression-rest/options.json deleted file mode 100644 index aef4d7f4f9a2..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-expression-rest/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Can not use 'yield' as identifier inside a generator (1:18)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-expression-rest/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-expression-rest/output.json new file mode 100644 index 000000000000..74eaaceb9832 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-expression-rest/output.json @@ -0,0 +1,143 @@ +{ + "type": "File", + "start": 0, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "errors": [ + "SyntaxError: Can not use 'yield' as identifier inside a generator (1:18)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "expression": { + "type": "FunctionExpression", + "start": 1, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "id": null, + "generator": true, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 12, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + }, + "identifierName": "x" + }, + "name": "x" + }, + { + "type": "RestElement", + "start": 15, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "argument": { + "type": "Identifier", + "start": 18, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 23 + }, + "identifierName": "yield" + }, + "name": "yield" + } + } + ], + "body": { + "type": "BlockStatement", + "start": 24, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "body": [], + "directives": [] + }, + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-function-declaration/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-function-declaration/options.json deleted file mode 100644 index 6993832643f1..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-function-declaration/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Can not use 'yield' as identifier inside a generator (1:25)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-function-declaration/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-function-declaration/output.json new file mode 100644 index 000000000000..ec55ac771815 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-function-declaration/output.json @@ -0,0 +1,143 @@ +{ + "type": "File", + "start": 0, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "errors": [ + "SyntaxError: Can not use 'yield' as identifier inside a generator (1:25)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "id": { + "type": "Identifier", + "start": 10, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + }, + "identifierName": "g" + }, + "name": "g" + }, + "generator": true, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 14, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "body": [ + { + "type": "FunctionDeclaration", + "start": 16, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "id": { + "type": "Identifier", + "start": 25, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 30 + }, + "identifierName": "yield" + }, + "name": "yield" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 33, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-lexical-declaration/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-lexical-declaration/options.json deleted file mode 100644 index ad818f81f136..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-lexical-declaration/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Can not use 'yield' as identifier inside a generator (1:20)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-lexical-declaration/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-lexical-declaration/output.json new file mode 100644 index 000000000000..e07b84fedd4d --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-lexical-declaration/output.json @@ -0,0 +1,142 @@ +{ + "type": "File", + "start": 0, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "errors": [ + "SyntaxError: Can not use 'yield' as identifier inside a generator (1:20)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "id": { + "type": "Identifier", + "start": 10, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + }, + "identifierName": "g" + }, + "name": "g" + }, + "generator": true, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 14, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "body": [ + { + "type": "VariableDeclaration", + "start": 16, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 20, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "id": { + "type": "Identifier", + "start": 20, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 25 + }, + "identifierName": "yield" + }, + "name": "yield" + }, + "init": null + } + ], + "kind": "let" + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-parameter/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-parameter/options.json deleted file mode 100644 index 28b734910647..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-parameter/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Can not use 'yield' as identifier inside a generator (1:12)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-parameter/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-parameter/output.json new file mode 100644 index 000000000000..91b76a6f9351 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-parameter/output.json @@ -0,0 +1,108 @@ +{ + "type": "File", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "errors": [ + "SyntaxError: Can not use 'yield' as identifier inside a generator (1:12)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "id": { + "type": "Identifier", + "start": 10, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + }, + "identifierName": "g" + }, + "name": "g" + }, + "generator": true, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 12, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 17 + }, + "identifierName": "yield" + }, + "name": "yield" + } + ], + "body": { + "type": "BlockStatement", + "start": 18, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-rest/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-rest/options.json deleted file mode 100644 index c811689d9abd..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-rest/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Can not use 'yield' as identifier inside a generator (1:24)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-rest/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-rest/output.json new file mode 100644 index 000000000000..0b1e59c7ab58 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-rest/output.json @@ -0,0 +1,174 @@ +{ + "type": "File", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "errors": [ + "SyntaxError: Can not use 'yield' as identifier inside a generator (1:24)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "id": { + "type": "Identifier", + "start": 10, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + }, + "identifierName": "g" + }, + "name": "g" + }, + "generator": true, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 12, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + }, + "identifierName": "a" + }, + "name": "a" + }, + { + "type": "Identifier", + "start": 15, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + }, + "identifierName": "b" + }, + "name": "b" + }, + { + "type": "Identifier", + "start": 18, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + }, + "identifierName": "c" + }, + "name": "c" + }, + { + "type": "RestElement", + "start": 21, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "argument": { + "type": "Identifier", + "start": 24, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 29 + }, + "identifierName": "yield" + }, + "name": "yield" + } + } + ], + "body": { + "type": "BlockStatement", + "start": 30, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-strict-function-expression/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-strict-function-expression/options.json deleted file mode 100644 index 865e081676d6..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-strict-function-expression/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected reserved word 'yield' (1:46)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-strict-function-expression/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-strict-function-expression/output.json new file mode 100644 index 000000000000..b1b8b4f0880d --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-strict-function-expression/output.json @@ -0,0 +1,229 @@ +{ + "type": "File", + "start": 0, + "end": 58, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 58 + } + }, + "errors": [ + "SyntaxError: Unexpected reserved word 'yield' (1:46)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 58, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 58 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 14, + "end": 58, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 58 + } + }, + "id": { + "type": "Identifier", + "start": 24, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + }, + "identifierName": "g" + }, + "name": "g" + }, + "generator": true, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 27, + "end": 58, + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 58 + } + }, + "body": [ + { + "type": "VariableDeclaration", + "start": 29, + "end": 56, + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 56 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 33, + "end": 55, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 55 + } + }, + "id": { + "type": "Identifier", + "start": 33, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 34 + }, + "identifierName": "y" + }, + "name": "y" + }, + "init": { + "type": "FunctionExpression", + "start": 37, + "end": 55, + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 55 + } + }, + "id": { + "type": "Identifier", + "start": 46, + "end": 51, + "loc": { + "start": { + "line": 1, + "column": 46 + }, + "end": { + "line": 1, + "column": 51 + }, + "identifierName": "yield" + }, + "name": "yield" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 53, + "end": 55, + "loc": { + "start": { + "line": 1, + "column": 53 + }, + "end": { + "line": 1, + "column": 55 + } + }, + "body": [], + "directives": [] + } + } + } + ], + "kind": "var" + } + ], + "directives": [] + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-strict-function-parameter/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-strict-function-parameter/options.json deleted file mode 100644 index 21348af52377..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-strict-function-parameter/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected reserved word 'yield' (1:47)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-strict-function-parameter/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-strict-function-parameter/output.json new file mode 100644 index 000000000000..40d206249a26 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-strict-function-parameter/output.json @@ -0,0 +1,231 @@ +{ + "type": "File", + "start": 0, + "end": 58, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 58 + } + }, + "errors": [ + "SyntaxError: Unexpected reserved word 'yield' (1:47)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 58, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 58 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 14, + "end": 58, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 58 + } + }, + "id": { + "type": "Identifier", + "start": 24, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + }, + "identifierName": "g" + }, + "name": "g" + }, + "generator": true, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 28, + "end": 58, + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 58 + } + }, + "body": [ + { + "type": "VariableDeclaration", + "start": 30, + "end": 56, + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 56 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 34, + "end": 56, + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 56 + } + }, + "id": { + "type": "Identifier", + "start": 34, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 35 + }, + "identifierName": "z" + }, + "name": "z" + }, + "init": { + "type": "FunctionExpression", + "start": 38, + "end": 56, + "loc": { + "start": { + "line": 1, + "column": 38 + }, + "end": { + "line": 1, + "column": 56 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 47, + "end": 52, + "loc": { + "start": { + "line": 1, + "column": 47 + }, + "end": { + "line": 1, + "column": 52 + }, + "identifierName": "yield" + }, + "name": "yield" + } + ], + "body": { + "type": "BlockStatement", + "start": 54, + "end": 56, + "loc": { + "start": { + "line": 1, + "column": 54 + }, + "end": { + "line": 1, + "column": 56 + } + }, + "body": [], + "directives": [] + } + } + } + ], + "kind": "var" + } + ], + "directives": [] + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-variable-declaration/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-variable-declaration/options.json deleted file mode 100644 index ad818f81f136..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-variable-declaration/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Can not use 'yield' as identifier inside a generator (1:20)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-variable-declaration/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-variable-declaration/output.json new file mode 100644 index 000000000000..770c2246fabb --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-generator-variable-declaration/output.json @@ -0,0 +1,142 @@ +{ + "type": "File", + "start": 0, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "errors": [ + "SyntaxError: Can not use 'yield' as identifier inside a generator (1:20)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "id": { + "type": "Identifier", + "start": 10, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + }, + "identifierName": "g" + }, + "name": "g" + }, + "generator": true, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 14, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "body": [ + { + "type": "VariableDeclaration", + "start": 16, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 20, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "id": { + "type": "Identifier", + "start": 20, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 25 + }, + "identifierName": "yield" + }, + "name": "yield" + }, + "init": null + } + ], + "kind": "var" + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-array-pattern/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-array-pattern/options.json deleted file mode 100644 index e817f30acb5c..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-array-pattern/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected reserved word 'yield' (1:16)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-array-pattern/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-array-pattern/output.json new file mode 100644 index 000000000000..4a0cd5664566 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-array-pattern/output.json @@ -0,0 +1,160 @@ +{ + "type": "File", + "start": 0, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "errors": [ + "SyntaxError: Unexpected reserved word 'yield' (1:16)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 14, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 15, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "operator": "=", + "left": { + "type": "ArrayPattern", + "start": 15, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "elements": [ + { + "type": "Identifier", + "start": 16, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 21 + }, + "identifierName": "yield" + }, + "name": "yield" + } + ] + }, + "right": { + "type": "Identifier", + "start": 25, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + }, + "identifierName": "x" + }, + "name": "x" + }, + "extra": { + "parenthesized": true, + "parenStart": 14 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-arrow-parameter-default/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-arrow-parameter-default/options.json deleted file mode 100644 index e80b46c31b86..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-arrow-parameter-default/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected reserved word 'yield' (1:19)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-arrow-parameter-default/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-arrow-parameter-default/output.json new file mode 100644 index 000000000000..b6b507c9e6cb --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-arrow-parameter-default/output.json @@ -0,0 +1,175 @@ +{ + "type": "File", + "start": 0, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "errors": [ + "SyntaxError: Unexpected reserved word 'yield' (1:19)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 14, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 14, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "AssignmentPattern", + "start": 15, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "left": { + "type": "Identifier", + "start": 15, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + }, + "identifierName": "x" + }, + "name": "x" + }, + "right": { + "type": "Identifier", + "start": 19, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 24 + }, + "identifierName": "yield" + }, + "name": "yield" + } + } + ], + "body": { + "type": "BlockStatement", + "start": 29, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "body": [], + "directives": [] + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-arrow-parameter-name/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-arrow-parameter-name/options.json deleted file mode 100644 index 27b38d28f986..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-arrow-parameter-name/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected reserved word 'yield' (1:15)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-arrow-parameter-name/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-arrow-parameter-name/output.json new file mode 100644 index 000000000000..3c5b82bd6c7b --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-arrow-parameter-name/output.json @@ -0,0 +1,146 @@ +{ + "type": "File", + "start": 0, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "errors": [ + "SyntaxError: Unexpected reserved word 'yield' (1:15)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 14, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 14, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 15, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 20 + }, + "identifierName": "yield" + }, + "name": "yield" + } + ], + "body": { + "type": "NumericLiteral", + "start": 25, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-binding-element/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-binding-element/options.json deleted file mode 100644 index 5d111aab9319..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-binding-element/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected reserved word 'yield' (1:23)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-binding-element/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-binding-element/output.json new file mode 100644 index 000000000000..06d787bb4992 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-binding-element/output.json @@ -0,0 +1,193 @@ +{ + "type": "File", + "start": 0, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "errors": [ + "SyntaxError: Unexpected reserved word 'yield' (1:23)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 14, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 18, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "id": { + "type": "ObjectPattern", + "start": 18, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 20, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 20, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + }, + "identifierName": "x" + }, + "name": "x" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "Identifier", + "start": 23, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 28 + }, + "identifierName": "yield" + }, + "name": "yield" + } + } + ] + }, + "init": { + "type": "Identifier", + "start": 33, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 36 + }, + "identifierName": "foo" + }, + "name": "foo" + } + } + ], + "kind": "var" + } + ], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-catch-parameter/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-catch-parameter/options.json deleted file mode 100644 index 01aca4591cea..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-catch-parameter/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected reserved word 'yield' (1:28)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-catch-parameter/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-catch-parameter/output.json new file mode 100644 index 000000000000..2b7952b2afe7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-catch-parameter/output.json @@ -0,0 +1,156 @@ +{ + "type": "File", + "start": 0, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "errors": [ + "SyntaxError: Unexpected reserved word 'yield' (1:28)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "TryStatement", + "start": 14, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "block": { + "type": "BlockStatement", + "start": 18, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "body": [], + "directives": [] + }, + "handler": { + "type": "CatchClause", + "start": 21, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "param": { + "type": "Identifier", + "start": 28, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 33 + }, + "identifierName": "yield" + }, + "name": "yield" + }, + "body": { + "type": "BlockStatement", + "start": 35, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "body": [], + "directives": [] + } + }, + "finalizer": null + } + ], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-formal-parameter/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-formal-parameter/options.json deleted file mode 100644 index a4a677fb3136..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-formal-parameter/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected reserved word 'yield' (1:25)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-formal-parameter/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-formal-parameter/output.json new file mode 100644 index 000000000000..f936dc48abf9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-formal-parameter/output.json @@ -0,0 +1,144 @@ +{ + "type": "File", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "errors": [ + "SyntaxError: Unexpected reserved word 'yield' (1:25)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 14, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "id": { + "type": "Identifier", + "start": 23, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + }, + "identifierName": "f" + }, + "name": "f" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 25, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 30 + }, + "identifierName": "yield" + }, + "name": "yield" + } + ], + "body": { + "type": "BlockStatement", + "start": 32, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-function-declaration/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-function-declaration/options.json deleted file mode 100644 index e55b18eb4f07..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-function-declaration/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'yield' in strict mode (1:9)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-function-declaration/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-function-declaration/output.json new file mode 100644 index 000000000000..7f270919a446 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-function-declaration/output.json @@ -0,0 +1,126 @@ +{ + "type": "File", + "start": 0, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "errors": [ + "SyntaxError: Binding 'yield' in strict mode (1:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "yield" + }, + "name": "yield" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 16, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 18, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 18, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-function-expression/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-function-expression/options.json deleted file mode 100644 index 8928b8977517..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-function-expression/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'yield' in strict mode (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-function-expression/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-function-expression/output.json new file mode 100644 index 000000000000..d65f41baceea --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-function-expression/output.json @@ -0,0 +1,145 @@ +{ + "type": "File", + "start": 0, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "errors": [ + "SyntaxError: Binding 'yield' in strict mode (1:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "expression": { + "type": "FunctionExpression", + "start": 1, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "id": { + "type": "Identifier", + "start": 10, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 15 + }, + "identifierName": "yield" + }, + "name": "yield" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 19, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 19, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + }, + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-identifier/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-identifier/options.json deleted file mode 100644 index 412431249548..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-identifier/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected reserved word 'yield' (1:29)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-identifier/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-identifier/output.json new file mode 100644 index 000000000000..0d4e30957667 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-identifier/output.json @@ -0,0 +1,159 @@ +{ + "type": "File", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "errors": [ + "SyntaxError: Unexpected reserved word 'yield' (1:29)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 14, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "id": { + "type": "Identifier", + "start": 23, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + }, + "identifierName": "f" + }, + "name": "f" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 27, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 29, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "expression": { + "type": "Identifier", + "start": 29, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 34 + }, + "identifierName": "yield" + }, + "name": "yield" + } + } + ], + "directives": [] + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-lexical-declaration/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-lexical-declaration/options.json deleted file mode 100644 index 53a8921cb309..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-lexical-declaration/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected reserved word 'yield' (1:18)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-lexical-declaration/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-lexical-declaration/output.json new file mode 100644 index 000000000000..71c86eec827d --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-lexical-declaration/output.json @@ -0,0 +1,144 @@ +{ + "type": "File", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "errors": [ + "SyntaxError: Unexpected reserved word 'yield' (1:18)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 14, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 18, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "id": { + "type": "Identifier", + "start": 18, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 23 + }, + "identifierName": "yield" + }, + "name": "yield" + }, + "init": { + "type": "NumericLiteral", + "start": 26, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + ], + "kind": "let" + } + ], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-rest-parameter/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-rest-parameter/options.json deleted file mode 100644 index 01aca4591cea..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-rest-parameter/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected reserved word 'yield' (1:28)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-rest-parameter/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-rest-parameter/output.json new file mode 100644 index 000000000000..d246bfc86e6e --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-rest-parameter/output.json @@ -0,0 +1,159 @@ +{ + "type": "File", + "start": 0, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "errors": [ + "SyntaxError: Unexpected reserved word 'yield' (1:28)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 14, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "id": { + "type": "Identifier", + "start": 23, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + }, + "identifierName": "f" + }, + "name": "f" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "RestElement", + "start": 25, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "argument": { + "type": "Identifier", + "start": 28, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 33 + }, + "identifierName": "yield" + }, + "name": "yield" + } + } + ], + "body": { + "type": "BlockStatement", + "start": 35, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-variable-declaration/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-variable-declaration/options.json deleted file mode 100644 index 53a8921cb309..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-variable-declaration/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected reserved word 'yield' (1:18)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-variable-declaration/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-variable-declaration/output.json new file mode 100644 index 000000000000..0561e522bd7b --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/invalid-yield-strict-variable-declaration/output.json @@ -0,0 +1,125 @@ +{ + "type": "File", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "errors": [ + "SyntaxError: Unexpected reserved word 'yield' (1:18)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 14, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 18, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "id": { + "type": "Identifier", + "start": 18, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 23 + }, + "identifierName": "yield" + }, + "name": "yield" + }, + "init": null + } + ], + "kind": "var" + } + ], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-generator-arrow-default/options.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-generator-arrow-default/options.json deleted file mode 100644 index f81e206da65d..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-generator-arrow-default/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Yield cannot be used as name inside a generator function (1:21)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-generator-arrow-default/output.json b/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-generator-arrow-default/output.json new file mode 100644 index 000000000000..c26b779c0207 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/es2015-yield/yield-generator-arrow-default/output.json @@ -0,0 +1,192 @@ +{ + "type": "File", + "start": 0, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "errors": [ + "SyntaxError: Yield cannot be used as name inside a generator function (1:21)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "id": { + "type": "Identifier", + "start": 10, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + }, + "identifierName": "g" + }, + "name": "g" + }, + "generator": true, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 14, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 16, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 16, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "AssignmentPattern", + "start": 17, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "left": { + "type": "Identifier", + "start": 17, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + }, + "identifierName": "x" + }, + "name": "x" + }, + "right": { + "type": "YieldExpression", + "start": 21, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "delegate": false, + "argument": null + } + } + ], + "body": { + "type": "BlockStatement", + "start": 31, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "body": [], + "directives": [] + } + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-array/migrated_0012/input.js b/packages/babel-parser/test/fixtures/esprima/expression-primary-array/migrated_0012/input.js index 79581f8529b7..cbd842119b94 100755 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-array/migrated_0012/input.js +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-array/migrated_0012/input.js @@ -1 +1 @@ -\u2163\u2161\u200A=\u2009[] +\u2163\u2161\u200A diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-array/migrated_0012/options.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-array/migrated_0012/options.json deleted file mode 100644 index abe9f835b84b..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/expression-primary-array/migrated_0012/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid Unicode escape (1:12)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/expression-primary-array/migrated_0012/output.json b/packages/babel-parser/test/fixtures/esprima/expression-primary-array/migrated_0012/output.json new file mode 100644 index 000000000000..ea30bc6a3013 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/expression-primary-array/migrated_0012/output.json @@ -0,0 +1,70 @@ +{ + "type": "File", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "errors": [ + "SyntaxError: Invalid Unicode escape (1:12)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "expression": { + "type": "Identifier", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + }, + "identifierName": "ⅣⅡ " + }, + "name": "ⅣⅡ " + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-00/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-00/options.json deleted file mode 100644 index 8e0dce66eff8..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-00/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Bad character escape sequence (1:3)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-00/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-00/output.json new file mode 100644 index 000000000000..30ad8a2a0533 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-00/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "errors": [ + "SyntaxError: Bad character escape sequence (1:3)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "value": "\\x", + "extra": { + "raw": "\"\\x\"", + "rawValue": "\\x" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-01/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-01/options.json deleted file mode 100644 index 8e0dce66eff8..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-01/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Bad character escape sequence (1:3)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-01/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-01/output.json new file mode 100644 index 000000000000..91bb0ab97d98 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-01/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "errors": [ + "SyntaxError: Bad character escape sequence (1:3)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "value": "\\x0", + "extra": { + "raw": "\"\\x0\"", + "rawValue": "\\x0" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-02/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-02/options.json deleted file mode 100644 index 8e0dce66eff8..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-02/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Bad character escape sequence (1:3)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-02/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-02/output.json new file mode 100644 index 000000000000..422caf2f1ecf --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-02/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "errors": [ + "SyntaxError: Bad character escape sequence (1:3)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "value": "\\xx", + "extra": { + "raw": "\"\\xx\"", + "rawValue": "\\xx" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-03/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-03/options.json deleted file mode 100644 index 8e0dce66eff8..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-03/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Bad character escape sequence (1:3)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-03/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-03/output.json new file mode 100644 index 000000000000..a00ba8fc772c --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-03/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "errors": [ + "SyntaxError: Bad character escape sequence (1:3)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "value": "\\u", + "extra": { + "raw": "\"\\u\"", + "rawValue": "\\u" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-04/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-04/options.json deleted file mode 100644 index 8e0dce66eff8..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-04/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Bad character escape sequence (1:3)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-04/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-04/output.json new file mode 100644 index 000000000000..4158fada8f7f --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-04/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "errors": [ + "SyntaxError: Bad character escape sequence (1:3)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "value": "\\u0", + "extra": { + "raw": "\"\\u0\"", + "rawValue": "\\u0" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-05/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-05/options.json deleted file mode 100644 index 8e0dce66eff8..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-05/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Bad character escape sequence (1:3)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-05/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-05/output.json new file mode 100644 index 000000000000..b36764ece66c --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-05/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "errors": [ + "SyntaxError: Bad character escape sequence (1:3)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "value": "\\ux", + "extra": { + "raw": "\"\\ux\"", + "rawValue": "\\ux" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-06/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-06/options.json deleted file mode 100644 index 8e0dce66eff8..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-06/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Bad character escape sequence (1:3)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-06/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-06/output.json new file mode 100644 index 000000000000..b24d044db414 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-06/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "errors": [ + "SyntaxError: Bad character escape sequence (1:3)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "value": "\\u00", + "extra": { + "raw": "\"\\u00\"", + "rawValue": "\\u00" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-07/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-07/options.json deleted file mode 100644 index 8e0dce66eff8..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-07/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Bad character escape sequence (1:3)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-07/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-07/output.json new file mode 100644 index 000000000000..eb3f631398dc --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/GH-1106-07/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "errors": [ + "SyntaxError: Bad character escape sequence (1:3)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "value": "\\u000", + "extra": { + "raw": "\"\\u000\"", + "rawValue": "\\u000" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0002/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0002/options.json index 91bb1eef0c0d..aa61ff56c2b3 100644 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0002/options.json +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0002/options.json @@ -1,3 +1,3 @@ { - "throws": "Invalid number (1:0)" -} + "throws": "Identifier directly after number (1:2)" +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0004/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0004/options.json deleted file mode 100644 index 91bb1eef0c0d..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0004/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid number (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0004/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0004/output.json new file mode 100644 index 000000000000..284fac8c4357 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0004/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "errors": [ + "SyntaxError: Invalid number (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "extra": { + "rawValue": 3, + "raw": "3e" + }, + "value": 3 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0005/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0005/options.json deleted file mode 100644 index 91bb1eef0c0d..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0005/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid number (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0005/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0005/output.json new file mode 100644 index 000000000000..6b6e666b00ca --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0005/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "errors": [ + "SyntaxError: Invalid number (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "extra": { + "rawValue": 3, + "raw": "3e+" + }, + "value": 3 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0006/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0006/options.json deleted file mode 100644 index 91bb1eef0c0d..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0006/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid number (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0006/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0006/output.json new file mode 100644 index 000000000000..b52b27d1ef37 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0006/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "errors": [ + "SyntaxError: Invalid number (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "extra": { + "rawValue": 3, + "raw": "3e-" + }, + "value": 3 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0009/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0009/options.json deleted file mode 100644 index 1a0693338eee..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0009/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Expected number in radix 16 (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0009/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0009/output.json new file mode 100644 index 000000000000..ffcb3680fd0b --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0009/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "errors": [ + "SyntaxError: Expected number in radix 16 (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "extra": { + "rawValue": null, + "raw": "0x" + }, + "value": null + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0012/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0012/options.json deleted file mode 100644 index 3f09c36a5f1c..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0012/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Expected number in radix 8 (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0012/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0012/output.json new file mode 100644 index 000000000000..12a024fb2c03 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0012/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "errors": [ + "SyntaxError: Expected number in radix 8 (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "extra": { + "rawValue": null, + "raw": "0o" + }, + "value": null + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0013/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0013/options.json deleted file mode 100644 index 3f09c36a5f1c..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0013/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Expected number in radix 8 (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0013/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0013/output.json new file mode 100644 index 000000000000..5d2ed2d91388 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0013/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "errors": [ + "SyntaxError: Expected number in radix 8 (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "extra": { + "rawValue": null, + "raw": "0O" + }, + "value": null + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0014/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0014/options.json deleted file mode 100644 index 3f09c36a5f1c..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0014/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Expected number in radix 8 (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0014/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0014/output.json new file mode 100644 index 000000000000..4b91f320f950 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0014/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "errors": [ + "SyntaxError: Expected number in radix 8 (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "extra": { + "rawValue": 0, + "raw": "0o9" + }, + "value": 0 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0015/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0015/options.json deleted file mode 100644 index d52d9cfac4bc..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0015/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected token, expected \";\" (1:3)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0015/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0015/output.json new file mode 100644 index 000000000000..9978c5342ef3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0015/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "errors": [ + "SyntaxError: Expected number in radix 8 (1:3)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "extra": { + "rawValue": 8, + "raw": "0o18" + }, + "value": 8 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0017/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0017/options.json deleted file mode 100644 index 40dc3da9a8f4..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0017/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Expected number in radix 2 (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0017/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0017/output.json new file mode 100644 index 000000000000..0688a297c669 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0017/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "errors": [ + "SyntaxError: Expected number in radix 2 (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "extra": { + "rawValue": null, + "raw": "0b" + }, + "value": null + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0019/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0019/options.json deleted file mode 100644 index 40dc3da9a8f4..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0019/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Expected number in radix 2 (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0019/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0019/output.json new file mode 100644 index 000000000000..7281fb745a17 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0019/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "errors": [ + "SyntaxError: Expected number in radix 2 (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "extra": { + "rawValue": 0, + "raw": "0b9" + }, + "value": 0 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0020/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0020/options.json deleted file mode 100644 index d52d9cfac4bc..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0020/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected token, expected \";\" (1:3)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0020/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0020/output.json new file mode 100644 index 000000000000..25d711669b8b --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0020/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "errors": [ + "SyntaxError: Expected number in radix 2 (1:3)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "extra": { + "rawValue": 2, + "raw": "0b18" + }, + "value": 2 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0021/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0021/options.json deleted file mode 100644 index d52d9cfac4bc..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0021/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected token, expected \";\" (1:3)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0021/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0021/output.json new file mode 100644 index 000000000000..379e9db894c0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0021/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "errors": [ + "SyntaxError: Expected number in radix 2 (1:3)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "extra": { + "rawValue": 2, + "raw": "0b12" + }, + "value": 2 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0022/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0022/options.json deleted file mode 100644 index 40dc3da9a8f4..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0022/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Expected number in radix 2 (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0022/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0022/output.json new file mode 100644 index 000000000000..c87719ade97e --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0022/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "errors": [ + "SyntaxError: Expected number in radix 2 (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "extra": { + "rawValue": null, + "raw": "0B" + }, + "value": null + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0024/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0024/options.json deleted file mode 100644 index 40dc3da9a8f4..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0024/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Expected number in radix 2 (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0024/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0024/output.json new file mode 100644 index 000000000000..e82ab6ace61a --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0024/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "errors": [ + "SyntaxError: Expected number in radix 2 (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "extra": { + "rawValue": 0, + "raw": "0B9" + }, + "value": 0 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0025/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0025/options.json deleted file mode 100644 index d52d9cfac4bc..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0025/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected token, expected \";\" (1:3)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0025/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0025/output.json new file mode 100644 index 000000000000..3726afdc10d4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0025/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "errors": [ + "SyntaxError: Expected number in radix 2 (1:3)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "extra": { + "rawValue": 2, + "raw": "0B18" + }, + "value": 2 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0026/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0026/options.json deleted file mode 100644 index d52d9cfac4bc..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0026/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected token, expected \";\" (1:3)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0026/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0026/output.json new file mode 100644 index 000000000000..402fcffc9e54 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0026/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "errors": [ + "SyntaxError: Expected number in radix 2 (1:3)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "extra": { + "rawValue": 2, + "raw": "0B12" + }, + "value": 2 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0027/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0027/options.json deleted file mode 100644 index 3f09c36a5f1c..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0027/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Expected number in radix 8 (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0027/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0027/output.json new file mode 100644 index 000000000000..af4105738ef8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0027/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "errors": [ + "SyntaxError: Expected number in radix 8 (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "extra": { + "rawValue": 0, + "raw": "0O9" + }, + "value": 0 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0028/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0028/options.json deleted file mode 100644 index d52d9cfac4bc..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0028/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected token, expected \";\" (1:3)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0028/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0028/output.json new file mode 100644 index 000000000000..617cc13b6615 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0028/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "errors": [ + "SyntaxError: Expected number in radix 8 (1:3)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "extra": { + "rawValue": 8, + "raw": "0O18" + }, + "value": 8 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0032/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0032/options.json deleted file mode 100644 index 18c53b997b56..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0032/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Expecting Unicode escape sequence \\uXXXX (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0032/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0032/output.json new file mode 100644 index 000000000000..fbb1d3b5d554 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0032/output.json @@ -0,0 +1,70 @@ +{ + "type": "File", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "errors": [ + "SyntaxError: Expecting Unicode escape sequence \\uXXXX (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "expression": { + "type": "Identifier", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + }, + "identifierName": "xx\\" + }, + "name": "xx\\" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0033/input.js b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0033/input.js index fff580f2044f..0d9e932087f0 100644 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0033/input.js +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0033/input.js @@ -1 +1 @@ -x\\u005c +x\u005c diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0033/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0033/options.json deleted file mode 100644 index 18c53b997b56..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0033/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Expecting Unicode escape sequence \\uXXXX (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0033/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0033/output.json new file mode 100644 index 000000000000..fae32b78cde4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0033/output.json @@ -0,0 +1,70 @@ +{ + "type": "File", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "errors": [ + "SyntaxError: Invalid Unicode escape (1:1)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "expression": { + "type": "Identifier", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "x\\" + }, + "name": "x\\" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0034/input.js b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0034/input.js index 17112246786b..2999f29197cd 100644 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0034/input.js +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0034/input.js @@ -1 +1 @@ -x\\u002a +x\u002a diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0034/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0034/options.json deleted file mode 100644 index 18c53b997b56..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0034/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Expecting Unicode escape sequence \\uXXXX (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0034/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0034/output.json new file mode 100644 index 000000000000..37312f42ce97 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0034/output.json @@ -0,0 +1,70 @@ +{ + "type": "File", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "errors": [ + "SyntaxError: Invalid Unicode escape (1:1)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "expression": { + "type": "Identifier", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "x*" + }, + "name": "x*" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0036/input.js b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0036/input.js index 3177052a225a..9cfc5e1cb357 100644 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0036/input.js +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0036/input.js @@ -1 +1 @@ -a\\u +a\u diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0036/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0036/options.json deleted file mode 100644 index 18c53b997b56..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0036/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Expecting Unicode escape sequence \\uXXXX (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0036/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0036/output.json new file mode 100644 index 000000000000..3fa5e0bfd57d --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0036/output.json @@ -0,0 +1,70 @@ +{ + "type": "File", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "errors": [ + "SyntaxError: Bad character escape sequence (1:3)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "expression": { + "type": "Identifier", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + }, + "identifierName": "a" + }, + "name": "a" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0037/input.js b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0037/input.js index d56d7c190d02..fa959cc0ecce 100644 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0037/input.js +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0037/input.js @@ -1 +1 @@ -\\ua +\ua diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0037/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0037/options.json deleted file mode 100644 index 381fd12ce2d0..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0037/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Expecting Unicode escape sequence \\uXXXX (1:1)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0037/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0037/output.json new file mode 100644 index 000000000000..be5c03381dd1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0037/output.json @@ -0,0 +1,70 @@ +{ + "type": "File", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "errors": [ + "SyntaxError: Bad character escape sequence (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "expression": { + "type": "Identifier", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + }, + "identifierName": "" + }, + "name": "" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0041/input.js b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0041/input.js index 9a2dc1767685..7f54fa707500 100644 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0041/input.js +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0041/input.js @@ -1 +1 @@ -var x = /[a-z]/\\ux +var x = /[a-z]/\ux diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0041/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0041/options.json deleted file mode 100644 index adf556b0a352..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0041/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid regular expression flag (1:16)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0041/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0041/output.json new file mode 100644 index 000000000000..68d637a98170 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0041/output.json @@ -0,0 +1,109 @@ +{ + "type": "File", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "errors": [ + "SyntaxError: Invalid regular expression flag (1:16)", + "SyntaxError: Invalid regular expression flag (1:18)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "id": { + "type": "Identifier", + "start": 4, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "x" + }, + "name": "x" + }, + "init": { + "type": "RegExpLiteral", + "start": 8, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "extra": { + "raw": "/[a-z]/\\ux" + }, + "pattern": "[a-z]", + "flags": "\\ux" + } + } + ], + "kind": "var" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0042/input.js b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0042/input.js index fdbf86f1d023..e8f66bb867d1 100644 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0042/input.js +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0042/input.js @@ -1 +1 @@ -var x = /[a-z\n]/\\ux +var x = /[a-z\n]/\ux diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0042/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0042/options.json deleted file mode 100644 index eae3757f4451..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0042/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid regular expression flag (1:18)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0042/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0042/output.json new file mode 100644 index 000000000000..c4e889cefe20 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0042/output.json @@ -0,0 +1,109 @@ +{ + "type": "File", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "errors": [ + "SyntaxError: Invalid regular expression flag (1:18)", + "SyntaxError: Invalid regular expression flag (1:20)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "id": { + "type": "Identifier", + "start": 4, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "x" + }, + "name": "x" + }, + "init": { + "type": "RegExpLiteral", + "start": 8, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "extra": { + "raw": "/[a-z\\n]/\\ux" + }, + "pattern": "[a-z\\n]", + "flags": "\\ux" + } + } + ], + "kind": "var" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0043/input.js b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0043/input.js index e2a2d371e229..9a2dc1767685 100644 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0043/input.js +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0043/input.js @@ -1 +1 @@ -var x = /[a-z]/\\\\ux +var x = /[a-z]/\\ux diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0043/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0043/options.json deleted file mode 100644 index adf556b0a352..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0043/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid regular expression flag (1:16)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0043/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0043/output.json new file mode 100644 index 000000000000..76ef6d90fe84 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0043/output.json @@ -0,0 +1,110 @@ +{ + "type": "File", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "errors": [ + "SyntaxError: Invalid regular expression flag (1:16)", + "SyntaxError: Invalid regular expression flag (1:17)", + "SyntaxError: Invalid regular expression flag (1:19)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "id": { + "type": "Identifier", + "start": 4, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "x" + }, + "name": "x" + }, + "init": { + "type": "RegExpLiteral", + "start": 8, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "extra": { + "raw": "/[a-z]/\\\\ux" + }, + "pattern": "[a-z]", + "flags": "\\\\ux" + } + } + ], + "kind": "var" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0044/input.js b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0044/input.js index fc48dffd74dc..405b48568aa8 100644 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0044/input.js +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0044/input.js @@ -1 +1 @@ -var x = /[P QR]/\\\\u0067 +var x = /[P QR]/\\u0067 diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0044/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0044/options.json deleted file mode 100644 index 080cb0eaaa8a..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0044/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid regular expression flag (1:17)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0044/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0044/output.json new file mode 100644 index 000000000000..430d18e24eac --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0044/output.json @@ -0,0 +1,113 @@ +{ + "type": "File", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "errors": [ + "SyntaxError: Invalid regular expression flag (1:17)", + "SyntaxError: Invalid regular expression flag (1:18)", + "SyntaxError: Invalid regular expression flag (1:20)", + "SyntaxError: Invalid regular expression flag (1:21)", + "SyntaxError: Invalid regular expression flag (1:22)", + "SyntaxError: Invalid regular expression flag (1:23)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "id": { + "type": "Identifier", + "start": 4, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "x" + }, + "name": "x" + }, + "init": { + "type": "RegExpLiteral", + "start": 8, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "extra": { + "raw": "/[P QR]/\\\\u0067" + }, + "pattern": "[P QR]", + "flags": "\\\\u0067" + } + } + ], + "kind": "var" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0045/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0045/options.json deleted file mode 100644 index 6010e96ed144..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0045/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in assignment expression (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0045/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0045/output.json new file mode 100644 index 000000000000..99a3e74a04af --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0045/output.json @@ -0,0 +1,109 @@ +{ + "type": "File", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "errors": [ + "SyntaxError: Invalid left-hand side in assignment expression (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "operator": "=", + "left": { + "type": "NumericLiteral", + "start": 0, + "end": 1, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "extra": { + "rawValue": 3, + "raw": "3" + }, + "value": 3 + }, + "right": { + "type": "NumericLiteral", + "start": 4, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "extra": { + "rawValue": 4, + "raw": "4" + }, + "value": 4 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0046/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0046/options.json deleted file mode 100644 index 6010e96ed144..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0046/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in assignment expression (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0046/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0046/output.json new file mode 100644 index 000000000000..8770df4abba7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0046/output.json @@ -0,0 +1,122 @@ +{ + "type": "File", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "errors": [ + "SyntaxError: Invalid left-hand side in assignment expression (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "operator": "=", + "left": { + "type": "CallExpression", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "callee": { + "type": "Identifier", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + }, + "identifierName": "func" + }, + "name": "func" + }, + "arguments": [] + }, + "right": { + "type": "NumericLiteral", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "extra": { + "rawValue": 4, + "raw": "4" + }, + "value": 4 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0047/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0047/options.json deleted file mode 100644 index 7c5f08eb9ba6..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0047/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in assignment expression (1:1)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0047/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0047/output.json new file mode 100644 index 000000000000..42614106f157 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0047/output.json @@ -0,0 +1,149 @@ +{ + "type": "File", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "errors": [ + "SyntaxError: Invalid left-hand side in assignment expression (1:1)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "operator": "=", + "left": { + "type": "BinaryExpression", + "start": 1, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "left": { + "type": "NumericLiteral", + "start": 1, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + }, + "operator": "+", + "right": { + "type": "NumericLiteral", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + }, + "extra": { + "parenthesized": true, + "parenStart": 0 + } + }, + "right": { + "type": "NumericLiteral", + "start": 10, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "extra": { + "rawValue": 10, + "raw": "10" + }, + "value": 10 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0048/input.js b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0048/input.js index 2bbf7ac4d47c..1d1226dada02 100644 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0048/input.js +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0048/input.js @@ -1 +1 @@ -\\u{110000} +\u{110000} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0048/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0048/options.json index 381fd12ce2d0..8dfd231d943b 100644 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0048/options.json +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0048/options.json @@ -1,3 +1,3 @@ { - "throws": "Expecting Unicode escape sequence \\uXXXX (1:1)" -} + "throws": "Invalid code point 1114112" +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0049/input.js b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0049/input.js index 9943cc7906a5..aabe8d74272e 100644 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0049/input.js +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0049/input.js @@ -1 +1 @@ -\\u{} +\u{} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0049/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0049/options.json deleted file mode 100644 index 381fd12ce2d0..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0049/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Expecting Unicode escape sequence \\uXXXX (1:1)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0049/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0049/output.json new file mode 100644 index 000000000000..9d206b4f8475 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0049/output.json @@ -0,0 +1,70 @@ +{ + "type": "File", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "errors": [ + "SyntaxError: Bad character escape sequence (1:3)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "expression": { + "type": "Identifier", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + }, + "identifierName": "" + }, + "name": "" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0050/input.js b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0050/input.js index 5d4f24cb8271..170edba55da6 100644 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0050/input.js +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0050/input.js @@ -1 +1 @@ -\\u{FFFF +\u{FFFF diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0050/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0050/options.json deleted file mode 100644 index 381fd12ce2d0..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0050/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Expecting Unicode escape sequence \\uXXXX (1:1)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0050/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0050/output.json new file mode 100644 index 000000000000..252665de0e5e --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0050/output.json @@ -0,0 +1,70 @@ +{ + "type": "File", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "errors": [ + "SyntaxError: Bad character escape sequence (1:3)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "expression": { + "type": "Identifier", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "FFF" + }, + "name": "FFF" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0051/input.js b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0051/input.js index 11e05c81c1e8..0c65088d077b 100644 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0051/input.js +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0051/input.js @@ -1 +1 @@ -\\u{FFZ} +\u{FFZ} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0051/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0051/options.json deleted file mode 100644 index 381fd12ce2d0..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0051/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Expecting Unicode escape sequence \\uXXXX (1:1)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0051/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0051/output.json new file mode 100644 index 000000000000..2c27554ffa56 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0051/output.json @@ -0,0 +1,70 @@ +{ + "type": "File", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "errors": [ + "SyntaxError: Bad character escape sequence (1:3)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "expression": { + "type": "Identifier", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "" + }, + "name": "" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0052/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0052/options.json deleted file mode 100644 index c09dac1301de..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0052/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in postfix operation (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0052/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0052/output.json new file mode 100644 index 000000000000..ce2cb3d23d67 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0052/output.json @@ -0,0 +1,90 @@ +{ + "type": "File", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "errors": [ + "SyntaxError: Invalid left-hand side in postfix operation (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "expression": { + "type": "UpdateExpression", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "operator": "++", + "prefix": false, + "argument": { + "type": "NumericLiteral", + "start": 0, + "end": 1, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0053/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0053/options.json deleted file mode 100644 index c09dac1301de..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0053/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in postfix operation (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0053/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0053/output.json new file mode 100644 index 000000000000..57d55fec0b5d --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0053/output.json @@ -0,0 +1,90 @@ +{ + "type": "File", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "errors": [ + "SyntaxError: Invalid left-hand side in postfix operation (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "expression": { + "type": "UpdateExpression", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "operator": "--", + "prefix": false, + "argument": { + "type": "NumericLiteral", + "start": 0, + "end": 1, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0054/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0054/options.json deleted file mode 100644 index 515e441e8ea7..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0054/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in prefix operation (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0054/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0054/output.json new file mode 100644 index 000000000000..9a7a240c5b4a --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0054/output.json @@ -0,0 +1,90 @@ +{ + "type": "File", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "errors": [ + "SyntaxError: Invalid left-hand side in prefix operation (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "expression": { + "type": "UpdateExpression", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "operator": "++", + "prefix": true, + "argument": { + "type": "NumericLiteral", + "start": 2, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0055/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0055/options.json deleted file mode 100644 index 515e441e8ea7..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0055/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in prefix operation (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0055/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0055/output.json new file mode 100644 index 000000000000..85107220dae5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0055/output.json @@ -0,0 +1,90 @@ +{ + "type": "File", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "errors": [ + "SyntaxError: Invalid left-hand side in prefix operation (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "expression": { + "type": "UpdateExpression", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "operator": "--", + "prefix": true, + "argument": { + "type": "NumericLiteral", + "start": 2, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0056/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0056/options.json deleted file mode 100644 index f8560a7de9d6..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0056/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in for-in statement (1:5)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0056/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0056/output.json new file mode 100644 index 000000000000..f9e5df01e76a --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0056/output.json @@ -0,0 +1,196 @@ +{ + "type": "File", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "errors": [ + "SyntaxError: Invalid left-hand side in for-in statement (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ForInStatement", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "left": { + "type": "BinaryExpression", + "start": 5, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "left": { + "type": "NumericLiteral", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + }, + "operator": "+", + "right": { + "type": "NumericLiteral", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + }, + "extra": { + "parenthesized": true, + "parenStart": 4 + } + }, + "right": { + "type": "Identifier", + "start": 15, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 19 + }, + "identifierName": "list" + }, + "name": "list" + }, + "body": { + "type": "ExpressionStatement", + "start": 21, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "expression": { + "type": "CallExpression", + "start": 21, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "callee": { + "type": "Identifier", + "start": 21, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 28 + }, + "identifierName": "process" + }, + "name": "process" + }, + "arguments": [ + { + "type": "Identifier", + "start": 29, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 30 + }, + "identifierName": "x" + }, + "name": "x" + } + ] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0064/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0064/options.json deleted file mode 100644 index 2b91be8d5115..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0064/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected keyword 'if' (1:4)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0064/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0064/output.json new file mode 100644 index 000000000000..ac910291b748 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0064/output.json @@ -0,0 +1,108 @@ +{ + "type": "File", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "errors": [ + "SyntaxError: Unexpected keyword 'if' (1:4)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "id": { + "type": "Identifier", + "start": 4, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "if" + }, + "name": "if" + }, + "init": { + "type": "NumericLiteral", + "start": 9, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + ], + "kind": "var" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0066/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0066/options.json deleted file mode 100644 index 6010e96ed144..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0066/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in assignment expression (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0066/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0066/output.json new file mode 100644 index 000000000000..56547ff7be13 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0066/output.json @@ -0,0 +1,142 @@ +{ + "type": "File", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "errors": [ + "SyntaxError: Invalid left-hand side in assignment expression (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "operator": "=", + "left": { + "type": "BinaryExpression", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "left": { + "type": "Identifier", + "start": 0, + "end": 1, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + }, + "identifierName": "i" + }, + "name": "i" + }, + "operator": "+", + "right": { + "type": "NumericLiteral", + "start": 4, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "extra": { + "rawValue": 2, + "raw": "2" + }, + "value": 2 + } + }, + "right": { + "type": "NumericLiteral", + "start": 8, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0067/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0067/options.json deleted file mode 100644 index 6010e96ed144..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0067/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in assignment expression (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0067/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0067/output.json new file mode 100644 index 000000000000..ece139488ea0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0067/output.json @@ -0,0 +1,123 @@ +{ + "type": "File", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "errors": [ + "SyntaxError: Invalid left-hand side in assignment expression (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "operator": "=", + "left": { + "type": "UnaryExpression", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "operator": "+", + "prefix": true, + "argument": { + "type": "Identifier", + "start": 1, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + }, + "identifierName": "i" + }, + "name": "i" + } + }, + "right": { + "type": "NumericLiteral", + "start": 5, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0075/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0075/options.json index aa55ec4f840f..5a02a61446d2 100644 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0075/options.json +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0075/options.json @@ -1,3 +1,5 @@ { - "throws": "setter must have exactly one formal parameter (1:3)" -} + "plugins": [ + "estree" + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0075/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0075/output.json new file mode 100644 index 000000000000..b0ad15758245 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0075/output.json @@ -0,0 +1,145 @@ +{ + "type": "File", + "start": 0, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "errors": [ + "SyntaxError: setter must have exactly one formal parameter (1:3)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "expression": { + "type": "ObjectExpression", + "start": 1, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "properties": [ + { + "type": "Property", + "start": 3, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + }, + "identifierName": "s" + }, + "name": "s" + }, + "computed": false, + "kind": "set", + "value": { + "type": "FunctionExpression", + "start": 8, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "id": null, + "generator": false, + "async": false, + "expression": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 11, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "body": [] + } + }, + "shorthand": false + } + ], + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0087/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0087/options.json deleted file mode 100644 index 92845f5f2081..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0087/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Assigning to 'eval' in strict mode (1:15)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0087/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0087/output.json new file mode 100644 index 000000000000..3731ec6d7b75 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0087/output.json @@ -0,0 +1,182 @@ +{ + "type": "File", + "start": 0, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "errors": [ + "SyntaxError: Assigning to 'eval' in strict mode (1:15)", + "SyntaxError: Binding 'eval' in strict mode (1:15)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 14, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 14, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "AssignmentPattern", + "start": 15, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "left": { + "type": "Identifier", + "start": 15, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 19 + }, + "identifierName": "eval" + }, + "name": "eval" + }, + "right": { + "type": "NumericLiteral", + "start": 22, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "extra": { + "rawValue": 10, + "raw": "10" + }, + "value": 10 + } + } + ], + "body": { + "type": "NumericLiteral", + "start": 29, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0088/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0088/options.json deleted file mode 100644 index ad54c428a2f9..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0088/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:14)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0088/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0088/output.json new file mode 100644 index 000000000000..dbffe6547ab5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0088/output.json @@ -0,0 +1,146 @@ +{ + "type": "File", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:14)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 14, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 14, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 14, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 18 + }, + "identifierName": "eval" + }, + "name": "eval" + } + ], + "body": { + "type": "NumericLiteral", + "start": 22, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0089/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0089/options.json deleted file mode 100644 index bfa08eae293e..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0089/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'arguments' in strict mode (1:14)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0089/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0089/output.json new file mode 100644 index 000000000000..1b3ed15f002e --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0089/output.json @@ -0,0 +1,146 @@ +{ + "type": "File", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "errors": [ + "SyntaxError: Binding 'arguments' in strict mode (1:14)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 14, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 14, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 14, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 23 + }, + "identifierName": "arguments" + }, + "name": "arguments" + } + ], + "body": { + "type": "NumericLiteral", + "start": 27, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0090/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0090/options.json deleted file mode 100644 index 794c4864d4e5..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0090/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:15)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0090/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0090/output.json new file mode 100644 index 000000000000..6b7ae83c0ad2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0090/output.json @@ -0,0 +1,163 @@ +{ + "type": "File", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:15)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 14, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 14, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 15, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 19 + }, + "identifierName": "eval" + }, + "name": "eval" + }, + { + "type": "Identifier", + "start": 21, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + }, + "identifierName": "a" + }, + "name": "a" + } + ], + "body": { + "type": "NumericLiteral", + "start": 27, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0091/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0091/options.json deleted file mode 100644 index 212d35fcb5fe..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0091/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'arguments' in strict mode (1:15)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0091/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0091/output.json new file mode 100644 index 000000000000..c681755fb108 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0091/output.json @@ -0,0 +1,163 @@ +{ + "type": "File", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "errors": [ + "SyntaxError: Binding 'arguments' in strict mode (1:15)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 14, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 14, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 15, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 24 + }, + "identifierName": "arguments" + }, + "name": "arguments" + }, + { + "type": "Identifier", + "start": 26, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 27 + }, + "identifierName": "a" + }, + "name": "a" + } + ], + "body": { + "type": "NumericLiteral", + "start": 32, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0092/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0092/options.json deleted file mode 100644 index 368006ae58bd..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0092/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Argument name clash (1:4)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0092/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0092/output.json new file mode 100644 index 000000000000..78da40f6d8c7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0092/output.json @@ -0,0 +1,127 @@ +{ + "type": "File", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "errors": [ + "SyntaxError: Argument name clash (1:4)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 1, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + }, + "identifierName": "a" + }, + "name": "a" + }, + { + "type": "Identifier", + "start": 4, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "a" + }, + "name": "a" + } + ], + "body": { + "type": "NumericLiteral", + "start": 10, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0093/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0093/options.json deleted file mode 100644 index b99fd35222b1..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0093/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Argument name clash (1:18)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0093/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0093/output.json new file mode 100644 index 000000000000..3a5f60bdddea --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0093/output.json @@ -0,0 +1,163 @@ +{ + "type": "File", + "start": 0, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "errors": [ + "SyntaxError: Argument name clash (1:18)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 14, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 14, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 15, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + }, + "identifierName": "a" + }, + "name": "a" + }, + { + "type": "Identifier", + "start": 18, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + }, + "identifierName": "a" + }, + "name": "a" + } + ], + "body": { + "type": "NumericLiteral", + "start": 24, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0094/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0094/options.json deleted file mode 100644 index 79a05e62290e..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0094/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Legacy octal literals are not allowed in strict mode (1:21)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0094/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0094/output.json new file mode 100644 index 000000000000..18c0889f74b8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0094/output.json @@ -0,0 +1,146 @@ +{ + "type": "File", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "errors": [ + "SyntaxError: Legacy octal literals are not allowed in strict mode (1:21)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 14, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 14, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 15, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + }, + "identifierName": "a" + }, + "name": "a" + } + ], + "body": { + "type": "NumericLiteral", + "start": 21, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "extra": { + "rawValue": 0, + "raw": "00" + }, + "value": 0 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0098/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0098/options.json deleted file mode 100644 index 99ffc0de0153..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0098/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in arrow function parameters (1:1)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0098/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0098/output.json new file mode 100644 index 000000000000..a7c444dfbcdc --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0098/output.json @@ -0,0 +1,113 @@ +{ + "type": "File", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "errors": [ + "SyntaxError: Binding invalid left-hand side in function parameter list (1:1)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "NumericLiteral", + "start": 1, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "extra": { + "rawValue": 10, + "raw": "10" + }, + "value": 10 + } + ], + "body": { + "type": "NumericLiteral", + "start": 8, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "extra": { + "rawValue": 0, + "raw": "00" + }, + "value": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0099/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0099/options.json deleted file mode 100644 index 99ffc0de0153..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0099/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in arrow function parameters (1:1)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0099/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0099/output.json new file mode 100644 index 000000000000..2d80f047d283 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0099/output.json @@ -0,0 +1,134 @@ +{ + "type": "File", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "errors": [ + "SyntaxError: Binding invalid left-hand side in function parameter list (1:1)", + "SyntaxError: Binding invalid left-hand side in function parameter list (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "NumericLiteral", + "start": 1, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "extra": { + "rawValue": 10, + "raw": "10" + }, + "value": 10 + }, + { + "type": "NumericLiteral", + "start": 5, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "extra": { + "rawValue": 20, + "raw": "20" + }, + "value": 20 + } + ], + "body": { + "type": "NumericLiteral", + "start": 12, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "extra": { + "rawValue": 0, + "raw": "00" + }, + "value": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0100/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0100/options.json deleted file mode 100644 index 794c4864d4e5..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0100/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:15)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0100/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0100/output.json new file mode 100644 index 000000000000..49e0835c1bfc --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0100/output.json @@ -0,0 +1,146 @@ +{ + "type": "File", + "start": 0, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:15)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 14, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 14, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 15, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 19 + }, + "identifierName": "eval" + }, + "name": "eval" + } + ], + "body": { + "type": "NumericLiteral", + "start": 24, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0101/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0101/options.json deleted file mode 100644 index cc2bef2a9a34..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0101/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:1)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0101/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0101/output.json new file mode 100644 index 000000000000..85866aeddd23 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0101/output.json @@ -0,0 +1,179 @@ +{ + "type": "File", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:1)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 1, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "eval" + }, + "name": "eval" + } + ], + "body": { + "type": "BlockStatement", + "start": 10, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 26, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 26, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 12, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 12, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0116/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0116/options.json deleted file mode 100644 index 701f9fe8f27a..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0116/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unsyntactic break (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0116/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0116/output.json new file mode 100644 index 000000000000..d3a105c584dd --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0116/output.json @@ -0,0 +1,54 @@ +{ + "type": "File", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "errors": [ + "SyntaxError: Unsyntactic break (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "BreakStatement", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "label": null + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0118/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0118/options.json deleted file mode 100644 index de66853a7a3d..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0118/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unsyntactic continue (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0118/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0118/output.json new file mode 100644 index 000000000000..c32c5b089115 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0118/output.json @@ -0,0 +1,54 @@ +{ + "type": "File", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "errors": [ + "SyntaxError: Unsyntactic continue (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ContinueStatement", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "label": null + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0125/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0125/options.json deleted file mode 100644 index f8560a7de9d6..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0125/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in for-in statement (1:5)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0125/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0125/output.json new file mode 100644 index 000000000000..3844a4d151a7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0125/output.json @@ -0,0 +1,137 @@ +{ + "type": "File", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "errors": [ + "SyntaxError: Invalid left-hand side in for-in statement (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ForInStatement", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "left": { + "type": "BinaryExpression", + "start": 5, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "left": { + "type": "Identifier", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "i" + }, + "name": "i" + }, + "operator": "+", + "right": { + "type": "NumericLiteral", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + }, + "right": { + "type": "ObjectExpression", + "start": 14, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "properties": [] + }, + "body": { + "type": "EmptyStatement", + "start": 17, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0126/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0126/options.json deleted file mode 100644 index f8560a7de9d6..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0126/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in for-in statement (1:5)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0126/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0126/output.json new file mode 100644 index 000000000000..9d008175f644 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0126/output.json @@ -0,0 +1,118 @@ +{ + "type": "File", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "errors": [ + "SyntaxError: Invalid left-hand side in for-in statement (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ForInStatement", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "left": { + "type": "UnaryExpression", + "start": 5, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "operator": "+", + "prefix": true, + "argument": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "i" + }, + "name": "i" + } + }, + "right": { + "type": "ObjectExpression", + "start": 11, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "properties": [] + }, + "body": { + "type": "EmptyStatement", + "start": 14, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0133/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0133/options.json deleted file mode 100644 index 429d96ca3f9a..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0133/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Missing catch or finally clause (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0133/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0133/output.json new file mode 100644 index 000000000000..3d2ee0555b85 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0133/output.json @@ -0,0 +1,72 @@ +{ + "type": "File", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "errors": [ + "SyntaxError: Missing catch or finally clause (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "TryStatement", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "block": { + "type": "BlockStatement", + "start": 4, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "body": [], + "directives": [] + }, + "handler": null, + "finalizer": null + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0137/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0137/options.json deleted file mode 100644 index 82bcfe621c49..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0137/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid Unicode escape (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0137/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0137/output.json new file mode 100644 index 000000000000..237da8c03a78 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0137/output.json @@ -0,0 +1,106 @@ +{ + "type": "File", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "errors": [ + "SyntaxError: Invalid Unicode escape (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "operator": "=", + "left": { + "type": "Identifier", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "‿" + }, + "name": "‿" + }, + "right": { + "type": "NumericLiteral", + "start": 9, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "extra": { + "rawValue": 10, + "raw": "10" + }, + "value": 10 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0142/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0142/options.json deleted file mode 100644 index 97818d2eea7e..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0142/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Lexical declaration cannot appear in a single-statement context (1:9)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0142/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0142/output.json new file mode 100644 index 000000000000..c273b86361e0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0142/output.json @@ -0,0 +1,140 @@ +{ + "type": "File", + "start": 0, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "errors": [ + "SyntaxError: Lexical declaration cannot appear in a single-statement context (1:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "IfStatement", + "start": 0, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "test": { + "type": "BooleanLiteral", + "start": 3, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "value": true + }, + "consequent": { + "type": "VariableDeclaration", + "start": 9, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 15, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "id": { + "type": "Identifier", + "start": 15, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + }, + "identifierName": "a" + }, + "name": "a" + }, + "init": { + "type": "NumericLiteral", + "start": 19, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "const" + }, + "alternate": null + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0143/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0143/options.json deleted file mode 100644 index aadfa63716c2..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0143/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Multiple default clauses (1:22)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0143/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0143/output.json new file mode 100644 index 000000000000..c90c4eefdc6f --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0143/output.json @@ -0,0 +1,106 @@ +{ + "type": "File", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "errors": [ + "SyntaxError: Multiple default clauses (1:22)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "SwitchStatement", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "discriminant": { + "type": "Identifier", + "start": 8, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + }, + "identifierName": "c" + }, + "name": "c" + }, + "cases": [ + { + "type": "SwitchCase", + "start": 13, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "consequent": [], + "test": null + }, + { + "type": "SwitchCase", + "start": 22, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "consequent": [], + "test": null + } + ] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0162/input.js b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0162/input.js index adcf3cef4357..57ddad2aec5d 100644 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0162/input.js +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0162/input.js @@ -1 +1 @@ -\\ +\ diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0162/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0162/options.json deleted file mode 100644 index 381fd12ce2d0..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0162/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Expecting Unicode escape sequence \\uXXXX (1:1)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0162/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0162/output.json new file mode 100644 index 000000000000..8644ccf99c0e --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0162/output.json @@ -0,0 +1,70 @@ +{ + "type": "File", + "start": 0, + "end": 1, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Expecting Unicode escape sequence \\uXXXX (1:1)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 1, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 1, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "expression": { + "type": "Identifier", + "start": 0, + "end": 1, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + }, + "identifierName": "\\" + }, + "name": "\\" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0163/input.js b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0163/input.js index b9e12b2eff54..65bd7cf67b3f 100644 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0163/input.js +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0163/input.js @@ -1 +1 @@ -\\u005c +\u005c diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0163/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0163/options.json deleted file mode 100644 index 381fd12ce2d0..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0163/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Expecting Unicode escape sequence \\uXXXX (1:1)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0163/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0163/output.json new file mode 100644 index 000000000000..d44909ca998a --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0163/output.json @@ -0,0 +1,70 @@ +{ + "type": "File", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "errors": [ + "SyntaxError: Invalid Unicode escape (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "expression": { + "type": "Identifier", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "\\" + }, + "name": "\\" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0164/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0164/options.json deleted file mode 100644 index 381fd12ce2d0..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0164/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Expecting Unicode escape sequence \\uXXXX (1:1)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0164/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0164/output.json new file mode 100644 index 000000000000..38cc0c05b021 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0164/output.json @@ -0,0 +1,70 @@ +{ + "type": "File", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "errors": [ + "SyntaxError: Expecting Unicode escape sequence \\uXXXX (1:1)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "expression": { + "type": "Identifier", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + }, + "identifierName": "\\x" + }, + "name": "\\x" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0165/input.js b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0165/input.js index a6e819ccd18b..ecb0a859c956 100644 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0165/input.js +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0165/input.js @@ -1 +1 @@ -\\u0000 +\u0000 diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0165/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0165/options.json deleted file mode 100644 index 381fd12ce2d0..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0165/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Expecting Unicode escape sequence \\uXXXX (1:1)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0165/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0165/output.json new file mode 100644 index 000000000000..380e6ec698ef --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0165/output.json @@ -0,0 +1,70 @@ +{ + "type": "File", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "errors": [ + "SyntaxError: Invalid Unicode escape (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "expression": { + "type": "Identifier", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "\u0000" + }, + "name": "\u0000" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0166/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0166/options.json deleted file mode 100644 index 82bcfe621c49..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0166/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid Unicode escape (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0166/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0166/output.json new file mode 100644 index 000000000000..d528d79e32d4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0166/output.json @@ -0,0 +1,102 @@ +{ + "type": "File", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "errors": [ + "SyntaxError: Invalid Unicode escape (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "operator": "=", + "left": { + "type": "Identifier", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "‌" + }, + "name": "‌" + }, + "right": { + "type": "ArrayExpression", + "start": 9, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "elements": [] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0167/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0167/options.json deleted file mode 100644 index 82bcfe621c49..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0167/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid Unicode escape (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0167/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0167/output.json new file mode 100644 index 000000000000..91544094b698 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0167/output.json @@ -0,0 +1,102 @@ +{ + "type": "File", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "errors": [ + "SyntaxError: Invalid Unicode escape (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "operator": "=", + "left": { + "type": "Identifier", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "‍" + }, + "name": "‍" + }, + "right": { + "type": "ArrayExpression", + "start": 9, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "elements": [] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0169/input.js b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0169/input.js index 2775e915bb92..1ef32f79a66e 100644 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0169/input.js +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0169/input.js @@ -1 +1 @@ -"\\u +"\u diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0171/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0171/options.json deleted file mode 100644 index f9d29c7f328c..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0171/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "'return' outside of function (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0171/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0171/output.json new file mode 100644 index 000000000000..e43da2374537 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0171/output.json @@ -0,0 +1,54 @@ +{ + "type": "File", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "errors": [ + "SyntaxError: 'return' outside of function (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ReturnStatement", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "argument": null + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0172/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0172/options.json deleted file mode 100644 index 701f9fe8f27a..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0172/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unsyntactic break (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0172/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0172/output.json new file mode 100644 index 000000000000..d3a105c584dd --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0172/output.json @@ -0,0 +1,54 @@ +{ + "type": "File", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "errors": [ + "SyntaxError: Unsyntactic break (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "BreakStatement", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "label": null + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0173/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0173/options.json deleted file mode 100644 index de66853a7a3d..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0173/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unsyntactic continue (1:0)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0173/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0173/output.json new file mode 100644 index 000000000000..c32c5b089115 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0173/output.json @@ -0,0 +1,54 @@ +{ + "type": "File", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "errors": [ + "SyntaxError: Unsyntactic continue (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ContinueStatement", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "label": null + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0174/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0174/options.json deleted file mode 100644 index c726e8fa98e4..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0174/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unsyntactic continue (1:22)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0174/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0174/output.json new file mode 100644 index 000000000000..b83145faf5ab --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0174/output.json @@ -0,0 +1,106 @@ +{ + "type": "File", + "start": 0, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "errors": [ + "SyntaxError: Unsyntactic continue (1:22)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "SwitchStatement", + "start": 0, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "discriminant": { + "type": "Identifier", + "start": 8, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + }, + "identifierName": "x" + }, + "name": "x" + }, + "cases": [ + { + "type": "SwitchCase", + "start": 13, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "consequent": [ + { + "type": "ContinueStatement", + "start": 22, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "label": null + } + ], + "test": null + } + ] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0176/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0176/options.json deleted file mode 100644 index 070e662e80d4..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0176/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unsyntactic break (1:15)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0176/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0176/output.json new file mode 100644 index 000000000000..a7c8d4f9a0ca --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0176/output.json @@ -0,0 +1,119 @@ +{ + "type": "File", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "errors": [ + "SyntaxError: Unsyntactic break (1:15)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "WhileStatement", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "test": { + "type": "BooleanLiteral", + "start": 7, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "value": true + }, + "body": { + "type": "BlockStatement", + "start": 13, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "body": [ + { + "type": "BreakStatement", + "start": 15, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "label": { + "type": "Identifier", + "start": 21, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + }, + "identifierName": "x" + }, + "name": "x" + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0177/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0177/options.json deleted file mode 100644 index 2a2e15787aa7..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0177/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unsyntactic continue (1:15)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0177/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0177/output.json new file mode 100644 index 000000000000..2f1c8737b22e --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0177/output.json @@ -0,0 +1,119 @@ +{ + "type": "File", + "start": 0, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "errors": [ + "SyntaxError: Unsyntactic continue (1:15)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "WhileStatement", + "start": 0, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "test": { + "type": "BooleanLiteral", + "start": 7, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "value": true + }, + "body": { + "type": "BlockStatement", + "start": 13, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "body": [ + { + "type": "ContinueStatement", + "start": 15, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "label": { + "type": "Identifier", + "start": 24, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + }, + "identifierName": "x" + }, + "name": "x" + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0178/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0178/options.json deleted file mode 100644 index 464af80a1561..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0178/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unsyntactic break (1:33)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0178/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0178/output.json new file mode 100644 index 000000000000..7337acd3e8fd --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0178/output.json @@ -0,0 +1,207 @@ +{ + "type": "File", + "start": 0, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 47 + } + }, + "errors": [ + "SyntaxError: Unsyntactic break (1:33)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 47 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "LabeledStatement", + "start": 0, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 47 + } + }, + "body": { + "type": "WhileStatement", + "start": 3, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 47 + } + }, + "test": { + "type": "BooleanLiteral", + "start": 10, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "value": true + }, + "body": { + "type": "BlockStatement", + "start": 16, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 47 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 18, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 45 + } + }, + "expression": { + "type": "FunctionExpression", + "start": 19, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 31, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "body": [ + { + "type": "BreakStatement", + "start": 33, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "label": { + "type": "Identifier", + "start": 39, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 39 + }, + "end": { + "line": 1, + "column": 40 + }, + "identifierName": "x" + }, + "name": "x" + } + } + ], + "directives": [] + }, + "extra": { + "parenthesized": true, + "parenStart": 18 + } + } + } + ], + "directives": [] + } + }, + "label": { + "type": "Identifier", + "start": 0, + "end": 1, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + }, + "identifierName": "x" + }, + "name": "x" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0179/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0179/options.json deleted file mode 100644 index a056cb50e190..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0179/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unsyntactic continue (1:33)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0179/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0179/output.json new file mode 100644 index 000000000000..18bc9b977ca7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0179/output.json @@ -0,0 +1,207 @@ +{ + "type": "File", + "start": 0, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 50 + } + }, + "errors": [ + "SyntaxError: Unsyntactic continue (1:33)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 50 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "LabeledStatement", + "start": 0, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 50 + } + }, + "body": { + "type": "WhileStatement", + "start": 3, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 50 + } + }, + "test": { + "type": "BooleanLiteral", + "start": 10, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "value": true + }, + "body": { + "type": "BlockStatement", + "start": 16, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 50 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 18, + "end": 48, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 48 + } + }, + "expression": { + "type": "FunctionExpression", + "start": 19, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 31, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "body": [ + { + "type": "ContinueStatement", + "start": 33, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 44 + } + }, + "label": { + "type": "Identifier", + "start": 42, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 42 + }, + "end": { + "line": 1, + "column": 43 + }, + "identifierName": "x" + }, + "name": "x" + } + } + ], + "directives": [] + }, + "extra": { + "parenthesized": true, + "parenStart": 18 + } + } + } + ], + "directives": [] + } + }, + "label": { + "type": "Identifier", + "start": 0, + "end": 1, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + }, + "identifierName": "x" + }, + "name": "x" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0180/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0180/options.json deleted file mode 100644 index 464af80a1561..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0180/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unsyntactic break (1:33)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0180/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0180/output.json new file mode 100644 index 000000000000..59ae007d6fba --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0180/output.json @@ -0,0 +1,191 @@ +{ + "type": "File", + "start": 0, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 45 + } + }, + "errors": [ + "SyntaxError: Unsyntactic break (1:33)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 45 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "LabeledStatement", + "start": 0, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 45 + } + }, + "body": { + "type": "WhileStatement", + "start": 3, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 45 + } + }, + "test": { + "type": "BooleanLiteral", + "start": 10, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "value": true + }, + "body": { + "type": "BlockStatement", + "start": 16, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 45 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 18, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "expression": { + "type": "FunctionExpression", + "start": 19, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 31, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "body": [ + { + "type": "BreakStatement", + "start": 33, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "label": null + } + ], + "directives": [] + }, + "extra": { + "parenthesized": true, + "parenStart": 18 + } + } + } + ], + "directives": [] + } + }, + "label": { + "type": "Identifier", + "start": 0, + "end": 1, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + }, + "identifierName": "x" + }, + "name": "x" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0181/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0181/options.json deleted file mode 100644 index a056cb50e190..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0181/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unsyntactic continue (1:33)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0181/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0181/output.json new file mode 100644 index 000000000000..d26e37b08031 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0181/output.json @@ -0,0 +1,191 @@ +{ + "type": "File", + "start": 0, + "end": 48, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 48 + } + }, + "errors": [ + "SyntaxError: Unsyntactic continue (1:33)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 48, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 48 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "LabeledStatement", + "start": 0, + "end": 48, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 48 + } + }, + "body": { + "type": "WhileStatement", + "start": 3, + "end": 48, + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 48 + } + }, + "test": { + "type": "BooleanLiteral", + "start": 10, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "value": true + }, + "body": { + "type": "BlockStatement", + "start": 16, + "end": 48, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 48 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 18, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "expression": { + "type": "FunctionExpression", + "start": 19, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 44 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 31, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 44 + } + }, + "body": [ + { + "type": "ContinueStatement", + "start": 33, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 42 + } + }, + "label": null + } + ], + "directives": [] + }, + "extra": { + "parenthesized": true, + "parenStart": 18 + } + } + } + ], + "directives": [] + } + }, + "label": { + "type": "Identifier", + "start": 0, + "end": 1, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + }, + "identifierName": "x" + }, + "name": "x" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0182/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0182/options.json deleted file mode 100644 index da7f2590db0b..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0182/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Label 'x' is already declared (1:18)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0182/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0182/output.json new file mode 100644 index 000000000000..3025d6bfbf72 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0182/output.json @@ -0,0 +1,199 @@ +{ + "type": "File", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "errors": [ + "SyntaxError: Label 'x' is already declared (1:18)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "LabeledStatement", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "body": { + "type": "WhileStatement", + "start": 3, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "test": { + "type": "BooleanLiteral", + "start": 10, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "value": true + }, + "body": { + "type": "BlockStatement", + "start": 16, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "body": [ + { + "type": "LabeledStatement", + "start": 18, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "body": { + "type": "WhileStatement", + "start": 21, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "test": { + "type": "BooleanLiteral", + "start": 28, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "value": true + }, + "body": { + "type": "BlockStatement", + "start": 34, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "body": [], + "directives": [] + } + }, + "label": { + "type": "Identifier", + "start": 18, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + }, + "identifierName": "x" + }, + "name": "x" + } + } + ], + "directives": [] + } + }, + "label": { + "type": "Identifier", + "start": 0, + "end": 1, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + }, + "identifierName": "x" + }, + "name": "x" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0183/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0183/options.json deleted file mode 100644 index 1517e1719333..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0183/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Deleting local variable in strict mode (1:29)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0183/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0183/output.json new file mode 100644 index 000000000000..f22f0efb0609 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0183/output.json @@ -0,0 +1,195 @@ +{ + "type": "File", + "start": 0, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "errors": [ + "SyntaxError: Deleting local variable in strict mode (1:29)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "expression": { + "type": "CallExpression", + "start": 1, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 42 + } + }, + "callee": { + "type": "FunctionExpression", + "start": 1, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 13, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 29, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "expression": { + "type": "UnaryExpression", + "start": 29, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "operator": "delete", + "prefix": true, + "argument": { + "type": "Identifier", + "start": 36, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 37 + }, + "identifierName": "i" + }, + "name": "i" + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 15, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 15, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + }, + "arguments": [], + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0184/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0184/options.json deleted file mode 100644 index 31b4c6d2a040..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0184/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "'with' in strict mode (1:29)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0184/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0184/output.json new file mode 100644 index 000000000000..1567b18881d6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0184/output.json @@ -0,0 +1,193 @@ +{ + "type": "File", + "start": 0, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "errors": [ + "SyntaxError: 'with' in strict mode (1:29)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "expression": { + "type": "CallExpression", + "start": 1, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 42 + } + }, + "callee": { + "type": "FunctionExpression", + "start": 1, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 13, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "body": [ + { + "type": "WithStatement", + "start": 29, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "object": { + "type": "Identifier", + "start": 35, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 36 + }, + "identifierName": "i" + }, + "name": "i" + }, + "body": { + "type": "EmptyStatement", + "start": 37, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 38 + } + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 15, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 15, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + }, + "arguments": [], + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0185/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0185/options.json deleted file mode 100644 index dfbf1f6d0d1c..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0185/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:36)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0185/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0185/output.json new file mode 100644 index 000000000000..7598b7431e9f --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0185/output.json @@ -0,0 +1,197 @@ +{ + "type": "File", + "start": 0, + "end": 48, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 48 + } + }, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:36)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 48, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 48 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 48, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 48 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 48, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 48 + } + }, + "body": [ + { + "type": "VariableDeclaration", + "start": 32, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 36, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 45 + } + }, + "id": { + "type": "Identifier", + "start": 36, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 40 + }, + "identifierName": "eval" + }, + "name": "eval" + }, + "init": { + "type": "NumericLiteral", + "start": 43, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 43 + }, + "end": { + "line": 1, + "column": 45 + } + }, + "extra": { + "rawValue": 10, + "raw": "10" + }, + "value": 10 + } + } + ], + "kind": "var" + } + ], + "directives": [ + { + "type": "Directive", + "start": 18, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 18, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0186/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0186/options.json deleted file mode 100644 index b74dfcf59199..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0186/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'arguments' in strict mode (1:36)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0186/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0186/output.json new file mode 100644 index 000000000000..7101109189a2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0186/output.json @@ -0,0 +1,197 @@ +{ + "type": "File", + "start": 0, + "end": 53, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 53 + } + }, + "errors": [ + "SyntaxError: Binding 'arguments' in strict mode (1:36)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 53, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 53 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 53, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 53 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 53, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 53 + } + }, + "body": [ + { + "type": "VariableDeclaration", + "start": 32, + "end": 51, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 51 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 36, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 50 + } + }, + "id": { + "type": "Identifier", + "start": 36, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 45 + }, + "identifierName": "arguments" + }, + "name": "arguments" + }, + "init": { + "type": "NumericLiteral", + "start": 48, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 48 + }, + "end": { + "line": 1, + "column": 50 + } + }, + "extra": { + "rawValue": 10, + "raw": "10" + }, + "value": 10 + } + } + ], + "kind": "var" + } + ], + "directives": [ + { + "type": "Directive", + "start": 18, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 18, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0187/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0187/options.json deleted file mode 100644 index e95a2d7f7535..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0187/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:47)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0187/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0187/output.json new file mode 100644 index 000000000000..dd5fca85f2e5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0187/output.json @@ -0,0 +1,209 @@ +{ + "type": "File", + "start": 0, + "end": 58, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 58 + } + }, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:47)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 58, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 58 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 58, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 58 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 58, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 58 + } + }, + "body": [ + { + "type": "TryStatement", + "start": 32, + "end": 56, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 56 + } + }, + "block": { + "type": "BlockStatement", + "start": 36, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "body": [], + "directives": [] + }, + "handler": { + "type": "CatchClause", + "start": 40, + "end": 56, + "loc": { + "start": { + "line": 1, + "column": 40 + }, + "end": { + "line": 1, + "column": 56 + } + }, + "param": { + "type": "Identifier", + "start": 47, + "end": 51, + "loc": { + "start": { + "line": 1, + "column": 47 + }, + "end": { + "line": 1, + "column": 51 + }, + "identifierName": "eval" + }, + "name": "eval" + }, + "body": { + "type": "BlockStatement", + "start": 53, + "end": 56, + "loc": { + "start": { + "line": 1, + "column": 53 + }, + "end": { + "line": 1, + "column": 56 + } + }, + "body": [], + "directives": [] + } + }, + "finalizer": null + } + ], + "directives": [ + { + "type": "Directive", + "start": 18, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 18, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0188/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0188/options.json deleted file mode 100644 index 14d96617b4b6..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0188/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'arguments' in strict mode (1:47)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0188/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0188/output.json new file mode 100644 index 000000000000..3b89f63424e2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0188/output.json @@ -0,0 +1,209 @@ +{ + "type": "File", + "start": 0, + "end": 63, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 63 + } + }, + "errors": [ + "SyntaxError: Binding 'arguments' in strict mode (1:47)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 63, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 63 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 63, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 63 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 63, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 63 + } + }, + "body": [ + { + "type": "TryStatement", + "start": 32, + "end": 61, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 61 + } + }, + "block": { + "type": "BlockStatement", + "start": 36, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "body": [], + "directives": [] + }, + "handler": { + "type": "CatchClause", + "start": 40, + "end": 61, + "loc": { + "start": { + "line": 1, + "column": 40 + }, + "end": { + "line": 1, + "column": 61 + } + }, + "param": { + "type": "Identifier", + "start": 47, + "end": 56, + "loc": { + "start": { + "line": 1, + "column": 47 + }, + "end": { + "line": 1, + "column": 56 + }, + "identifierName": "arguments" + }, + "name": "arguments" + }, + "body": { + "type": "BlockStatement", + "start": 58, + "end": 61, + "loc": { + "start": { + "line": 1, + "column": 58 + }, + "end": { + "line": 1, + "column": 61 + } + }, + "body": [], + "directives": [] + } + }, + "finalizer": null + } + ], + "directives": [ + { + "type": "Directive", + "start": 18, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 18, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0189/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0189/options.json deleted file mode 100644 index 6faa5d0476c3..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0189/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Assigning to 'eval' in strict mode (1:32)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0189/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0189/output.json new file mode 100644 index 000000000000..2973f3517639 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0189/output.json @@ -0,0 +1,195 @@ +{ + "type": "File", + "start": 0, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 44 + } + }, + "errors": [ + "SyntaxError: Assigning to 'eval' in strict mode (1:32)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 44 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 44 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 44 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 32, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 42 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 32, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "operator": "=", + "left": { + "type": "Identifier", + "start": 32, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 36 + }, + "identifierName": "eval" + }, + "name": "eval" + }, + "right": { + "type": "NumericLiteral", + "start": 39, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 39 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "extra": { + "rawValue": 10, + "raw": "10" + }, + "value": 10 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 18, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 18, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0190/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0190/options.json deleted file mode 100644 index 2f502104f7d4..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0190/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Assigning to 'arguments' in strict mode (1:32)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0190/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0190/output.json new file mode 100644 index 000000000000..e328a1e98ef9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0190/output.json @@ -0,0 +1,195 @@ +{ + "type": "File", + "start": 0, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 49 + } + }, + "errors": [ + "SyntaxError: Assigning to 'arguments' in strict mode (1:32)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 49 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 49 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 49 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 32, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 47 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 32, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "operator": "=", + "left": { + "type": "Identifier", + "start": 32, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 41 + }, + "identifierName": "arguments" + }, + "name": "arguments" + }, + "right": { + "type": "NumericLiteral", + "start": 44, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 44 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "extra": { + "rawValue": 10, + "raw": "10" + }, + "value": 10 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 18, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 18, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0191/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0191/options.json deleted file mode 100644 index 0964911894d9..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0191/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Assigning to 'eval' in strict mode (1:34)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0191/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0191/output.json new file mode 100644 index 000000000000..95091e65367d --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0191/output.json @@ -0,0 +1,176 @@ +{ + "type": "File", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "errors": [ + "SyntaxError: Assigning to 'eval' in strict mode (1:34)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 32, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "expression": { + "type": "UpdateExpression", + "start": 32, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "operator": "++", + "prefix": true, + "argument": { + "type": "Identifier", + "start": 34, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 38 + }, + "identifierName": "eval" + }, + "name": "eval" + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 18, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 18, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0192/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0192/options.json deleted file mode 100644 index 0964911894d9..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0192/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Assigning to 'eval' in strict mode (1:34)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0192/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0192/output.json new file mode 100644 index 000000000000..8473055a411c --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0192/output.json @@ -0,0 +1,176 @@ +{ + "type": "File", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "errors": [ + "SyntaxError: Assigning to 'eval' in strict mode (1:34)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 32, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "expression": { + "type": "UpdateExpression", + "start": 32, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "operator": "--", + "prefix": true, + "argument": { + "type": "Identifier", + "start": 34, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 38 + }, + "identifierName": "eval" + }, + "name": "eval" + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 18, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 18, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0193/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0193/options.json deleted file mode 100644 index ba5ef9dd55cc..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0193/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Assigning to 'arguments' in strict mode (1:34)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0193/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0193/output.json new file mode 100644 index 000000000000..c9974932443e --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0193/output.json @@ -0,0 +1,176 @@ +{ + "type": "File", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "errors": [ + "SyntaxError: Assigning to 'arguments' in strict mode (1:34)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 32, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 44 + } + }, + "expression": { + "type": "UpdateExpression", + "start": 32, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "operator": "++", + "prefix": true, + "argument": { + "type": "Identifier", + "start": 34, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 43 + }, + "identifierName": "arguments" + }, + "name": "arguments" + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 18, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 18, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0194/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0194/options.json deleted file mode 100644 index ba5ef9dd55cc..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0194/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Assigning to 'arguments' in strict mode (1:34)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0194/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0194/output.json new file mode 100644 index 000000000000..cf31420c53a0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0194/output.json @@ -0,0 +1,176 @@ +{ + "type": "File", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "errors": [ + "SyntaxError: Assigning to 'arguments' in strict mode (1:34)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 32, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 44 + } + }, + "expression": { + "type": "UpdateExpression", + "start": 32, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "operator": "--", + "prefix": true, + "argument": { + "type": "Identifier", + "start": 34, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 43 + }, + "identifierName": "arguments" + }, + "name": "arguments" + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 18, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 18, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0195/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0195/options.json deleted file mode 100644 index 6faa5d0476c3..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0195/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Assigning to 'eval' in strict mode (1:32)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0195/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0195/output.json new file mode 100644 index 000000000000..59618c91e2ca --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0195/output.json @@ -0,0 +1,176 @@ +{ + "type": "File", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "errors": [ + "SyntaxError: Assigning to 'eval' in strict mode (1:32)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 32, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "expression": { + "type": "UpdateExpression", + "start": 32, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "operator": "++", + "prefix": false, + "argument": { + "type": "Identifier", + "start": 32, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 36 + }, + "identifierName": "eval" + }, + "name": "eval" + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 18, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 18, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0196/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0196/options.json deleted file mode 100644 index 6faa5d0476c3..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0196/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Assigning to 'eval' in strict mode (1:32)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0196/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0196/output.json new file mode 100644 index 000000000000..0b6b047c7b58 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0196/output.json @@ -0,0 +1,176 @@ +{ + "type": "File", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "errors": [ + "SyntaxError: Assigning to 'eval' in strict mode (1:32)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 32, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "expression": { + "type": "UpdateExpression", + "start": 32, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "operator": "--", + "prefix": false, + "argument": { + "type": "Identifier", + "start": 32, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 36 + }, + "identifierName": "eval" + }, + "name": "eval" + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 18, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 18, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0197/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0197/options.json deleted file mode 100644 index 2f502104f7d4..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0197/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Assigning to 'arguments' in strict mode (1:32)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0197/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0197/output.json new file mode 100644 index 000000000000..64f2c09fd91e --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0197/output.json @@ -0,0 +1,176 @@ +{ + "type": "File", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "errors": [ + "SyntaxError: Assigning to 'arguments' in strict mode (1:32)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 32, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 44 + } + }, + "expression": { + "type": "UpdateExpression", + "start": 32, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "operator": "++", + "prefix": false, + "argument": { + "type": "Identifier", + "start": 32, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 41 + }, + "identifierName": "arguments" + }, + "name": "arguments" + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 18, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 18, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0198/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0198/options.json deleted file mode 100644 index 2f502104f7d4..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0198/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Assigning to 'arguments' in strict mode (1:32)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0198/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0198/output.json new file mode 100644 index 000000000000..34c1b59c4e79 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0198/output.json @@ -0,0 +1,176 @@ +{ + "type": "File", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "errors": [ + "SyntaxError: Assigning to 'arguments' in strict mode (1:32)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 32, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 44 + } + }, + "expression": { + "type": "UpdateExpression", + "start": 32, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "operator": "--", + "prefix": false, + "argument": { + "type": "Identifier", + "start": 32, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 41 + }, + "identifierName": "arguments" + }, + "name": "arguments" + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 18, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 18, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0199/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0199/options.json deleted file mode 100644 index 439ffff53e89..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0199/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:41)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0199/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0199/output.json new file mode 100644 index 000000000000..35af060b7c6e --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0199/output.json @@ -0,0 +1,179 @@ +{ + "type": "File", + "start": 0, + "end": 53, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 53 + } + }, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:41)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 53, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 53 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 53, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 53 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 53, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 53 + } + }, + "body": [ + { + "type": "FunctionDeclaration", + "start": 32, + "end": 51, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 51 + } + }, + "id": { + "type": "Identifier", + "start": 41, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 41 + }, + "end": { + "line": 1, + "column": 45 + }, + "identifierName": "eval" + }, + "name": "eval" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 48, + "end": 51, + "loc": { + "start": { + "line": 1, + "column": 48 + }, + "end": { + "line": 1, + "column": 51 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 18, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 18, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0200/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0200/options.json deleted file mode 100644 index ad15b27f9b9a..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0200/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'arguments' in strict mode (1:41)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0200/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0200/output.json new file mode 100644 index 000000000000..7419ba446dc9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0200/output.json @@ -0,0 +1,179 @@ +{ + "type": "File", + "start": 0, + "end": 58, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 58 + } + }, + "errors": [ + "SyntaxError: Binding 'arguments' in strict mode (1:41)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 58, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 58 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 58, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 58 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 58, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 58 + } + }, + "body": [ + { + "type": "FunctionDeclaration", + "start": 32, + "end": 56, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 56 + } + }, + "id": { + "type": "Identifier", + "start": 41, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 41 + }, + "end": { + "line": 1, + "column": 50 + }, + "identifierName": "arguments" + }, + "name": "arguments" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 53, + "end": 56, + "loc": { + "start": { + "line": 1, + "column": 53 + }, + "end": { + "line": 1, + "column": 56 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 18, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 18, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0201/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0201/options.json deleted file mode 100644 index 1eb91299eb1b..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0201/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:9)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0201/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0201/output.json new file mode 100644 index 000000000000..ede15490b692 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0201/output.json @@ -0,0 +1,126 @@ +{ + "type": "File", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 13 + }, + "identifierName": "eval" + }, + "name": "eval" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 16, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 17, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 17, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0202/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0202/options.json deleted file mode 100644 index c903c1205ce8..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0202/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'arguments' in strict mode (1:9)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0202/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0202/output.json new file mode 100644 index 000000000000..aeccd1a07ed9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0202/output.json @@ -0,0 +1,126 @@ +{ + "type": "File", + "start": 0, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "errors": [ + "SyntaxError: Binding 'arguments' in strict mode (1:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 18 + }, + "identifierName": "arguments" + }, + "name": "arguments" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 21, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 22, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 22, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0203/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0203/options.json deleted file mode 100644 index 884ab94e3403..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0203/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:42)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0203/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0203/output.json new file mode 100644 index 000000000000..4e8af9c85d04 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0203/output.json @@ -0,0 +1,214 @@ +{ + "type": "File", + "start": 0, + "end": 57, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 57 + } + }, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:42)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 57, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 57 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 57, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 57 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 57, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 57 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 32, + "end": 55, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 55 + } + }, + "expression": { + "type": "CallExpression", + "start": 33, + "end": 54, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 54 + } + }, + "callee": { + "type": "FunctionExpression", + "start": 33, + "end": 52, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 52 + } + }, + "id": { + "type": "Identifier", + "start": 42, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 42 + }, + "end": { + "line": 1, + "column": 46 + }, + "identifierName": "eval" + }, + "name": "eval" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 49, + "end": 52, + "loc": { + "start": { + "line": 1, + "column": 49 + }, + "end": { + "line": 1, + "column": 52 + } + }, + "body": [], + "directives": [] + } + }, + "arguments": [], + "extra": { + "parenthesized": true, + "parenStart": 32 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 18, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 18, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0204/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0204/options.json deleted file mode 100644 index 58a98e4ca953..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0204/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'arguments' in strict mode (1:42)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0204/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0204/output.json new file mode 100644 index 000000000000..49a2e0086f28 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0204/output.json @@ -0,0 +1,214 @@ +{ + "type": "File", + "start": 0, + "end": 62, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 62 + } + }, + "errors": [ + "SyntaxError: Binding 'arguments' in strict mode (1:42)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 62, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 62 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 62, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 62 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 62, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 62 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 32, + "end": 60, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 60 + } + }, + "expression": { + "type": "CallExpression", + "start": 33, + "end": 59, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 59 + } + }, + "callee": { + "type": "FunctionExpression", + "start": 33, + "end": 57, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 57 + } + }, + "id": { + "type": "Identifier", + "start": 42, + "end": 51, + "loc": { + "start": { + "line": 1, + "column": 42 + }, + "end": { + "line": 1, + "column": 51 + }, + "identifierName": "arguments" + }, + "name": "arguments" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 54, + "end": 57, + "loc": { + "start": { + "line": 1, + "column": 54 + }, + "end": { + "line": 1, + "column": 57 + } + }, + "body": [], + "directives": [] + } + }, + "arguments": [], + "extra": { + "parenthesized": true, + "parenStart": 32 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 18, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 18, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0205/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0205/options.json deleted file mode 100644 index aa44c4aafa4d..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0205/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0205/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0205/output.json new file mode 100644 index 000000000000..6d1387258a3e --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0205/output.json @@ -0,0 +1,161 @@ +{ + "type": "File", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "expression": { + "type": "CallExpression", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "callee": { + "type": "FunctionExpression", + "start": 1, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "id": { + "type": "Identifier", + "start": 10, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "eval" + }, + "name": "eval" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 18, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 18, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + }, + "extra": { + "parenthesized": true, + "parenStart": 0 + } + }, + "arguments": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0206/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0206/options.json deleted file mode 100644 index 59ccf8eb8209..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0206/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'arguments' in strict mode (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0206/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0206/output.json new file mode 100644 index 000000000000..d3b5c3628386 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0206/output.json @@ -0,0 +1,161 @@ +{ + "type": "File", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "errors": [ + "SyntaxError: Binding 'arguments' in strict mode (1:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "expression": { + "type": "CallExpression", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "callee": { + "type": "FunctionExpression", + "start": 1, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "id": { + "type": "Identifier", + "start": 10, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 19 + }, + "identifierName": "arguments" + }, + "name": "arguments" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 22, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 23, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 23, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + }, + "extra": { + "parenthesized": true, + "parenStart": 0 + } + }, + "arguments": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0207/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0207/options.json deleted file mode 100644 index e95a2d7f7535..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0207/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:47)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0207/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0207/output.json new file mode 100644 index 000000000000..d0eb8e29b2a1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0207/output.json @@ -0,0 +1,250 @@ +{ + "type": "File", + "start": 0, + "end": 63, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 63 + } + }, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:47)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 63, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 63 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 63, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 63 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 63, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 63 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 32, + "end": 61, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 61 + } + }, + "expression": { + "type": "ObjectExpression", + "start": 33, + "end": 59, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 59 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 35, + "end": 57, + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 57 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 35, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 36 + }, + "identifierName": "s" + }, + "name": "s" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "FunctionExpression", + "start": 38, + "end": 57, + "loc": { + "start": { + "line": 1, + "column": 38 + }, + "end": { + "line": 1, + "column": 57 + } + }, + "id": { + "type": "Identifier", + "start": 47, + "end": 51, + "loc": { + "start": { + "line": 1, + "column": 47 + }, + "end": { + "line": 1, + "column": 51 + }, + "identifierName": "eval" + }, + "name": "eval" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 54, + "end": 57, + "loc": { + "start": { + "line": 1, + "column": 54 + }, + "end": { + "line": 1, + "column": 57 + } + }, + "body": [], + "directives": [] + } + } + } + ], + "extra": { + "parenthesized": true, + "parenStart": 32 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 18, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 18, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0208/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0208/options.json deleted file mode 100644 index e29c7aee6091..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0208/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'package' in strict mode (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0208/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0208/output.json new file mode 100644 index 000000000000..d6510094936e --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0208/output.json @@ -0,0 +1,161 @@ +{ + "type": "File", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "errors": [ + "SyntaxError: Binding 'package' in strict mode (1:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "expression": { + "type": "CallExpression", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "callee": { + "type": "FunctionExpression", + "start": 1, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "id": { + "type": "Identifier", + "start": 10, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 17 + }, + "identifierName": "package" + }, + "name": "package" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 20, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 21, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 21, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + }, + "extra": { + "parenthesized": true, + "parenStart": 0 + } + }, + "arguments": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0209/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0209/options.json deleted file mode 100644 index 43dc5662e1e5..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0209/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:48)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0209/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0209/output.json new file mode 100644 index 000000000000..98e096877880 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0209/output.json @@ -0,0 +1,292 @@ +{ + "type": "File", + "start": 0, + "end": 63, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 63 + } + }, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:48)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 63, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 63 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 63, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 63 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 63, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 63 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 32, + "end": 61, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 61 + } + }, + "expression": { + "type": "ObjectExpression", + "start": 33, + "end": 59, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 59 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 35, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 35, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 36 + }, + "identifierName": "i" + }, + "name": "i" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "NumericLiteral", + "start": 38, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 38 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "extra": { + "rawValue": 10, + "raw": "10" + }, + "value": 10 + } + }, + { + "type": "ObjectMethod", + "start": 42, + "end": 57, + "loc": { + "start": { + "line": 1, + "column": 42 + }, + "end": { + "line": 1, + "column": 57 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 46, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 46 + }, + "end": { + "line": 1, + "column": 47 + }, + "identifierName": "s" + }, + "name": "s" + }, + "computed": false, + "kind": "set", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 48, + "end": 52, + "loc": { + "start": { + "line": 1, + "column": 48 + }, + "end": { + "line": 1, + "column": 52 + }, + "identifierName": "eval" + }, + "name": "eval" + } + ], + "body": { + "type": "BlockStatement", + "start": 54, + "end": 57, + "loc": { + "start": { + "line": 1, + "column": 54 + }, + "end": { + "line": 1, + "column": 57 + } + }, + "body": [], + "directives": [] + } + } + ], + "extra": { + "parenthesized": true, + "parenStart": 32 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 18, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 18, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0210/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0210/options.json deleted file mode 100644 index 439ffff53e89..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0210/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:41)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0210/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0210/output.json new file mode 100644 index 000000000000..f974d83f5a98 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0210/output.json @@ -0,0 +1,237 @@ +{ + "type": "File", + "start": 0, + "end": 56, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 56 + } + }, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:41)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 56, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 56 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 56, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 56 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 56, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 56 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 32, + "end": 54, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 54 + } + }, + "expression": { + "type": "ObjectExpression", + "start": 33, + "end": 52, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 52 + } + }, + "properties": [ + { + "type": "ObjectMethod", + "start": 35, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 50 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 39, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 39 + }, + "end": { + "line": 1, + "column": 40 + }, + "identifierName": "s" + }, + "name": "s" + }, + "computed": false, + "kind": "set", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 41, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 41 + }, + "end": { + "line": 1, + "column": 45 + }, + "identifierName": "eval" + }, + "name": "eval" + } + ], + "body": { + "type": "BlockStatement", + "start": 47, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 47 + }, + "end": { + "line": 1, + "column": 50 + } + }, + "body": [], + "directives": [] + } + } + ], + "extra": { + "parenthesized": true, + "parenStart": 32 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 18, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 18, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0211/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0211/options.json deleted file mode 100644 index 8b18a4ec3e5a..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0211/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:49)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0211/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0211/output.json new file mode 100644 index 000000000000..2993cf648835 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0211/output.json @@ -0,0 +1,268 @@ +{ + "type": "File", + "start": 0, + "end": 64, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 64 + } + }, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:49)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 64, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 64 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 64, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 64 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 64, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 64 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 32, + "end": 62, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 62 + } + }, + "expression": { + "type": "ObjectExpression", + "start": 33, + "end": 60, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 60 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 35, + "end": 58, + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 58 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 35, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 36 + }, + "identifierName": "s" + }, + "name": "s" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "FunctionExpression", + "start": 38, + "end": 58, + "loc": { + "start": { + "line": 1, + "column": 38 + }, + "end": { + "line": 1, + "column": 58 + } + }, + "id": { + "type": "Identifier", + "start": 47, + "end": 48, + "loc": { + "start": { + "line": 1, + "column": 47 + }, + "end": { + "line": 1, + "column": 48 + }, + "identifierName": "s" + }, + "name": "s" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 49, + "end": 53, + "loc": { + "start": { + "line": 1, + "column": 49 + }, + "end": { + "line": 1, + "column": 53 + }, + "identifierName": "eval" + }, + "name": "eval" + } + ], + "body": { + "type": "BlockStatement", + "start": 55, + "end": 58, + "loc": { + "start": { + "line": 1, + "column": 55 + }, + "end": { + "line": 1, + "column": 58 + } + }, + "body": [], + "directives": [] + } + } + } + ], + "extra": { + "parenthesized": true, + "parenStart": 32 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 18, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 18, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0212/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0212/options.json deleted file mode 100644 index 794c4864d4e5..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0212/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:15)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0212/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0212/output.json new file mode 100644 index 000000000000..4534376b270a --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0212/output.json @@ -0,0 +1,144 @@ +{ + "type": "File", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:15)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 15, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 19 + }, + "identifierName": "eval" + }, + "name": "eval" + } + ], + "body": { + "type": "BlockStatement", + "start": 21, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 22, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 22, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0213/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0213/options.json deleted file mode 100644 index 212d35fcb5fe..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0213/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'arguments' in strict mode (1:15)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0213/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0213/output.json new file mode 100644 index 000000000000..cb41c2783446 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0213/output.json @@ -0,0 +1,144 @@ +{ + "type": "File", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "errors": [ + "SyntaxError: Binding 'arguments' in strict mode (1:15)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 15, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 24 + }, + "identifierName": "arguments" + }, + "name": "arguments" + } + ], + "body": { + "type": "BlockStatement", + "start": 26, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 27, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 27, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0214/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0214/options.json deleted file mode 100644 index 43dc5662e1e5..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0214/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:48)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0214/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0214/output.json new file mode 100644 index 000000000000..d8df2c1c2d07 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0214/output.json @@ -0,0 +1,197 @@ +{ + "type": "File", + "start": 0, + "end": 58, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 58 + } + }, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:48)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 58, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 58 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 58, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 58 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 58, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 58 + } + }, + "body": [ + { + "type": "FunctionDeclaration", + "start": 33, + "end": 56, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 56 + } + }, + "id": { + "type": "Identifier", + "start": 42, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 42 + }, + "end": { + "line": 1, + "column": 47 + }, + "identifierName": "inner" + }, + "name": "inner" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 48, + "end": 52, + "loc": { + "start": { + "line": 1, + "column": 48 + }, + "end": { + "line": 1, + "column": 52 + }, + "identifierName": "eval" + }, + "name": "eval" + } + ], + "body": { + "type": "BlockStatement", + "start": 54, + "end": 56, + "loc": { + "start": { + "line": 1, + "column": 54 + }, + "end": { + "line": 1, + "column": 56 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 19, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 19, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0215/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0215/options.json deleted file mode 100644 index 8370ba5c765f..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0215/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'arguments' in strict mode (1:48)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0215/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0215/output.json new file mode 100644 index 000000000000..a2fc6cb4db0e --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0215/output.json @@ -0,0 +1,197 @@ +{ + "type": "File", + "start": 0, + "end": 63, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 63 + } + }, + "errors": [ + "SyntaxError: Binding 'arguments' in strict mode (1:48)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 63, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 63 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 63, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 63 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 63, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 63 + } + }, + "body": [ + { + "type": "FunctionDeclaration", + "start": 33, + "end": 61, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 61 + } + }, + "id": { + "type": "Identifier", + "start": 42, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 42 + }, + "end": { + "line": 1, + "column": 47 + }, + "identifierName": "inner" + }, + "name": "inner" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 48, + "end": 57, + "loc": { + "start": { + "line": 1, + "column": 48 + }, + "end": { + "line": 1, + "column": 57 + }, + "identifierName": "arguments" + }, + "name": "arguments" + } + ], + "body": { + "type": "BlockStatement", + "start": 59, + "end": 61, + "loc": { + "start": { + "line": 1, + "column": 59 + }, + "end": { + "line": 1, + "column": 61 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 19, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 19, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0216/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0216/options.json deleted file mode 100644 index 61a5834b639e..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0216/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Octal literal in strict mode (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0216/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0216/output.json new file mode 100644 index 000000000000..48c8fda845ba --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0216/output.json @@ -0,0 +1,108 @@ +{ + "type": "File", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "errors": [ + "SyntaxError: Octal literal in strict mode (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "value": "\\1", + "extra": { + "raw": "\"\\1\"", + "rawValue": "\\1" + } + } + }, + { + "type": "Directive", + "start": 6, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 6, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0217/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0217/options.json deleted file mode 100644 index ae2bfab55c68..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0217/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Octal literal in strict mode (1:35)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0217/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0217/output.json new file mode 100644 index 000000000000..1504ace4ac5d --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0217/output.json @@ -0,0 +1,162 @@ +{ + "type": "File", + "start": 0, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "errors": [ + "SyntaxError: Octal literal in strict mode (1:35)", + "SyntaxError: Octal literal in strict mode (1:35)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 19, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 19, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + }, + { + "type": "Directive", + "start": 33, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 33, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "value": "\\1", + "extra": { + "raw": "\"\\1\"", + "rawValue": "\\1" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0218/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0218/options.json deleted file mode 100644 index 45ca229c1e8e..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0218/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Legacy octal literals are not allowed in strict mode (1:33)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0218/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0218/output.json new file mode 100644 index 000000000000..805c176e7856 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0218/output.json @@ -0,0 +1,163 @@ +{ + "type": "File", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "errors": [ + "SyntaxError: Legacy octal literals are not allowed in strict mode (1:33)", + "SyntaxError: Legacy octal literals are not allowed in strict mode (1:33)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 33, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 33, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "extra": { + "rawValue": 17, + "raw": "021" + }, + "value": 17 + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 19, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 19, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0219/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0219/options.json deleted file mode 100644 index 7e50b5f9165e..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0219/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Octal literal in strict mode (1:38)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0219/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0219/output.json new file mode 100644 index 000000000000..f73cb42cd9cf --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0219/output.json @@ -0,0 +1,221 @@ +{ + "type": "File", + "start": 0, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 50 + } + }, + "errors": [ + "SyntaxError: Octal literal in strict mode (1:38)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 50 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 50 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 50 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 33, + "end": 48, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 48 + } + }, + "expression": { + "type": "ObjectExpression", + "start": 34, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 36, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 44 + } + }, + "method": false, + "key": { + "type": "StringLiteral", + "start": 36, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "extra": { + "rawValue": "\u0001", + "raw": "\"\\1\"" + }, + "value": "\u0001" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "NumericLiteral", + "start": 42, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 42 + }, + "end": { + "line": 1, + "column": 44 + } + }, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + ], + "extra": { + "parenthesized": true, + "parenStart": 33 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 19, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 19, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0220/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0220/options.json deleted file mode 100644 index 8f6c8218f747..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0220/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Legacy octal literals are not allowed in strict mode (1:36)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0220/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0220/output.json new file mode 100644 index 000000000000..5eb3bcef0b18 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0220/output.json @@ -0,0 +1,221 @@ +{ + "type": "File", + "start": 0, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 49 + } + }, + "errors": [ + "SyntaxError: Legacy octal literals are not allowed in strict mode (1:36)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 49 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 49 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 49 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 33, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 47 + } + }, + "expression": { + "type": "ObjectExpression", + "start": 34, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 45 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 36, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "method": false, + "key": { + "type": "NumericLiteral", + "start": 36, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "extra": { + "rawValue": 17, + "raw": "021" + }, + "value": 17 + }, + "computed": false, + "shorthand": false, + "value": { + "type": "NumericLiteral", + "start": 41, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 41 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + ], + "extra": { + "parenthesized": true, + "parenStart": 33 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 19, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 19, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": "use strict", + "extra": { + "raw": "'use strict'", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0221/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0221/options.json deleted file mode 100644 index d094fe0284b1..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0221/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Octal literal in strict mode (1:36)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0221/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0221/output.json new file mode 100644 index 000000000000..374201e48c95 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0221/output.json @@ -0,0 +1,161 @@ +{ + "type": "File", + "start": 0, + "end": 55, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 55 + } + }, + "errors": [ + "SyntaxError: Octal literal in strict mode (1:36)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 55, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 55 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 55, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 55 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 55, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 55 + } + }, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 19, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 19, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "value": "octal directive\\1", + "extra": { + "raw": "\"octal directive\\1\"", + "rawValue": "octal directive\\1" + } + } + }, + { + "type": "Directive", + "start": 40, + "end": 53, + "loc": { + "start": { + "line": 1, + "column": 40 + }, + "end": { + "line": 1, + "column": 53 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 40, + "end": 52, + "loc": { + "start": { + "line": 1, + "column": 40 + }, + "end": { + "line": 1, + "column": 52 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0222/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0222/options.json deleted file mode 100644 index d094fe0284b1..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0222/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Octal literal in strict mode (1:36)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0222/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0222/output.json new file mode 100644 index 000000000000..1c7a53167a1c --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0222/output.json @@ -0,0 +1,197 @@ +{ + "type": "File", + "start": 0, + "end": 76, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 76 + } + }, + "errors": [ + "SyntaxError: Octal literal in strict mode (1:36)", + "SyntaxError: Octal literal in strict mode (1:57)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 76, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 76 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 76, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 76 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 76, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 76 + } + }, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 19, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 19, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "value": "octal directive\\1", + "extra": { + "raw": "\"octal directive\\1\"", + "rawValue": "octal directive\\1" + } + } + }, + { + "type": "Directive", + "start": 40, + "end": 60, + "loc": { + "start": { + "line": 1, + "column": 40 + }, + "end": { + "line": 1, + "column": 60 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 40, + "end": 59, + "loc": { + "start": { + "line": 1, + "column": 40 + }, + "end": { + "line": 1, + "column": 59 + } + }, + "value": "octal directive\\2", + "extra": { + "raw": "\"octal directive\\2\"", + "rawValue": "octal directive\\2" + } + } + }, + { + "type": "Directive", + "start": 61, + "end": 74, + "loc": { + "start": { + "line": 1, + "column": 61 + }, + "end": { + "line": 1, + "column": 74 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 61, + "end": 73, + "loc": { + "start": { + "line": 1, + "column": 61 + }, + "end": { + "line": 1, + "column": 73 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0223/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0223/options.json deleted file mode 100644 index 8389b2c726ca..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0223/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Octal literal in strict mode (1:69)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0223/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0223/output.json new file mode 100644 index 000000000000..e52fa38ccf73 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0223/output.json @@ -0,0 +1,215 @@ +{ + "type": "File", + "start": 0, + "end": 76, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 76 + } + }, + "errors": [ + "SyntaxError: Octal literal in strict mode (1:69)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 76, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 76 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 76, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 76 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 76, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 76 + } + }, + "body": [ + { + "type": "FunctionDeclaration", + "start": 33, + "end": 74, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 74 + } + }, + "id": { + "type": "Identifier", + "start": 42, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 42 + }, + "end": { + "line": 1, + "column": 47 + }, + "identifierName": "inner" + }, + "name": "inner" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 50, + "end": 74, + "loc": { + "start": { + "line": 1, + "column": 50 + }, + "end": { + "line": 1, + "column": 74 + } + }, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 52, + "end": 72, + "loc": { + "start": { + "line": 1, + "column": 52 + }, + "end": { + "line": 1, + "column": 72 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 52, + "end": 71, + "loc": { + "start": { + "line": 1, + "column": 52 + }, + "end": { + "line": 1, + "column": 71 + } + }, + "value": "octal directive\\1", + "extra": { + "raw": "\"octal directive\\1\"", + "rawValue": "octal directive\\1" + } + } + } + ] + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 19, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 19, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0224/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0224/options.json deleted file mode 100644 index 0641de45e29a..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0224/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected reserved word 'implements' (1:37)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0224/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0224/output.json new file mode 100644 index 000000000000..2201ea3de8c6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0224/output.json @@ -0,0 +1,178 @@ +{ + "type": "File", + "start": 0, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 50 + } + }, + "errors": [ + "SyntaxError: Unexpected reserved word 'implements' (1:37)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 50 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 50 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 50 + } + }, + "body": [ + { + "type": "VariableDeclaration", + "start": 33, + "end": 48, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 48 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 37, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 47 + } + }, + "id": { + "type": "Identifier", + "start": 37, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 47 + }, + "identifierName": "implements" + }, + "name": "implements" + }, + "init": null + } + ], + "kind": "var" + } + ], + "directives": [ + { + "type": "Directive", + "start": 19, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 19, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0225/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0225/options.json deleted file mode 100644 index 859238d0423f..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0225/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected reserved word 'interface' (1:37)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0225/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0225/output.json new file mode 100644 index 000000000000..be76deabc7a1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0225/output.json @@ -0,0 +1,178 @@ +{ + "type": "File", + "start": 0, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 49 + } + }, + "errors": [ + "SyntaxError: Unexpected reserved word 'interface' (1:37)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 49 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 49 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 49 + } + }, + "body": [ + { + "type": "VariableDeclaration", + "start": 33, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 47 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 37, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "id": { + "type": "Identifier", + "start": 37, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 46 + }, + "identifierName": "interface" + }, + "name": "interface" + }, + "init": null + } + ], + "kind": "var" + } + ], + "directives": [ + { + "type": "Directive", + "start": 19, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 19, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0226/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0226/options.json deleted file mode 100644 index 344c7075f4bf..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0226/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected reserved word 'package' (1:37)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0226/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0226/output.json new file mode 100644 index 000000000000..414e229fac38 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0226/output.json @@ -0,0 +1,178 @@ +{ + "type": "File", + "start": 0, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 47 + } + }, + "errors": [ + "SyntaxError: Unexpected reserved word 'package' (1:37)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 47 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 47 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 47 + } + }, + "body": [ + { + "type": "VariableDeclaration", + "start": 33, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 45 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 37, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 44 + } + }, + "id": { + "type": "Identifier", + "start": 37, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 44 + }, + "identifierName": "package" + }, + "name": "package" + }, + "init": null + } + ], + "kind": "var" + } + ], + "directives": [ + { + "type": "Directive", + "start": 19, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 19, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0227/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0227/options.json deleted file mode 100644 index 9fb9deaf9cba..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0227/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected reserved word 'private' (1:37)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0227/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0227/output.json new file mode 100644 index 000000000000..32efcd46a632 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0227/output.json @@ -0,0 +1,178 @@ +{ + "type": "File", + "start": 0, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 47 + } + }, + "errors": [ + "SyntaxError: Unexpected reserved word 'private' (1:37)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 47 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 47 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 47 + } + }, + "body": [ + { + "type": "VariableDeclaration", + "start": 33, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 45 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 37, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 44 + } + }, + "id": { + "type": "Identifier", + "start": 37, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 44 + }, + "identifierName": "private" + }, + "name": "private" + }, + "init": null + } + ], + "kind": "var" + } + ], + "directives": [ + { + "type": "Directive", + "start": 19, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 19, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0228/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0228/options.json deleted file mode 100644 index 292fb56f1cf3..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0228/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected reserved word 'protected' (1:37)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0228/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0228/output.json new file mode 100644 index 000000000000..e3d3f255c253 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0228/output.json @@ -0,0 +1,178 @@ +{ + "type": "File", + "start": 0, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 49 + } + }, + "errors": [ + "SyntaxError: Unexpected reserved word 'protected' (1:37)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 49 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 49 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 49 + } + }, + "body": [ + { + "type": "VariableDeclaration", + "start": 33, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 47 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 37, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "id": { + "type": "Identifier", + "start": 37, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 46 + }, + "identifierName": "protected" + }, + "name": "protected" + }, + "init": null + } + ], + "kind": "var" + } + ], + "directives": [ + { + "type": "Directive", + "start": 19, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 19, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0229/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0229/options.json deleted file mode 100644 index d5f48446906a..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0229/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected reserved word 'public' (1:37)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0229/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0229/output.json new file mode 100644 index 000000000000..2e801038c78d --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0229/output.json @@ -0,0 +1,178 @@ +{ + "type": "File", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "errors": [ + "SyntaxError: Unexpected reserved word 'public' (1:37)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "body": [ + { + "type": "VariableDeclaration", + "start": 33, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 44 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 37, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "id": { + "type": "Identifier", + "start": 37, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 43 + }, + "identifierName": "public" + }, + "name": "public" + }, + "init": null + } + ], + "kind": "var" + } + ], + "directives": [ + { + "type": "Directive", + "start": 19, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 19, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0230/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0230/options.json deleted file mode 100644 index 0f41ff2e6f24..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0230/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected reserved word 'static' (1:37)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0230/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0230/output.json new file mode 100644 index 000000000000..4ed420518d6d --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0230/output.json @@ -0,0 +1,178 @@ +{ + "type": "File", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "errors": [ + "SyntaxError: Unexpected reserved word 'static' (1:37)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "body": [ + { + "type": "VariableDeclaration", + "start": 33, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 44 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 37, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "id": { + "type": "Identifier", + "start": 37, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 43 + }, + "identifierName": "static" + }, + "name": "static" + }, + "init": null + } + ], + "kind": "var" + } + ], + "directives": [ + { + "type": "Directive", + "start": 19, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 19, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0231/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0231/options.json deleted file mode 100644 index 6ab197f35dc9..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0231/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected reserved word 'yield' (1:37)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0231/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0231/output.json new file mode 100644 index 000000000000..55dc17f91beb --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0231/output.json @@ -0,0 +1,178 @@ +{ + "type": "File", + "start": 0, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 45 + } + }, + "errors": [ + "SyntaxError: Unexpected reserved word 'yield' (1:37)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 45 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 45 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 45 + } + }, + "body": [ + { + "type": "VariableDeclaration", + "start": 33, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 37, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 42 + } + }, + "id": { + "type": "Identifier", + "start": 37, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 42 + }, + "identifierName": "yield" + }, + "name": "yield" + }, + "init": null + } + ], + "kind": "var" + } + ], + "directives": [ + { + "type": "Directive", + "start": 19, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 19, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0232/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0232/options.json deleted file mode 100644 index d2f3cbc2e116..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0232/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected reserved word 'let' (1:37)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0232/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0232/output.json new file mode 100644 index 000000000000..3b946aeb3223 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0232/output.json @@ -0,0 +1,178 @@ +{ + "type": "File", + "start": 0, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "errors": [ + "SyntaxError: Unexpected reserved word 'let' (1:37)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "body": [ + { + "type": "VariableDeclaration", + "start": 33, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 37, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "id": { + "type": "Identifier", + "start": 37, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 40 + }, + "identifierName": "let" + }, + "name": "let" + }, + "init": null + } + ], + "kind": "var" + } + ], + "directives": [ + { + "type": "Directive", + "start": 19, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 19, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0233/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0233/options.json deleted file mode 100644 index 78c799ec6a49..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0233/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'static' in strict mode (1:15)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0233/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0233/output.json new file mode 100644 index 000000000000..ab669586dc27 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0233/output.json @@ -0,0 +1,144 @@ +{ + "type": "File", + "start": 0, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "errors": [ + "SyntaxError: Binding 'static' in strict mode (1:15)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "hello" + }, + "name": "hello" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 15, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 21 + }, + "identifierName": "static" + }, + "name": "static" + } + ], + "body": { + "type": "BlockStatement", + "start": 23, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 25, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 25, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0234/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0234/options.json deleted file mode 100644 index d4a2d92e5b45..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0234/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'static' in strict mode (1:9)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0234/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0234/output.json new file mode 100644 index 000000000000..be76a2099b54 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0234/output.json @@ -0,0 +1,126 @@ +{ + "type": "File", + "start": 0, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "errors": [ + "SyntaxError: Binding 'static' in strict mode (1:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 15 + }, + "identifierName": "static" + }, + "name": "static" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 18, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 20, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 20, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0235/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0235/options.json deleted file mode 100644 index 1eb91299eb1b..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0235/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:9)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0235/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0235/output.json new file mode 100644 index 000000000000..df217b6af2bc --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0235/output.json @@ -0,0 +1,144 @@ +{ + "type": "File", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 13 + }, + "identifierName": "eval" + }, + "name": "eval" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 14, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + }, + "identifierName": "a" + }, + "name": "a" + } + ], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 19, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 19, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0236/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0236/options.json deleted file mode 100644 index c903c1205ce8..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0236/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'arguments' in strict mode (1:9)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0236/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0236/output.json new file mode 100644 index 000000000000..0de7c6ba2ac0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0236/output.json @@ -0,0 +1,144 @@ +{ + "type": "File", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "errors": [ + "SyntaxError: Binding 'arguments' in strict mode (1:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 18 + }, + "identifierName": "arguments" + }, + "name": "arguments" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 19, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + }, + "identifierName": "a" + }, + "name": "a" + } + ], + "body": { + "type": "BlockStatement", + "start": 22, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 24, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 24, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0239/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0239/options.json deleted file mode 100644 index 91bc36d3f360..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0239/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected reserved word 'static' (1:23)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0239/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0239/output.json new file mode 100644 index 000000000000..c249f39209bf --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0239/output.json @@ -0,0 +1,126 @@ +{ + "type": "File", + "start": 0, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "errors": [ + "SyntaxError: Unexpected reserved word 'static' (1:23)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 14, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "id": { + "type": "Identifier", + "start": 23, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 29 + }, + "identifierName": "static" + }, + "name": "static" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 32, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0240/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0240/options.json deleted file mode 100644 index 8b20b9a7df36..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0240/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Argument name clash (1:14)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0240/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0240/output.json new file mode 100644 index 000000000000..f945eeb57491 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0240/output.json @@ -0,0 +1,161 @@ +{ + "type": "File", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "errors": [ + "SyntaxError: Argument name clash (1:14)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "a" + }, + "name": "a" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 11, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "t" + }, + "name": "t" + }, + { + "type": "Identifier", + "start": 14, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + }, + "identifierName": "t" + }, + "name": "t" + } + ], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 19, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 19, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0241/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0241/options.json deleted file mode 100644 index 85fd3822f433..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0241/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:11)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0241/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0241/output.json new file mode 100644 index 000000000000..f2ff5d38de33 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0241/output.json @@ -0,0 +1,144 @@ +{ + "type": "File", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:11)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "a" + }, + "name": "a" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 11, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 15 + }, + "identifierName": "eval" + }, + "name": "eval" + } + ], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 19, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 19, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0242/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0242/options.json deleted file mode 100644 index 604b5896c2c5..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0242/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'package' in strict mode (1:11)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0242/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0242/output.json new file mode 100644 index 000000000000..2f734055a47a --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0242/output.json @@ -0,0 +1,144 @@ +{ + "type": "File", + "start": 0, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "errors": [ + "SyntaxError: Binding 'package' in strict mode (1:11)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "a" + }, + "name": "a" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 11, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 18 + }, + "identifierName": "package" + }, + "name": "package" + } + ], + "body": { + "type": "BlockStatement", + "start": 20, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 22, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 22, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0243/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0243/options.json deleted file mode 100644 index 9d2a58081596..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0243/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Argument name clash (1:43)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0243/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0243/output.json new file mode 100644 index 000000000000..60ac3ce8c98c --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0243/output.json @@ -0,0 +1,229 @@ +{ + "type": "File", + "start": 0, + "end": 52, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 52 + } + }, + "errors": [ + "SyntaxError: Argument name clash (1:43)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 52, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 52 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 52, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 52 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "a" + }, + "name": "a" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 13, + "end": 52, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 52 + } + }, + "body": [ + { + "type": "FunctionDeclaration", + "start": 29, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 49 + } + }, + "id": { + "type": "Identifier", + "start": 38, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 38 + }, + "end": { + "line": 1, + "column": 39 + }, + "identifierName": "b" + }, + "name": "b" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 40, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 40 + }, + "end": { + "line": 1, + "column": 41 + }, + "identifierName": "t" + }, + "name": "t" + }, + { + "type": "Identifier", + "start": 43, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 43 + }, + "end": { + "line": 1, + "column": 44 + }, + "identifierName": "t" + }, + "name": "t" + } + ], + "body": { + "type": "BlockStatement", + "start": 46, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 46 + }, + "end": { + "line": 1, + "column": 49 + } + }, + "body": [], + "directives": [] + } + }, + { + "type": "EmptyStatement", + "start": 49, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 49 + }, + "end": { + "line": 1, + "column": 50 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 15, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 15, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0244/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0244/options.json deleted file mode 100644 index 61c3bbb5abe0..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0244/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Argument name clash (1:15)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0244/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0244/output.json new file mode 100644 index 000000000000..766ec14c5a33 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0244/output.json @@ -0,0 +1,180 @@ +{ + "type": "File", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "errors": [ + "SyntaxError: Argument name clash (1:15)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "expression": { + "type": "FunctionExpression", + "start": 1, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "id": { + "type": "Identifier", + "start": 10, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + }, + "identifierName": "a" + }, + "name": "a" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 12, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + }, + "identifierName": "t" + }, + "name": "t" + }, + { + "type": "Identifier", + "start": 15, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + }, + "identifierName": "t" + }, + "name": "t" + } + ], + "body": { + "type": "BlockStatement", + "start": 18, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 20, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 20, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + }, + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0245/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0245/options.json deleted file mode 100644 index ae469fbd59da..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0245/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Argument name clash (1:44)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0245/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0245/output.json new file mode 100644 index 000000000000..0f2e3c5dce01 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0245/output.json @@ -0,0 +1,233 @@ +{ + "type": "File", + "start": 0, + "end": 54, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 54 + } + }, + "errors": [ + "SyntaxError: Argument name clash (1:44)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 54, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 54 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 54, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 54 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "a" + }, + "name": "a" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 13, + "end": 54, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 54 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 29, + "end": 52, + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 52 + } + }, + "expression": { + "type": "FunctionExpression", + "start": 30, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 50 + } + }, + "id": { + "type": "Identifier", + "start": 39, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 39 + }, + "end": { + "line": 1, + "column": 40 + }, + "identifierName": "b" + }, + "name": "b" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 41, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 41 + }, + "end": { + "line": 1, + "column": 42 + }, + "identifierName": "t" + }, + "name": "t" + }, + { + "type": "Identifier", + "start": 44, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 44 + }, + "end": { + "line": 1, + "column": 45 + }, + "identifierName": "t" + }, + "name": "t" + } + ], + "body": { + "type": "BlockStatement", + "start": 47, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 47 + }, + "end": { + "line": 1, + "column": 50 + } + }, + "body": [], + "directives": [] + }, + "extra": { + "parenthesized": true, + "parenStart": 29 + } + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 15, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 15, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0246/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0246/options.json deleted file mode 100644 index b60957f217a4..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0246/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'eval' in strict mode (1:12)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0246/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0246/output.json new file mode 100644 index 000000000000..7945e482ca86 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0246/output.json @@ -0,0 +1,163 @@ +{ + "type": "File", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "errors": [ + "SyntaxError: Binding 'eval' in strict mode (1:12)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "expression": { + "type": "FunctionExpression", + "start": 1, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "id": { + "type": "Identifier", + "start": 10, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + }, + "identifierName": "a" + }, + "name": "a" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 12, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 16 + }, + "identifierName": "eval" + }, + "name": "eval" + } + ], + "body": { + "type": "BlockStatement", + "start": 18, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 20, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 20, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + }, + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0247/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0247/options.json deleted file mode 100644 index 62075401e782..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0247/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Binding 'package' in strict mode (1:12)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0247/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0247/output.json new file mode 100644 index 000000000000..304b4237e9e7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0247/output.json @@ -0,0 +1,163 @@ +{ + "type": "File", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "errors": [ + "SyntaxError: Binding 'package' in strict mode (1:12)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "expression": { + "type": "FunctionExpression", + "start": 1, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "id": { + "type": "Identifier", + "start": 10, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + }, + "identifierName": "a" + }, + "name": "a" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 12, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 19 + }, + "identifierName": "package" + }, + "name": "package" + } + ], + "body": { + "type": "BlockStatement", + "start": 21, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 23, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 23, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + }, + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0248/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0248/options.json deleted file mode 100644 index cb5abd9f7401..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0248/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Label '__proto__' is already declared (1:11)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0248/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0248/output.json new file mode 100644 index 000000000000..2b1e638019cc --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0248/output.json @@ -0,0 +1,137 @@ +{ + "type": "File", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "errors": [ + "SyntaxError: Label '__proto__' is already declared (1:11)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "LabeledStatement", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "body": { + "type": "LabeledStatement", + "start": 11, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "body": { + "type": "ExpressionStatement", + "start": 22, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 22, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + }, + "label": { + "type": "Identifier", + "start": 11, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 20 + }, + "identifierName": "__proto__" + }, + "name": "__proto__" + } + }, + "label": { + "type": "Identifier", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + }, + "identifierName": "__proto__" + }, + "name": "__proto__" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0249/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0249/options.json deleted file mode 100644 index 505798d5a203..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0249/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Argument name clash (1:36)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0249/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0249/output.json new file mode 100644 index 000000000000..45d9e76d63b8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0249/output.json @@ -0,0 +1,161 @@ +{ + "type": "File", + "start": 0, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 50 + } + }, + "errors": [ + "SyntaxError: Argument name clash (1:36)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 50 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 14, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 50 + } + }, + "id": { + "type": "Identifier", + "start": 23, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + }, + "identifierName": "t" + }, + "name": "t" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 25, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 34 + }, + "identifierName": "__proto__" + }, + "name": "__proto__" + }, + { + "type": "Identifier", + "start": 36, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 45 + }, + "identifierName": "__proto__" + }, + "name": "__proto__" + } + ], + "body": { + "type": "BlockStatement", + "start": 47, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 47 + }, + "end": { + "line": 1, + "column": 50 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": "use strict", + "extra": { + "raw": "\"use strict\"", + "rawValue": "use strict" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0250/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0250/options.json deleted file mode 100644 index 8e9b9f585996..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0250/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Redefinition of __proto__ property (1:21)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0250/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0250/output.json new file mode 100644 index 000000000000..6c9cf3db90bb --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0250/output.json @@ -0,0 +1,213 @@ +{ + "type": "File", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "errors": [ + "SyntaxError: Redefinition of __proto__ property (1:21)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "operator": "=", + "left": { + "type": "Identifier", + "start": 0, + "end": 1, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + }, + "identifierName": "x" + }, + "name": "x" + }, + "right": { + "type": "ObjectExpression", + "start": 4, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 6, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 6, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 15 + }, + "identifierName": "__proto__" + }, + "name": "__proto__" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "NumericLiteral", + "start": 17, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + }, + { + "type": "ObjectProperty", + "start": 21, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 21, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 30 + }, + "identifierName": "__proto__" + }, + "name": "__proto__" + }, + "computed": false, + "shorthand": false, + "value": { + "type": "NumericLiteral", + "start": 32, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "extra": { + "rawValue": 43, + "raw": "43" + }, + "value": 43 + } + } + ] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0270/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0270/options.json deleted file mode 100644 index 8df109cb3c33..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0270/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Classes may not have static property named prototype (1:16)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0270/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0270/output.json new file mode 100644 index 000000000000..3c3b792e5b9b --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0270/output.json @@ -0,0 +1,144 @@ +{ + "type": "File", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "errors": [ + "SyntaxError: Classes may not have static property named prototype (1:16)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "body": [ + { + "type": "ClassMethod", + "start": 9, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "static": true, + "key": { + "type": "Identifier", + "start": 16, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 25 + }, + "identifierName": "prototype" + }, + "name": "prototype" + }, + "computed": false, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 27, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0271/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0271/options.json deleted file mode 100644 index 8df109cb3c33..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0271/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Classes may not have static property named prototype (1:16)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0271/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0271/output.json new file mode 100644 index 000000000000..0c00e7e06841 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0271/output.json @@ -0,0 +1,147 @@ +{ + "type": "File", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "errors": [ + "SyntaxError: Classes may not have static property named prototype (1:16)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "body": [ + { + "type": "ClassMethod", + "start": 9, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "static": true, + "key": { + "type": "StringLiteral", + "start": 16, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "extra": { + "rawValue": "prototype", + "raw": "\"prototype\"" + }, + "value": "prototype" + }, + "computed": false, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 29, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0272/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0272/options.json deleted file mode 100644 index f4b1d256a4ab..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0272/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Constructor can't have get/set modifier (1:13)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0272/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0272/output.json new file mode 100644 index 000000000000..d583a2ec1119 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0272/output.json @@ -0,0 +1,144 @@ +{ + "type": "File", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "errors": [ + "SyntaxError: Constructor can't have get/set modifier (1:13)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "body": [ + { + "type": "ClassMethod", + "start": 9, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "static": false, + "key": { + "type": "Identifier", + "start": 13, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 24 + }, + "identifierName": "constructor" + }, + "name": "constructor" + }, + "computed": false, + "kind": "get", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 26, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0273/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0273/options.json deleted file mode 100644 index f4b1d256a4ab..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0273/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Constructor can't have get/set modifier (1:13)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0273/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0273/output.json new file mode 100644 index 000000000000..532d8ebe70a8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0273/output.json @@ -0,0 +1,162 @@ +{ + "type": "File", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "errors": [ + "SyntaxError: Constructor can't have get/set modifier (1:13)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "body": [ + { + "type": "ClassMethod", + "start": 9, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "static": false, + "key": { + "type": "Identifier", + "start": 13, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 24 + }, + "identifierName": "constructor" + }, + "name": "constructor" + }, + "computed": false, + "kind": "set", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 25, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + }, + "identifierName": "m" + }, + "name": "m" + } + ], + "body": { + "type": "BlockStatement", + "start": 27, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0274/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0274/options.json deleted file mode 100644 index 4d892adceff9..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0274/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Duplicate constructor in the same class (1:25)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0274/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0274/output.json new file mode 100644 index 000000000000..4337adcf6eb6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0274/output.json @@ -0,0 +1,203 @@ +{ + "type": "File", + "start": 0, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "errors": [ + "SyntaxError: Duplicate constructor in the same class (1:25)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "body": [ + { + "type": "ClassMethod", + "start": 9, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "static": false, + "key": { + "type": "Identifier", + "start": 9, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 20 + }, + "identifierName": "constructor" + }, + "name": "constructor" + }, + "computed": false, + "kind": "constructor", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 22, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "body": [], + "directives": [] + } + }, + { + "type": "ClassMethod", + "start": 25, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 42 + } + }, + "static": false, + "key": { + "type": "StringLiteral", + "start": 25, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "extra": { + "rawValue": "constructor", + "raw": "\"constructor\"" + }, + "value": "constructor" + }, + "computed": false, + "kind": "constructor", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 40, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 40 + }, + "end": { + "line": 1, + "column": 42 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0277/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0277/options.json deleted file mode 100644 index aef7f56007e9..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0277/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected reserved word 'enum' (1:11)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0277/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0277/output.json new file mode 100644 index 000000000000..df10adea166e --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0277/output.json @@ -0,0 +1,162 @@ +{ + "type": "File", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "errors": [ + "SyntaxError: Unexpected reserved word 'enum' (1:11)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "body": [ + { + "type": "ClassMethod", + "start": 9, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "static": false, + "key": { + "type": "Identifier", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "a" + }, + "name": "a" + }, + "computed": false, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 11, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 15 + }, + "identifierName": "enum" + }, + "name": "enum" + } + ], + "body": { + "type": "BlockStatement", + "start": 16, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0278/options.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0278/options.json deleted file mode 100644 index 757b207f0ef2..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0278/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected reserved word 'static' (1:17)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0278/output.json b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0278/output.json new file mode 100644 index 000000000000..275b0d3ee35a --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/invalid-syntax/migrated_0278/output.json @@ -0,0 +1,144 @@ +{ + "type": "File", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "errors": [ + "SyntaxError: Unexpected reserved word 'static' (1:17)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "body": [ + { + "type": "ClassMethod", + "start": 9, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "static": true, + "computed": true, + "key": { + "type": "Identifier", + "start": 17, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 23 + }, + "identifierName": "static" + }, + "name": "static" + }, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 26, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/rest-parameter/invalid-setter-rest/options.json b/packages/babel-parser/test/fixtures/esprima/rest-parameter/invalid-setter-rest/options.json deleted file mode 100644 index 0006fbf98e5c..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/rest-parameter/invalid-setter-rest/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "setter function argument must not be a rest parameter (1:6)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/rest-parameter/invalid-setter-rest/output.json b/packages/babel-parser/test/fixtures/esprima/rest-parameter/invalid-setter-rest/output.json new file mode 100644 index 000000000000..30ec6b3832e2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/rest-parameter/invalid-setter-rest/output.json @@ -0,0 +1,192 @@ +{ + "type": "File", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "errors": [ + "SyntaxError: setter function argument must not be a rest parameter (1:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "operator": "=", + "left": { + "type": "Identifier", + "start": 0, + "end": 1, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + }, + "identifierName": "x" + }, + "name": "x" + }, + "right": { + "type": "ObjectExpression", + "start": 4, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "properties": [ + { + "type": "ObjectMethod", + "start": 6, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "method": false, + "key": { + "type": "Identifier", + "start": 10, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + }, + "identifierName": "f" + }, + "name": "f" + }, + "computed": false, + "kind": "set", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "RestElement", + "start": 12, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "argument": { + "type": "Identifier", + "start": 15, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + }, + "identifierName": "y" + }, + "name": "y" + } + } + ], + "body": { + "type": "BlockStatement", + "start": 18, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/statement-expression/migrated_0002/options.json b/packages/babel-parser/test/fixtures/esprima/statement-expression/migrated_0002/options.json deleted file mode 100644 index 381fd12ce2d0..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/statement-expression/migrated_0002/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Expecting Unicode escape sequence \\uXXXX (1:1)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/statement-expression/migrated_0002/output.json b/packages/babel-parser/test/fixtures/esprima/statement-expression/migrated_0002/output.json new file mode 100644 index 000000000000..e418d699ca2c --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/statement-expression/migrated_0002/output.json @@ -0,0 +1,70 @@ +{ + "type": "File", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "errors": [ + "SyntaxError: Expecting Unicode escape sequence \\uXXXX (1:1)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "expression": { + "type": "Identifier", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "\\a" + }, + "name": "\\a" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/statement-expression/migrated_0003/options.json b/packages/babel-parser/test/fixtures/esprima/statement-expression/migrated_0003/options.json deleted file mode 100644 index 18c53b997b56..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/statement-expression/migrated_0003/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Expecting Unicode escape sequence \\uXXXX (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/statement-expression/migrated_0003/output.json b/packages/babel-parser/test/fixtures/esprima/statement-expression/migrated_0003/output.json new file mode 100644 index 000000000000..6f022e5637c6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/statement-expression/migrated_0003/output.json @@ -0,0 +1,70 @@ +{ + "type": "File", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "errors": [ + "SyntaxError: Expecting Unicode escape sequence \\uXXXX (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "expression": { + "type": "Identifier", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + }, + "identifierName": "aa\\a" + }, + "name": "aa\\a" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/statement-expression/migrated_0004/options.json b/packages/babel-parser/test/fixtures/esprima/statement-expression/migrated_0004/options.json deleted file mode 100644 index 381fd12ce2d0..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/statement-expression/migrated_0004/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Expecting Unicode escape sequence \\uXXXX (1:1)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/statement-expression/migrated_0004/output.json b/packages/babel-parser/test/fixtures/esprima/statement-expression/migrated_0004/output.json new file mode 100644 index 000000000000..c0f511826127 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/statement-expression/migrated_0004/output.json @@ -0,0 +1,70 @@ +{ + "type": "File", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "errors": [ + "SyntaxError: Expecting Unicode escape sequence \\uXXXX (1:1)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "expression": { + "type": "Identifier", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + }, + "identifierName": "\\aa" + }, + "name": "\\aa" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/statement-expression/migrated_0005/options.json b/packages/babel-parser/test/fixtures/esprima/statement-expression/migrated_0005/options.json deleted file mode 100644 index 381fd12ce2d0..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/statement-expression/migrated_0005/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Expecting Unicode escape sequence \\uXXXX (1:1)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/statement-expression/migrated_0005/output.json b/packages/babel-parser/test/fixtures/esprima/statement-expression/migrated_0005/output.json new file mode 100644 index 000000000000..c0f511826127 --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/statement-expression/migrated_0005/output.json @@ -0,0 +1,70 @@ +{ + "type": "File", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "errors": [ + "SyntaxError: Expecting Unicode escape sequence \\uXXXX (1:1)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "expression": { + "type": "Identifier", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + }, + "identifierName": "\\aa" + }, + "name": "\\aa" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/esprima/statement-variable/complex-pattern-requires-init/options.json b/packages/babel-parser/test/fixtures/esprima/statement-variable/complex-pattern-requires-init/options.json deleted file mode 100644 index 57893e4eee56..000000000000 --- a/packages/babel-parser/test/fixtures/esprima/statement-variable/complex-pattern-requires-init/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Complex binding patterns require an initialization value (1:6)" -} diff --git a/packages/babel-parser/test/fixtures/esprima/statement-variable/complex-pattern-requires-init/output.json b/packages/babel-parser/test/fixtures/esprima/statement-variable/complex-pattern-requires-init/output.json new file mode 100644 index 000000000000..8c9fa87e494e --- /dev/null +++ b/packages/babel-parser/test/fixtures/esprima/statement-variable/complex-pattern-requires-init/output.json @@ -0,0 +1,88 @@ +{ + "type": "File", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "errors": [ + "SyntaxError: Complex binding patterns require an initialization value (1:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "id": { + "type": "ArrayPattern", + "start": 4, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "elements": [] + }, + "init": null + } + ], + "kind": "var" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/bigint/invalid-decimal/options.json b/packages/babel-parser/test/fixtures/experimental/bigint/invalid-decimal/options.json deleted file mode 100644 index a1fd77a3341e..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/bigint/invalid-decimal/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid BigIntLiteral (1:0)" } diff --git a/packages/babel-parser/test/fixtures/experimental/bigint/invalid-decimal/output.json b/packages/babel-parser/test/fixtures/experimental/bigint/invalid-decimal/output.json new file mode 100644 index 000000000000..26cbd0245288 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/bigint/invalid-decimal/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "errors": [ + "SyntaxError: Invalid BigIntLiteral (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "expression": { + "type": "BigIntLiteral", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "extra": { + "rawValue": "1.0", + "raw": "1.0n" + }, + "value": "1.0" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/bigint/invalid-e/options.json b/packages/babel-parser/test/fixtures/experimental/bigint/invalid-e/options.json deleted file mode 100644 index a1fd77a3341e..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/bigint/invalid-e/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid BigIntLiteral (1:0)" } diff --git a/packages/babel-parser/test/fixtures/experimental/bigint/invalid-e/output.json b/packages/babel-parser/test/fixtures/experimental/bigint/invalid-e/output.json new file mode 100644 index 000000000000..527c53215960 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/bigint/invalid-e/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "errors": [ + "SyntaxError: Invalid BigIntLiteral (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "expression": { + "type": "BigIntLiteral", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "extra": { + "rawValue": "2e9", + "raw": "2e9n" + }, + "value": "2e9" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/bigint/invalid-non-octal-decimal-int/options.json b/packages/babel-parser/test/fixtures/experimental/bigint/invalid-non-octal-decimal-int/options.json index a1fd77a3341e..8078d8f00dad 100644 --- a/packages/babel-parser/test/fixtures/experimental/bigint/invalid-non-octal-decimal-int/options.json +++ b/packages/babel-parser/test/fixtures/experimental/bigint/invalid-non-octal-decimal-int/options.json @@ -1 +1,5 @@ -{ "throws": "Invalid BigIntLiteral (1:0)" } +{ + "plugins": [ + "bigInt" + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/bigint/invalid-non-octal-decimal-int/output.json b/packages/babel-parser/test/fixtures/experimental/bigint/invalid-non-octal-decimal-int/output.json new file mode 100644 index 000000000000..86220085cd71 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/bigint/invalid-non-octal-decimal-int/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "errors": [ + "SyntaxError: Invalid BigIntLiteral (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "expression": { + "type": "BigIntLiteral", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "extra": { + "rawValue": "089", + "raw": "089n" + }, + "value": "089" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/bigint/invalid-octal-legacy/options.json b/packages/babel-parser/test/fixtures/experimental/bigint/invalid-octal-legacy/options.json deleted file mode 100644 index a1fd77a3341e..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/bigint/invalid-octal-legacy/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid BigIntLiteral (1:0)" } diff --git a/packages/babel-parser/test/fixtures/experimental/bigint/invalid-octal-legacy/output.json b/packages/babel-parser/test/fixtures/experimental/bigint/invalid-octal-legacy/output.json new file mode 100644 index 000000000000..baa4133652f9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/bigint/invalid-octal-legacy/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "errors": [ + "SyntaxError: Invalid BigIntLiteral (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "expression": { + "type": "BigIntLiteral", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "extra": { + "rawValue": "016432", + "raw": "016432n" + }, + "value": "016432" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-methods/failure-name-constructor/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-methods/failure-name-constructor/options.json index d702f4db972b..a6ccef275874 100644 --- a/packages/babel-parser/test/fixtures/experimental/class-private-methods/failure-name-constructor/options.json +++ b/packages/babel-parser/test/fixtures/experimental/class-private-methods/failure-name-constructor/options.json @@ -1,4 +1,5 @@ { - "throws": "Classes may not have a private field named '#constructor' (2:2)", - "plugins": ["classPrivateMethods"] -} + "plugins": [ + "classPrivateMethods" + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-methods/failure-name-constructor/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-methods/failure-name-constructor/output.json new file mode 100644 index 000000000000..342fc174b592 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-methods/failure-name-constructor/output.json @@ -0,0 +1,158 @@ +{ + "type": "File", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Classes may not have a private field named '#constructor' (2:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + }, + "identifierName": "Foo" + }, + "name": "Foo" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 10, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ClassPrivateMethod", + "start": 14, + "end": 31, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "static": false, + "key": { + "type": "PrivateName", + "start": 14, + "end": 26, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "id": { + "type": "Identifier", + "start": 15, + "end": 26, + "loc": { + "start": { + "line": 2, + "column": 3 + }, + "end": { + "line": 2, + "column": 14 + }, + "identifierName": "constructor" + }, + "name": "constructor" + } + }, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 29, + "end": 31, + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-methods/failure-spaces/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-methods/failure-spaces/options.json index 9914950b66fe..8d265ec66c23 100644 --- a/packages/babel-parser/test/fixtures/experimental/class-private-methods/failure-spaces/options.json +++ b/packages/babel-parser/test/fixtures/experimental/class-private-methods/failure-spaces/options.json @@ -1,4 +1,3 @@ { - "throws": "Unexpected space between # and identifier (2:3)", "plugins": ["classPrivateMethods"] } diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-methods/failure-spaces/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-methods/failure-spaces/output.json new file mode 100644 index 000000000000..e126bf7fb5fb --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-methods/failure-spaces/output.json @@ -0,0 +1,207 @@ +{ + "type": "File", + "start": 0, + "end": 60, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Unexpected space between # and identifier (2:3)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 60, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 60, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "Spaces" + }, + "name": "Spaces" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 13, + "end": 60, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "body": [ + { + "type": "ClassPrivateMethod", + "start": 17, + "end": 58, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 4, + "column": 3 + } + }, + "static": false, + "key": { + "type": "PrivateName", + "start": 17, + "end": 31, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "id": { + "type": "Identifier", + "start": 20, + "end": 31, + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 16 + }, + "identifierName": "wrongSpaces" + }, + "name": "wrongSpaces" + } + }, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 34, + "end": 58, + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 4, + "column": 3 + } + }, + "body": [ + { + "type": "ReturnStatement", + "start": 40, + "end": 54, + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 18 + } + }, + "argument": { + "type": "CallExpression", + "start": 47, + "end": 53, + "loc": { + "start": { + "line": 3, + "column": 11 + }, + "end": { + "line": 3, + "column": 17 + } + }, + "callee": { + "type": "Identifier", + "start": 47, + "end": 51, + "loc": { + "start": { + "line": 3, + "column": 11 + }, + "end": { + "line": 3, + "column": 15 + }, + "identifierName": "fail" + }, + "name": "fail" + }, + "arguments": [] + } + } + ], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-properties/failure-delete-private-property/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-properties/failure-delete-private-property/options.json index e9f18e93d1d5..1ca5069a3a2f 100644 --- a/packages/babel-parser/test/fixtures/experimental/class-private-properties/failure-delete-private-property/options.json +++ b/packages/babel-parser/test/fixtures/experimental/class-private-properties/failure-delete-private-property/options.json @@ -1,4 +1,5 @@ { - "throws": "Deleting a private field is not allowed (4:4)", - "plugins": ["classPrivateProperties"] -} + "plugins": [ + "classPrivateProperties" + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-properties/failure-delete-private-property/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-properties/failure-delete-private-property/output.json new file mode 100644 index 000000000000..1f5d18e55096 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-properties/failure-delete-private-property/output.json @@ -0,0 +1,289 @@ +{ + "type": "File", + "start": 0, + "end": 61, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 6, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Deleting a private field is not allowed (4:4)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 61, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 6, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 61, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 6, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + }, + "identifierName": "Foo" + }, + "name": "Foo" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 10, + "end": 61, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 6, + "column": 1 + } + }, + "body": [ + { + "type": "ClassPrivateProperty", + "start": 14, + "end": 17, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 5 + } + }, + "static": false, + "key": { + "type": "PrivateName", + "start": 14, + "end": 16, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 4 + } + }, + "id": { + "type": "Identifier", + "start": 15, + "end": 16, + "loc": { + "start": { + "line": 2, + "column": 3 + }, + "end": { + "line": 2, + "column": 4 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "value": null + }, + { + "type": "ClassMethod", + "start": 20, + "end": 59, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 5, + "column": 3 + } + }, + "static": false, + "key": { + "type": "Identifier", + "start": 20, + "end": 31, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 13 + }, + "identifierName": "constructor" + }, + "name": "constructor" + }, + "computed": false, + "kind": "constructor", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 34, + "end": 59, + "loc": { + "start": { + "line": 3, + "column": 16 + }, + "end": { + "line": 5, + "column": 3 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 40, + "end": 55, + "loc": { + "start": { + "line": 4, + "column": 4 + }, + "end": { + "line": 4, + "column": 19 + } + }, + "expression": { + "type": "UnaryExpression", + "start": 40, + "end": 54, + "loc": { + "start": { + "line": 4, + "column": 4 + }, + "end": { + "line": 4, + "column": 18 + } + }, + "operator": "delete", + "prefix": true, + "argument": { + "type": "MemberExpression", + "start": 47, + "end": 54, + "loc": { + "start": { + "line": 4, + "column": 11 + }, + "end": { + "line": 4, + "column": 18 + } + }, + "object": { + "type": "ThisExpression", + "start": 47, + "end": 51, + "loc": { + "start": { + "line": 4, + "column": 11 + }, + "end": { + "line": 4, + "column": 15 + } + } + }, + "property": { + "type": "PrivateName", + "start": 52, + "end": 54, + "loc": { + "start": { + "line": 4, + "column": 16 + }, + "end": { + "line": 4, + "column": 18 + } + }, + "id": { + "type": "Identifier", + "start": 53, + "end": 54, + "loc": { + "start": { + "line": 4, + "column": 17 + }, + "end": { + "line": 4, + "column": 18 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "computed": false + } + } + } + ], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-properties/failure-name-constructor/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-properties/failure-name-constructor/options.json index 51343aac3b23..1ca5069a3a2f 100644 --- a/packages/babel-parser/test/fixtures/experimental/class-private-properties/failure-name-constructor/options.json +++ b/packages/babel-parser/test/fixtures/experimental/class-private-properties/failure-name-constructor/options.json @@ -1,4 +1,5 @@ { - "throws": "Classes may not have a private field named '#constructor' (2:2)", - "plugins": ["classPrivateProperties"] -} + "plugins": [ + "classPrivateProperties" + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-properties/failure-name-constructor/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-properties/failure-name-constructor/output.json new file mode 100644 index 000000000000..1f4da38f9f9f --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-properties/failure-name-constructor/output.json @@ -0,0 +1,137 @@ +{ + "type": "File", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Classes may not have a private field named '#constructor' (2:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + }, + "identifierName": "Foo" + }, + "name": "Foo" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 10, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ClassPrivateProperty", + "start": 14, + "end": 27, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "static": false, + "key": { + "type": "PrivateName", + "start": 14, + "end": 26, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "id": { + "type": "Identifier", + "start": 15, + "end": 26, + "loc": { + "start": { + "line": 2, + "column": 3 + }, + "end": { + "line": 2, + "column": 14 + }, + "identifierName": "constructor" + }, + "name": "constructor" + } + }, + "value": null + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-properties/failure-spaces/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-properties/failure-spaces/options.json index 9914950b66fe..f26e916957c8 100644 --- a/packages/babel-parser/test/fixtures/experimental/class-private-properties/failure-spaces/options.json +++ b/packages/babel-parser/test/fixtures/experimental/class-private-properties/failure-spaces/options.json @@ -1,4 +1,3 @@ { - "throws": "Unexpected space between # and identifier (2:3)", - "plugins": ["classPrivateMethods"] + "plugins": ["classPrivateProperties"] } diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-properties/failure-spaces/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-properties/failure-spaces/output.json new file mode 100644 index 000000000000..34003e4e9209 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-properties/failure-spaces/output.json @@ -0,0 +1,137 @@ +{ + "type": "File", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Unexpected space between # and identifier (2:3)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "Spaces" + }, + "name": "Spaces" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 13, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ClassPrivateProperty", + "start": 17, + "end": 32, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 17 + } + }, + "static": false, + "key": { + "type": "PrivateName", + "start": 17, + "end": 31, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "id": { + "type": "Identifier", + "start": 20, + "end": 31, + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 16 + }, + "identifierName": "wrongSpaces" + }, + "name": "wrongSpaces" + } + }, + "value": null + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-properties/super-call/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-properties/super-call/options.json index 2154c844bfd7..1ca5069a3a2f 100644 --- a/packages/babel-parser/test/fixtures/experimental/class-private-properties/super-call/options.json +++ b/packages/babel-parser/test/fixtures/experimental/class-private-properties/super-call/options.json @@ -1,4 +1,5 @@ { - "plugins": ["classPrivateProperties"], - "throws": "super() is only valid inside a class constructor of a subclass. Maybe a typo in the method name ('constructor') or not extending another class? (4:13)" -} + "plugins": [ + "classPrivateProperties" + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-properties/super-call/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-properties/super-call/output.json new file mode 100644 index 000000000000..26e00894a7a7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-properties/super-call/output.json @@ -0,0 +1,306 @@ +{ + "type": "File", + "start": 0, + "end": 95, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 7, + "column": 1 + } + }, + "errors": [ + "SyntaxError: super() is only valid inside a class constructor of a subclass. Maybe a typo in the method name ('constructor') or not extending another class? (4:13)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 95, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 7, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 95, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 7, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": { + "type": "Identifier", + "start": 16, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + }, + "identifierName": "B" + }, + "name": "B" + }, + "body": { + "type": "ClassBody", + "start": 18, + "end": 95, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 7, + "column": 1 + } + }, + "body": [ + { + "type": "ClassMethod", + "start": 22, + "end": 93, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 6, + "column": 3 + } + }, + "static": false, + "key": { + "type": "Identifier", + "start": 22, + "end": 33, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 13 + }, + "identifierName": "constructor" + }, + "name": "constructor" + }, + "computed": false, + "kind": "constructor", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 36, + "end": 93, + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 6, + "column": 3 + } + }, + "body": [ + { + "type": "ClassDeclaration", + "start": 42, + "end": 89, + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 5, + "column": 5 + } + }, + "id": { + "type": "Identifier", + "start": 48, + "end": 49, + "loc": { + "start": { + "line": 3, + "column": 10 + }, + "end": { + "line": 3, + "column": 11 + }, + "identifierName": "C" + }, + "name": "C" + }, + "superClass": { + "type": "Identifier", + "start": 58, + "end": 59, + "loc": { + "start": { + "line": 3, + "column": 20 + }, + "end": { + "line": 3, + "column": 21 + }, + "identifierName": "D" + }, + "name": "D" + }, + "body": { + "type": "ClassBody", + "start": 60, + "end": 89, + "loc": { + "start": { + "line": 3, + "column": 22 + }, + "end": { + "line": 5, + "column": 5 + } + }, + "body": [ + { + "type": "ClassPrivateProperty", + "start": 68, + "end": 83, + "loc": { + "start": { + "line": 4, + "column": 6 + }, + "end": { + "line": 4, + "column": 21 + } + }, + "static": false, + "key": { + "type": "PrivateName", + "start": 68, + "end": 72, + "loc": { + "start": { + "line": 4, + "column": 6 + }, + "end": { + "line": 4, + "column": 10 + } + }, + "id": { + "type": "Identifier", + "start": 69, + "end": 72, + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 10 + }, + "identifierName": "foo" + }, + "name": "foo" + } + }, + "value": { + "type": "CallExpression", + "start": 75, + "end": 82, + "loc": { + "start": { + "line": 4, + "column": 13 + }, + "end": { + "line": 4, + "column": 20 + } + }, + "callee": { + "type": "Super", + "start": 75, + "end": 80, + "loc": { + "start": { + "line": 4, + "column": 13 + }, + "end": { + "line": 4, + "column": 18 + } + } + }, + "arguments": [] + } + } + ] + } + } + ], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-properties/super-private-member-access/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-properties/super-private-member-access/options.json index 162c282e64a2..1ca5069a3a2f 100644 --- a/packages/babel-parser/test/fixtures/experimental/class-private-properties/super-private-member-access/options.json +++ b/packages/babel-parser/test/fixtures/experimental/class-private-properties/super-private-member-access/options.json @@ -1,6 +1,5 @@ { "plugins": [ "classPrivateProperties" - ], - "throws": "Private fields can't be accessed on super (5:4)" -} + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-properties/super-private-member-access/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-properties/super-private-member-access/output.json new file mode 100644 index 000000000000..bf5051685be7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-properties/super-private-member-access/output.json @@ -0,0 +1,288 @@ +{ + "type": "File", + "start": 0, + "end": 59, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 7, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Private fields can't be accessed on super (5:4)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 59, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 7, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 59, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 7, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": { + "type": "Identifier", + "start": 16, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + }, + "identifierName": "B" + }, + "name": "B" + }, + "body": { + "type": "ClassBody", + "start": 18, + "end": 59, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 7, + "column": 1 + } + }, + "body": [ + { + "type": "ClassPrivateProperty", + "start": 22, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 5 + } + }, + "static": false, + "key": { + "type": "PrivateName", + "start": 22, + "end": 24, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 4 + } + }, + "id": { + "type": "Identifier", + "start": 23, + "end": 24, + "loc": { + "start": { + "line": 2, + "column": 3 + }, + "end": { + "line": 2, + "column": 4 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "value": null + }, + { + "type": "ClassMethod", + "start": 29, + "end": 57, + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 6, + "column": 3 + } + }, + "static": false, + "key": { + "type": "Identifier", + "start": 29, + "end": 35, + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 4, + "column": 8 + }, + "identifierName": "method" + }, + "name": "method" + }, + "computed": false, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 38, + "end": 57, + "loc": { + "start": { + "line": 4, + "column": 11 + }, + "end": { + "line": 6, + "column": 3 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 44, + "end": 53, + "loc": { + "start": { + "line": 5, + "column": 4 + }, + "end": { + "line": 5, + "column": 13 + } + }, + "expression": { + "type": "MemberExpression", + "start": 44, + "end": 52, + "loc": { + "start": { + "line": 5, + "column": 4 + }, + "end": { + "line": 5, + "column": 12 + } + }, + "object": { + "type": "Super", + "start": 44, + "end": 49, + "loc": { + "start": { + "line": 5, + "column": 4 + }, + "end": { + "line": 5, + "column": 9 + } + } + }, + "property": { + "type": "PrivateName", + "start": 50, + "end": 52, + "loc": { + "start": { + "line": 5, + "column": 10 + }, + "end": { + "line": 5, + "column": 12 + } + }, + "id": { + "type": "Identifier", + "start": 51, + "end": 52, + "loc": { + "start": { + "line": 5, + "column": 11 + }, + "end": { + "line": 5, + "column": 12 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "computed": false + } + } + ], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-properties/arguments-in-arrow-function/options.json b/packages/babel-parser/test/fixtures/experimental/class-properties/arguments-in-arrow-function/options.json index a567b19a72cb..7f9944b56296 100644 --- a/packages/babel-parser/test/fixtures/experimental/class-properties/arguments-in-arrow-function/options.json +++ b/packages/babel-parser/test/fixtures/experimental/class-properties/arguments-in-arrow-function/options.json @@ -1,4 +1,5 @@ { - "plugins": ["classProperties"], - "throws": "'arguments' is not allowed in class field initializer (3:16)" -} + "plugins": [ + "classProperties" + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-properties/arguments-in-arrow-function/output.json b/packages/babel-parser/test/fixtures/experimental/class-properties/arguments-in-arrow-function/output.json new file mode 100644 index 000000000000..7cd90e6e9021 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-properties/arguments-in-arrow-function/output.json @@ -0,0 +1,211 @@ +{ + "type": "File", + "start": 0, + "end": 60, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "errors": [ + "SyntaxError: 'arguments' is not allowed in class field initializer (3:16)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 60, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 60, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 11 + }, + "identifierName": "fn" + }, + "name": "fn" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 14, + "end": 60, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "body": [ + { + "type": "ClassDeclaration", + "start": 18, + "end": 58, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 4, + "column": 3 + } + }, + "id": { + "type": "Identifier", + "start": 24, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 9 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 26, + "end": 58, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 4, + "column": 3 + } + }, + "body": [ + { + "type": "ClassProperty", + "start": 32, + "end": 54, + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 26 + } + }, + "static": false, + "key": { + "type": "Identifier", + "start": 32, + "end": 35, + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 7 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "computed": false, + "value": { + "type": "ArrowFunctionExpression", + "start": 38, + "end": 53, + "loc": { + "start": { + "line": 3, + "column": 10 + }, + "end": { + "line": 3, + "column": 25 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "Identifier", + "start": 44, + "end": 53, + "loc": { + "start": { + "line": 3, + "column": 16 + }, + "end": { + "line": 3, + "column": 25 + }, + "identifierName": "arguments" + }, + "name": "arguments" + } + } + } + ] + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-properties/arguments/options.json b/packages/babel-parser/test/fixtures/experimental/class-properties/arguments/options.json index e79a44db0bef..7f9944b56296 100644 --- a/packages/babel-parser/test/fixtures/experimental/class-properties/arguments/options.json +++ b/packages/babel-parser/test/fixtures/experimental/class-properties/arguments/options.json @@ -1,4 +1,5 @@ { - "plugins": ["classProperties"], - "throws": "'arguments' is not allowed in class field initializer (3:10)" -} + "plugins": [ + "classProperties" + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-properties/arguments/output.json b/packages/babel-parser/test/fixtures/experimental/class-properties/arguments/output.json new file mode 100644 index 000000000000..f2522558f086 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-properties/arguments/output.json @@ -0,0 +1,192 @@ +{ + "type": "File", + "start": 0, + "end": 54, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "errors": [ + "SyntaxError: 'arguments' is not allowed in class field initializer (3:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 54, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 54, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 11 + }, + "identifierName": "fn" + }, + "name": "fn" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 14, + "end": 54, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "body": [ + { + "type": "ClassDeclaration", + "start": 18, + "end": 52, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 4, + "column": 3 + } + }, + "id": { + "type": "Identifier", + "start": 24, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 9 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 26, + "end": 52, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 4, + "column": 3 + } + }, + "body": [ + { + "type": "ClassProperty", + "start": 32, + "end": 48, + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 20 + } + }, + "static": false, + "key": { + "type": "Identifier", + "start": 32, + "end": 35, + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 7 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "computed": false, + "value": { + "type": "Identifier", + "start": 38, + "end": 47, + "loc": { + "start": { + "line": 3, + "column": 10 + }, + "end": { + "line": 3, + "column": 19 + }, + "identifierName": "arguments" + }, + "name": "arguments" + } + } + ] + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-properties/new-target-invalid/options.json b/packages/babel-parser/test/fixtures/experimental/class-properties/new-target-invalid/options.json index 8d36a47b9f64..7f9944b56296 100644 --- a/packages/babel-parser/test/fixtures/experimental/class-properties/new-target-invalid/options.json +++ b/packages/babel-parser/test/fixtures/experimental/class-properties/new-target-invalid/options.json @@ -1,4 +1,5 @@ { - "plugins": ["classProperties"], - "throws": "new.target can only be used in functions or class properties (1:8)" -} + "plugins": [ + "classProperties" + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-properties/new-target-invalid/output.json b/packages/babel-parser/test/fixtures/experimental/class-properties/new-target-invalid/output.json new file mode 100644 index 000000000000..a44ee2efc222 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-properties/new-target-invalid/output.json @@ -0,0 +1,137 @@ +{ + "type": "File", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "errors": [ + "SyntaxError: new.target can only be used in functions or class properties (1:8)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "id": { + "type": "Identifier", + "start": 4, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "x" + }, + "name": "x" + }, + "init": { + "type": "MetaProperty", + "start": 8, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "meta": { + "type": "Identifier", + "start": 8, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + }, + "identifierName": "new" + }, + "name": "new" + }, + "property": { + "type": "Identifier", + "start": 12, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 18 + }, + "identifierName": "target" + }, + "name": "target" + } + } + } + ], + "kind": "var" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-properties/no-ctor-2/options.json b/packages/babel-parser/test/fixtures/experimental/class-properties/no-ctor-2/options.json index 5560d1052435..7c697d760098 100644 --- a/packages/babel-parser/test/fixtures/experimental/class-properties/no-ctor-2/options.json +++ b/packages/babel-parser/test/fixtures/experimental/class-properties/no-ctor-2/options.json @@ -1,4 +1,5 @@ { - "throws": "Classes may not have a field named 'constructor' (2:2)", - "plugins": ["classProperties"] + "plugins": [ + "classProperties" + ] } diff --git a/packages/babel-parser/test/fixtures/experimental/class-properties/no-ctor-2/output.json b/packages/babel-parser/test/fixtures/experimental/class-properties/no-ctor-2/output.json new file mode 100644 index 000000000000..0678d1917926 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-properties/no-ctor-2/output.json @@ -0,0 +1,179 @@ +{ + "type": "File", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Classes may not have a field named 'constructor' (2:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + }, + "identifierName": "Foo" + }, + "name": "Foo" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 10, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "ClassProperty", + "start": 14, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 13 + } + }, + "static": false, + "key": { + "type": "Identifier", + "start": 14, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 13 + }, + "identifierName": "constructor" + }, + "name": "constructor" + }, + "computed": false, + "value": null + }, + { + "type": "ClassMethod", + "start": 28, + "end": 34, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 8 + } + }, + "static": false, + "kind": "method", + "key": { + "type": "Identifier", + "start": 29, + "end": 30, + "loc": { + "start": { + "line": 3, + "column": 3 + }, + "end": { + "line": 3, + "column": 4 + }, + "identifierName": "x" + }, + "name": "x" + }, + "computed": false, + "id": null, + "generator": true, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 32, + "end": 34, + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 8 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-properties/no-ctor/options.json b/packages/babel-parser/test/fixtures/experimental/class-properties/no-ctor/options.json index 5560d1052435..7c697d760098 100644 --- a/packages/babel-parser/test/fixtures/experimental/class-properties/no-ctor/options.json +++ b/packages/babel-parser/test/fixtures/experimental/class-properties/no-ctor/options.json @@ -1,4 +1,5 @@ { - "throws": "Classes may not have a field named 'constructor' (2:2)", - "plugins": ["classProperties"] + "plugins": [ + "classProperties" + ] } diff --git a/packages/babel-parser/test/fixtures/experimental/class-properties/no-ctor/output.json b/packages/babel-parser/test/fixtures/experimental/class-properties/no-ctor/output.json new file mode 100644 index 000000000000..2a969d61e76e --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-properties/no-ctor/output.json @@ -0,0 +1,123 @@ +{ + "type": "File", + "start": 0, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Classes may not have a field named 'constructor' (2:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + }, + "identifierName": "Foo" + }, + "name": "Foo" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 10, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ClassProperty", + "start": 14, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 13 + } + }, + "static": false, + "key": { + "type": "Identifier", + "start": 14, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 13 + }, + "identifierName": "constructor" + }, + "name": "constructor" + }, + "computed": false, + "value": null + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-properties/no-static-prototype-2/options.json b/packages/babel-parser/test/fixtures/experimental/class-properties/no-static-prototype-2/options.json index 5bde2716ebdd..7f9944b56296 100644 --- a/packages/babel-parser/test/fixtures/experimental/class-properties/no-static-prototype-2/options.json +++ b/packages/babel-parser/test/fixtures/experimental/class-properties/no-static-prototype-2/options.json @@ -1,4 +1,5 @@ { - "throws": "Classes may not have static property named prototype (2:9)", - "plugins": ["classProperties"] -} + "plugins": [ + "classProperties" + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-properties/no-static-prototype-2/output.json b/packages/babel-parser/test/fixtures/experimental/class-properties/no-static-prototype-2/output.json new file mode 100644 index 000000000000..975df8dd8199 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-properties/no-static-prototype-2/output.json @@ -0,0 +1,179 @@ +{ + "type": "File", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Classes may not have static property named prototype (2:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + }, + "identifierName": "Foo" + }, + "name": "Foo" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 10, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "ClassProperty", + "start": 14, + "end": 30, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "static": true, + "key": { + "type": "Identifier", + "start": 21, + "end": 30, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 18 + }, + "identifierName": "prototype" + }, + "name": "prototype" + }, + "computed": false, + "value": null + }, + { + "type": "ClassMethod", + "start": 33, + "end": 39, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 8 + } + }, + "static": false, + "kind": "method", + "key": { + "type": "Identifier", + "start": 34, + "end": 35, + "loc": { + "start": { + "line": 3, + "column": 3 + }, + "end": { + "line": 3, + "column": 4 + }, + "identifierName": "x" + }, + "name": "x" + }, + "computed": false, + "id": null, + "generator": true, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 37, + "end": 39, + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 8 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-properties/no-static-prototype/options.json b/packages/babel-parser/test/fixtures/experimental/class-properties/no-static-prototype/options.json index 5bde2716ebdd..7f9944b56296 100644 --- a/packages/babel-parser/test/fixtures/experimental/class-properties/no-static-prototype/options.json +++ b/packages/babel-parser/test/fixtures/experimental/class-properties/no-static-prototype/options.json @@ -1,4 +1,5 @@ { - "throws": "Classes may not have static property named prototype (2:9)", - "plugins": ["classProperties"] -} + "plugins": [ + "classProperties" + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-properties/no-static-prototype/output.json b/packages/babel-parser/test/fixtures/experimental/class-properties/no-static-prototype/output.json new file mode 100644 index 000000000000..fb3005664209 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-properties/no-static-prototype/output.json @@ -0,0 +1,123 @@ +{ + "type": "File", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Classes may not have static property named prototype (2:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + }, + "identifierName": "Foo" + }, + "name": "Foo" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 10, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ClassProperty", + "start": 14, + "end": 30, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "static": true, + "key": { + "type": "Identifier", + "start": 21, + "end": 30, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 18 + }, + "identifierName": "prototype" + }, + "name": "prototype" + }, + "computed": false, + "value": null + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-properties/static-field-named-constructor/options.json b/packages/babel-parser/test/fixtures/experimental/class-properties/static-field-named-constructor/options.json index 36858dc626ae..7f9944b56296 100644 --- a/packages/babel-parser/test/fixtures/experimental/class-properties/static-field-named-constructor/options.json +++ b/packages/babel-parser/test/fixtures/experimental/class-properties/static-field-named-constructor/options.json @@ -1,4 +1,5 @@ { - "throws": "Classes may not have a field named 'constructor' (2:11)", - "plugins": ["classProperties"] -} + "plugins": [ + "classProperties" + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-properties/static-field-named-constructor/output.json b/packages/babel-parser/test/fixtures/experimental/class-properties/static-field-named-constructor/output.json new file mode 100644 index 000000000000..74fd91c747c5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-properties/static-field-named-constructor/output.json @@ -0,0 +1,123 @@ +{ + "type": "File", + "start": 0, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Classes may not have a field named 'constructor' (2:11)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + }, + "identifierName": "Foo" + }, + "name": "Foo" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 10, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ClassProperty", + "start": 16, + "end": 35, + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 23 + } + }, + "static": true, + "key": { + "type": "Identifier", + "start": 23, + "end": 34, + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 22 + }, + "identifierName": "constructor" + }, + "name": "constructor" + }, + "computed": false, + "value": null + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-properties/super-call/options.json b/packages/babel-parser/test/fixtures/experimental/class-properties/super-call/options.json index e8d509e27740..7f9944b56296 100644 --- a/packages/babel-parser/test/fixtures/experimental/class-properties/super-call/options.json +++ b/packages/babel-parser/test/fixtures/experimental/class-properties/super-call/options.json @@ -1,4 +1,5 @@ { - "plugins": ["classProperties"], - "throws": "super() is only valid inside a class constructor of a subclass. Maybe a typo in the method name ('constructor') or not extending another class? (4:12)" -} + "plugins": [ + "classProperties" + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-properties/super-call/output.json b/packages/babel-parser/test/fixtures/experimental/class-properties/super-call/output.json new file mode 100644 index 000000000000..987d1eef5055 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-properties/super-call/output.json @@ -0,0 +1,292 @@ +{ + "type": "File", + "start": 0, + "end": 94, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 7, + "column": 1 + } + }, + "errors": [ + "SyntaxError: super() is only valid inside a class constructor of a subclass. Maybe a typo in the method name ('constructor') or not extending another class? (4:12)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 94, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 7, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 94, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 7, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": { + "type": "Identifier", + "start": 16, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + }, + "identifierName": "B" + }, + "name": "B" + }, + "body": { + "type": "ClassBody", + "start": 18, + "end": 94, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 7, + "column": 1 + } + }, + "body": [ + { + "type": "ClassMethod", + "start": 22, + "end": 92, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 6, + "column": 3 + } + }, + "static": false, + "key": { + "type": "Identifier", + "start": 22, + "end": 33, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 13 + }, + "identifierName": "constructor" + }, + "name": "constructor" + }, + "computed": false, + "kind": "constructor", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 36, + "end": 92, + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 6, + "column": 3 + } + }, + "body": [ + { + "type": "ClassDeclaration", + "start": 42, + "end": 88, + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 5, + "column": 5 + } + }, + "id": { + "type": "Identifier", + "start": 48, + "end": 49, + "loc": { + "start": { + "line": 3, + "column": 10 + }, + "end": { + "line": 3, + "column": 11 + }, + "identifierName": "C" + }, + "name": "C" + }, + "superClass": { + "type": "Identifier", + "start": 58, + "end": 59, + "loc": { + "start": { + "line": 3, + "column": 20 + }, + "end": { + "line": 3, + "column": 21 + }, + "identifierName": "D" + }, + "name": "D" + }, + "body": { + "type": "ClassBody", + "start": 60, + "end": 88, + "loc": { + "start": { + "line": 3, + "column": 22 + }, + "end": { + "line": 5, + "column": 5 + } + }, + "body": [ + { + "type": "ClassProperty", + "start": 68, + "end": 82, + "loc": { + "start": { + "line": 4, + "column": 6 + }, + "end": { + "line": 4, + "column": 20 + } + }, + "static": false, + "key": { + "type": "Identifier", + "start": 68, + "end": 71, + "loc": { + "start": { + "line": 4, + "column": 6 + }, + "end": { + "line": 4, + "column": 9 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "computed": false, + "value": { + "type": "CallExpression", + "start": 74, + "end": 81, + "loc": { + "start": { + "line": 4, + "column": 12 + }, + "end": { + "line": 4, + "column": 19 + } + }, + "callee": { + "type": "Super", + "start": 74, + "end": 79, + "loc": { + "start": { + "line": 4, + "column": 12 + }, + "end": { + "line": 4, + "column": 17 + } + } + }, + "arguments": [] + } + } + ] + } + } + ], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-properties/super-inside-function/options.json b/packages/babel-parser/test/fixtures/experimental/class-properties/super-inside-function/options.json index 386c2968e7b0..7f9944b56296 100644 --- a/packages/babel-parser/test/fixtures/experimental/class-properties/super-inside-function/options.json +++ b/packages/babel-parser/test/fixtures/experimental/class-properties/super-inside-function/options.json @@ -1,4 +1,5 @@ { - "plugins": ["classProperties"], - "throws": "super is only allowed in object methods and classes (3:4)" -} + "plugins": [ + "classProperties" + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-properties/super-inside-function/output.json b/packages/babel-parser/test/fixtures/experimental/class-properties/super-inside-function/output.json new file mode 100644 index 000000000000..b129c88406f6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-properties/super-inside-function/output.json @@ -0,0 +1,254 @@ +{ + "type": "File", + "start": 0, + "end": 54, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "errors": [ + "SyntaxError: super is only allowed in object methods and classes (3:4)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 54, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 54, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 54, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "body": [ + { + "type": "ClassProperty", + "start": 12, + "end": 52, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 4, + "column": 3 + } + }, + "static": false, + "key": { + "type": "Identifier", + "start": 12, + "end": 15, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 5 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "computed": false, + "value": { + "type": "FunctionExpression", + "start": 18, + "end": 52, + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 4, + "column": 3 + } + }, + "id": { + "type": "Identifier", + "start": 27, + "end": 29, + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 19 + }, + "identifierName": "fn" + }, + "name": "fn" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 32, + "end": 52, + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 4, + "column": 3 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 38, + "end": 48, + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 14 + } + }, + "expression": { + "type": "CallExpression", + "start": 38, + "end": 47, + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 13 + } + }, + "callee": { + "type": "MemberExpression", + "start": 38, + "end": 45, + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 11 + } + }, + "object": { + "type": "Super", + "start": 38, + "end": 43, + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 9 + } + } + }, + "property": { + "type": "Identifier", + "start": 44, + "end": 45, + "loc": { + "start": { + "line": 3, + "column": 10 + }, + "end": { + "line": 3, + "column": 11 + }, + "identifierName": "x" + }, + "name": "x" + }, + "computed": false + }, + "arguments": [] + } + } + ], + "directives": [] + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/decorators-2/decoratorsBeforeExport-export-default-decorated-expression-without-parens/options.json b/packages/babel-parser/test/fixtures/experimental/decorators-2/decoratorsBeforeExport-export-default-decorated-expression-without-parens/options.json index 39592e4eb294..70c2c7a17676 100644 --- a/packages/babel-parser/test/fixtures/experimental/decorators-2/decoratorsBeforeExport-export-default-decorated-expression-without-parens/options.json +++ b/packages/babel-parser/test/fixtures/experimental/decorators-2/decoratorsBeforeExport-export-default-decorated-expression-without-parens/options.json @@ -1,5 +1,11 @@ { - "sourceType": "module", - "plugins": [["decorators", { "decoratorsBeforeExport": true }]], - "throws": "Decorators must be placed *before* the 'export' keyword. You can set the 'decoratorsBeforeExport' option to false to use the 'export @decorator class {}' syntax (1:15)" -} + "plugins": [ + [ + "decorators", + { + "decoratorsBeforeExport": true + } + ] + ], + "sourceType": "module" +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/decorators-2/decoratorsBeforeExport-export-default-decorated-expression-without-parens/output.json b/packages/babel-parser/test/fixtures/experimental/decorators-2/decoratorsBeforeExport-export-default-decorated-expression-without-parens/output.json new file mode 100644 index 000000000000..2ac3ce6a5954 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/decorators-2/decoratorsBeforeExport-export-default-decorated-expression-without-parens/output.json @@ -0,0 +1,136 @@ +{ + "type": "File", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "errors": [ + "SyntaxError: Decorators must be placed *before* the 'export' keyword. You can set the 'decoratorsBeforeExport' option to false to use the 'export @decorator class {}' syntax (1:15)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportDefaultDeclaration", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "declaration": { + "type": "ClassDeclaration", + "start": 15, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "decorators": [ + { + "type": "Decorator", + "start": 15, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "expression": { + "type": "Identifier", + "start": 16, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 25 + }, + "identifierName": "decorator" + }, + "name": "decorator" + } + } + ], + "id": { + "type": "Identifier", + "start": 32, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 35 + }, + "identifierName": "Foo" + }, + "name": "Foo" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 36, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "body": [] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/decorators-2/no-class-method-parameter/options.json b/packages/babel-parser/test/fixtures/experimental/decorators-2/no-class-method-parameter/options.json deleted file mode 100644 index 7b4e6dc626ae..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/decorators-2/no-class-method-parameter/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Stage 2 decorators cannot be used to decorate parameters (2:14)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/decorators-2/no-class-method-parameter/output.json b/packages/babel-parser/test/fixtures/experimental/decorators-2/no-class-method-parameter/output.json new file mode 100644 index 000000000000..9f8814a38f61 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/decorators-2/no-class-method-parameter/output.json @@ -0,0 +1,196 @@ +{ + "type": "File", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Stage 2 decorators cannot be used to decorate parameters (2:14)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + }, + "identifierName": "Foo" + }, + "name": "Foo" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 10, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ClassMethod", + "start": 14, + "end": 36, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 24 + } + }, + "static": false, + "key": { + "type": "Identifier", + "start": 14, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 13 + }, + "identifierName": "constructor" + }, + "name": "constructor" + }, + "computed": false, + "kind": "constructor", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 31, + "end": 32, + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 20 + }, + "identifierName": "x" + }, + "name": "x", + "decorators": [ + { + "type": "Decorator", + "start": 26, + "end": 30, + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "expression": { + "type": "Identifier", + "start": 27, + "end": 30, + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 18 + }, + "identifierName": "foo" + }, + "name": "foo" + } + } + ] + } + ], + "body": { + "type": "BlockStatement", + "start": 34, + "end": 36, + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 24 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/decorators-2/no-constructor-decorators/options.json b/packages/babel-parser/test/fixtures/experimental/decorators-2/no-constructor-decorators/options.json deleted file mode 100644 index a26ed7cacb84..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/decorators-2/no-constructor-decorators/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "You can't attach decorators to a class constructor (2:2)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/decorators-2/no-constructor-decorators/output.json b/packages/babel-parser/test/fixtures/experimental/decorators-2/no-constructor-decorators/output.json new file mode 100644 index 000000000000..084e74570676 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/decorators-2/no-constructor-decorators/output.json @@ -0,0 +1,178 @@ +{ + "type": "File", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Decorators can't be used with a constructor. Did you mean '@dec class { ... }'? (2:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + }, + "identifierName": "Foo" + }, + "name": "Foo" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 10, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "ClassMethod", + "start": 14, + "end": 36, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 3, + "column": 17 + } + }, + "decorators": [ + { + "type": "Decorator", + "start": 14, + "end": 18, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 6 + } + }, + "expression": { + "type": "Identifier", + "start": 15, + "end": 18, + "loc": { + "start": { + "line": 2, + "column": 3 + }, + "end": { + "line": 2, + "column": 6 + }, + "identifierName": "abc" + }, + "name": "abc" + } + } + ], + "static": false, + "key": { + "type": "Identifier", + "start": 21, + "end": 32, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 13 + }, + "identifierName": "constructor" + }, + "name": "constructor" + }, + "computed": false, + "kind": "constructor", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 34, + "end": 36, + "loc": { + "start": { + "line": 3, + "column": 15 + }, + "end": { + "line": 3, + "column": 17 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/decorators-2/no-export-decorators-on-class/options.json b/packages/babel-parser/test/fixtures/experimental/decorators-2/no-export-decorators-on-class/options.json index cb54fc794402..2104ca43283f 100644 --- a/packages/babel-parser/test/fixtures/experimental/decorators-2/no-export-decorators-on-class/options.json +++ b/packages/babel-parser/test/fixtures/experimental/decorators-2/no-export-decorators-on-class/options.json @@ -1,4 +1,3 @@ { - "sourceType": "module", - "throws": "Using the export keyword between a decorator and a class is not allowed. Please use `export @dec class` instead. (2:0)" + "sourceType": "module" } diff --git a/packages/babel-parser/test/fixtures/experimental/decorators-2/no-export-decorators-on-class/output.json b/packages/babel-parser/test/fixtures/experimental/decorators-2/no-export-decorators-on-class/output.json new file mode 100644 index 000000000000..733e482e120a --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/decorators-2/no-export-decorators-on-class/output.json @@ -0,0 +1,120 @@ +{ + "type": "File", + "start": 0, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 23 + } + }, + "errors": [ + "SyntaxError: Using the export keyword between a decorator and a class is not allowed. Please use `export @dec class` instead. (2:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 23 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExportDefaultDeclaration", + "start": 5, + "end": 28, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 23 + } + }, + "declaration": { + "type": "ClassDeclaration", + "start": 0, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 23 + } + }, + "decorators": [ + { + "type": "Decorator", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "expression": { + "type": "Identifier", + "start": 1, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 4 + }, + "identifierName": "foo" + }, + "name": "foo" + } + } + ], + "id": null, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 26, + "end": 28, + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 23 + } + }, + "body": [] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/decorators-2/no-function-parameters/options.json b/packages/babel-parser/test/fixtures/experimental/decorators-2/no-function-parameters/options.json deleted file mode 100644 index 6637fc7f8345..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/decorators-2/no-function-parameters/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Stage 2 decorators cannot be used to decorate parameters (1:14)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/decorators-2/no-function-parameters/output.json b/packages/babel-parser/test/fixtures/experimental/decorators-2/no-function-parameters/output.json new file mode 100644 index 000000000000..ec6b85a88a6b --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/decorators-2/no-function-parameters/output.json @@ -0,0 +1,142 @@ +{ + "type": "File", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "errors": [ + "SyntaxError: Stage 2 decorators cannot be used to decorate parameters (1:14)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 13 + }, + "identifierName": "func" + }, + "name": "func" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 19, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + }, + "identifierName": "x" + }, + "name": "x", + "decorators": [ + { + "type": "Decorator", + "start": 14, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "expression": { + "type": "Identifier", + "start": 15, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 18 + }, + "identifierName": "foo" + }, + "name": "foo" + } + } + ] + } + ], + "body": { + "type": "BlockStatement", + "start": 22, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/decorators-2/no-object-method-parameters/options.json b/packages/babel-parser/test/fixtures/experimental/decorators-2/no-object-method-parameters/options.json deleted file mode 100644 index b1730696933e..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/decorators-2/no-object-method-parameters/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Stage 2 decorators cannot be used to decorate parameters (2:9)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/decorators-2/no-object-method-parameters/output.json b/packages/babel-parser/test/fixtures/experimental/decorators-2/no-object-method-parameters/output.json new file mode 100644 index 000000000000..2819428d5aef --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/decorators-2/no-object-method-parameters/output.json @@ -0,0 +1,213 @@ +{ + "type": "File", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 2 + } + }, + "errors": [ + "SyntaxError: Stage 2 decorators cannot be used to decorate parameters (2:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 2 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 2 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 4, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "obj" + }, + "name": "obj" + }, + "init": { + "type": "ObjectExpression", + "start": 10, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "properties": [ + { + "type": "ObjectMethod", + "start": 14, + "end": 31, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "method": true, + "key": { + "type": "Identifier", + "start": 14, + "end": 20, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 8 + }, + "identifierName": "method" + }, + "name": "method" + }, + "computed": false, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 26, + "end": 27, + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 15 + }, + "identifierName": "x" + }, + "name": "x", + "decorators": [ + { + "type": "Decorator", + "start": 21, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 13 + } + }, + "expression": { + "type": "Identifier", + "start": 22, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 13 + }, + "identifierName": "foo" + }, + "name": "foo" + } + } + ] + } + ], + "body": { + "type": "BlockStatement", + "start": 29, + "end": 31, + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "kind": "var" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/decorators-2/no-object-methods/options.json b/packages/babel-parser/test/fixtures/experimental/decorators-2/no-object-methods/options.json index 7dd4ed9e2837..69639859c25e 100644 --- a/packages/babel-parser/test/fixtures/experimental/decorators-2/no-object-methods/options.json +++ b/packages/babel-parser/test/fixtures/experimental/decorators-2/no-object-methods/options.json @@ -1,3 +1,10 @@ { - "throws": "Stage 2 decorators disallow object literal property decorators (2:2)" -} + "plugins": [ + [ + "decorators", + { + "decoratorsBeforeExport": false + } + ] + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/decorators-2/no-object-methods/output.json b/packages/babel-parser/test/fixtures/experimental/decorators-2/no-object-methods/output.json new file mode 100644 index 000000000000..e50713954be0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/decorators-2/no-object-methods/output.json @@ -0,0 +1,195 @@ +{ + "type": "File", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Stage 2 decorators disallow object literal property decorators (2:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 4, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "o" + }, + "name": "o" + }, + "init": { + "type": "ObjectExpression", + "start": 8, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "properties": [ + { + "type": "ObjectMethod", + "start": 19, + "end": 30, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 4, + "column": 3 + } + }, + "decorators": [ + { + "type": "Decorator", + "start": 12, + "end": 16, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 6 + } + }, + "expression": { + "type": "Identifier", + "start": 13, + "end": 16, + "loc": { + "start": { + "line": 2, + "column": 3 + }, + "end": { + "line": 2, + "column": 6 + }, + "identifierName": "baz" + }, + "name": "baz" + } + } + ], + "method": true, + "key": { + "type": "Identifier", + "start": 19, + "end": 22, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 5 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "computed": false, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 25, + "end": 30, + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 4, + "column": 3 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "kind": "var" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/decorators/no-constructor-decorators/options.json b/packages/babel-parser/test/fixtures/experimental/decorators/no-constructor-decorators/options.json deleted file mode 100644 index a26ed7cacb84..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/decorators/no-constructor-decorators/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "You can't attach decorators to a class constructor (2:2)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/decorators/no-constructor-decorators/output.json b/packages/babel-parser/test/fixtures/experimental/decorators/no-constructor-decorators/output.json new file mode 100644 index 000000000000..084e74570676 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/decorators/no-constructor-decorators/output.json @@ -0,0 +1,178 @@ +{ + "type": "File", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Decorators can't be used with a constructor. Did you mean '@dec class { ... }'? (2:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + }, + "identifierName": "Foo" + }, + "name": "Foo" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 10, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "ClassMethod", + "start": 14, + "end": 36, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 3, + "column": 17 + } + }, + "decorators": [ + { + "type": "Decorator", + "start": 14, + "end": 18, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 6 + } + }, + "expression": { + "type": "Identifier", + "start": 15, + "end": 18, + "loc": { + "start": { + "line": 2, + "column": 3 + }, + "end": { + "line": 2, + "column": 6 + }, + "identifierName": "abc" + }, + "name": "abc" + } + } + ], + "static": false, + "key": { + "type": "Identifier", + "start": 21, + "end": 32, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 13 + }, + "identifierName": "constructor" + }, + "name": "constructor" + }, + "computed": false, + "kind": "constructor", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 34, + "end": 36, + "loc": { + "start": { + "line": 3, + "column": 15 + }, + "end": { + "line": 3, + "column": 17 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/dynamic-import/direct-calls-only/options.json b/packages/babel-parser/test/fixtures/experimental/dynamic-import/direct-calls-only/options.json index 599298db4614..fae0a8fe39ac 100644 --- a/packages/babel-parser/test/fixtures/experimental/dynamic-import/direct-calls-only/options.json +++ b/packages/babel-parser/test/fixtures/experimental/dynamic-import/direct-calls-only/options.json @@ -1,3 +1,5 @@ { - "throws": "Dynamic imports require a parameter: import('a.js') (2:9)" -} + "plugins": [ + "dynamicImport" + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/dynamic-import/direct-calls-only/output.json b/packages/babel-parser/test/fixtures/experimental/dynamic-import/direct-calls-only/output.json new file mode 100644 index 000000000000..07f26c50d81d --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/dynamic-import/direct-calls-only/output.json @@ -0,0 +1,172 @@ +{ + "type": "File", + "start": 0, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Dynamic imports require a parameter: import('a.js') (2:9)", + "SyntaxError: The only valid meta property for import is import.meta (2:16)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 19 + }, + "identifierName": "failsParse" + }, + "name": "failsParse" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 22, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ReturnStatement", + "start": 26, + "end": 47, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 23 + } + }, + "argument": { + "type": "CallExpression", + "start": 33, + "end": 46, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "callee": { + "type": "MetaProperty", + "start": 33, + "end": 44, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 20 + } + }, + "meta": { + "type": "Identifier", + "start": 33, + "end": 39, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 15 + }, + "identifierName": "import" + }, + "name": "import" + }, + "property": { + "type": "Identifier", + "start": 40, + "end": 44, + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 20 + }, + "identifierName": "then" + }, + "name": "then" + } + }, + "arguments": [] + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/dynamic-import/invalid-arguments-spread/options.json b/packages/babel-parser/test/fixtures/experimental/dynamic-import/invalid-arguments-spread/options.json index c4e1e2ffeb50..fae0a8fe39ac 100644 --- a/packages/babel-parser/test/fixtures/experimental/dynamic-import/invalid-arguments-spread/options.json +++ b/packages/babel-parser/test/fixtures/experimental/dynamic-import/invalid-arguments-spread/options.json @@ -1,3 +1,5 @@ { - "throws": "... is not allowed in import() (1:7)" -} + "plugins": [ + "dynamicImport" + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/dynamic-import/invalid-arguments-spread/output.json b/packages/babel-parser/test/fixtures/experimental/dynamic-import/invalid-arguments-spread/output.json new file mode 100644 index 000000000000..d6eaecc7e5c0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/dynamic-import/invalid-arguments-spread/output.json @@ -0,0 +1,137 @@ +{ + "type": "File", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "errors": [ + "SyntaxError: ... is not allowed in import() (1:7)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "expression": { + "type": "CallExpression", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "callee": { + "type": "Import", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "arguments": [ + { + "type": "SpreadElement", + "start": 7, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "argument": { + "type": "ArrayExpression", + "start": 10, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "elements": [ + { + "type": "NumericLiteral", + "start": 11, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + ] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/dynamic-import/invalid-new/options.json b/packages/babel-parser/test/fixtures/experimental/dynamic-import/invalid-new/options.json index 26e64ffc5d96..fae0a8fe39ac 100644 --- a/packages/babel-parser/test/fixtures/experimental/dynamic-import/invalid-new/options.json +++ b/packages/babel-parser/test/fixtures/experimental/dynamic-import/invalid-new/options.json @@ -1,3 +1,5 @@ { - "throws": "Cannot use new with import(...) (1:4)" -} + "plugins": [ + "dynamicImport" + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/dynamic-import/invalid-new/output.json b/packages/babel-parser/test/fixtures/experimental/dynamic-import/invalid-new/output.json new file mode 100644 index 000000000000..a0b8467953bc --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/dynamic-import/invalid-new/output.json @@ -0,0 +1,105 @@ +{ + "type": "File", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "errors": [ + "SyntaxError: Cannot use new with import(...) (1:4)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "expression": { + "type": "NewExpression", + "start": 0, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "callee": { + "type": "Import", + "start": 4, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + "arguments": [ + { + "type": "StringLiteral", + "start": 11, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "extra": { + "rawValue": "foo", + "raw": "\"foo\"" + }, + "value": "foo" + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/dynamic-import/invalid-trailing-comma/options.json b/packages/babel-parser/test/fixtures/experimental/dynamic-import/invalid-trailing-comma/options.json index ae6f5f18ff31..329bfdd92330 100644 --- a/packages/babel-parser/test/fixtures/experimental/dynamic-import/invalid-trailing-comma/options.json +++ b/packages/babel-parser/test/fixtures/experimental/dynamic-import/invalid-trailing-comma/options.json @@ -1,3 +1,5 @@ { - "throws": "Trailing comma is disallowed inside import(...) arguments (1:12)" + "plugins": [ + "dynamicImport" + ] } diff --git a/packages/babel-parser/test/fixtures/experimental/dynamic-import/invalid-trailing-comma/output.json b/packages/babel-parser/test/fixtures/experimental/dynamic-import/invalid-trailing-comma/output.json new file mode 100644 index 000000000000..fde34fb849ab --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/dynamic-import/invalid-trailing-comma/output.json @@ -0,0 +1,108 @@ +{ + "type": "File", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "errors": [ + "SyntaxError: Trailing comma is disallowed inside import(...) arguments (1:12)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "expression": { + "type": "CallExpression", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "callee": { + "type": "Import", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "extra": { + "trailingComma": 12 + }, + "arguments": [ + { + "type": "StringLiteral", + "start": 7, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "extra": { + "rawValue": "foo", + "raw": "\"foo\"" + }, + "value": "foo" + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/dynamic-import/multiple-args/options.json b/packages/babel-parser/test/fixtures/experimental/dynamic-import/multiple-args/options.json index 95a99c52ae49..fae0a8fe39ac 100644 --- a/packages/babel-parser/test/fixtures/experimental/dynamic-import/multiple-args/options.json +++ b/packages/babel-parser/test/fixtures/experimental/dynamic-import/multiple-args/options.json @@ -1,3 +1,5 @@ { - "throws": "import() requires exactly one argument (1:0)" -} + "plugins": [ + "dynamicImport" + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/dynamic-import/multiple-args/output.json b/packages/babel-parser/test/fixtures/experimental/dynamic-import/multiple-args/output.json new file mode 100644 index 000000000000..f66dbbf22885 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/dynamic-import/multiple-args/output.json @@ -0,0 +1,125 @@ +{ + "type": "File", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "errors": [ + "SyntaxError: import() requires exactly one argument (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "expression": { + "type": "CallExpression", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "callee": { + "type": "Import", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "arguments": [ + { + "type": "StringLiteral", + "start": 7, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "extra": { + "rawValue": "hello", + "raw": "'hello'" + }, + "value": "hello" + }, + { + "type": "StringLiteral", + "start": 16, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "extra": { + "rawValue": "world", + "raw": "'world'" + }, + "value": "world" + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/dynamic-import/no-args/options.json b/packages/babel-parser/test/fixtures/experimental/dynamic-import/no-args/options.json index 95a99c52ae49..fae0a8fe39ac 100644 --- a/packages/babel-parser/test/fixtures/experimental/dynamic-import/no-args/options.json +++ b/packages/babel-parser/test/fixtures/experimental/dynamic-import/no-args/options.json @@ -1,3 +1,5 @@ { - "throws": "import() requires exactly one argument (1:0)" -} + "plugins": [ + "dynamicImport" + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/dynamic-import/no-args/output.json b/packages/babel-parser/test/fixtures/experimental/dynamic-import/no-args/output.json new file mode 100644 index 000000000000..9f50d0da240c --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/dynamic-import/no-args/output.json @@ -0,0 +1,84 @@ +{ + "type": "File", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "errors": [ + "SyntaxError: import() requires exactly one argument (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "expression": { + "type": "CallExpression", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "callee": { + "type": "Import", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "arguments": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/import-meta/error-in-script/options.json b/packages/babel-parser/test/fixtures/experimental/import-meta/error-in-script/options.json index eb1e545759e8..cdbf46968b69 100644 --- a/packages/babel-parser/test/fixtures/experimental/import-meta/error-in-script/options.json +++ b/packages/babel-parser/test/fixtures/experimental/import-meta/error-in-script/options.json @@ -1,5 +1,7 @@ { - "throws": "import.meta may appear only with 'sourceType: \"module\"' (1:10)", - "plugins": ["dynamicImport", "importMeta"], + "plugins": [ + "dynamicImport", + "importMeta" + ], "sourceType": "script" -} +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/import-meta/error-in-script/output.json b/packages/babel-parser/test/fixtures/experimental/import-meta/error-in-script/output.json new file mode 100644 index 000000000000..12e01e17c23c --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/import-meta/error-in-script/output.json @@ -0,0 +1,137 @@ +{ + "type": "File", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "errors": [ + "SyntaxError: import.meta may appear only with 'sourceType: \"module\"' (1:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 6, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "x" + }, + "name": "x" + }, + "init": { + "type": "MetaProperty", + "start": 10, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "meta": { + "type": "Identifier", + "start": 10, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 16 + }, + "identifierName": "import" + }, + "name": "import" + }, + "property": { + "type": "Identifier", + "start": 17, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 21 + }, + "identifierName": "meta" + }, + "name": "meta" + } + } + } + ], + "kind": "const" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/import-meta/no-other-prop-names/options.json b/packages/babel-parser/test/fixtures/experimental/import-meta/no-other-prop-names/options.json index 97ba83ec465d..e05ac2744632 100644 --- a/packages/babel-parser/test/fixtures/experimental/import-meta/no-other-prop-names/options.json +++ b/packages/babel-parser/test/fixtures/experimental/import-meta/no-other-prop-names/options.json @@ -1,5 +1,7 @@ { - "throws": "The only valid meta property for import is import.meta (1:7)", "sourceType": "module", - "plugins": ["dynamicImport", "importMeta"] -} + "plugins": [ + "dynamicImport", + "importMeta" + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/import-meta/no-other-prop-names/output.json b/packages/babel-parser/test/fixtures/experimental/import-meta/no-other-prop-names/output.json new file mode 100644 index 000000000000..9b2370d8c3ec --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/import-meta/no-other-prop-names/output.json @@ -0,0 +1,102 @@ +{ + "type": "File", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "errors": [ + "SyntaxError: The only valid meta property for import is import.meta (1:7)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "expression": { + "type": "MetaProperty", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "meta": { + "type": "Identifier", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "import" + }, + "name": "import" + }, + "property": { + "type": "Identifier", + "start": 7, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "notMeta" + }, + "name": "notMeta" + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/import-meta/not-assignable/options.json b/packages/babel-parser/test/fixtures/experimental/import-meta/not-assignable/options.json index 647ad9f65dee..e05ac2744632 100644 --- a/packages/babel-parser/test/fixtures/experimental/import-meta/not-assignable/options.json +++ b/packages/babel-parser/test/fixtures/experimental/import-meta/not-assignable/options.json @@ -1,5 +1,7 @@ { - "throws": "Invalid left-hand side in assignment expression (1:0)", "sourceType": "module", - "plugins": ["dynamicImport", "importMeta"] -} + "plugins": [ + "dynamicImport", + "importMeta" + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/import-meta/not-assignable/output.json b/packages/babel-parser/test/fixtures/experimental/import-meta/not-assignable/output.json new file mode 100644 index 000000000000..7610536beafc --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/import-meta/not-assignable/output.json @@ -0,0 +1,134 @@ +{ + "type": "File", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "errors": [ + "SyntaxError: Invalid left-hand side in assignment expression (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "operator": "=", + "left": { + "type": "MetaProperty", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "meta": { + "type": "Identifier", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "import" + }, + "name": "import" + }, + "property": { + "type": "Identifier", + "start": 7, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 11 + }, + "identifierName": "meta" + }, + "name": "meta" + } + }, + "right": { + "type": "BooleanLiteral", + "start": 14, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "value": true + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-0/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-0/options.json deleted file mode 100644 index 27e4acfa8f65..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-0/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:1)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-0/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-0/output.json new file mode 100644 index 000000000000..bed1899ddc7e --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-0/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:1)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "extra": { + "rawValue": 1, + "raw": "1_" + }, + "value": 1 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-1/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-1/options.json deleted file mode 100644 index 477511a87822..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-1/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:3)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-1/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-1/output.json new file mode 100644 index 000000000000..c1dac7764035 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-1/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:3)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "extra": { + "rawValue": 11, + "raw": "1_1_" + }, + "value": 11 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-10/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-10/options.json deleted file mode 100644 index a65e1ff322a7..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-10/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:5)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-10/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-10/output.json new file mode 100644 index 000000000000..6839504edf6c --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-10/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "extra": { + "rawValue": 17, + "raw": "0x1_1_" + }, + "value": 17 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-100/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-100/options.json deleted file mode 100644 index 8cb6bf4866a3..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-100/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:2)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-100/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-100/output.json new file mode 100644 index 000000000000..c7f4877e2059 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-100/output.json @@ -0,0 +1,75 @@ +{ + "type": "File", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 1, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "extra": { + "rawValue": 1, + "raw": "1_", + "parenthesized": true, + "parenStart": 0 + }, + "value": 1 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-101/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-101/options.json deleted file mode 100644 index 91c5decd9c42..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-101/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:4)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-101/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-101/output.json new file mode 100644 index 000000000000..1b343c302559 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-101/output.json @@ -0,0 +1,75 @@ +{ + "type": "File", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:4)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 1, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "extra": { + "rawValue": 11, + "raw": "1_1_", + "parenthesized": true, + "parenStart": 0 + }, + "value": 11 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-102/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-102/options.json deleted file mode 100644 index 91c5decd9c42..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-102/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:4)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-102/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-102/output.json new file mode 100644 index 000000000000..2ab61fd7bb04 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-102/output.json @@ -0,0 +1,76 @@ +{ + "type": "File", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:4)", + "SyntaxError: A numeric separator is only allowed between two digits (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 1, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "extra": { + "rawValue": 11, + "raw": "1_1__", + "parenthesized": true, + "parenStart": 0 + }, + "value": 11 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-103/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-103/options.json deleted file mode 100644 index 8cb6bf4866a3..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-103/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:2)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-103/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-103/output.json new file mode 100644 index 000000000000..e799ede442c5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-103/output.json @@ -0,0 +1,76 @@ +{ + "type": "File", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:2)", + "SyntaxError: A numeric separator is only allowed between two digits (1:3)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 1, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "extra": { + "rawValue": 11, + "raw": "1__1", + "parenthesized": true, + "parenStart": 0 + }, + "value": 11 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-104/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-104/options.json deleted file mode 100644 index 91c5decd9c42..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-104/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:4)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-104/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-104/output.json new file mode 100644 index 000000000000..7eef10ad862b --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-104/output.json @@ -0,0 +1,75 @@ +{ + "type": "File", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:4)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 1, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "extra": { + "rawValue": 11.11, + "raw": "1_1_.1_1", + "parenthesized": true, + "parenStart": 0 + }, + "value": 11.11 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-105/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-105/options.json deleted file mode 100644 index a65e1ff322a7..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-105/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:5)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-105/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-105/output.json new file mode 100644 index 000000000000..5a3cc58cada8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-105/output.json @@ -0,0 +1,75 @@ +{ + "type": "File", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 1, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "extra": { + "rawValue": 11.11, + "raw": "1_1._1_1", + "parenthesized": true, + "parenStart": 0 + }, + "value": 11.11 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-106/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-106/options.json deleted file mode 100644 index 9c49308645fd..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-106/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:6)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-106/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-106/output.json new file mode 100644 index 000000000000..45e0aecd2129 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-106/output.json @@ -0,0 +1,75 @@ +{ + "type": "File", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 1, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "extra": { + "rawValue": 111, + "raw": "1_1.1_e1", + "parenthesized": true, + "parenStart": 0 + }, + "value": 111 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-107/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-107/options.json deleted file mode 100644 index 9c49308645fd..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-107/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:6)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-107/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-107/output.json new file mode 100644 index 000000000000..73400bf8fd10 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-107/output.json @@ -0,0 +1,75 @@ +{ + "type": "File", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 1, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "extra": { + "rawValue": 111, + "raw": "1_1.1_E1", + "parenthesized": true, + "parenStart": 0 + }, + "value": 111 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-108/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-108/options.json deleted file mode 100644 index badcb4c1b655..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-108/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:7)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-108/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-108/output.json new file mode 100644 index 000000000000..6c6aa937ac70 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-108/output.json @@ -0,0 +1,75 @@ +{ + "type": "File", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:7)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 1, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "extra": { + "rawValue": 111, + "raw": "1_1.1e_1", + "parenthesized": true, + "parenStart": 0 + }, + "value": 111 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-109/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-109/options.json deleted file mode 100644 index badcb4c1b655..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-109/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:7)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-109/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-109/output.json new file mode 100644 index 000000000000..a646828811ea --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-109/output.json @@ -0,0 +1,75 @@ +{ + "type": "File", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:7)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 1, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "extra": { + "rawValue": 111, + "raw": "1_1.1E_1", + "parenthesized": true, + "parenStart": 0 + }, + "value": 111 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-11/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-11/options.json deleted file mode 100644 index a65e1ff322a7..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-11/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:5)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-11/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-11/output.json new file mode 100644 index 000000000000..0a1b0a11038e --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-11/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "extra": { + "rawValue": 161, + "raw": "0xa_1_" + }, + "value": 161 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-110/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-110/options.json deleted file mode 100644 index 9c49308645fd..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-110/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:6)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-110/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-110/output.json new file mode 100644 index 000000000000..34647c6e63c9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-110/output.json @@ -0,0 +1,75 @@ +{ + "type": "File", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 1, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "extra": { + "rawValue": 17, + "raw": "0x1_1_", + "parenthesized": true, + "parenStart": 0 + }, + "value": 17 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-111/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-111/options.json deleted file mode 100644 index 9c49308645fd..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-111/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:6)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-111/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-111/output.json new file mode 100644 index 000000000000..e33208bf5970 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-111/output.json @@ -0,0 +1,75 @@ +{ + "type": "File", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 1, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "extra": { + "rawValue": 161, + "raw": "0xa_1_", + "parenthesized": true, + "parenStart": 0 + }, + "value": 161 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-112/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-112/options.json deleted file mode 100644 index 477511a87822..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-112/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:3)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-112/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-112/output.json new file mode 100644 index 000000000000..48e2d915883b --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-112/output.json @@ -0,0 +1,75 @@ +{ + "type": "File", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:3)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 1, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "extra": { + "rawValue": 161, + "raw": "0x_a_1", + "parenthesized": true, + "parenStart": 0 + }, + "value": 161 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-113/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-113/options.json deleted file mode 100644 index 477511a87822..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-113/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:3)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-113/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-113/output.json new file mode 100644 index 000000000000..af714540b44f --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-113/output.json @@ -0,0 +1,77 @@ +{ + "type": "File", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:3)", + "SyntaxError: A numeric separator is only allowed between two digits (1:4)", + "SyntaxError: A numeric separator is only allowed between two digits (1:8)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 1, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "extra": { + "rawValue": 17, + "raw": "0x__1_1_", + "parenthesized": true, + "parenStart": 0 + }, + "value": 17 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-114/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-114/options.json deleted file mode 100644 index 477511a87822..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-114/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:3)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-114/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-114/output.json new file mode 100644 index 000000000000..151f29fb87dc --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-114/output.json @@ -0,0 +1,77 @@ +{ + "type": "File", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:3)", + "SyntaxError: A numeric separator is only allowed between two digits (1:5)", + "SyntaxError: A numeric separator is only allowed between two digits (1:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 1, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 17, + "raw": "0x_1__1", + "parenthesized": true, + "parenStart": 0 + }, + "value": 17 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-115/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-115/options.json deleted file mode 100644 index 477511a87822..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-115/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:3)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-115/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-115/output.json new file mode 100644 index 000000000000..3ec08e9eab54 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-115/output.json @@ -0,0 +1,76 @@ +{ + "type": "File", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:3)", + "SyntaxError: A numeric separator is only allowed between two digits (1:7)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 1, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 17, + "raw": "0x_1_1_", + "parenthesized": true, + "parenStart": 0 + }, + "value": 17 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-116/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-116/options.json deleted file mode 100644 index 477511a87822..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-116/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:3)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-116/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-116/output.json new file mode 100644 index 000000000000..b79700fd396f --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-116/output.json @@ -0,0 +1,75 @@ +{ + "type": "File", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:3)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 1, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "extra": { + "rawValue": 9, + "raw": "0o_1_1", + "parenthesized": true, + "parenStart": 0 + }, + "value": 9 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-117/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-117/options.json deleted file mode 100644 index 477511a87822..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-117/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:3)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-117/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-117/output.json new file mode 100644 index 000000000000..c0bcbc71a47a --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-117/output.json @@ -0,0 +1,75 @@ +{ + "type": "File", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:3)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 1, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "extra": { + "rawValue": 9, + "raw": "0o_11", + "parenthesized": true, + "parenStart": 0 + }, + "value": 9 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-118/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-118/options.json deleted file mode 100644 index 477511a87822..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-118/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:3)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-118/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-118/output.json new file mode 100644 index 000000000000..00976d92c50f --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-118/output.json @@ -0,0 +1,76 @@ +{ + "type": "File", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:3)", + "SyntaxError: A numeric separator is only allowed between two digits (1:8)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 1, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "extra": { + "rawValue": 9, + "raw": "0o_01_1_", + "parenthesized": true, + "parenStart": 0 + }, + "value": 9 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-119/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-119/options.json deleted file mode 100644 index 477511a87822..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-119/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:3)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-119/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-119/output.json new file mode 100644 index 000000000000..1858a06292b1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-119/output.json @@ -0,0 +1,75 @@ +{ + "type": "File", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:3)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 1, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "extra": { + "rawValue": 3, + "raw": "0b_0_1_1", + "parenthesized": true, + "parenStart": 0 + }, + "value": 3 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-12/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-12/options.json deleted file mode 100644 index 8cb6bf4866a3..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-12/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:2)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-12/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-12/output.json new file mode 100644 index 000000000000..a3ac3d5828d0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-12/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "extra": { + "rawValue": 161, + "raw": "0x_a_1" + }, + "value": 161 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-120/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-120/options.json deleted file mode 100644 index 477511a87822..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-120/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:3)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-120/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-120/output.json new file mode 100644 index 000000000000..0b18241bc1c5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-120/output.json @@ -0,0 +1,76 @@ +{ + "type": "File", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:3)", + "SyntaxError: A numeric separator is only allowed between two digits (1:8)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 1, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "extra": { + "rawValue": 3, + "raw": "0b_01_1_", + "parenthesized": true, + "parenStart": 0 + }, + "value": 3 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-121/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-121/options.json deleted file mode 100644 index badcb4c1b655..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-121/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:7)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-121/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-121/output.json new file mode 100644 index 000000000000..c478966220d4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-121/output.json @@ -0,0 +1,75 @@ +{ + "type": "File", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:7)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 1, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 3, + "raw": "0b01_1_", + "parenthesized": true, + "parenStart": 0 + }, + "value": 3 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-122/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-122/options.json deleted file mode 100644 index 9c49308645fd..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-122/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:6)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-122/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-122/output.json new file mode 100644 index 000000000000..3c73b3979a52 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-122/output.json @@ -0,0 +1,75 @@ +{ + "type": "File", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 1, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "extra": { + "rawValue": 9, + "raw": "0o1_1_", + "parenthesized": true, + "parenStart": 0 + }, + "value": 9 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-123/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-123/options.json deleted file mode 100644 index 477511a87822..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-123/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:3)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-123/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-123/output.json new file mode 100644 index 000000000000..7b4538c88e9c --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-123/output.json @@ -0,0 +1,76 @@ +{ + "type": "File", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:3)", + "SyntaxError: A numeric separator is only allowed between two digits (1:7)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 1, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 9, + "raw": "0o_1_1_", + "parenthesized": true, + "parenStart": 0 + }, + "value": 9 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-124/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-124/options.json deleted file mode 100644 index 8cb6bf4866a3..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-124/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:2)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-124/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-124/output.json new file mode 100644 index 000000000000..55f03701d9db --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-124/output.json @@ -0,0 +1,91 @@ +{ + "type": "File", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "BlockStatement", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 1, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 1, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "extra": { + "rawValue": 1, + "raw": "1_" + }, + "value": 1 + } + } + ], + "directives": [] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-125/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-125/options.json deleted file mode 100644 index 91c5decd9c42..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-125/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:4)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-125/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-125/output.json new file mode 100644 index 000000000000..4c87cc2b22a7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-125/output.json @@ -0,0 +1,91 @@ +{ + "type": "File", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:4)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "BlockStatement", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 1, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 1, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "extra": { + "rawValue": 11, + "raw": "1_1_" + }, + "value": 11 + } + } + ], + "directives": [] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-126/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-126/options.json deleted file mode 100644 index 91c5decd9c42..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-126/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:4)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-126/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-126/output.json new file mode 100644 index 000000000000..65bec6bcbd60 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-126/output.json @@ -0,0 +1,92 @@ +{ + "type": "File", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:4)", + "SyntaxError: A numeric separator is only allowed between two digits (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "BlockStatement", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 1, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 1, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "extra": { + "rawValue": 11, + "raw": "1_1__" + }, + "value": 11 + } + } + ], + "directives": [] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-127/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-127/options.json deleted file mode 100644 index 8cb6bf4866a3..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-127/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:2)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-127/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-127/output.json new file mode 100644 index 000000000000..740a870e3ad3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-127/output.json @@ -0,0 +1,92 @@ +{ + "type": "File", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:2)", + "SyntaxError: A numeric separator is only allowed between two digits (1:3)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "BlockStatement", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 1, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 1, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "extra": { + "rawValue": 11, + "raw": "1__1" + }, + "value": 11 + } + } + ], + "directives": [] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-128/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-128/options.json deleted file mode 100644 index 91c5decd9c42..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-128/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:4)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-128/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-128/output.json new file mode 100644 index 000000000000..8b3ea170250c --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-128/output.json @@ -0,0 +1,91 @@ +{ + "type": "File", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:4)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "BlockStatement", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 1, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 1, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "extra": { + "rawValue": 11.11, + "raw": "1_1_.1_1" + }, + "value": 11.11 + } + } + ], + "directives": [] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-129/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-129/options.json deleted file mode 100644 index a65e1ff322a7..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-129/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:5)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-129/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-129/output.json new file mode 100644 index 000000000000..a30df38017e0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-129/output.json @@ -0,0 +1,91 @@ +{ + "type": "File", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "BlockStatement", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 1, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 1, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "extra": { + "rawValue": 11.11, + "raw": "1_1._1_1" + }, + "value": 11.11 + } + } + ], + "directives": [] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-13/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-13/options.json deleted file mode 100644 index 8cb6bf4866a3..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-13/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:2)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-13/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-13/output.json new file mode 100644 index 000000000000..78257d308a98 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-13/output.json @@ -0,0 +1,75 @@ +{ + "type": "File", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:2)", + "SyntaxError: A numeric separator is only allowed between two digits (1:3)", + "SyntaxError: A numeric separator is only allowed between two digits (1:7)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 17, + "raw": "0x__1_1_" + }, + "value": 17 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-130/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-130/options.json deleted file mode 100644 index 9c49308645fd..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-130/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:6)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-130/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-130/output.json new file mode 100644 index 000000000000..a3ea6fad2e5a --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-130/output.json @@ -0,0 +1,91 @@ +{ + "type": "File", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "BlockStatement", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 1, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 1, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "extra": { + "rawValue": 111, + "raw": "1_1.1_e1" + }, + "value": 111 + } + } + ], + "directives": [] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-131/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-131/options.json deleted file mode 100644 index 9c49308645fd..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-131/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:6)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-131/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-131/output.json new file mode 100644 index 000000000000..6461d8dba2bd --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-131/output.json @@ -0,0 +1,91 @@ +{ + "type": "File", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "BlockStatement", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 1, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 1, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "extra": { + "rawValue": 111, + "raw": "1_1.1_E1" + }, + "value": 111 + } + } + ], + "directives": [] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-132/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-132/options.json deleted file mode 100644 index badcb4c1b655..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-132/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:7)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-132/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-132/output.json new file mode 100644 index 000000000000..d27ae3b4fadf --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-132/output.json @@ -0,0 +1,91 @@ +{ + "type": "File", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:7)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "BlockStatement", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 1, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 1, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "extra": { + "rawValue": 111, + "raw": "1_1.1e_1" + }, + "value": 111 + } + } + ], + "directives": [] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-133/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-133/options.json deleted file mode 100644 index badcb4c1b655..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-133/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:7)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-133/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-133/output.json new file mode 100644 index 000000000000..ee4395d21f55 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-133/output.json @@ -0,0 +1,91 @@ +{ + "type": "File", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:7)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "BlockStatement", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 1, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 1, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "extra": { + "rawValue": 111, + "raw": "1_1.1E_1" + }, + "value": 111 + } + } + ], + "directives": [] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-134/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-134/options.json deleted file mode 100644 index 9c49308645fd..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-134/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:6)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-134/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-134/output.json new file mode 100644 index 000000000000..29dc70b2487f --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-134/output.json @@ -0,0 +1,91 @@ +{ + "type": "File", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "BlockStatement", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 1, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 1, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "extra": { + "rawValue": 17, + "raw": "0x1_1_" + }, + "value": 17 + } + } + ], + "directives": [] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-135/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-135/options.json deleted file mode 100644 index 9c49308645fd..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-135/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:6)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-135/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-135/output.json new file mode 100644 index 000000000000..f08afb905eac --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-135/output.json @@ -0,0 +1,91 @@ +{ + "type": "File", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "BlockStatement", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 1, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 1, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "extra": { + "rawValue": 161, + "raw": "0xa_1_" + }, + "value": 161 + } + } + ], + "directives": [] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-136/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-136/options.json deleted file mode 100644 index 477511a87822..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-136/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:3)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-136/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-136/output.json new file mode 100644 index 000000000000..2507a579d6de --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-136/output.json @@ -0,0 +1,91 @@ +{ + "type": "File", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:3)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "BlockStatement", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 1, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 1, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "extra": { + "rawValue": 161, + "raw": "0x_a_1" + }, + "value": 161 + } + } + ], + "directives": [] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-137/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-137/options.json deleted file mode 100644 index 477511a87822..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-137/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:3)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-137/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-137/output.json new file mode 100644 index 000000000000..89afd3efde35 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-137/output.json @@ -0,0 +1,93 @@ +{ + "type": "File", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:3)", + "SyntaxError: A numeric separator is only allowed between two digits (1:4)", + "SyntaxError: A numeric separator is only allowed between two digits (1:8)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "BlockStatement", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 1, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 1, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "extra": { + "rawValue": 17, + "raw": "0x__1_1_" + }, + "value": 17 + } + } + ], + "directives": [] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-138/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-138/options.json deleted file mode 100644 index 477511a87822..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-138/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:3)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-138/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-138/output.json new file mode 100644 index 000000000000..8cad1428818e --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-138/output.json @@ -0,0 +1,93 @@ +{ + "type": "File", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:3)", + "SyntaxError: A numeric separator is only allowed between two digits (1:5)", + "SyntaxError: A numeric separator is only allowed between two digits (1:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "BlockStatement", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 1, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 1, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 17, + "raw": "0x_1__1" + }, + "value": 17 + } + } + ], + "directives": [] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-139/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-139/options.json deleted file mode 100644 index 477511a87822..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-139/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:3)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-139/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-139/output.json new file mode 100644 index 000000000000..9d86aac2191a --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-139/output.json @@ -0,0 +1,92 @@ +{ + "type": "File", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:3)", + "SyntaxError: A numeric separator is only allowed between two digits (1:7)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "BlockStatement", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 1, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 1, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 17, + "raw": "0x_1_1_" + }, + "value": 17 + } + } + ], + "directives": [] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-14/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-14/options.json deleted file mode 100644 index 8cb6bf4866a3..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-14/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:2)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-14/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-14/output.json new file mode 100644 index 000000000000..477b3c1f3cf4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-14/output.json @@ -0,0 +1,75 @@ +{ + "type": "File", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:2)", + "SyntaxError: A numeric separator is only allowed between two digits (1:4)", + "SyntaxError: A numeric separator is only allowed between two digits (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "extra": { + "rawValue": 17, + "raw": "0x_1__1" + }, + "value": 17 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-140/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-140/options.json deleted file mode 100644 index 477511a87822..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-140/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:3)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-140/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-140/output.json new file mode 100644 index 000000000000..73b694a6656c --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-140/output.json @@ -0,0 +1,91 @@ +{ + "type": "File", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:3)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "BlockStatement", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 1, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 1, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "extra": { + "rawValue": 9, + "raw": "0o_1_1" + }, + "value": 9 + } + } + ], + "directives": [] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-141/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-141/options.json deleted file mode 100644 index 477511a87822..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-141/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:3)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-141/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-141/output.json new file mode 100644 index 000000000000..3e602cf8e35b --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-141/output.json @@ -0,0 +1,91 @@ +{ + "type": "File", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:3)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "BlockStatement", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 1, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 1, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "extra": { + "rawValue": 9, + "raw": "0o_11" + }, + "value": 9 + } + } + ], + "directives": [] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-142/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-142/options.json deleted file mode 100644 index 477511a87822..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-142/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:3)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-142/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-142/output.json new file mode 100644 index 000000000000..7b96b478be97 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-142/output.json @@ -0,0 +1,92 @@ +{ + "type": "File", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:3)", + "SyntaxError: A numeric separator is only allowed between two digits (1:8)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "BlockStatement", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 1, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 1, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "extra": { + "rawValue": 9, + "raw": "0o_01_1_" + }, + "value": 9 + } + } + ], + "directives": [] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-143/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-143/options.json deleted file mode 100644 index 477511a87822..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-143/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:3)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-143/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-143/output.json new file mode 100644 index 000000000000..bd3c89e95560 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-143/output.json @@ -0,0 +1,91 @@ +{ + "type": "File", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:3)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "BlockStatement", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 1, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 1, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "extra": { + "rawValue": 3, + "raw": "0b_0_1_1" + }, + "value": 3 + } + } + ], + "directives": [] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-144/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-144/options.json deleted file mode 100644 index 477511a87822..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-144/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:3)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-144/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-144/output.json new file mode 100644 index 000000000000..df4e4858faae --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-144/output.json @@ -0,0 +1,92 @@ +{ + "type": "File", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:3)", + "SyntaxError: A numeric separator is only allowed between two digits (1:8)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "BlockStatement", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 1, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 1, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "extra": { + "rawValue": 3, + "raw": "0b_01_1_" + }, + "value": 3 + } + } + ], + "directives": [] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-145/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-145/options.json deleted file mode 100644 index badcb4c1b655..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-145/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:7)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-145/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-145/output.json new file mode 100644 index 000000000000..f9203546d16c --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-145/output.json @@ -0,0 +1,91 @@ +{ + "type": "File", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:7)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "BlockStatement", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 1, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 1, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 3, + "raw": "0b01_1_" + }, + "value": 3 + } + } + ], + "directives": [] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-146/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-146/options.json deleted file mode 100644 index 9c49308645fd..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-146/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:6)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-146/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-146/output.json new file mode 100644 index 000000000000..3138ed92346a --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-146/output.json @@ -0,0 +1,91 @@ +{ + "type": "File", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "BlockStatement", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 1, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 1, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "extra": { + "rawValue": 9, + "raw": "0o1_1_" + }, + "value": 9 + } + } + ], + "directives": [] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-147/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-147/options.json deleted file mode 100644 index 477511a87822..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-147/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:3)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-147/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-147/output.json new file mode 100644 index 000000000000..5cd647c2bf7d --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-147/output.json @@ -0,0 +1,92 @@ +{ + "type": "File", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:3)", + "SyntaxError: A numeric separator is only allowed between two digits (1:7)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "BlockStatement", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 1, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 1, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 9, + "raw": "0o_1_1_" + }, + "value": 9 + } + } + ], + "directives": [] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-15/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-15/options.json deleted file mode 100644 index 8cb6bf4866a3..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-15/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:2)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-15/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-15/output.json new file mode 100644 index 000000000000..a43596db0e4e --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-15/output.json @@ -0,0 +1,74 @@ +{ + "type": "File", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:2)", + "SyntaxError: A numeric separator is only allowed between two digits (1:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "extra": { + "rawValue": 17, + "raw": "0x_1_1_" + }, + "value": 17 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-16/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-16/options.json deleted file mode 100644 index 8cb6bf4866a3..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-16/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:2)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-16/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-16/output.json new file mode 100644 index 000000000000..c6b51546660e --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-16/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "extra": { + "rawValue": 9, + "raw": "0o_1_1" + }, + "value": 9 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-17/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-17/options.json deleted file mode 100644 index 8cb6bf4866a3..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-17/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:2)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-17/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-17/output.json new file mode 100644 index 000000000000..4788bc887407 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-17/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "extra": { + "rawValue": 9, + "raw": "0o_11" + }, + "value": 9 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-18/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-18/options.json deleted file mode 100644 index 8cb6bf4866a3..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-18/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:2)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-18/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-18/output.json new file mode 100644 index 000000000000..e797620a329e --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-18/output.json @@ -0,0 +1,74 @@ +{ + "type": "File", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:2)", + "SyntaxError: A numeric separator is only allowed between two digits (1:7)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 9, + "raw": "0o_01_1_" + }, + "value": 9 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-19/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-19/options.json deleted file mode 100644 index 8cb6bf4866a3..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-19/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:2)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-19/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-19/output.json new file mode 100644 index 000000000000..509fa7be5376 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-19/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 3, + "raw": "0b_0_1_1" + }, + "value": 3 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-2/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-2/options.json deleted file mode 100644 index 477511a87822..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-2/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:3)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-2/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-2/output.json new file mode 100644 index 000000000000..71b523cdc3f5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-2/output.json @@ -0,0 +1,74 @@ +{ + "type": "File", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:3)", + "SyntaxError: A numeric separator is only allowed between two digits (1:4)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "extra": { + "rawValue": 11, + "raw": "1_1__" + }, + "value": 11 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-20/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-20/options.json deleted file mode 100644 index 8cb6bf4866a3..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-20/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:2)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-20/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-20/output.json new file mode 100644 index 000000000000..386c54cac8e1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-20/output.json @@ -0,0 +1,74 @@ +{ + "type": "File", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:2)", + "SyntaxError: A numeric separator is only allowed between two digits (1:7)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 3, + "raw": "0b_01_1_" + }, + "value": 3 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-21/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-21/options.json deleted file mode 100644 index 9c49308645fd..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-21/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:6)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-21/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-21/output.json new file mode 100644 index 000000000000..99329263441c --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-21/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "extra": { + "rawValue": 3, + "raw": "0b01_1_" + }, + "value": 3 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-22/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-22/options.json deleted file mode 100644 index a65e1ff322a7..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-22/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:5)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-22/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-22/output.json new file mode 100644 index 000000000000..031ce3f9fcf2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-22/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "extra": { + "rawValue": 9, + "raw": "0o1_1_" + }, + "value": 9 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-23/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-23/options.json deleted file mode 100644 index 8cb6bf4866a3..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-23/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:2)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-23/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-23/output.json new file mode 100644 index 000000000000..cf60b4557bd1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-23/output.json @@ -0,0 +1,74 @@ +{ + "type": "File", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:2)", + "SyntaxError: A numeric separator is only allowed between two digits (1:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "extra": { + "rawValue": 9, + "raw": "0o_1_1_" + }, + "value": 9 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-25/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-25/options.json deleted file mode 100644 index 91c5decd9c42..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-25/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:4)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-25/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-25/output.json new file mode 100644 index 000000000000..0de8505e1170 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-25/output.json @@ -0,0 +1,74 @@ +{ + "type": "File", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:4)", + "SyntaxError: Expected number in radix 8 (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "extra": { + "rawValue": 8, + "raw": "0o01_8" + }, + "value": 8 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-26/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-26/options.json deleted file mode 100644 index 7f37dbb4686b..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-26/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Expected number in radix 2 (1:2)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-26/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-26/output.json new file mode 100644 index 000000000000..ab45a08cb897 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-26/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "errors": [ + "SyntaxError: Expected number in radix 2 (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "extra": { + "rawValue": 1, + "raw": "0b2_1" + }, + "value": 1 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-27/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-27/options.json index fab06a453d2f..ee18527964e7 100644 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-27/options.json +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-27/options.json @@ -1 +1,3 @@ -{ "throws": "Expected number in radix 16 (1:2)" } +{ + "throws": "Identifier directly after number (1:2)" +} diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-28/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-28/options.json deleted file mode 100644 index 27e4acfa8f65..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-28/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:1)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-28/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-28/output.json new file mode 100644 index 000000000000..22352b5f300f --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-28/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:1)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "extra": { + "rawValue": 1, + "raw": "1_" + }, + "value": 1 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-29/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-29/options.json deleted file mode 100644 index 477511a87822..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-29/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:3)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-29/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-29/output.json new file mode 100644 index 000000000000..109e14677751 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-29/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:3)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "extra": { + "rawValue": 11, + "raw": "1_1_" + }, + "value": 11 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-3/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-3/options.json deleted file mode 100644 index 27e4acfa8f65..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-3/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:1)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-3/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-3/output.json new file mode 100644 index 000000000000..39f6afe910ec --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-3/output.json @@ -0,0 +1,74 @@ +{ + "type": "File", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:1)", + "SyntaxError: A numeric separator is only allowed between two digits (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "extra": { + "rawValue": 11, + "raw": "1__1" + }, + "value": 11 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-30/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-30/options.json deleted file mode 100644 index 477511a87822..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-30/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:3)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-30/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-30/output.json new file mode 100644 index 000000000000..422bdd6c6384 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-30/output.json @@ -0,0 +1,74 @@ +{ + "type": "File", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:3)", + "SyntaxError: A numeric separator is only allowed between two digits (1:4)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "extra": { + "rawValue": 11, + "raw": "1_1__" + }, + "value": 11 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-31/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-31/options.json deleted file mode 100644 index 27e4acfa8f65..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-31/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:1)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-31/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-31/output.json new file mode 100644 index 000000000000..4cf178b2082e --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-31/output.json @@ -0,0 +1,74 @@ +{ + "type": "File", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:1)", + "SyntaxError: A numeric separator is only allowed between two digits (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "extra": { + "rawValue": 11, + "raw": "1__1" + }, + "value": 11 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-32/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-32/options.json deleted file mode 100644 index 477511a87822..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-32/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:3)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-32/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-32/output.json new file mode 100644 index 000000000000..3ac121a5eece --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-32/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:3)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 11.11, + "raw": "1_1_.1_1" + }, + "value": 11.11 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-33/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-33/options.json deleted file mode 100644 index 91c5decd9c42..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-33/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:4)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-33/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-33/output.json new file mode 100644 index 000000000000..4e344f6fd3bf --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-33/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:4)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 11.11, + "raw": "1_1._1_1" + }, + "value": 11.11 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-34/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-34/options.json deleted file mode 100644 index a65e1ff322a7..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-34/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:5)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-34/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-34/output.json new file mode 100644 index 000000000000..d8a2a2deda67 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-34/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 111, + "raw": "1_1.1_e1" + }, + "value": 111 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-35/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-35/options.json deleted file mode 100644 index a65e1ff322a7..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-35/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:5)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-35/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-35/output.json new file mode 100644 index 000000000000..0b63b9681805 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-35/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 111, + "raw": "1_1.1_E1" + }, + "value": 111 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-36/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-36/options.json deleted file mode 100644 index 9c49308645fd..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-36/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:6)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-36/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-36/output.json new file mode 100644 index 000000000000..6a9efc69296c --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-36/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 111, + "raw": "1_1.1e_1" + }, + "value": 111 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-37/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-37/options.json deleted file mode 100644 index 9c49308645fd..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-37/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:6)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-37/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-37/output.json new file mode 100644 index 000000000000..f68c59283508 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-37/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 111, + "raw": "1_1.1E_1" + }, + "value": 111 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-38/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-38/options.json deleted file mode 100644 index a65e1ff322a7..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-38/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:5)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-38/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-38/output.json new file mode 100644 index 000000000000..0c35b0296649 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-38/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "extra": { + "rawValue": 17, + "raw": "0x1_1_" + }, + "value": 17 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-39/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-39/options.json deleted file mode 100644 index a65e1ff322a7..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-39/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:5)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-39/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-39/output.json new file mode 100644 index 000000000000..8076713df223 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-39/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "extra": { + "rawValue": 161, + "raw": "0xa_1_" + }, + "value": 161 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-4/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-4/options.json deleted file mode 100644 index 477511a87822..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-4/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:3)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-4/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-4/output.json new file mode 100644 index 000000000000..ad70ca6fc270 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-4/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:3)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 11.11, + "raw": "1_1_.1_1" + }, + "value": 11.11 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-40/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-40/options.json deleted file mode 100644 index 8cb6bf4866a3..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-40/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:2)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-40/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-40/output.json new file mode 100644 index 000000000000..31bfeccc15a7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-40/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "extra": { + "rawValue": 161, + "raw": "0x_a_1" + }, + "value": 161 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-41/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-41/options.json deleted file mode 100644 index 8cb6bf4866a3..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-41/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:2)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-41/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-41/output.json new file mode 100644 index 000000000000..ca8eaf7c7c31 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-41/output.json @@ -0,0 +1,75 @@ +{ + "type": "File", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:2)", + "SyntaxError: A numeric separator is only allowed between two digits (1:3)", + "SyntaxError: A numeric separator is only allowed between two digits (1:7)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 17, + "raw": "0x__1_1_" + }, + "value": 17 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-42/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-42/options.json deleted file mode 100644 index 8cb6bf4866a3..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-42/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:2)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-42/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-42/output.json new file mode 100644 index 000000000000..689560a3bb3c --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-42/output.json @@ -0,0 +1,75 @@ +{ + "type": "File", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:2)", + "SyntaxError: A numeric separator is only allowed between two digits (1:4)", + "SyntaxError: A numeric separator is only allowed between two digits (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "extra": { + "rawValue": 17, + "raw": "0x_1__1" + }, + "value": 17 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-43/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-43/options.json deleted file mode 100644 index 8cb6bf4866a3..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-43/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:2)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-43/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-43/output.json new file mode 100644 index 000000000000..b92b88fa4a19 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-43/output.json @@ -0,0 +1,74 @@ +{ + "type": "File", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:2)", + "SyntaxError: A numeric separator is only allowed between two digits (1:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "extra": { + "rawValue": 17, + "raw": "0x_1_1_" + }, + "value": 17 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-44/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-44/options.json deleted file mode 100644 index 8cb6bf4866a3..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-44/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:2)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-44/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-44/output.json new file mode 100644 index 000000000000..9487edc545b8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-44/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "extra": { + "rawValue": 9, + "raw": "0o_1_1" + }, + "value": 9 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-45/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-45/options.json deleted file mode 100644 index 8cb6bf4866a3..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-45/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:2)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-45/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-45/output.json new file mode 100644 index 000000000000..1c39ba7a1d72 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-45/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "extra": { + "rawValue": 9, + "raw": "0o_11" + }, + "value": 9 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-46/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-46/options.json deleted file mode 100644 index 8cb6bf4866a3..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-46/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:2)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-46/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-46/output.json new file mode 100644 index 000000000000..2890e46ca71d --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-46/output.json @@ -0,0 +1,74 @@ +{ + "type": "File", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:2)", + "SyntaxError: A numeric separator is only allowed between two digits (1:7)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 9, + "raw": "0o_01_1_" + }, + "value": 9 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-47/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-47/options.json deleted file mode 100644 index 8cb6bf4866a3..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-47/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:2)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-47/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-47/output.json new file mode 100644 index 000000000000..6de8c77bf903 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-47/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 3, + "raw": "0b_0_1_1" + }, + "value": 3 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-48/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-48/options.json deleted file mode 100644 index 8cb6bf4866a3..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-48/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:2)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-48/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-48/output.json new file mode 100644 index 000000000000..ae93a109760c --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-48/output.json @@ -0,0 +1,74 @@ +{ + "type": "File", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:2)", + "SyntaxError: A numeric separator is only allowed between two digits (1:7)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 3, + "raw": "0b_01_1_" + }, + "value": 3 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-49/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-49/options.json deleted file mode 100644 index 9c49308645fd..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-49/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:6)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-49/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-49/output.json new file mode 100644 index 000000000000..fdede7a21ac0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-49/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "extra": { + "rawValue": 3, + "raw": "0b01_1_" + }, + "value": 3 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-5/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-5/options.json deleted file mode 100644 index 91c5decd9c42..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-5/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:4)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-5/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-5/output.json new file mode 100644 index 000000000000..ae808dbc99cf --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-5/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:4)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 11.11, + "raw": "1_1._1_1" + }, + "value": 11.11 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-50/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-50/options.json deleted file mode 100644 index a65e1ff322a7..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-50/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:5)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-50/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-50/output.json new file mode 100644 index 000000000000..784d1a34983e --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-50/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "extra": { + "rawValue": 9, + "raw": "0o1_1_" + }, + "value": 9 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-51/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-51/options.json deleted file mode 100644 index 8cb6bf4866a3..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-51/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:2)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-51/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-51/output.json new file mode 100644 index 000000000000..678bccf4fa1e --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-51/output.json @@ -0,0 +1,74 @@ +{ + "type": "File", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:2)", + "SyntaxError: A numeric separator is only allowed between two digits (1:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "extra": { + "rawValue": 9, + "raw": "0o_1_1_" + }, + "value": 9 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-52/input.js b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-52/input.js index b6b4f448099d..475f52e0eb50 100644 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-52/input.js +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-52/input.js @@ -1 +1 @@ -1_, +1_, 0 diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-52/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-52/options.json deleted file mode 100644 index 27e4acfa8f65..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-52/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:1)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-52/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-52/output.json new file mode 100644 index 000000000000..2c53bf532cbd --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-52/output.json @@ -0,0 +1,110 @@ +{ + "type": "File", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:1)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "expression": { + "type": "SequenceExpression", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "extra": { + "rawValue": 1, + "raw": "1_" + }, + "value": 1 + }, + { + "type": "NumericLiteral", + "start": 4, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-53/input.js b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-53/input.js index 4b8047ea34a5..ce3480ab5810 100644 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-53/input.js +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-53/input.js @@ -1 +1 @@ -1_1_, +1_1_, 0 diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-53/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-53/options.json deleted file mode 100644 index 477511a87822..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-53/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:3)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-53/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-53/output.json new file mode 100644 index 000000000000..f3956eac0884 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-53/output.json @@ -0,0 +1,110 @@ +{ + "type": "File", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:3)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "expression": { + "type": "SequenceExpression", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "extra": { + "rawValue": 11, + "raw": "1_1_" + }, + "value": 11 + }, + { + "type": "NumericLiteral", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-54/input.js b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-54/input.js index cac8642d14e7..be4906c68d09 100644 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-54/input.js +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-54/input.js @@ -1 +1 @@ -1_1__, +1_1__, 0 diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-54/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-54/options.json deleted file mode 100644 index 477511a87822..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-54/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:3)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-54/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-54/output.json new file mode 100644 index 000000000000..fa8e18cac1a1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-54/output.json @@ -0,0 +1,111 @@ +{ + "type": "File", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:3)", + "SyntaxError: A numeric separator is only allowed between two digits (1:4)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "expression": { + "type": "SequenceExpression", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "extra": { + "rawValue": 11, + "raw": "1_1__" + }, + "value": 11 + }, + { + "type": "NumericLiteral", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-55/input.js b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-55/input.js index a9051bb2db71..10191f1bd355 100644 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-55/input.js +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-55/input.js @@ -1 +1 @@ -1__1, +1__1, 0 diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-55/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-55/options.json deleted file mode 100644 index 27e4acfa8f65..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-55/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:1)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-55/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-55/output.json new file mode 100644 index 000000000000..d2ac83f6572e --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-55/output.json @@ -0,0 +1,111 @@ +{ + "type": "File", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:1)", + "SyntaxError: A numeric separator is only allowed between two digits (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "expression": { + "type": "SequenceExpression", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "extra": { + "rawValue": 11, + "raw": "1__1" + }, + "value": 11 + }, + { + "type": "NumericLiteral", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-56/input.js b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-56/input.js index 7213755d0f38..be9c6e14d226 100644 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-56/input.js +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-56/input.js @@ -1 +1 @@ -1_1_.1_1, +1_1_.1_1, 0 diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-56/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-56/options.json deleted file mode 100644 index 477511a87822..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-56/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:3)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-56/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-56/output.json new file mode 100644 index 000000000000..154d9a6f4641 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-56/output.json @@ -0,0 +1,110 @@ +{ + "type": "File", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:3)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "expression": { + "type": "SequenceExpression", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 11.11, + "raw": "1_1_.1_1" + }, + "value": 11.11 + }, + { + "type": "NumericLiteral", + "start": 10, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-57/input.js b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-57/input.js index db8717756d2a..e2a13541725e 100644 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-57/input.js +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-57/input.js @@ -1 +1 @@ -1_1._1_1, +1_1._1_1, 0 diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-57/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-57/options.json deleted file mode 100644 index 91c5decd9c42..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-57/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:4)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-57/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-57/output.json new file mode 100644 index 000000000000..6e462c0e07d4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-57/output.json @@ -0,0 +1,110 @@ +{ + "type": "File", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:4)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "expression": { + "type": "SequenceExpression", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 11.11, + "raw": "1_1._1_1" + }, + "value": 11.11 + }, + { + "type": "NumericLiteral", + "start": 10, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-58/input.js b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-58/input.js index 5e5e356da976..49539d8e1686 100644 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-58/input.js +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-58/input.js @@ -1 +1 @@ -1_1.1_e1, +1_1.1_e1, 0 diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-58/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-58/options.json deleted file mode 100644 index a65e1ff322a7..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-58/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:5)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-58/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-58/output.json new file mode 100644 index 000000000000..95a795d633b6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-58/output.json @@ -0,0 +1,110 @@ +{ + "type": "File", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "expression": { + "type": "SequenceExpression", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 111, + "raw": "1_1.1_e1" + }, + "value": 111 + }, + { + "type": "NumericLiteral", + "start": 10, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-59/input.js b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-59/input.js index b07556e6d95e..b06fd2edbbc4 100644 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-59/input.js +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-59/input.js @@ -1 +1 @@ -1_1.1_E1, +1_1.1_E1, 0 diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-59/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-59/options.json deleted file mode 100644 index a65e1ff322a7..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-59/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:5)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-59/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-59/output.json new file mode 100644 index 000000000000..51953305e0c8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-59/output.json @@ -0,0 +1,110 @@ +{ + "type": "File", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "expression": { + "type": "SequenceExpression", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 111, + "raw": "1_1.1_E1" + }, + "value": 111 + }, + { + "type": "NumericLiteral", + "start": 10, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-6/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-6/options.json deleted file mode 100644 index a65e1ff322a7..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-6/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:5)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-6/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-6/output.json new file mode 100644 index 000000000000..d0b1538b39dc --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-6/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 111, + "raw": "1_1.1_e1" + }, + "value": 111 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-60/input.js b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-60/input.js index 0186dfaccb82..61f6290af574 100644 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-60/input.js +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-60/input.js @@ -1 +1 @@ -1_1.1e_1, +1_1.1e_1, 0 diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-60/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-60/options.json deleted file mode 100644 index 9c49308645fd..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-60/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:6)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-60/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-60/output.json new file mode 100644 index 000000000000..a394466973f3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-60/output.json @@ -0,0 +1,110 @@ +{ + "type": "File", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "expression": { + "type": "SequenceExpression", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 111, + "raw": "1_1.1e_1" + }, + "value": 111 + }, + { + "type": "NumericLiteral", + "start": 10, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-61/input.js b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-61/input.js index 85594dea3099..026cf8e40d3a 100644 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-61/input.js +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-61/input.js @@ -1 +1 @@ -1_1.1E_1, +1_1.1E_1, 0 diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-61/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-61/options.json deleted file mode 100644 index 9c49308645fd..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-61/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:6)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-61/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-61/output.json new file mode 100644 index 000000000000..36605277710f --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-61/output.json @@ -0,0 +1,110 @@ +{ + "type": "File", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "expression": { + "type": "SequenceExpression", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 111, + "raw": "1_1.1E_1" + }, + "value": 111 + }, + { + "type": "NumericLiteral", + "start": 10, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-62/input.js b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-62/input.js index e0ed0c98f626..b34d9ea95a4d 100644 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-62/input.js +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-62/input.js @@ -1 +1 @@ -0x1_1_, +0x1_1_, 0 diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-62/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-62/options.json deleted file mode 100644 index a65e1ff322a7..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-62/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:5)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-62/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-62/output.json new file mode 100644 index 000000000000..347125ca2b1d --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-62/output.json @@ -0,0 +1,110 @@ +{ + "type": "File", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "expression": { + "type": "SequenceExpression", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "extra": { + "rawValue": 17, + "raw": "0x1_1_" + }, + "value": 17 + }, + { + "type": "NumericLiteral", + "start": 8, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-63/input.js b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-63/input.js index d1b793f8dfed..28a917a7aca3 100644 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-63/input.js +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-63/input.js @@ -1 +1 @@ -0xa_1_, +0xa_1_, 0 diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-63/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-63/options.json deleted file mode 100644 index a65e1ff322a7..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-63/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:5)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-63/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-63/output.json new file mode 100644 index 000000000000..ac06aae7f847 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-63/output.json @@ -0,0 +1,110 @@ +{ + "type": "File", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "expression": { + "type": "SequenceExpression", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "extra": { + "rawValue": 161, + "raw": "0xa_1_" + }, + "value": 161 + }, + { + "type": "NumericLiteral", + "start": 8, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-64/input.js b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-64/input.js index e5543066d000..8e1c3c4399a1 100644 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-64/input.js +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-64/input.js @@ -1 +1 @@ -0x_a_1, +0x_a_1, 0 diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-64/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-64/options.json deleted file mode 100644 index 8cb6bf4866a3..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-64/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:2)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-64/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-64/output.json new file mode 100644 index 000000000000..a70fc4a0fa0f --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-64/output.json @@ -0,0 +1,110 @@ +{ + "type": "File", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "expression": { + "type": "SequenceExpression", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "extra": { + "rawValue": 161, + "raw": "0x_a_1" + }, + "value": 161 + }, + { + "type": "NumericLiteral", + "start": 8, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-65/input.js b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-65/input.js index 68e6a0d63fea..d8039a473eb0 100644 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-65/input.js +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-65/input.js @@ -1 +1 @@ -0x__1_1_, +0x__1_1_, 0 diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-65/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-65/options.json deleted file mode 100644 index 8cb6bf4866a3..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-65/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:2)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-65/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-65/output.json new file mode 100644 index 000000000000..b75b68e18c5f --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-65/output.json @@ -0,0 +1,112 @@ +{ + "type": "File", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:2)", + "SyntaxError: A numeric separator is only allowed between two digits (1:3)", + "SyntaxError: A numeric separator is only allowed between two digits (1:7)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "expression": { + "type": "SequenceExpression", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 17, + "raw": "0x__1_1_" + }, + "value": 17 + }, + { + "type": "NumericLiteral", + "start": 10, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-66/input.js b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-66/input.js index fd959c9609a9..3853dd5ba743 100644 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-66/input.js +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-66/input.js @@ -1 +1 @@ -0x_1__1, +0x_1__1, 0 diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-66/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-66/options.json deleted file mode 100644 index 8cb6bf4866a3..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-66/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:2)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-66/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-66/output.json new file mode 100644 index 000000000000..7ddf567a2967 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-66/output.json @@ -0,0 +1,112 @@ +{ + "type": "File", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:2)", + "SyntaxError: A numeric separator is only allowed between two digits (1:4)", + "SyntaxError: A numeric separator is only allowed between two digits (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "expression": { + "type": "SequenceExpression", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "extra": { + "rawValue": 17, + "raw": "0x_1__1" + }, + "value": 17 + }, + { + "type": "NumericLiteral", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-67/input.js b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-67/input.js index dc2301a00ea7..90213eb4c896 100644 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-67/input.js +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-67/input.js @@ -1 +1 @@ -0x_1_1_, +0x_1_1_, 0 diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-67/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-67/options.json deleted file mode 100644 index 8cb6bf4866a3..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-67/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:2)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-67/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-67/output.json new file mode 100644 index 000000000000..849bdb6de9a8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-67/output.json @@ -0,0 +1,111 @@ +{ + "type": "File", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:2)", + "SyntaxError: A numeric separator is only allowed between two digits (1:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "expression": { + "type": "SequenceExpression", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "extra": { + "rawValue": 17, + "raw": "0x_1_1_" + }, + "value": 17 + }, + { + "type": "NumericLiteral", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-68/input.js b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-68/input.js index 3a7f53b8dc81..56f62d261b65 100644 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-68/input.js +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-68/input.js @@ -1 +1 @@ -0o_1_1, +0o_1_1, 0 diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-68/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-68/options.json deleted file mode 100644 index 8cb6bf4866a3..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-68/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:2)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-68/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-68/output.json new file mode 100644 index 000000000000..112bef72c91a --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-68/output.json @@ -0,0 +1,110 @@ +{ + "type": "File", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "expression": { + "type": "SequenceExpression", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "extra": { + "rawValue": 9, + "raw": "0o_1_1" + }, + "value": 9 + }, + { + "type": "NumericLiteral", + "start": 8, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-69/input.js b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-69/input.js index ed870aa937cd..fe56d1a3c36d 100644 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-69/input.js +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-69/input.js @@ -1 +1 @@ -0o_11, +0o_11, 0 diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-69/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-69/options.json deleted file mode 100644 index 8cb6bf4866a3..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-69/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:2)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-69/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-69/output.json new file mode 100644 index 000000000000..e702d612d243 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-69/output.json @@ -0,0 +1,110 @@ +{ + "type": "File", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "expression": { + "type": "SequenceExpression", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "extra": { + "rawValue": 9, + "raw": "0o_11" + }, + "value": 9 + }, + { + "type": "NumericLiteral", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-7/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-7/options.json deleted file mode 100644 index a65e1ff322a7..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-7/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:5)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-7/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-7/output.json new file mode 100644 index 000000000000..13d9caf030b8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-7/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 111, + "raw": "1_1.1_E1" + }, + "value": 111 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-70/input.js b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-70/input.js index e9fcb15ff998..d395282140ef 100644 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-70/input.js +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-70/input.js @@ -1 +1 @@ -0o_01_1_, +0o_01_1_, 0 diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-70/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-70/options.json deleted file mode 100644 index 8cb6bf4866a3..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-70/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:2)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-70/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-70/output.json new file mode 100644 index 000000000000..5f86cf161b9a --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-70/output.json @@ -0,0 +1,111 @@ +{ + "type": "File", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:2)", + "SyntaxError: A numeric separator is only allowed between two digits (1:7)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "expression": { + "type": "SequenceExpression", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 9, + "raw": "0o_01_1_" + }, + "value": 9 + }, + { + "type": "NumericLiteral", + "start": 10, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-71/input.js b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-71/input.js index 86cc54d9ed2d..4f5cb5c1e06b 100644 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-71/input.js +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-71/input.js @@ -1 +1 @@ -0b_0_1_1, +0b_0_1_1, 0 diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-71/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-71/options.json deleted file mode 100644 index 8cb6bf4866a3..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-71/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:2)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-71/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-71/output.json new file mode 100644 index 000000000000..5ce3d7e5f1db --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-71/output.json @@ -0,0 +1,110 @@ +{ + "type": "File", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "expression": { + "type": "SequenceExpression", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 3, + "raw": "0b_0_1_1" + }, + "value": 3 + }, + { + "type": "NumericLiteral", + "start": 10, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-72/input.js b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-72/input.js index 0c52a13346c0..1589fddd67c3 100644 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-72/input.js +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-72/input.js @@ -1 +1 @@ -0b_01_1_, +0b_01_1_, 0 diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-72/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-72/options.json deleted file mode 100644 index 8cb6bf4866a3..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-72/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:2)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-72/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-72/output.json new file mode 100644 index 000000000000..3364a2a11b7b --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-72/output.json @@ -0,0 +1,111 @@ +{ + "type": "File", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:2)", + "SyntaxError: A numeric separator is only allowed between two digits (1:7)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "expression": { + "type": "SequenceExpression", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 3, + "raw": "0b_01_1_" + }, + "value": 3 + }, + { + "type": "NumericLiteral", + "start": 10, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-73/input.js b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-73/input.js index 95c45fd025be..c730763e66fa 100644 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-73/input.js +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-73/input.js @@ -1 +1 @@ -0b01_1_, +0b01_1_, 0 diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-73/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-73/options.json deleted file mode 100644 index 9c49308645fd..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-73/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:6)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-73/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-73/output.json new file mode 100644 index 000000000000..77046a4ee17f --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-73/output.json @@ -0,0 +1,110 @@ +{ + "type": "File", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "expression": { + "type": "SequenceExpression", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "extra": { + "rawValue": 3, + "raw": "0b01_1_" + }, + "value": 3 + }, + { + "type": "NumericLiteral", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-74/input.js b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-74/input.js index 58ff35dd6c36..3a3aa0484726 100644 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-74/input.js +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-74/input.js @@ -1 +1 @@ -0o1_1_, +0o1_1_, 0 diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-74/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-74/options.json deleted file mode 100644 index a65e1ff322a7..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-74/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:5)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-74/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-74/output.json new file mode 100644 index 000000000000..fdc0933003a0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-74/output.json @@ -0,0 +1,110 @@ +{ + "type": "File", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "expression": { + "type": "SequenceExpression", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "extra": { + "rawValue": 9, + "raw": "0o1_1_" + }, + "value": 9 + }, + { + "type": "NumericLiteral", + "start": 8, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-75/input.js b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-75/input.js index bd44d425a6fa..a4d36757d478 100644 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-75/input.js +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-75/input.js @@ -1 +1 @@ -0o_1_1_, +0o_1_1_, 0 diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-75/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-75/options.json deleted file mode 100644 index 8cb6bf4866a3..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-75/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:2)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-75/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-75/output.json new file mode 100644 index 000000000000..7f14d41f530d --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-75/output.json @@ -0,0 +1,111 @@ +{ + "type": "File", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:2)", + "SyntaxError: A numeric separator is only allowed between two digits (1:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "expression": { + "type": "SequenceExpression", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "extra": { + "rawValue": 9, + "raw": "0o_1_1_" + }, + "value": 9 + }, + { + "type": "NumericLiteral", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-76/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-76/options.json deleted file mode 100644 index 8cb6bf4866a3..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-76/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:2)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-76/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-76/output.json new file mode 100644 index 000000000000..f505cbb81666 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-76/output.json @@ -0,0 +1,90 @@ +{ + "type": "File", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "expression": { + "type": "ArrayExpression", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "elements": [ + { + "type": "NumericLiteral", + "start": 1, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "extra": { + "rawValue": 1, + "raw": "1_" + }, + "value": 1 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-77/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-77/options.json deleted file mode 100644 index 91c5decd9c42..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-77/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:4)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-77/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-77/output.json new file mode 100644 index 000000000000..2648664f298c --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-77/output.json @@ -0,0 +1,90 @@ +{ + "type": "File", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:4)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "expression": { + "type": "ArrayExpression", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "elements": [ + { + "type": "NumericLiteral", + "start": 1, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "extra": { + "rawValue": 11, + "raw": "1_1_" + }, + "value": 11 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-78/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-78/options.json deleted file mode 100644 index 91c5decd9c42..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-78/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:4)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-78/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-78/output.json new file mode 100644 index 000000000000..a270c2420610 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-78/output.json @@ -0,0 +1,91 @@ +{ + "type": "File", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:4)", + "SyntaxError: A numeric separator is only allowed between two digits (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "expression": { + "type": "ArrayExpression", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "elements": [ + { + "type": "NumericLiteral", + "start": 1, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "extra": { + "rawValue": 11, + "raw": "1_1__" + }, + "value": 11 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-79/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-79/options.json deleted file mode 100644 index 8cb6bf4866a3..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-79/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:2)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-79/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-79/output.json new file mode 100644 index 000000000000..650a98a4cbff --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-79/output.json @@ -0,0 +1,91 @@ +{ + "type": "File", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:2)", + "SyntaxError: A numeric separator is only allowed between two digits (1:3)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "expression": { + "type": "ArrayExpression", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "elements": [ + { + "type": "NumericLiteral", + "start": 1, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "extra": { + "rawValue": 11, + "raw": "1__1" + }, + "value": 11 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-8/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-8/options.json deleted file mode 100644 index 9c49308645fd..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-8/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:6)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-8/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-8/output.json new file mode 100644 index 000000000000..037c60cbef6f --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-8/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 111, + "raw": "1_1.1e_1" + }, + "value": 111 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-80/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-80/options.json deleted file mode 100644 index 91c5decd9c42..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-80/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:4)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-80/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-80/output.json new file mode 100644 index 000000000000..1410809bebec --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-80/output.json @@ -0,0 +1,90 @@ +{ + "type": "File", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:4)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "expression": { + "type": "ArrayExpression", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "elements": [ + { + "type": "NumericLiteral", + "start": 1, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "extra": { + "rawValue": 11.11, + "raw": "1_1_.1_1" + }, + "value": 11.11 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-81/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-81/options.json deleted file mode 100644 index a65e1ff322a7..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-81/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:5)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-81/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-81/output.json new file mode 100644 index 000000000000..5ac0337bfe64 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-81/output.json @@ -0,0 +1,90 @@ +{ + "type": "File", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "expression": { + "type": "ArrayExpression", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "elements": [ + { + "type": "NumericLiteral", + "start": 1, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "extra": { + "rawValue": 11.11, + "raw": "1_1._1_1" + }, + "value": 11.11 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-82/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-82/options.json deleted file mode 100644 index 9c49308645fd..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-82/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:6)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-82/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-82/output.json new file mode 100644 index 000000000000..417003e07eaa --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-82/output.json @@ -0,0 +1,90 @@ +{ + "type": "File", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "expression": { + "type": "ArrayExpression", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "elements": [ + { + "type": "NumericLiteral", + "start": 1, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "extra": { + "rawValue": 111, + "raw": "1_1.1_e1" + }, + "value": 111 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-83/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-83/options.json deleted file mode 100644 index 9c49308645fd..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-83/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:6)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-83/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-83/output.json new file mode 100644 index 000000000000..9aa4e5c834d8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-83/output.json @@ -0,0 +1,90 @@ +{ + "type": "File", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "expression": { + "type": "ArrayExpression", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "elements": [ + { + "type": "NumericLiteral", + "start": 1, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "extra": { + "rawValue": 111, + "raw": "1_1.1_E1" + }, + "value": 111 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-84/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-84/options.json deleted file mode 100644 index badcb4c1b655..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-84/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:7)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-84/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-84/output.json new file mode 100644 index 000000000000..859e6d5d5325 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-84/output.json @@ -0,0 +1,90 @@ +{ + "type": "File", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:7)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "expression": { + "type": "ArrayExpression", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "elements": [ + { + "type": "NumericLiteral", + "start": 1, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "extra": { + "rawValue": 111, + "raw": "1_1.1e_1" + }, + "value": 111 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-85/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-85/options.json deleted file mode 100644 index badcb4c1b655..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-85/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:7)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-85/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-85/output.json new file mode 100644 index 000000000000..5020300be097 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-85/output.json @@ -0,0 +1,90 @@ +{ + "type": "File", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:7)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "expression": { + "type": "ArrayExpression", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "elements": [ + { + "type": "NumericLiteral", + "start": 1, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "extra": { + "rawValue": 111, + "raw": "1_1.1E_1" + }, + "value": 111 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-86/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-86/options.json deleted file mode 100644 index 9c49308645fd..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-86/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:6)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-86/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-86/output.json new file mode 100644 index 000000000000..3f132f054796 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-86/output.json @@ -0,0 +1,90 @@ +{ + "type": "File", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "expression": { + "type": "ArrayExpression", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "elements": [ + { + "type": "NumericLiteral", + "start": 1, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "extra": { + "rawValue": 17, + "raw": "0x1_1_" + }, + "value": 17 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-87/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-87/options.json deleted file mode 100644 index 9c49308645fd..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-87/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:6)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-87/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-87/output.json new file mode 100644 index 000000000000..173a126235b1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-87/output.json @@ -0,0 +1,90 @@ +{ + "type": "File", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "expression": { + "type": "ArrayExpression", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "elements": [ + { + "type": "NumericLiteral", + "start": 1, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "extra": { + "rawValue": 161, + "raw": "0xa_1_" + }, + "value": 161 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-88/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-88/options.json deleted file mode 100644 index 477511a87822..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-88/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:3)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-88/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-88/output.json new file mode 100644 index 000000000000..4f7277b6d914 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-88/output.json @@ -0,0 +1,90 @@ +{ + "type": "File", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:3)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "expression": { + "type": "ArrayExpression", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "elements": [ + { + "type": "NumericLiteral", + "start": 1, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "extra": { + "rawValue": 161, + "raw": "0x_a_1" + }, + "value": 161 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-89/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-89/options.json deleted file mode 100644 index 477511a87822..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-89/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:3)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-89/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-89/output.json new file mode 100644 index 000000000000..1e5f3a747c34 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-89/output.json @@ -0,0 +1,92 @@ +{ + "type": "File", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:3)", + "SyntaxError: A numeric separator is only allowed between two digits (1:4)", + "SyntaxError: A numeric separator is only allowed between two digits (1:8)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "expression": { + "type": "ArrayExpression", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "elements": [ + { + "type": "NumericLiteral", + "start": 1, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "extra": { + "rawValue": 17, + "raw": "0x__1_1_" + }, + "value": 17 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-9/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-9/options.json deleted file mode 100644 index 9c49308645fd..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-9/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:6)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-9/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-9/output.json new file mode 100644 index 000000000000..ea1d5804721a --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-9/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 111, + "raw": "1_1.1E_1" + }, + "value": 111 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-90/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-90/options.json deleted file mode 100644 index 477511a87822..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-90/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:3)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-90/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-90/output.json new file mode 100644 index 000000000000..9723cfbd4fda --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-90/output.json @@ -0,0 +1,92 @@ +{ + "type": "File", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:3)", + "SyntaxError: A numeric separator is only allowed between two digits (1:5)", + "SyntaxError: A numeric separator is only allowed between two digits (1:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "expression": { + "type": "ArrayExpression", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "elements": [ + { + "type": "NumericLiteral", + "start": 1, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 17, + "raw": "0x_1__1" + }, + "value": 17 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-91/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-91/options.json deleted file mode 100644 index 477511a87822..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-91/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:3)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-91/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-91/output.json new file mode 100644 index 000000000000..e802a59e0737 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-91/output.json @@ -0,0 +1,91 @@ +{ + "type": "File", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:3)", + "SyntaxError: A numeric separator is only allowed between two digits (1:7)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "expression": { + "type": "ArrayExpression", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "elements": [ + { + "type": "NumericLiteral", + "start": 1, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 17, + "raw": "0x_1_1_" + }, + "value": 17 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-92/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-92/options.json deleted file mode 100644 index 477511a87822..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-92/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:3)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-92/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-92/output.json new file mode 100644 index 000000000000..ffc792a8db4d --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-92/output.json @@ -0,0 +1,90 @@ +{ + "type": "File", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:3)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "expression": { + "type": "ArrayExpression", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "elements": [ + { + "type": "NumericLiteral", + "start": 1, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "extra": { + "rawValue": 9, + "raw": "0o_1_1" + }, + "value": 9 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-93/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-93/options.json deleted file mode 100644 index 477511a87822..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-93/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:3)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-93/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-93/output.json new file mode 100644 index 000000000000..583643ac786d --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-93/output.json @@ -0,0 +1,90 @@ +{ + "type": "File", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:3)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "expression": { + "type": "ArrayExpression", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "elements": [ + { + "type": "NumericLiteral", + "start": 1, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "extra": { + "rawValue": 9, + "raw": "0o_11" + }, + "value": 9 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-94/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-94/options.json deleted file mode 100644 index 477511a87822..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-94/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:3)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-94/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-94/output.json new file mode 100644 index 000000000000..71984f0f6d53 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-94/output.json @@ -0,0 +1,91 @@ +{ + "type": "File", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:3)", + "SyntaxError: A numeric separator is only allowed between two digits (1:8)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "expression": { + "type": "ArrayExpression", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "elements": [ + { + "type": "NumericLiteral", + "start": 1, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "extra": { + "rawValue": 9, + "raw": "0o_01_1_" + }, + "value": 9 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-95/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-95/options.json deleted file mode 100644 index 477511a87822..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-95/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:3)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-95/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-95/output.json new file mode 100644 index 000000000000..92169c50ab72 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-95/output.json @@ -0,0 +1,90 @@ +{ + "type": "File", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:3)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "expression": { + "type": "ArrayExpression", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "elements": [ + { + "type": "NumericLiteral", + "start": 1, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "extra": { + "rawValue": 3, + "raw": "0b_0_1_1" + }, + "value": 3 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-96/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-96/options.json deleted file mode 100644 index 477511a87822..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-96/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:3)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-96/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-96/output.json new file mode 100644 index 000000000000..8775652f6e4e --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-96/output.json @@ -0,0 +1,91 @@ +{ + "type": "File", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:3)", + "SyntaxError: A numeric separator is only allowed between two digits (1:8)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "expression": { + "type": "ArrayExpression", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "elements": [ + { + "type": "NumericLiteral", + "start": 1, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "extra": { + "rawValue": 3, + "raw": "0b_01_1_" + }, + "value": 3 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-97/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-97/options.json deleted file mode 100644 index badcb4c1b655..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-97/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:7)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-97/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-97/output.json new file mode 100644 index 000000000000..8427ff4fefb2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-97/output.json @@ -0,0 +1,90 @@ +{ + "type": "File", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:7)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "expression": { + "type": "ArrayExpression", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "elements": [ + { + "type": "NumericLiteral", + "start": 1, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 3, + "raw": "0b01_1_" + }, + "value": 3 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-98/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-98/options.json deleted file mode 100644 index 9c49308645fd..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-98/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:6)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-98/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-98/output.json new file mode 100644 index 000000000000..ab96b90e5fb1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-98/output.json @@ -0,0 +1,90 @@ +{ + "type": "File", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "expression": { + "type": "ArrayExpression", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "elements": [ + { + "type": "NumericLiteral", + "start": 1, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "extra": { + "rawValue": 9, + "raw": "0o1_1_" + }, + "value": 9 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-99/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-99/options.json deleted file mode 100644 index 477511a87822..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-99/options.json +++ /dev/null @@ -1 +0,0 @@ -{ "throws": "Invalid or unexpected token (1:3)" } diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-99/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-99/output.json new file mode 100644 index 000000000000..a3925ad6c8e8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-99/output.json @@ -0,0 +1,91 @@ +{ + "type": "File", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "errors": [ + "SyntaxError: A numeric separator is only allowed between two digits (1:3)", + "SyntaxError: A numeric separator is only allowed between two digits (1:7)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "expression": { + "type": "ArrayExpression", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "elements": [ + { + "type": "NumericLiteral", + "start": 1, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 9, + "raw": "0o_1_1_" + }, + "value": 9 + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-hex/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-hex/options.json index fd0b1c7f0a7d..45b66a114bf9 100644 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-hex/options.json +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-hex/options.json @@ -1 +1,6 @@ -{ "throws": "Numeric separators are not allowed inside unicode escape sequences or hex escape sequences (1:4)" } +{ + "plugins": [ + "bigInt", + "numericSeparator" + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-hex/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-hex/output.json new file mode 100644 index 000000000000..f47a3612a995 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-hex/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "errors": [ + "SyntaxError: Numeric separators are not allowed inside unicode escape sequences or hex escape sequences (1:4)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "value": "\\x1_0", + "extra": { + "raw": "\"\\x1_0\"", + "rawValue": "\\x1_0" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-leading-zero/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-leading-zero/options.json index 57c99a94dbd6..45b66a114bf9 100644 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-leading-zero/options.json +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-leading-zero/options.json @@ -1 +1,6 @@ -{ "throws": "Numeric separator can not be used after leading 0 (1:1)" } +{ + "plugins": [ + "bigInt", + "numericSeparator" + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-leading-zero/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-leading-zero/output.json new file mode 100644 index 000000000000..b9271342b1f5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-leading-zero/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "errors": [ + "SyntaxError: Numeric separator can not be used after leading 0 (1:1)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "extra": { + "rawValue": 8, + "raw": "0_8" + }, + "value": 8 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-legacy-octal-literal/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-legacy-octal-literal/options.json index 5a4fb4525d02..45b66a114bf9 100644 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-legacy-octal-literal/options.json +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-legacy-octal-literal/options.json @@ -1 +1,6 @@ -{ "throws": "Numeric separator can not be used after leading 0 (1:2)" } +{ + "plugins": [ + "bigInt", + "numericSeparator" + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-legacy-octal-literal/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-legacy-octal-literal/output.json new file mode 100644 index 000000000000..9677b88e4b27 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-legacy-octal-literal/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "errors": [ + "SyntaxError: Numeric separator can not be used after leading 0 (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "expression": { + "type": "NumericLiteral", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "extra": { + "rawValue": 0, + "raw": "00_0" + }, + "value": 0 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-non-octal-decimal-int/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-non-octal-decimal-int/options.json index 5a4fb4525d02..45b66a114bf9 100644 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-non-octal-decimal-int/options.json +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-non-octal-decimal-int/options.json @@ -1 +1,6 @@ -{ "throws": "Numeric separator can not be used after leading 0 (1:2)" } +{ + "plugins": [ + "bigInt", + "numericSeparator" + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-non-octal-decimal-int/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-non-octal-decimal-int/output.json new file mode 100644 index 000000000000..da24fe2bdd7d --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-non-octal-decimal-int/output.json @@ -0,0 +1,74 @@ +{ + "type": "File", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "errors": [ + "SyntaxError: Numeric separator can not be used after leading 0 (1:2)", + "SyntaxError: Invalid BigIntLiteral (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "expression": { + "type": "BigIntLiteral", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "extra": { + "rawValue": "080", + "raw": "08_0n" + }, + "value": "080" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-unicode-2/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-unicode-2/options.json index ca0ceaeaaea6..45b66a114bf9 100644 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-unicode-2/options.json +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-unicode-2/options.json @@ -1 +1,6 @@ -{ "throws": "Numeric separators are not allowed inside unicode escape sequences or hex escape sequences (1:5)" } +{ + "plugins": [ + "bigInt", + "numericSeparator" + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-unicode-2/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-unicode-2/output.json new file mode 100644 index 000000000000..b3d5564b9494 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-unicode-2/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "errors": [ + "SyntaxError: Numeric separators are not allowed inside unicode escape sequences or hex escape sequences (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "value": "\\u12_34", + "extra": { + "raw": "\"\\u12_34\"", + "rawValue": "\\u12_34" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-unicode/options.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-unicode/options.json index e42d95d86acf..45b66a114bf9 100644 --- a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-unicode/options.json +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-unicode/options.json @@ -1 +1,6 @@ -{ "throws": "Numeric separators are not allowed inside unicode escape sequences or hex escape sequences (1:6)" } +{ + "plugins": [ + "bigInt", + "numericSeparator" + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-unicode/output.json b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-unicode/output.json new file mode 100644 index 000000000000..e30a6e6b7370 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/numeric-separator/invalid-unicode/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "errors": [ + "SyntaxError: Numeric separators are not allowed inside unicode escape sequences or hex escape sequences (1:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [], + "directives": [ + { + "type": "Directive", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": { + "type": "DirectiveLiteral", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": "\\u{1F_639}", + "extra": { + "raw": "\"\\u{1F_639}\"", + "rawValue": "\\u{1F_639}" + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/optional-chaining/class-contructor-call/options.json b/packages/babel-parser/test/fixtures/experimental/optional-chaining/class-contructor-call/options.json index ed5e3c16bf68..0011d898807d 100644 --- a/packages/babel-parser/test/fixtures/experimental/optional-chaining/class-contructor-call/options.json +++ b/packages/babel-parser/test/fixtures/experimental/optional-chaining/class-contructor-call/options.json @@ -1,4 +1,5 @@ { - "plugins": ["optionalChaining"], - "throws": "constructors in/after an Optional Chain are not allowed (1:10)" -} + "plugins": [ + "optionalChaining" + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/optional-chaining/class-contructor-call/output.json b/packages/babel-parser/test/fixtures/experimental/optional-chaining/class-contructor-call/output.json new file mode 100644 index 000000000000..8ecf52133d5f --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/optional-chaining/class-contructor-call/output.json @@ -0,0 +1,154 @@ +{ + "type": "File", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "errors": [ + "SyntaxError: constructors in/after an Optional Chain are not allowed (1:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "expression": { + "type": "NewExpression", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "callee": { + "type": "OptionalMemberExpression", + "start": 4, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "object": { + "type": "OptionalMemberExpression", + "start": 4, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "object": { + "type": "Identifier", + "start": 4, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "C" + }, + "name": "C" + }, + "property": { + "type": "Identifier", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + }, + "identifierName": "b" + }, + "name": "b" + }, + "computed": false, + "optional": true + }, + "property": { + "type": "Identifier", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "d" + }, + "name": "d" + }, + "computed": false, + "optional": false + }, + "arguments": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/optional-chaining/optional-constructor/options.json b/packages/babel-parser/test/fixtures/experimental/optional-chaining/optional-constructor/options.json index 10cef4d48073..0011d898807d 100644 --- a/packages/babel-parser/test/fixtures/experimental/optional-chaining/optional-constructor/options.json +++ b/packages/babel-parser/test/fixtures/experimental/optional-chaining/optional-constructor/options.json @@ -1,4 +1,5 @@ { - "plugins": ["optionalChaining"], - "throws": "constructors in/after an Optional Chain are not allowed (1:7)" -} + "plugins": [ + "optionalChaining" + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/optional-chaining/optional-constructor/output.json b/packages/babel-parser/test/fixtures/experimental/optional-chaining/optional-constructor/output.json new file mode 100644 index 000000000000..6c643fbdd8ab --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/optional-chaining/optional-constructor/output.json @@ -0,0 +1,86 @@ +{ + "type": "File", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "errors": [ + "SyntaxError: constructors in/after an Optional Chain are not allowed (1:7)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "expression": { + "type": "NewExpression", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "callee": { + "type": "Identifier", + "start": 4, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "a" + }, + "name": "a" + }, + "arguments": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/optional-chaining/optional-super-property-class/options.json b/packages/babel-parser/test/fixtures/experimental/optional-chaining/optional-super-property-class/options.json index 86849e8c464a..fd201c1bdb02 100644 --- a/packages/babel-parser/test/fixtures/experimental/optional-chaining/optional-super-property-class/options.json +++ b/packages/babel-parser/test/fixtures/experimental/optional-chaining/optional-super-property-class/options.json @@ -1,4 +1,3 @@ { - "plugins": ["optionalChaining"], - "throws": "Unexpected token (3:20)" + "plugins": ["optionalChaining"] } diff --git a/packages/babel-parser/test/fixtures/experimental/optional-chaining/optional-super-property-class/output.json b/packages/babel-parser/test/fixtures/experimental/optional-chaining/optional-super-property-class/output.json new file mode 100644 index 000000000000..1f9545412a7a --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/optional-chaining/optional-super-property-class/output.json @@ -0,0 +1,209 @@ +{ + "type": "File", + "start": 0, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "errors": [ + "SyntaxError: super can only be used with function calls (i.e. super()) or in property accesses (i.e. super.prop or super[prop]) (3:15)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 7, + "end": 50, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "body": [ + { + "type": "ClassMethod", + "start": 13, + "end": 48, + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 4, + "column": 5 + } + }, + "static": false, + "key": { + "type": "Identifier", + "start": 13, + "end": 14, + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 5 + }, + "identifierName": "b" + }, + "name": "b" + }, + "computed": false, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 16, + "end": 48, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 4, + "column": 5 + } + }, + "body": [ + { + "type": "ReturnStatement", + "start": 26, + "end": 42, + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 24 + } + }, + "argument": { + "type": "OptionalMemberExpression", + "start": 33, + "end": 41, + "loc": { + "start": { + "line": 3, + "column": 15 + }, + "end": { + "line": 3, + "column": 23 + } + }, + "object": { + "type": "Super", + "start": 33, + "end": 38, + "loc": { + "start": { + "line": 3, + "column": 15 + }, + "end": { + "line": 3, + "column": 20 + } + } + }, + "property": { + "type": "Identifier", + "start": 40, + "end": 41, + "loc": { + "start": { + "line": 3, + "column": 22 + }, + "end": { + "line": 3, + "column": 23 + }, + "identifierName": "b" + }, + "name": "b" + }, + "computed": false, + "optional": true + } + } + ], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/optional-chaining/optional-super-property/options.json b/packages/babel-parser/test/fixtures/experimental/optional-chaining/optional-super-property/options.json index 86849e8c464a..fd201c1bdb02 100644 --- a/packages/babel-parser/test/fixtures/experimental/optional-chaining/optional-super-property/options.json +++ b/packages/babel-parser/test/fixtures/experimental/optional-chaining/optional-super-property/options.json @@ -1,4 +1,3 @@ { - "plugins": ["optionalChaining"], - "throws": "Unexpected token (3:20)" + "plugins": ["optionalChaining"] } diff --git a/packages/babel-parser/test/fixtures/experimental/optional-chaining/optional-super-property/output.json b/packages/babel-parser/test/fixtures/experimental/optional-chaining/optional-super-property/output.json new file mode 100644 index 000000000000..548b5c32d5a7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/optional-chaining/optional-super-property/output.json @@ -0,0 +1,226 @@ +{ + "type": "File", + "start": 0, + "end": 53, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "errors": [ + "SyntaxError: super can only be used with function calls (i.e. super()) or in property accesses (i.e. super.prop or super[prop]) (3:15)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 53, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 53, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 6, + "end": 53, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "a" + }, + "name": "a" + }, + "init": { + "type": "ObjectExpression", + "start": 10, + "end": 53, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "properties": [ + { + "type": "ObjectMethod", + "start": 16, + "end": 51, + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 4, + "column": 5 + } + }, + "method": true, + "key": { + "type": "Identifier", + "start": 16, + "end": 17, + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 5 + }, + "identifierName": "b" + }, + "name": "b" + }, + "computed": false, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 19, + "end": 51, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 4, + "column": 5 + } + }, + "body": [ + { + "type": "ReturnStatement", + "start": 29, + "end": 45, + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 24 + } + }, + "argument": { + "type": "OptionalMemberExpression", + "start": 36, + "end": 44, + "loc": { + "start": { + "line": 3, + "column": 15 + }, + "end": { + "line": 3, + "column": 23 + } + }, + "object": { + "type": "Super", + "start": 36, + "end": 41, + "loc": { + "start": { + "line": 3, + "column": 15 + }, + "end": { + "line": 3, + "column": 20 + } + } + }, + "property": { + "type": "Identifier", + "start": 43, + "end": 44, + "loc": { + "start": { + "line": 3, + "column": 22 + }, + "end": { + "line": 3, + "column": 23 + }, + "identifierName": "c" + }, + "name": "c" + }, + "computed": false, + "optional": true + } + } + ], + "directives": [] + } + } + ] + } + } + ], + "kind": "const" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/optional-chaining/optional-tagged-template-literals/options.json b/packages/babel-parser/test/fixtures/experimental/optional-chaining/optional-tagged-template-literals/options.json index 631741b044e0..0011d898807d 100644 --- a/packages/babel-parser/test/fixtures/experimental/optional-chaining/optional-tagged-template-literals/options.json +++ b/packages/babel-parser/test/fixtures/experimental/optional-chaining/optional-tagged-template-literals/options.json @@ -1,4 +1,5 @@ { - "plugins": ["optionalChaining"], - "throws": "Tagged Template Literals are not allowed in optionalChain (1:0)" -} + "plugins": [ + "optionalChaining" + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/optional-chaining/optional-tagged-template-literals/output.json b/packages/babel-parser/test/fixtures/experimental/optional-chaining/optional-tagged-template-literals/output.json new file mode 100644 index 000000000000..9dff15f15eda --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/optional-chaining/optional-tagged-template-literals/output.json @@ -0,0 +1,157 @@ +{ + "type": "File", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "errors": [ + "SyntaxError: Tagged Template Literals are not allowed in optionalChain (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "expression": { + "type": "TaggedTemplateExpression", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "tag": { + "type": "OptionalMemberExpression", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "object": { + "type": "Identifier", + "start": 0, + "end": 1, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + }, + "identifierName": "a" + }, + "name": "a" + }, + "property": { + "type": "Identifier", + "start": 3, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + }, + "identifierName": "b" + }, + "name": "b" + }, + "computed": false, + "optional": true + }, + "quasi": { + "type": "TemplateLiteral", + "start": 4, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "expressions": [], + "quasis": [ + { + "type": "TemplateElement", + "start": 5, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "value": { + "raw": "foo", + "cooked": "foo" + }, + "tail": true + } + ] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/partial-application/in-SuperCall/options.json b/packages/babel-parser/test/fixtures/experimental/partial-application/in-SuperCall/options.json index 58192a87fd99..982b7cd1dab5 100644 --- a/packages/babel-parser/test/fixtures/experimental/partial-application/in-SuperCall/options.json +++ b/packages/babel-parser/test/fixtures/experimental/partial-application/in-SuperCall/options.json @@ -1,4 +1,5 @@ { - "plugins": ["partialApplication"], - "throws": "Unexpected argument placeholder (3:16)" -} + "plugins": [ + "partialApplication" + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/partial-application/in-SuperCall/output.json b/packages/babel-parser/test/fixtures/experimental/partial-application/in-SuperCall/output.json new file mode 100644 index 000000000000..14f531a7e147 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/partial-application/in-SuperCall/output.json @@ -0,0 +1,390 @@ +{ + "type": "File", + "start": 0, + "end": 86, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 6, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Unexpected argument placeholder (3:16)", + "SyntaxError: Unexpected argument placeholder (3:19)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 86, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 6, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 86, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 6, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + }, + "identifierName": "Foo" + }, + "name": "Foo" + }, + "superClass": { + "type": "Identifier", + "start": 18, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 21 + }, + "identifierName": "Bar" + }, + "name": "Bar" + }, + "body": { + "type": "ClassBody", + "start": 22, + "end": 86, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 6, + "column": 1 + } + }, + "body": [ + { + "type": "ClassMethod", + "start": 26, + "end": 84, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 5, + "column": 3 + } + }, + "static": false, + "key": { + "type": "Identifier", + "start": 26, + "end": 37, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 13 + }, + "identifierName": "constructor" + }, + "name": "constructor" + }, + "computed": false, + "kind": "constructor", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 38, + "end": 39, + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 15 + }, + "identifierName": "x" + }, + "name": "x" + } + ], + "body": { + "type": "BlockStatement", + "start": 40, + "end": 84, + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 5, + "column": 3 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 46, + "end": 64, + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 22 + } + }, + "expression": { + "type": "CallExpression", + "start": 46, + "end": 63, + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 21 + } + }, + "callee": { + "type": "Super", + "start": 46, + "end": 51, + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 9 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "start": 52, + "end": 53, + "loc": { + "start": { + "line": 3, + "column": 10 + }, + "end": { + "line": 3, + "column": 11 + }, + "identifierName": "x" + }, + "name": "x" + }, + { + "type": "NumericLiteral", + "start": 55, + "end": 56, + "loc": { + "start": { + "line": 3, + "column": 13 + }, + "end": { + "line": 3, + "column": 14 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + }, + { + "type": "ArgumentPlaceholder", + "start": 58, + "end": 59, + "loc": { + "start": { + "line": 3, + "column": 16 + }, + "end": { + "line": 3, + "column": 17 + } + } + }, + { + "type": "ArgumentPlaceholder", + "start": 61, + "end": 62, + "loc": { + "start": { + "line": 3, + "column": 19 + }, + "end": { + "line": 3, + "column": 20 + } + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 69, + "end": 80, + "loc": { + "start": { + "line": 4, + "column": 4 + }, + "end": { + "line": 4, + "column": 15 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 69, + "end": 79, + "loc": { + "start": { + "line": 4, + "column": 4 + }, + "end": { + "line": 4, + "column": 14 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 69, + "end": 75, + "loc": { + "start": { + "line": 4, + "column": 4 + }, + "end": { + "line": 4, + "column": 10 + } + }, + "object": { + "type": "ThisExpression", + "start": 69, + "end": 73, + "loc": { + "start": { + "line": 4, + "column": 4 + }, + "end": { + "line": 4, + "column": 8 + } + } + }, + "property": { + "type": "Identifier", + "start": 74, + "end": 75, + "loc": { + "start": { + "line": 4, + "column": 9 + }, + "end": { + "line": 4, + "column": 10 + }, + "identifierName": "x" + }, + "name": "x" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 78, + "end": 79, + "loc": { + "start": { + "line": 4, + "column": 13 + }, + "end": { + "line": 4, + "column": 14 + }, + "identifierName": "x" + }, + "name": "x" + } + } + } + ], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/partial-application/in-new/options.json b/packages/babel-parser/test/fixtures/experimental/partial-application/in-new/options.json index 3b09c84c03eb..982b7cd1dab5 100644 --- a/packages/babel-parser/test/fixtures/experimental/partial-application/in-new/options.json +++ b/packages/babel-parser/test/fixtures/experimental/partial-application/in-new/options.json @@ -1,4 +1,5 @@ { - "plugins": ["partialApplication"], - "throws": "Unexpected argument placeholder (1:11)" -} + "plugins": [ + "partialApplication" + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/partial-application/in-new/output.json b/packages/babel-parser/test/fixtures/experimental/partial-application/in-new/output.json new file mode 100644 index 000000000000..d12380e4820c --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/partial-application/in-new/output.json @@ -0,0 +1,155 @@ +{ + "type": "File", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "errors": [ + "SyntaxError: Unexpected argument placeholder (1:11)", + "SyntaxError: Unexpected argument placeholder (1:17)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "expression": { + "type": "NewExpression", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "callee": { + "type": "Identifier", + "start": 4, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "bar" + }, + "name": "bar" + }, + "arguments": [ + { + "type": "Identifier", + "start": 8, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + }, + "identifierName": "x" + }, + "name": "x" + }, + { + "type": "ArgumentPlaceholder", + "start": 11, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "NumericLiteral", + "start": 14, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "extra": { + "rawValue": 2, + "raw": "2" + }, + "value": 2 + }, + { + "type": "ArgumentPlaceholder", + "start": 17, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-bare-style,-head-with-topic-reference-pair/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-bare-style,-head-with-topic-reference-pair/options.json index cc2c16a778e7..abf908b86e3e 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-bare-style,-head-with-topic-reference-pair/options.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-bare-style,-head-with-topic-reference-pair/options.json @@ -1,4 +1,10 @@ { - "plugins": [["pipelineOperator", { "proposal": "smart" }]], - "throws": "Pipeline head should not be a comma-separated sequence expression (1:0)" -} + "plugins": [ + [ + "pipelineOperator", + { + "proposal": "smart" + } + ] + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-bare-style,-head-with-topic-reference-pair/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-bare-style,-head-with-topic-reference-pair/output.json new file mode 100644 index 000000000000..b06186702668 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-bare-style,-head-with-topic-reference-pair/output.json @@ -0,0 +1,162 @@ +{ + "type": "File", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "errors": [ + "SyntaxError: Pipeline head should not be a comma-separated sequence expression (1:0)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "expression": { + "type": "BinaryExpression", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "left": { + "type": "SequenceExpression", + "start": 1, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 1, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + }, + { + "type": "NumericLiteral", + "start": 4, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "extra": { + "rawValue": 2, + "raw": "2" + }, + "value": 2 + } + ], + "extra": { + "parenthesized": true, + "parenStart": 0 + } + }, + "operator": "|>", + "right": { + "type": "PipelineBareFunction", + "start": 10, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "callee": { + "type": "Identifier", + "start": 10, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + }, + "identifierName": "f" + }, + "name": "f" + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-nested-pipelines,-topic-style-with-arrow-function-with-bare-style,-no-outer-topic-reference/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-nested-pipelines,-topic-style-with-arrow-function-with-bare-style,-no-outer-topic-reference/options.json index d2b32f77521a..17e4e327bbad 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-nested-pipelines,-topic-style-with-arrow-function-with-bare-style,-no-outer-topic-reference/options.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-nested-pipelines,-topic-style-with-arrow-function-with-bare-style,-no-outer-topic-reference/options.json @@ -1,4 +1,3 @@ { - "plugins": [["pipelineOperator", { "proposal": "smart" }]], - "throws": "Pipeline is in topic style but does not use topic reference (1:5)" + "plugins": [["pipelineOperator", { "proposal": "smart" }]] } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-nested-pipelines,-topic-style-with-arrow-function-with-bare-style,-no-outer-topic-reference/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-nested-pipelines,-topic-style-with-arrow-function-with-bare-style,-no-outer-topic-reference/output.json new file mode 100644 index 000000000000..9aceb13325af --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-nested-pipelines,-topic-style-with-arrow-function-with-bare-style,-no-outer-topic-reference/output.json @@ -0,0 +1,207 @@ +{ + "type": "File", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "errors": [ + "SyntaxError: Pipeline is in topic style but does not use topic reference (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "expression": { + "type": "BinaryExpression", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "left": { + "type": "Identifier", + "start": 0, + "end": 1, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + }, + "identifierName": "x" + }, + "name": "x" + }, + "operator": "|>", + "right": { + "type": "PipelineTopicExpression", + "start": 5, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 6, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "$" + }, + "name": "$" + } + ], + "body": { + "type": "BinaryExpression", + "start": 11, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "left": { + "type": "Identifier", + "start": 11, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "$" + }, + "name": "$" + }, + "operator": "|>", + "right": { + "type": "PipelineBareFunction", + "start": 16, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "callee": { + "type": "Identifier", + "start": 16, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + }, + "identifierName": "f" + }, + "name": "f" + } + } + }, + "extra": { + "parenthesized": true, + "parenStart": 5 + } + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-nested-pipelines,-topic-style-with-arrow-function-with-topic-style,-no-inner-topic-reference/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-nested-pipelines,-topic-style-with-arrow-function-with-topic-style,-no-inner-topic-reference/options.json index e9eab6b46fe9..17e4e327bbad 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-nested-pipelines,-topic-style-with-arrow-function-with-topic-style,-no-inner-topic-reference/options.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-nested-pipelines,-topic-style-with-arrow-function-with-topic-style,-no-inner-topic-reference/options.json @@ -1,4 +1,3 @@ { - "plugins": [["pipelineOperator", { "proposal": "smart" }]], - "throws": "Pipeline is in topic style but does not use topic reference (1:16)" + "plugins": [["pipelineOperator", { "proposal": "smart" }]] } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-nested-pipelines,-topic-style-with-arrow-function-with-topic-style,-no-inner-topic-reference/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-nested-pipelines,-topic-style-with-arrow-function-with-topic-style,-no-inner-topic-reference/output.json new file mode 100644 index 000000000000..a4b95926f362 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-nested-pipelines,-topic-style-with-arrow-function-with-topic-style,-no-inner-topic-reference/output.json @@ -0,0 +1,241 @@ +{ + "type": "File", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "errors": [ + "SyntaxError: Pipeline is in topic style but does not use topic reference (1:16)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "expression": { + "type": "BinaryExpression", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "left": { + "type": "Identifier", + "start": 0, + "end": 1, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + }, + "identifierName": "x" + }, + "name": "x" + }, + "operator": "|>", + "right": { + "type": "PipelineTopicExpression", + "start": 5, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 6, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "$" + }, + "name": "$" + } + ], + "body": { + "type": "BinaryExpression", + "start": 11, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "left": { + "type": "PipelinePrimaryTopicReference", + "start": 11, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "operator": "|>", + "right": { + "type": "PipelineTopicExpression", + "start": 16, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "expression": { + "type": "BinaryExpression", + "start": 16, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "left": { + "type": "Identifier", + "start": 16, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + }, + "identifierName": "$" + }, + "name": "$" + }, + "operator": "+", + "right": { + "type": "NumericLiteral", + "start": 20, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + } + }, + "extra": { + "parenthesized": true, + "parenStart": 5 + } + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-nested-pipelines,-topic-style-with-arrow-function-with-topic-style,-no-outer-topic-reference/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-nested-pipelines,-topic-style-with-arrow-function-with-topic-style,-no-outer-topic-reference/options.json index d2b32f77521a..17e4e327bbad 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-nested-pipelines,-topic-style-with-arrow-function-with-topic-style,-no-outer-topic-reference/options.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-nested-pipelines,-topic-style-with-arrow-function-with-topic-style,-no-outer-topic-reference/options.json @@ -1,4 +1,3 @@ { - "plugins": [["pipelineOperator", { "proposal": "smart" }]], - "throws": "Pipeline is in topic style but does not use topic reference (1:5)" + "plugins": [["pipelineOperator", { "proposal": "smart" }]] } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-nested-pipelines,-topic-style-with-arrow-function-with-topic-style,-no-outer-topic-reference/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-nested-pipelines,-topic-style-with-arrow-function-with-topic-style,-no-outer-topic-reference/output.json new file mode 100644 index 000000000000..257c98280e2e --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-nested-pipelines,-topic-style-with-arrow-function-with-topic-style,-no-outer-topic-reference/output.json @@ -0,0 +1,205 @@ +{ + "type": "File", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "errors": [ + "SyntaxError: Pipeline is in topic style but does not use topic reference (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "expression": { + "type": "BinaryExpression", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "left": { + "type": "Identifier", + "start": 0, + "end": 1, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + }, + "identifierName": "x" + }, + "name": "x" + }, + "operator": "|>", + "right": { + "type": "PipelineTopicExpression", + "start": 5, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 6, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "$" + }, + "name": "$" + } + ], + "body": { + "type": "BinaryExpression", + "start": 11, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "left": { + "type": "Identifier", + "start": 11, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "$" + }, + "name": "$" + }, + "operator": "|>", + "right": { + "type": "PipelineTopicExpression", + "start": 16, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "expression": { + "type": "PipelinePrimaryTopicReference", + "start": 16, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + } + } + }, + "extra": { + "parenthesized": true, + "parenStart": 5 + } + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-nested-pipelines,-topic-style-with-inner-topic-style,-no-inner-topic-reference/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-nested-pipelines,-topic-style-with-inner-topic-style,-no-inner-topic-reference/options.json index bdf0547df8f9..17e4e327bbad 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-nested-pipelines,-topic-style-with-inner-topic-style,-no-inner-topic-reference/options.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-nested-pipelines,-topic-style-with-inner-topic-style,-no-inner-topic-reference/options.json @@ -1,4 +1,3 @@ { - "plugins": [["pipelineOperator", { "proposal": "smart" }]], - "throws": "Pipeline is in topic style but does not use topic reference (1:11)" + "plugins": [["pipelineOperator", { "proposal": "smart" }]] } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-nested-pipelines,-topic-style-with-inner-topic-style,-no-inner-topic-reference/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-nested-pipelines,-topic-style-with-inner-topic-style,-no-inner-topic-reference/output.json new file mode 100644 index 000000000000..5644ff01406b --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-nested-pipelines,-topic-style-with-inner-topic-style,-no-inner-topic-reference/output.json @@ -0,0 +1,184 @@ +{ + "type": "File", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "errors": [ + "SyntaxError: Pipeline is in topic style but does not use topic reference (1:11)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "expression": { + "type": "BinaryExpression", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "left": { + "type": "Identifier", + "start": 0, + "end": 1, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + }, + "identifierName": "x" + }, + "name": "x" + }, + "operator": "|>", + "right": { + "type": "PipelineTopicExpression", + "start": 5, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "expression": { + "type": "BinaryExpression", + "start": 6, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "left": { + "type": "PipelinePrimaryTopicReference", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "operator": "|>", + "right": { + "type": "PipelineTopicExpression", + "start": 11, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "expression": { + "type": "CallExpression", + "start": 11, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "callee": { + "type": "Identifier", + "start": 11, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "f" + }, + "name": "f" + }, + "arguments": [] + } + }, + "extra": { + "parenthesized": true, + "parenStart": 5 + } + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-nested-pipelines,-topic-style-with-inner-topic-style,-no-outer-topic-reference/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-nested-pipelines,-topic-style-with-inner-topic-style,-no-outer-topic-reference/options.json index d2b32f77521a..17e4e327bbad 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-nested-pipelines,-topic-style-with-inner-topic-style,-no-outer-topic-reference/options.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-nested-pipelines,-topic-style-with-inner-topic-style,-no-outer-topic-reference/options.json @@ -1,4 +1,3 @@ { - "plugins": [["pipelineOperator", { "proposal": "smart" }]], - "throws": "Pipeline is in topic style but does not use topic reference (1:5)" + "plugins": [["pipelineOperator", { "proposal": "smart" }]] } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-nested-pipelines,-topic-style-with-inner-topic-style,-no-outer-topic-reference/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-nested-pipelines,-topic-style-with-inner-topic-style,-no-outer-topic-reference/output.json new file mode 100644 index 000000000000..f274dbc1ad48 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-nested-pipelines,-topic-style-with-inner-topic-style,-no-outer-topic-reference/output.json @@ -0,0 +1,170 @@ +{ + "type": "File", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "errors": [ + "SyntaxError: Pipeline is in topic style but does not use topic reference (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "expression": { + "type": "BinaryExpression", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "left": { + "type": "Identifier", + "start": 0, + "end": 1, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + }, + "identifierName": "x" + }, + "name": "x" + }, + "operator": "|>", + "right": { + "type": "PipelineTopicExpression", + "start": 5, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "expression": { + "type": "BinaryExpression", + "start": 6, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "left": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "$" + }, + "name": "$" + }, + "operator": "|>", + "right": { + "type": "PipelineBareFunction", + "start": 11, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "callee": { + "type": "Identifier", + "start": 11, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "f" + }, + "name": "f" + } + }, + "extra": { + "parenthesized": true, + "parenStart": 5 + } + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-sequence-style,-body-with-topic-reference-pair-followed-by-bare-style-pipeline-body/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-sequence-style,-body-with-topic-reference-pair-followed-by-bare-style-pipeline-body/options.json index fe3873ecc67f..abf908b86e3e 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-sequence-style,-body-with-topic-reference-pair-followed-by-bare-style-pipeline-body/options.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-sequence-style,-body-with-topic-reference-pair-followed-by-bare-style-pipeline-body/options.json @@ -1,4 +1,10 @@ { - "plugins": [["pipelineOperator", { "proposal": "smart" }]], - "throws": "Pipeline body may not be a comma-separated sequence expression (1:6)" -} + "plugins": [ + [ + "pipelineOperator", + { + "proposal": "smart" + } + ] + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-sequence-style,-body-with-topic-reference-pair-followed-by-bare-style-pipeline-body/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-sequence-style,-body-with-topic-reference-pair-followed-by-bare-style-pipeline-body/output.json new file mode 100644 index 000000000000..b0b8ec5955df --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-sequence-style,-body-with-topic-reference-pair-followed-by-bare-style-pipeline-body/output.json @@ -0,0 +1,203 @@ +{ + "type": "File", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "errors": [ + "SyntaxError: Pipeline body may not be a comma-separated sequence expression (1:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "expression": { + "type": "BinaryExpression", + "start": 0, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "left": { + "type": "BinaryExpression", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "left": { + "type": "NumericLiteral", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "extra": { + "rawValue": 10, + "raw": "10" + }, + "value": 10 + }, + "operator": "|>", + "right": { + "type": "PipelineTopicExpression", + "start": 6, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "expression": { + "type": "SequenceExpression", + "start": 7, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "expressions": [ + { + "type": "PipelinePrimaryTopicReference", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "PipelinePrimaryTopicReference", + "start": 10, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + } + ], + "extra": { + "parenthesized": true, + "parenStart": 6 + } + } + } + }, + "operator": "|>", + "right": { + "type": "PipelineBareFunction", + "start": 16, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "callee": { + "type": "Identifier", + "start": 16, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + }, + "identifierName": "h" + }, + "name": "h" + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-sequence-style,-body-with-topic-reference-pair-then-end/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-sequence-style,-body-with-topic-reference-pair-then-end/options.json index fe3873ecc67f..abf908b86e3e 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-sequence-style,-body-with-topic-reference-pair-then-end/options.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-sequence-style,-body-with-topic-reference-pair-then-end/options.json @@ -1,4 +1,10 @@ { - "plugins": [["pipelineOperator", { "proposal": "smart" }]], - "throws": "Pipeline body may not be a comma-separated sequence expression (1:6)" -} + "plugins": [ + [ + "pipelineOperator", + { + "proposal": "smart" + } + ] + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-sequence-style,-body-with-topic-reference-pair-then-end/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-sequence-style,-body-with-topic-reference-pair-then-end/output.json new file mode 100644 index 000000000000..89c673d0bc0c --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-sequence-style,-body-with-topic-reference-pair-then-end/output.json @@ -0,0 +1,155 @@ +{ + "type": "File", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "errors": [ + "SyntaxError: Pipeline body may not be a comma-separated sequence expression (1:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "expression": { + "type": "BinaryExpression", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "left": { + "type": "NumericLiteral", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "extra": { + "rawValue": 10, + "raw": "10" + }, + "value": 10 + }, + "operator": "|>", + "right": { + "type": "PipelineTopicExpression", + "start": 6, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "expression": { + "type": "SequenceExpression", + "start": 7, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "expressions": [ + { + "type": "PipelinePrimaryTopicReference", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "PipelinePrimaryTopicReference", + "start": 10, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + } + ], + "extra": { + "parenthesized": true, + "parenStart": 6 + } + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-computed,-no-topic-reference/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-computed,-no-topic-reference/options.json index 7a4451381c91..17e4e327bbad 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-computed,-no-topic-reference/options.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-computed,-no-topic-reference/options.json @@ -1,4 +1,3 @@ { - "plugins": [["pipelineOperator", { "proposal": "smart" }]], - "throws": "Pipeline is in topic style but does not use topic reference (1:9)" + "plugins": [["pipelineOperator", { "proposal": "smart" }]] } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-computed,-no-topic-reference/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-computed,-no-topic-reference/output.json new file mode 100644 index 000000000000..feca14ebaf5b --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-computed,-no-topic-reference/output.json @@ -0,0 +1,151 @@ +{ + "type": "File", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "errors": [ + "SyntaxError: Pipeline is in topic style but does not use topic reference (1:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "expression": { + "type": "BinaryExpression", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "left": { + "type": "Identifier", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "value" + }, + "name": "value" + }, + "operator": "|>", + "right": { + "type": "PipelineTopicExpression", + "start": 9, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "expression": { + "type": "MemberExpression", + "start": 9, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "object": { + "type": "Identifier", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "a" + }, + "name": "a" + }, + "property": { + "type": "Identifier", + "start": 11, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "b" + }, + "name": "b" + }, + "computed": true + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-no-topic-reference,-addition/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-no-topic-reference,-addition/options.json index 7a4451381c91..17e4e327bbad 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-no-topic-reference,-addition/options.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-no-topic-reference,-addition/options.json @@ -1,4 +1,3 @@ { - "plugins": [["pipelineOperator", { "proposal": "smart" }]], - "throws": "Pipeline is in topic style but does not use topic reference (1:9)" + "plugins": [["pipelineOperator", { "proposal": "smart" }]] } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-no-topic-reference,-addition/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-no-topic-reference,-addition/output.json new file mode 100644 index 000000000000..c1399c71afa2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-no-topic-reference,-addition/output.json @@ -0,0 +1,151 @@ +{ + "type": "File", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "errors": [ + "SyntaxError: Pipeline is in topic style but does not use topic reference (1:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "expression": { + "type": "BinaryExpression", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "left": { + "type": "Identifier", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "value" + }, + "name": "value" + }, + "operator": "|>", + "right": { + "type": "PipelineTopicExpression", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "expression": { + "type": "BinaryExpression", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "left": { + "type": "Identifier", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "a" + }, + "name": "a" + }, + "operator": "+", + "right": { + "type": "Identifier", + "start": 13, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "b" + }, + "name": "b" + } + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-no-topic-reference,-class-expression/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-no-topic-reference,-class-expression/options.json index 7a4451381c91..17e4e327bbad 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-no-topic-reference,-class-expression/options.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-no-topic-reference,-class-expression/options.json @@ -1,4 +1,3 @@ { - "plugins": [["pipelineOperator", { "proposal": "smart" }]], - "throws": "Pipeline is in topic style but does not use topic reference (1:9)" + "plugins": [["pipelineOperator", { "proposal": "smart" }]] } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-no-topic-reference,-class-expression/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-no-topic-reference,-class-expression/output.json new file mode 100644 index 000000000000..da79f8d294e8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-no-topic-reference,-class-expression/output.json @@ -0,0 +1,134 @@ +{ + "type": "File", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "errors": [ + "SyntaxError: Pipeline is in topic style but does not use topic reference (1:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "expression": { + "type": "BinaryExpression", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "left": { + "type": "Identifier", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "value" + }, + "name": "value" + }, + "operator": "|>", + "right": { + "type": "PipelineTopicExpression", + "start": 9, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "expression": { + "type": "ClassExpression", + "start": 9, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "id": null, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 15, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "body": [] + } + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-no-topic-reference,-function-expression/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-no-topic-reference,-function-expression/options.json index 7a4451381c91..17e4e327bbad 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-no-topic-reference,-function-expression/options.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-no-topic-reference,-function-expression/options.json @@ -1,4 +1,3 @@ { - "plugins": [["pipelineOperator", { "proposal": "smart" }]], - "throws": "Pipeline is in topic style but does not use topic reference (1:9)" + "plugins": [["pipelineOperator", { "proposal": "smart" }]] } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-no-topic-reference,-function-expression/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-no-topic-reference,-function-expression/output.json new file mode 100644 index 000000000000..63e37b46042d --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-no-topic-reference,-function-expression/output.json @@ -0,0 +1,172 @@ +{ + "type": "File", + "start": 0, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "errors": [ + "SyntaxError: Pipeline is in topic style but does not use topic reference (1:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "expression": { + "type": "BinaryExpression", + "start": 0, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "left": { + "type": "Identifier", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "value" + }, + "name": "value" + }, + "operator": "|>", + "right": { + "type": "PipelineTopicExpression", + "start": 9, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "expression": { + "type": "FunctionExpression", + "start": 9, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 19, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + }, + "identifierName": "x" + }, + "name": "x" + } + ], + "body": { + "type": "BlockStatement", + "start": 22, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "body": [ + { + "type": "ReturnStatement", + "start": 24, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "argument": null + } + ], + "directives": [] + } + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-do-while-loop,-outer-topic-reference-in-loop-body/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-do-while-loop,-outer-topic-reference-in-loop-body/input.js index c1005576b7d5..8b34c84f521f 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-do-while-loop,-outer-topic-reference-in-loop-body/input.js +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-do-while-loop,-outer-topic-reference-in-loop-body/input.js @@ -1 +1 @@ -value |> do { do x += # while (x < 50); } +value |> do { do x += #; while (x < 50); } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-do-while-loop,-outer-topic-reference-in-loop-body/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-do-while-loop,-outer-topic-reference-in-loop-body/options.json index 3b7a52d71cf7..edb7679c6a74 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-do-while-loop,-outer-topic-reference-in-loop-body/options.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-do-while-loop,-outer-topic-reference-in-loop-body/options.json @@ -1,4 +1,3 @@ { - "plugins": [["pipelineOperator", { "proposal": "smart" }], "doExpressions"], - "throws": "Topic reference was used in a lexical context without topic binding (1:22)" + "plugins": [["pipelineOperator", { "proposal": "smart" }], "doExpressions"] } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-do-while-loop,-outer-topic-reference-in-loop-body/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-do-while-loop,-outer-topic-reference-in-loop-body/output.json new file mode 100644 index 000000000000..95125a326a21 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-do-while-loop,-outer-topic-reference-in-loop-body/output.json @@ -0,0 +1,266 @@ +{ + "type": "File", + "start": 0, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 42 + } + }, + "errors": [ + "SyntaxError: Topic reference was used in a lexical context without topic binding (1:22)", + "SyntaxError: Pipeline is in topic style but does not use topic reference (1:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 42 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 42 + } + }, + "expression": { + "type": "BinaryExpression", + "start": 0, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 42 + } + }, + "left": { + "type": "Identifier", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "value" + }, + "name": "value" + }, + "operator": "|>", + "right": { + "type": "PipelineTopicExpression", + "start": 9, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 42 + } + }, + "expression": { + "type": "DoExpression", + "start": 9, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 42 + } + }, + "body": { + "type": "BlockStatement", + "start": 12, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 42 + } + }, + "body": [ + { + "type": "DoWhileStatement", + "start": 14, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "body": { + "type": "ExpressionStatement", + "start": 17, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 17, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "operator": "+=", + "left": { + "type": "Identifier", + "start": 17, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + }, + "identifierName": "x" + }, + "name": "x" + }, + "right": { + "type": "PipelinePrimaryTopicReference", + "start": 22, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + } + } + }, + "test": { + "type": "BinaryExpression", + "start": 32, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "left": { + "type": "Identifier", + "start": 32, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 33 + }, + "identifierName": "x" + }, + "name": "x" + }, + "operator": "<", + "right": { + "type": "NumericLiteral", + "start": 36, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "extra": { + "rawValue": 50, + "raw": "50" + }, + "value": 50 + } + } + } + ], + "directives": [] + } + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-for-await-of-loop,-outer-topic-reference-in-loop-body/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-for-await-of-loop,-outer-topic-reference-in-loop-body/options.json index d117d235099d..680f780892b7 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-for-await-of-loop,-outer-topic-reference-in-loop-body/options.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-for-await-of-loop,-outer-topic-reference-in-loop-body/options.json @@ -3,6 +3,5 @@ ["pipelineOperator", { "proposal": "smart" }], "doExpressions", "asyncGenerators" - ], - "throws": "Topic reference was used in a lexical context without topic binding (2:48)" + ] } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-for-await-of-loop,-outer-topic-reference-in-loop-body/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-for-await-of-loop,-outer-topic-reference-in-loop-body/output.json new file mode 100644 index 000000000000..372a871e8b7b --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-for-await-of-loop,-outer-topic-reference-in-loop-body/output.json @@ -0,0 +1,302 @@ +{ + "type": "File", + "start": 0, + "end": 77, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Topic reference was used in a lexical context without topic binding (2:48)", + "SyntaxError: Pipeline is in topic style but does not use topic reference (2:11)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 77, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 77, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 15, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 17 + }, + "identifierName": "af" + }, + "name": "af" + }, + "generator": false, + "async": true, + "params": [], + "body": { + "type": "BlockStatement", + "start": 21, + "end": 77, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 25, + "end": 75, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 52 + } + }, + "expression": { + "type": "BinaryExpression", + "start": 25, + "end": 75, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 52 + } + }, + "left": { + "type": "Identifier", + "start": 25, + "end": 30, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 7 + }, + "identifierName": "value" + }, + "name": "value" + }, + "operator": "|>", + "right": { + "type": "PipelineTopicExpression", + "start": 34, + "end": 75, + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 52 + } + }, + "expression": { + "type": "DoExpression", + "start": 34, + "end": 75, + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 52 + } + }, + "body": { + "type": "BlockStatement", + "start": 37, + "end": 75, + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 52 + } + }, + "body": [ + { + "type": "ForOfStatement", + "start": 39, + "end": 73, + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 50 + } + }, + "await": true, + "left": { + "type": "VariableDeclaration", + "start": 50, + "end": 57, + "loc": { + "start": { + "line": 2, + "column": 27 + }, + "end": { + "line": 2, + "column": 34 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 56, + "end": 57, + "loc": { + "start": { + "line": 2, + "column": 33 + }, + "end": { + "line": 2, + "column": 34 + } + }, + "id": { + "type": "Identifier", + "start": 56, + "end": 57, + "loc": { + "start": { + "line": 2, + "column": 33 + }, + "end": { + "line": 2, + "column": 34 + }, + "identifierName": "e" + }, + "name": "e" + }, + "init": null + } + ], + "kind": "const" + }, + "right": { + "type": "Identifier", + "start": 61, + "end": 69, + "loc": { + "start": { + "line": 2, + "column": 38 + }, + "end": { + "line": 2, + "column": 46 + }, + "identifierName": "sequence" + }, + "name": "sequence" + }, + "body": { + "type": "ExpressionStatement", + "start": 71, + "end": 73, + "loc": { + "start": { + "line": 2, + "column": 48 + }, + "end": { + "line": 2, + "column": 50 + } + }, + "expression": { + "type": "PipelinePrimaryTopicReference", + "start": 71, + "end": 72, + "loc": { + "start": { + "line": 2, + "column": 48 + }, + "end": { + "line": 2, + "column": 49 + } + } + } + } + } + ], + "directives": [] + } + } + } + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-for-classic-loop,-outer-topic-reference-in-loop-body/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-for-classic-loop,-outer-topic-reference-in-loop-body/options.json index 35e8658a93da..edb7679c6a74 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-for-classic-loop,-outer-topic-reference-in-loop-body/options.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-for-classic-loop,-outer-topic-reference-in-loop-body/options.json @@ -1,4 +1,3 @@ { - "plugins": [["pipelineOperator", { "proposal": "smart" }], "doExpressions"], - "throws": "Topic reference was used in a lexical context without topic binding (1:45)" + "plugins": [["pipelineOperator", { "proposal": "smart" }], "doExpressions"] } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-for-classic-loop,-outer-topic-reference-in-loop-body/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-for-classic-loop,-outer-topic-reference-in-loop-body/output.json new file mode 100644 index 000000000000..58ca8064b581 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-for-classic-loop,-outer-topic-reference-in-loop-body/output.json @@ -0,0 +1,353 @@ +{ + "type": "File", + "start": 0, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 49 + } + }, + "errors": [ + "SyntaxError: Topic reference was used in a lexical context without topic binding (1:45)", + "SyntaxError: Pipeline is in topic style but does not use topic reference (1:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 49 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 49 + } + }, + "expression": { + "type": "BinaryExpression", + "start": 0, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 49 + } + }, + "left": { + "type": "Identifier", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "value" + }, + "name": "value" + }, + "operator": "|>", + "right": { + "type": "PipelineTopicExpression", + "start": 9, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 49 + } + }, + "expression": { + "type": "DoExpression", + "start": 9, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 49 + } + }, + "body": { + "type": "BlockStatement", + "start": 12, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 49 + } + }, + "body": [ + { + "type": "ForStatement", + "start": 14, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 47 + } + }, + "init": { + "type": "VariableDeclaration", + "start": 19, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 23, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "id": { + "type": "Identifier", + "start": 23, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + }, + "identifierName": "i" + }, + "name": "i" + }, + "init": { + "type": "NumericLiteral", + "start": 27, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + } + ], + "kind": "let" + }, + "test": { + "type": "BinaryExpression", + "start": 30, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "left": { + "type": "Identifier", + "start": 30, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 31 + }, + "identifierName": "i" + }, + "name": "i" + }, + "operator": "<", + "right": { + "type": "Identifier", + "start": 34, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 35 + }, + "identifierName": "n" + }, + "name": "n" + } + }, + "update": { + "type": "AssignmentExpression", + "start": 37, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "operator": "+=", + "left": { + "type": "Identifier", + "start": 37, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 38 + }, + "identifierName": "i" + }, + "name": "i" + }, + "right": { + "type": "NumericLiteral", + "start": 42, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 42 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + }, + "body": { + "type": "ExpressionStatement", + "start": 45, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 45 + }, + "end": { + "line": 1, + "column": 47 + } + }, + "expression": { + "type": "PipelinePrimaryTopicReference", + "start": 45, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 45 + }, + "end": { + "line": 1, + "column": 46 + } + } + } + } + } + ], + "directives": [] + } + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-for-in-loop,-outer-topic-reference-in-loop-body/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-for-in-loop,-outer-topic-reference-in-loop-body/options.json index 6e8b4a6f0d95..edb7679c6a74 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-for-in-loop,-outer-topic-reference-in-loop-body/options.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-for-in-loop,-outer-topic-reference-in-loop-body/options.json @@ -1,4 +1,3 @@ { - "plugins": [["pipelineOperator", { "proposal": "smart" }], "doExpressions"], - "throws": "Topic reference was used in a lexical context without topic binding (1:32)" + "plugins": [["pipelineOperator", { "proposal": "smart" }], "doExpressions"] } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-for-in-loop,-outer-topic-reference-in-loop-body/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-for-in-loop,-outer-topic-reference-in-loop-body/output.json new file mode 100644 index 000000000000..6f197479125e --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-for-in-loop,-outer-topic-reference-in-loop-body/output.json @@ -0,0 +1,214 @@ +{ + "type": "File", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "errors": [ + "SyntaxError: Topic reference was used in a lexical context without topic binding (1:32)", + "SyntaxError: Pipeline is in topic style but does not use topic reference (1:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "expression": { + "type": "BinaryExpression", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "left": { + "type": "Identifier", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "value" + }, + "name": "value" + }, + "operator": "|>", + "right": { + "type": "PipelineTopicExpression", + "start": 9, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "expression": { + "type": "DoExpression", + "start": 9, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "body": { + "type": "BlockStatement", + "start": 12, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "body": [ + { + "type": "ForInStatement", + "start": 14, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "left": { + "type": "Identifier", + "start": 19, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + }, + "identifierName": "e" + }, + "name": "e" + }, + "right": { + "type": "Identifier", + "start": 24, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 30 + }, + "identifierName": "object" + }, + "name": "object" + }, + "body": { + "type": "ExpressionStatement", + "start": 32, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "expression": { + "type": "PipelinePrimaryTopicReference", + "start": 32, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 33 + } + } + } + } + } + ], + "directives": [] + } + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-for-of-loop,-outer-topic-reference-in-loop-body/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-for-of-loop,-outer-topic-reference-in-loop-body/options.json index a3707cc91710..edb7679c6a74 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-for-of-loop,-outer-topic-reference-in-loop-body/options.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-for-of-loop,-outer-topic-reference-in-loop-body/options.json @@ -1,4 +1,3 @@ { - "plugins": [["pipelineOperator", { "proposal": "smart" }], "doExpressions"], - "throws": "Topic reference was used in a lexical context without topic binding (1:34)" + "plugins": [["pipelineOperator", { "proposal": "smart" }], "doExpressions"] } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-for-of-loop,-outer-topic-reference-in-loop-body/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-for-of-loop,-outer-topic-reference-in-loop-body/output.json new file mode 100644 index 000000000000..b4bdcb7bcd7d --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-for-of-loop,-outer-topic-reference-in-loop-body/output.json @@ -0,0 +1,215 @@ +{ + "type": "File", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "errors": [ + "SyntaxError: Topic reference was used in a lexical context without topic binding (1:34)", + "SyntaxError: Pipeline is in topic style but does not use topic reference (1:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "expression": { + "type": "BinaryExpression", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "left": { + "type": "Identifier", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "value" + }, + "name": "value" + }, + "operator": "|>", + "right": { + "type": "PipelineTopicExpression", + "start": 9, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "expression": { + "type": "DoExpression", + "start": 9, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "body": { + "type": "BlockStatement", + "start": 12, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "body": [ + { + "type": "ForOfStatement", + "start": 14, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "await": false, + "left": { + "type": "Identifier", + "start": 19, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + }, + "identifierName": "e" + }, + "name": "e" + }, + "right": { + "type": "Identifier", + "start": 24, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 32 + }, + "identifierName": "sequence" + }, + "name": "sequence" + }, + "body": { + "type": "ExpressionStatement", + "start": 34, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "expression": { + "type": "PipelinePrimaryTopicReference", + "start": 34, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 35 + } + } + } + } + } + ], + "directives": [] + } + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-try-statement,-outer-topic-reference-in-catch-clause/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-try-statement,-outer-topic-reference-in-catch-clause/options.json index 0f40a90d2204..edb7679c6a74 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-try-statement,-outer-topic-reference-in-catch-clause/options.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-try-statement,-outer-topic-reference-in-catch-clause/options.json @@ -1,4 +1,3 @@ { - "plugins": [["pipelineOperator", { "proposal": "smart" }], "doExpressions"], - "throws": "Topic reference was used in a lexical context without topic binding (3:32)" + "plugins": [["pipelineOperator", { "proposal": "smart" }], "doExpressions"] } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-try-statement,-outer-topic-reference-in-catch-clause/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-try-statement,-outer-topic-reference-in-catch-clause/output.json new file mode 100644 index 000000000000..f168982f9d91 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-try-statement,-outer-topic-reference-in-catch-clause/output.json @@ -0,0 +1,412 @@ +{ + "type": "File", + "start": 0, + "end": 78, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Topic reference was used in a lexical context without topic binding (3:32)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 78, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 78, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "expression": { + "type": "BinaryExpression", + "start": 0, + "end": 78, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "left": { + "type": "Identifier", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "value" + }, + "name": "value" + }, + "operator": "|>", + "right": { + "type": "PipelineTopicExpression", + "start": 9, + "end": 78, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "expression": { + "type": "DoExpression", + "start": 9, + "end": 78, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": { + "type": "BlockStatement", + "start": 12, + "end": 78, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "TryStatement", + "start": 16, + "end": 76, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 3, + "column": 37 + } + }, + "block": { + "type": "BlockStatement", + "start": 20, + "end": 38, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 24 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 22, + "end": 36, + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "expression": { + "type": "CallExpression", + "start": 22, + "end": 35, + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 21 + } + }, + "callee": { + "type": "MemberExpression", + "start": 22, + "end": 32, + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "object": { + "type": "Identifier", + "start": 22, + "end": 26, + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 12 + }, + "identifierName": "JSON" + }, + "name": "JSON" + }, + "property": { + "type": "Identifier", + "start": 27, + "end": 32, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 18 + }, + "identifierName": "parse" + }, + "name": "parse" + }, + "computed": false + }, + "arguments": [ + { + "type": "PipelinePrimaryTopicReference", + "start": 33, + "end": 34, + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 20 + } + } + } + ] + } + } + ], + "directives": [] + }, + "handler": { + "type": "CatchClause", + "start": 41, + "end": 76, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 37 + } + }, + "param": { + "type": "Identifier", + "start": 48, + "end": 53, + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 14 + }, + "identifierName": "error" + }, + "name": "error" + }, + "body": { + "type": "BlockStatement", + "start": 55, + "end": 76, + "loc": { + "start": { + "line": 3, + "column": 16 + }, + "end": { + "line": 3, + "column": 37 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 57, + "end": 74, + "loc": { + "start": { + "line": 3, + "column": 18 + }, + "end": { + "line": 3, + "column": 35 + } + }, + "expression": { + "type": "CallExpression", + "start": 57, + "end": 73, + "loc": { + "start": { + "line": 3, + "column": 18 + }, + "end": { + "line": 3, + "column": 34 + } + }, + "callee": { + "type": "MemberExpression", + "start": 57, + "end": 70, + "loc": { + "start": { + "line": 3, + "column": 18 + }, + "end": { + "line": 3, + "column": 31 + } + }, + "object": { + "type": "Identifier", + "start": 57, + "end": 64, + "loc": { + "start": { + "line": 3, + "column": 18 + }, + "end": { + "line": 3, + "column": 25 + }, + "identifierName": "console" + }, + "name": "console" + }, + "property": { + "type": "Identifier", + "start": 65, + "end": 70, + "loc": { + "start": { + "line": 3, + "column": 26 + }, + "end": { + "line": 3, + "column": 31 + }, + "identifierName": "error" + }, + "name": "error" + }, + "computed": false + }, + "arguments": [ + { + "type": "PipelinePrimaryTopicReference", + "start": 71, + "end": 72, + "loc": { + "start": { + "line": 3, + "column": 32 + }, + "end": { + "line": 3, + "column": 33 + } + } + } + ] + } + } + ], + "directives": [] + } + }, + "finalizer": null + } + ], + "directives": [] + } + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-while-loop,-outer-topic-reference-in-loop-body/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-while-loop,-outer-topic-reference-in-loop-body/options.json index a3707cc91710..edb7679c6a74 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-while-loop,-outer-topic-reference-in-loop-body/options.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-while-loop,-outer-topic-reference-in-loop-body/options.json @@ -1,4 +1,3 @@ { - "plugins": [["pipelineOperator", { "proposal": "smart" }], "doExpressions"], - "throws": "Topic reference was used in a lexical context without topic binding (1:34)" + "plugins": [["pipelineOperator", { "proposal": "smart" }], "doExpressions"] } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-while-loop,-outer-topic-reference-in-loop-body/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-while-loop,-outer-topic-reference-in-loop-body/output.json new file mode 100644 index 000000000000..899a06650593 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-while-loop,-outer-topic-reference-in-loop-body/output.json @@ -0,0 +1,266 @@ +{ + "type": "File", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "errors": [ + "SyntaxError: Topic reference was used in a lexical context without topic binding (1:34)", + "SyntaxError: Pipeline is in topic style but does not use topic reference (1:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "expression": { + "type": "BinaryExpression", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "left": { + "type": "Identifier", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "value" + }, + "name": "value" + }, + "operator": "|>", + "right": { + "type": "PipelineTopicExpression", + "start": 9, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "expression": { + "type": "DoExpression", + "start": 9, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "body": { + "type": "BlockStatement", + "start": 12, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "body": [ + { + "type": "WhileStatement", + "start": 14, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "test": { + "type": "BinaryExpression", + "start": 21, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "left": { + "type": "Identifier", + "start": 21, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + }, + "identifierName": "x" + }, + "name": "x" + }, + "operator": "<", + "right": { + "type": "NumericLiteral", + "start": 25, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "extra": { + "rawValue": 50, + "raw": "50" + }, + "value": 50 + } + }, + "body": { + "type": "ExpressionStatement", + "start": 29, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 29, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "operator": "+=", + "left": { + "type": "Identifier", + "start": 29, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 30 + }, + "identifierName": "x" + }, + "name": "x" + }, + "right": { + "type": "PipelinePrimaryTopicReference", + "start": 34, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 35 + } + } + } + } + } + } + ], + "directives": [] + } + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-with-statement,-outer-topic-reference-in-with-body/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-with-statement,-outer-topic-reference-in-with-body/options.json index fee1ffebc044..edb7679c6a74 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-with-statement,-outer-topic-reference-in-with-body/options.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-with-statement,-outer-topic-reference-in-with-body/options.json @@ -1,4 +1,3 @@ { - "plugins": [["pipelineOperator", { "proposal": "smart" }], "doExpressions"], - "throws": "Topic reference was used in a lexical context without topic binding (1:24)" + "plugins": [["pipelineOperator", { "proposal": "smart" }], "doExpressions"] } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-with-statement,-outer-topic-reference-in-with-body/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-with-statement,-outer-topic-reference-in-with-body/output.json new file mode 100644 index 000000000000..a185b5983604 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-topic-style,-unbound-topic,-do-expression,-with-statement,-outer-topic-reference-in-with-body/output.json @@ -0,0 +1,196 @@ +{ + "type": "File", + "start": 0, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "errors": [ + "SyntaxError: Topic reference was used in a lexical context without topic binding (1:24)", + "SyntaxError: Pipeline is in topic style but does not use topic reference (1:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "expression": { + "type": "BinaryExpression", + "start": 0, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "left": { + "type": "Identifier", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "value" + }, + "name": "value" + }, + "operator": "|>", + "right": { + "type": "PipelineTopicExpression", + "start": 9, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "expression": { + "type": "DoExpression", + "start": 9, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "body": { + "type": "BlockStatement", + "start": 12, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "body": [ + { + "type": "WithStatement", + "start": 14, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "object": { + "type": "ObjectExpression", + "start": 20, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "properties": [] + }, + "body": { + "type": "ExpressionStatement", + "start": 24, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "expression": { + "type": "PipelinePrimaryTopicReference", + "start": 24, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + } + } + } + ], + "directives": [] + } + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-unbound-topic,-inner-class-in-pipeline-body/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-unbound-topic,-inner-class-in-pipeline-body/options.json index 6401af97db12..17e4e327bbad 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-unbound-topic,-inner-class-in-pipeline-body/options.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-unbound-topic,-inner-class-in-pipeline-body/options.json @@ -1,4 +1,3 @@ { - "plugins": [["pipelineOperator", { "proposal": "smart" }]], - "throws": "Topic reference was used in a lexical context without topic binding (1:39)" + "plugins": [["pipelineOperator", { "proposal": "smart" }]] } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-unbound-topic,-inner-class-in-pipeline-body/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-unbound-topic,-inner-class-in-pipeline-body/output.json new file mode 100644 index 000000000000..64fb49d7358b --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-unbound-topic,-inner-class-in-pipeline-body/output.json @@ -0,0 +1,287 @@ +{ + "type": "File", + "start": 0, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 45 + } + }, + "errors": [ + "SyntaxError: Topic reference was used in a lexical context without topic binding (1:39)", + "SyntaxError: Pipeline is in topic style but does not use topic reference (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 45 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 45 + } + }, + "expression": { + "type": "BinaryExpression", + "start": 0, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 45 + } + }, + "left": { + "type": "Identifier", + "start": 0, + "end": 1, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + }, + "identifierName": "x" + }, + "name": "x" + }, + "operator": "|>", + "right": { + "type": "PipelineTopicExpression", + "start": 5, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 45 + } + }, + "expression": { + "type": "ClassExpression", + "start": 5, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 45 + } + }, + "id": null, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 11, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 45 + } + }, + "body": [ + { + "type": "ClassMethod", + "start": 13, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "static": false, + "key": { + "type": "Identifier", + "start": 13, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 24 + }, + "identifierName": "constructor" + }, + "name": "constructor" + }, + "computed": false, + "kind": "constructor", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 28, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 30, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 30, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 30, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "object": { + "type": "ThisExpression", + "start": 30, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + "property": { + "type": "Identifier", + "start": 35, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 36 + }, + "identifierName": "x" + }, + "name": "x" + }, + "computed": false + }, + "right": { + "type": "PipelinePrimaryTopicReference", + "start": 39, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 39 + }, + "end": { + "line": 1, + "column": 40 + } + } + } + } + } + ], + "directives": [] + } + } + ] + } + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-unbound-topic,-inner-function-in-pipeline-body/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-unbound-topic,-inner-function-in-pipeline-body/options.json index e6731253189f..17e4e327bbad 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-unbound-topic,-inner-function-in-pipeline-body/options.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-unbound-topic,-inner-function-in-pipeline-body/options.json @@ -1,4 +1,3 @@ { - "plugins": [["pipelineOperator", { "proposal": "smart" }]], - "throws": "Topic reference was used in a lexical context without topic binding (1:19)" + "plugins": [["pipelineOperator", { "proposal": "smart" }]] } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-unbound-topic,-inner-function-in-pipeline-body/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-unbound-topic,-inner-function-in-pipeline-body/output.json new file mode 100644 index 000000000000..df16ab34e48b --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-unbound-topic,-inner-function-in-pipeline-body/output.json @@ -0,0 +1,169 @@ +{ + "type": "File", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "errors": [ + "SyntaxError: Topic reference was used in a lexical context without topic binding (1:19)", + "SyntaxError: Pipeline is in topic style but does not use topic reference (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "expression": { + "type": "BinaryExpression", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "left": { + "type": "Identifier", + "start": 0, + "end": 1, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + }, + "identifierName": "x" + }, + "name": "x" + }, + "operator": "|>", + "right": { + "type": "PipelineTopicExpression", + "start": 5, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "expression": { + "type": "FunctionExpression", + "start": 5, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 19, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "expression": { + "type": "PipelinePrimaryTopicReference", + "start": 19, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + } + } + ], + "directives": [] + } + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-unbound-topic,-pipeline-head-in-inner-function-in-pipeline-body/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-unbound-topic,-pipeline-head-in-inner-function-in-pipeline-body/options.json index e6731253189f..17e4e327bbad 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-unbound-topic,-pipeline-head-in-inner-function-in-pipeline-body/options.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-unbound-topic,-pipeline-head-in-inner-function-in-pipeline-body/options.json @@ -1,4 +1,3 @@ { - "plugins": [["pipelineOperator", { "proposal": "smart" }]], - "throws": "Topic reference was used in a lexical context without topic binding (1:19)" + "plugins": [["pipelineOperator", { "proposal": "smart" }]] } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-unbound-topic,-pipeline-head-in-inner-function-in-pipeline-body/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-unbound-topic,-pipeline-head-in-inner-function-in-pipeline-body/output.json new file mode 100644 index 000000000000..0023723944ac --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/proposal-smart-error,-unbound-topic,-pipeline-head-in-inner-function-in-pipeline-body/output.json @@ -0,0 +1,215 @@ +{ + "type": "File", + "start": 0, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "errors": [ + "SyntaxError: Topic reference was used in a lexical context without topic binding (1:19)", + "SyntaxError: Pipeline is in topic style but does not use topic reference (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "expression": { + "type": "BinaryExpression", + "start": 0, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "left": { + "type": "Identifier", + "start": 0, + "end": 1, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + }, + "identifierName": "x" + }, + "name": "x" + }, + "operator": "|>", + "right": { + "type": "PipelineTopicExpression", + "start": 5, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "expression": { + "type": "FunctionExpression", + "start": 5, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 19, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "expression": { + "type": "BinaryExpression", + "start": 19, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "left": { + "type": "PipelinePrimaryTopicReference", + "start": 19, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + "operator": "|>", + "right": { + "type": "PipelineTopicExpression", + "start": 24, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "expression": { + "type": "PipelinePrimaryTopicReference", + "start": 24, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + } + } + } + } + ], + "directives": [] + } + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/1/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/1/options.json deleted file mode 100644 index fd4da953a419..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/1/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/1/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/1/output.json new file mode 100644 index 000000000000..f2d99c02f8f3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/1/output.json @@ -0,0 +1,91 @@ +{ + "type": "File", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "expressions": [], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "value": { + "raw": "\\01", + "cooked": null + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/10/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/10/options.json deleted file mode 100644 index fd4da953a419..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/10/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/10/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/10/output.json new file mode 100644 index 000000000000..84ac3db2b3e5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/10/output.json @@ -0,0 +1,132 @@ +{ + "type": "File", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "value": { + "raw": "\\xg", + "cooked": null + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 8, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "raw": "right", + "cooked": "right" + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/11/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/11/options.json deleted file mode 100644 index 27524e2b1f49..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/11/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/11/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/11/output.json new file mode 100644 index 000000000000..ad1bda1a1fbc --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/11/output.json @@ -0,0 +1,132 @@ +{ + "type": "File", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "value": { + "raw": "left", + "cooked": "left" + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 9, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": { + "raw": "\\xg", + "cooked": null + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/12/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/12/options.json deleted file mode 100644 index 27524e2b1f49..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/12/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/12/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/12/output.json new file mode 100644 index 000000000000..5c60a91a9482 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/12/output.json @@ -0,0 +1,172 @@ +{ + "type": "File", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + }, + { + "type": "NumericLiteral", + "start": 14, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "value": { + "raw": "left", + "cooked": "left" + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 9, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": { + "raw": "\\xg", + "cooked": null + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 16, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "value": { + "raw": "right", + "cooked": "right" + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/13/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/13/options.json deleted file mode 100644 index fd4da953a419..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/13/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/13/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/13/output.json new file mode 100644 index 000000000000..76b845845cea --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/13/output.json @@ -0,0 +1,91 @@ +{ + "type": "File", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "expressions": [], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "value": { + "raw": "\\xAg", + "cooked": null + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/14/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/14/options.json deleted file mode 100644 index fd4da953a419..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/14/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/14/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/14/output.json new file mode 100644 index 000000000000..6dd7932c623a --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/14/output.json @@ -0,0 +1,132 @@ +{ + "type": "File", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "value": { + "raw": "\\xAg", + "cooked": null + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "value": { + "raw": "right", + "cooked": "right" + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/15/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/15/options.json deleted file mode 100644 index 27524e2b1f49..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/15/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/15/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/15/output.json new file mode 100644 index 000000000000..46ca5191adb2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/15/output.json @@ -0,0 +1,132 @@ +{ + "type": "File", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "value": { + "raw": "left", + "cooked": "left" + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 9, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "raw": "\\xAg", + "cooked": null + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/16/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/16/options.json deleted file mode 100644 index 27524e2b1f49..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/16/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/16/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/16/output.json new file mode 100644 index 000000000000..b050c973d652 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/16/output.json @@ -0,0 +1,172 @@ +{ + "type": "File", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + }, + { + "type": "NumericLiteral", + "start": 15, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "value": { + "raw": "left", + "cooked": "left" + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 9, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "raw": "\\xAg", + "cooked": null + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 17, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "value": { + "raw": "right", + "cooked": "right" + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/17/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/17/options.json deleted file mode 100644 index fd4da953a419..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/17/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/17/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/17/output.json new file mode 100644 index 000000000000..5876338e6e3c --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/17/output.json @@ -0,0 +1,91 @@ +{ + "type": "File", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "expressions": [], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "value": { + "raw": "\\u0", + "cooked": null + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/18/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/18/options.json deleted file mode 100644 index fd4da953a419..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/18/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/18/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/18/output.json new file mode 100644 index 000000000000..ab51dae8c74a --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/18/output.json @@ -0,0 +1,132 @@ +{ + "type": "File", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "value": { + "raw": "\\u0", + "cooked": null + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 8, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "raw": "right", + "cooked": "right" + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/19/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/19/options.json deleted file mode 100644 index 27524e2b1f49..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/19/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/19/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/19/output.json new file mode 100644 index 000000000000..7e0fe1f7af88 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/19/output.json @@ -0,0 +1,132 @@ +{ + "type": "File", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "value": { + "raw": "left", + "cooked": "left" + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 9, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": { + "raw": "\\u0", + "cooked": null + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/2/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/2/options.json deleted file mode 100644 index fd4da953a419..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/2/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/2/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/2/output.json new file mode 100644 index 000000000000..05034cfa43af --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/2/output.json @@ -0,0 +1,132 @@ +{ + "type": "File", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "value": { + "raw": "\\01", + "cooked": null + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 8, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "raw": "right", + "cooked": "right" + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/20/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/20/options.json deleted file mode 100644 index 27524e2b1f49..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/20/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/20/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/20/output.json new file mode 100644 index 000000000000..4daf639555aa --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/20/output.json @@ -0,0 +1,172 @@ +{ + "type": "File", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + }, + { + "type": "NumericLiteral", + "start": 14, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "value": { + "raw": "left", + "cooked": "left" + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 9, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": { + "raw": "\\u0", + "cooked": null + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 16, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "value": { + "raw": "right", + "cooked": "right" + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/21/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/21/options.json deleted file mode 100644 index fd4da953a419..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/21/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/21/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/21/output.json new file mode 100644 index 000000000000..93487dccb244 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/21/output.json @@ -0,0 +1,91 @@ +{ + "type": "File", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "expressions": [], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "value": { + "raw": "\\u0g", + "cooked": null + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/22/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/22/options.json deleted file mode 100644 index fd4da953a419..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/22/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/22/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/22/output.json new file mode 100644 index 000000000000..d90c680f758c --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/22/output.json @@ -0,0 +1,132 @@ +{ + "type": "File", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "value": { + "raw": "\\u0g", + "cooked": null + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "value": { + "raw": "right", + "cooked": "right" + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/23/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/23/options.json deleted file mode 100644 index 27524e2b1f49..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/23/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/23/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/23/output.json new file mode 100644 index 000000000000..11b9589834ce --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/23/output.json @@ -0,0 +1,132 @@ +{ + "type": "File", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "value": { + "raw": "left", + "cooked": "left" + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 9, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "raw": "\\u0g", + "cooked": null + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/24/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/24/options.json deleted file mode 100644 index 27524e2b1f49..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/24/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/24/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/24/output.json new file mode 100644 index 000000000000..aef068ff0dcb --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/24/output.json @@ -0,0 +1,172 @@ +{ + "type": "File", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + }, + { + "type": "NumericLiteral", + "start": 15, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "value": { + "raw": "left", + "cooked": "left" + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 9, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "raw": "\\u0g", + "cooked": null + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 17, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "value": { + "raw": "right", + "cooked": "right" + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/25/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/25/options.json deleted file mode 100644 index fd4da953a419..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/25/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/25/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/25/output.json new file mode 100644 index 000000000000..83c602cde696 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/25/output.json @@ -0,0 +1,91 @@ +{ + "type": "File", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "expressions": [], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "value": { + "raw": "\\u00g", + "cooked": null + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/26/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/26/options.json deleted file mode 100644 index fd4da953a419..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/26/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/26/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/26/output.json new file mode 100644 index 000000000000..b775d5821aeb --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/26/output.json @@ -0,0 +1,132 @@ +{ + "type": "File", + "start": 0, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 8, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "value": { + "raw": "\\u00g", + "cooked": null + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 10, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "value": { + "raw": "right", + "cooked": "right" + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/27/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/27/options.json deleted file mode 100644 index 27524e2b1f49..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/27/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/27/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/27/output.json new file mode 100644 index 000000000000..7bfe8f7bc378 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/27/output.json @@ -0,0 +1,132 @@ +{ + "type": "File", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "value": { + "raw": "left", + "cooked": "left" + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "value": { + "raw": "\\u00g", + "cooked": null + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/28/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/28/options.json deleted file mode 100644 index 27524e2b1f49..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/28/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/28/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/28/output.json new file mode 100644 index 000000000000..b148595b1c8c --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/28/output.json @@ -0,0 +1,172 @@ +{ + "type": "File", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + }, + { + "type": "NumericLiteral", + "start": 16, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "value": { + "raw": "left", + "cooked": "left" + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "value": { + "raw": "\\u00g", + "cooked": null + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 18, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "value": { + "raw": "right", + "cooked": "right" + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/29/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/29/options.json deleted file mode 100644 index fd4da953a419..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/29/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/29/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/29/output.json new file mode 100644 index 000000000000..b0e6a55f8b9d --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/29/output.json @@ -0,0 +1,91 @@ +{ + "type": "File", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "expressions": [], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "value": { + "raw": "\\u000g", + "cooked": null + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/3/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/3/options.json deleted file mode 100644 index 27524e2b1f49..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/3/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/3/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/3/output.json new file mode 100644 index 000000000000..0d3190ef7f95 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/3/output.json @@ -0,0 +1,132 @@ +{ + "type": "File", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "value": { + "raw": "left", + "cooked": "left" + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 9, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": { + "raw": "\\01", + "cooked": null + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/30/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/30/options.json deleted file mode 100644 index fd4da953a419..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/30/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/30/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/30/output.json new file mode 100644 index 000000000000..a7b5e0bd1bfd --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/30/output.json @@ -0,0 +1,132 @@ +{ + "type": "File", + "start": 0, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "value": { + "raw": "\\u000g", + "cooked": null + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 11, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "value": { + "raw": "right", + "cooked": "right" + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/31/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/31/options.json deleted file mode 100644 index 27524e2b1f49..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/31/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/31/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/31/output.json new file mode 100644 index 000000000000..ac3a71555369 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/31/output.json @@ -0,0 +1,132 @@ +{ + "type": "File", + "start": 0, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "value": { + "raw": "left", + "cooked": "left" + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 9, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "value": { + "raw": "\\u000g", + "cooked": null + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/32/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/32/options.json deleted file mode 100644 index 27524e2b1f49..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/32/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/32/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/32/output.json new file mode 100644 index 000000000000..5163754673d0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/32/output.json @@ -0,0 +1,172 @@ +{ + "type": "File", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + }, + { + "type": "NumericLiteral", + "start": 17, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "value": { + "raw": "left", + "cooked": "left" + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 9, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "value": { + "raw": "\\u000g", + "cooked": null + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 19, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "value": { + "raw": "right", + "cooked": "right" + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/33/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/33/options.json deleted file mode 100644 index fd4da953a419..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/33/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/33/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/33/output.json new file mode 100644 index 000000000000..2273b5e141cf --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/33/output.json @@ -0,0 +1,91 @@ +{ + "type": "File", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "expressions": [], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "value": { + "raw": "\\u{}", + "cooked": null + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/34/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/34/options.json deleted file mode 100644 index fd4da953a419..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/34/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/34/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/34/output.json new file mode 100644 index 000000000000..fecd37e4b169 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/34/output.json @@ -0,0 +1,132 @@ +{ + "type": "File", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "value": { + "raw": "\\u{}", + "cooked": null + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "value": { + "raw": "right", + "cooked": "right" + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/35/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/35/options.json deleted file mode 100644 index 27524e2b1f49..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/35/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/35/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/35/output.json new file mode 100644 index 000000000000..83150d31dec6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/35/output.json @@ -0,0 +1,132 @@ +{ + "type": "File", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "value": { + "raw": "left", + "cooked": "left" + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 9, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "raw": "\\u{}", + "cooked": null + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/36/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/36/options.json deleted file mode 100644 index 27524e2b1f49..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/36/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/36/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/36/output.json new file mode 100644 index 000000000000..f5d1e7ad2ec7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/36/output.json @@ -0,0 +1,172 @@ +{ + "type": "File", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + }, + { + "type": "NumericLiteral", + "start": 15, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "value": { + "raw": "left", + "cooked": "left" + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 9, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "raw": "\\u{}", + "cooked": null + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 17, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "value": { + "raw": "right", + "cooked": "right" + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/37/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/37/options.json deleted file mode 100644 index fd4da953a419..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/37/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/37/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/37/output.json new file mode 100644 index 000000000000..1f51bd46894e --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/37/output.json @@ -0,0 +1,91 @@ +{ + "type": "File", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "expressions": [], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "value": { + "raw": "\\u{-0}", + "cooked": null + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/38/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/38/options.json deleted file mode 100644 index fd4da953a419..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/38/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/38/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/38/output.json new file mode 100644 index 000000000000..2654eccc8ca8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/38/output.json @@ -0,0 +1,132 @@ +{ + "type": "File", + "start": 0, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "value": { + "raw": "\\u{-0}", + "cooked": null + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 11, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "value": { + "raw": "right", + "cooked": "right" + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/39/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/39/options.json deleted file mode 100644 index 27524e2b1f49..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/39/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/39/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/39/output.json new file mode 100644 index 000000000000..b3b301d701b4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/39/output.json @@ -0,0 +1,132 @@ +{ + "type": "File", + "start": 0, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "value": { + "raw": "left", + "cooked": "left" + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 9, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "value": { + "raw": "\\u{-0}", + "cooked": null + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/4/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/4/options.json deleted file mode 100644 index 27524e2b1f49..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/4/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/4/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/4/output.json new file mode 100644 index 000000000000..1d30df1fa402 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/4/output.json @@ -0,0 +1,172 @@ +{ + "type": "File", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + }, + { + "type": "NumericLiteral", + "start": 14, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "value": { + "raw": "left", + "cooked": "left" + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 9, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": { + "raw": "\\01", + "cooked": null + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 16, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "value": { + "raw": "right", + "cooked": "right" + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/40/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/40/options.json deleted file mode 100644 index 27524e2b1f49..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/40/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/40/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/40/output.json new file mode 100644 index 000000000000..124c7c8c9d41 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/40/output.json @@ -0,0 +1,172 @@ +{ + "type": "File", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + }, + { + "type": "NumericLiteral", + "start": 17, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "value": { + "raw": "left", + "cooked": "left" + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 9, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "value": { + "raw": "\\u{-0}", + "cooked": null + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 19, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "value": { + "raw": "right", + "cooked": "right" + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/41/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/41/options.json deleted file mode 100644 index fd4da953a419..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/41/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/41/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/41/output.json new file mode 100644 index 000000000000..e22b35045789 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/41/output.json @@ -0,0 +1,91 @@ +{ + "type": "File", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "expressions": [], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "value": { + "raw": "\\u{g}", + "cooked": null + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/42/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/42/options.json deleted file mode 100644 index fd4da953a419..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/42/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/42/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/42/output.json new file mode 100644 index 000000000000..e25755bdf0c5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/42/output.json @@ -0,0 +1,132 @@ +{ + "type": "File", + "start": 0, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 8, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "value": { + "raw": "\\u{g}", + "cooked": null + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 10, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "value": { + "raw": "right", + "cooked": "right" + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/43/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/43/options.json deleted file mode 100644 index 27524e2b1f49..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/43/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/43/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/43/output.json new file mode 100644 index 000000000000..3dfeb7480fa4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/43/output.json @@ -0,0 +1,132 @@ +{ + "type": "File", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "value": { + "raw": "left", + "cooked": "left" + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "value": { + "raw": "\\u{g}", + "cooked": null + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/44/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/44/options.json deleted file mode 100644 index 27524e2b1f49..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/44/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/44/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/44/output.json new file mode 100644 index 000000000000..8da7d9e51bdf --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/44/output.json @@ -0,0 +1,172 @@ +{ + "type": "File", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + }, + { + "type": "NumericLiteral", + "start": 16, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "value": { + "raw": "left", + "cooked": "left" + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "value": { + "raw": "\\u{g}", + "cooked": null + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 18, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "value": { + "raw": "right", + "cooked": "right" + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/45/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/45/options.json deleted file mode 100644 index fd4da953a419..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/45/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/45/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/45/output.json new file mode 100644 index 000000000000..07b00d61949a --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/45/output.json @@ -0,0 +1,91 @@ +{ + "type": "File", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "expressions": [], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "value": { + "raw": "\\u{", + "cooked": null + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/46/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/46/options.json deleted file mode 100644 index fd4da953a419..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/46/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/46/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/46/output.json new file mode 100644 index 000000000000..b03d29b7821a --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/46/output.json @@ -0,0 +1,132 @@ +{ + "type": "File", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "value": { + "raw": "\\u{", + "cooked": null + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 8, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "raw": "right", + "cooked": "right" + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/47/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/47/options.json deleted file mode 100644 index 27524e2b1f49..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/47/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/47/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/47/output.json new file mode 100644 index 000000000000..dab814bd833d --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/47/output.json @@ -0,0 +1,132 @@ +{ + "type": "File", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "value": { + "raw": "left", + "cooked": "left" + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 9, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": { + "raw": "\\u{", + "cooked": null + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/48/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/48/options.json deleted file mode 100644 index 27524e2b1f49..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/48/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/48/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/48/output.json new file mode 100644 index 000000000000..28b0d47818c9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/48/output.json @@ -0,0 +1,172 @@ +{ + "type": "File", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + }, + { + "type": "NumericLiteral", + "start": 14, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "value": { + "raw": "left", + "cooked": "left" + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 9, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": { + "raw": "\\u{", + "cooked": null + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 16, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "value": { + "raw": "right", + "cooked": "right" + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/49/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/49/options.json deleted file mode 100644 index fd4da953a419..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/49/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/49/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/49/output.json new file mode 100644 index 000000000000..0c1f9bcd5045 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/49/output.json @@ -0,0 +1,91 @@ +{ + "type": "File", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "expressions": [], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "value": { + "raw": "\\u{\\\\", + "cooked": null + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/5/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/5/options.json deleted file mode 100644 index fd4da953a419..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/5/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/5/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/5/output.json new file mode 100644 index 000000000000..6ce800288f9a --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/5/output.json @@ -0,0 +1,91 @@ +{ + "type": "File", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "expressions": [], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "value": { + "raw": "\\1", + "cooked": null + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/50/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/50/options.json deleted file mode 100644 index fd4da953a419..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/50/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/50/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/50/output.json new file mode 100644 index 000000000000..2e283e2f77c8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/50/output.json @@ -0,0 +1,132 @@ +{ + "type": "File", + "start": 0, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 8, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "value": { + "raw": "\\u{\\\\", + "cooked": null + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 10, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "value": { + "raw": "right", + "cooked": "right" + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/51/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/51/options.json deleted file mode 100644 index 27524e2b1f49..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/51/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/51/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/51/output.json new file mode 100644 index 000000000000..151b718a43f4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/51/output.json @@ -0,0 +1,132 @@ +{ + "type": "File", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "value": { + "raw": "left", + "cooked": "left" + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "value": { + "raw": "\\u{\\\\", + "cooked": null + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/52/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/52/options.json deleted file mode 100644 index 27524e2b1f49..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/52/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/52/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/52/output.json new file mode 100644 index 000000000000..0ca0c69ed03d --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/52/output.json @@ -0,0 +1,172 @@ +{ + "type": "File", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + }, + { + "type": "NumericLiteral", + "start": 16, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "value": { + "raw": "left", + "cooked": "left" + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "value": { + "raw": "\\u{\\\\", + "cooked": null + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 18, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "value": { + "raw": "right", + "cooked": "right" + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/53/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/53/options.json deleted file mode 100644 index fd4da953a419..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/53/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/53/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/53/output.json new file mode 100644 index 000000000000..eb1dc9edcf28 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/53/output.json @@ -0,0 +1,91 @@ +{ + "type": "File", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "expressions": [], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "value": { + "raw": "\\u{\\`", + "cooked": null + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/54/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/54/options.json deleted file mode 100644 index fd4da953a419..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/54/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/54/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/54/output.json new file mode 100644 index 000000000000..a0df02ed0394 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/54/output.json @@ -0,0 +1,132 @@ +{ + "type": "File", + "start": 0, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 8, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "value": { + "raw": "\\u{\\`", + "cooked": null + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 10, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "value": { + "raw": "right", + "cooked": "right" + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/55/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/55/options.json deleted file mode 100644 index 27524e2b1f49..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/55/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/55/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/55/output.json new file mode 100644 index 000000000000..b757f165c1ee --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/55/output.json @@ -0,0 +1,132 @@ +{ + "type": "File", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "value": { + "raw": "left", + "cooked": "left" + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "value": { + "raw": "\\u{\\`", + "cooked": null + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/56/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/56/options.json deleted file mode 100644 index 27524e2b1f49..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/56/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/56/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/56/output.json new file mode 100644 index 000000000000..8ee240a36baf --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/56/output.json @@ -0,0 +1,172 @@ +{ + "type": "File", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + }, + { + "type": "NumericLiteral", + "start": 16, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "value": { + "raw": "left", + "cooked": "left" + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "value": { + "raw": "\\u{\\`", + "cooked": null + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 18, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "value": { + "raw": "right", + "cooked": "right" + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/57/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/57/options.json deleted file mode 100644 index fd4da953a419..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/57/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/57/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/57/output.json new file mode 100644 index 000000000000..1450743b5caa --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/57/output.json @@ -0,0 +1,91 @@ +{ + "type": "File", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "expressions": [], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "value": { + "raw": "\\u{0", + "cooked": null + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/58/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/58/options.json deleted file mode 100644 index fd4da953a419..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/58/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/58/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/58/output.json new file mode 100644 index 000000000000..24b6f69d7f38 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/58/output.json @@ -0,0 +1,132 @@ +{ + "type": "File", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "value": { + "raw": "\\u{0", + "cooked": null + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 9, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "value": { + "raw": "right", + "cooked": "right" + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/59/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/59/options.json deleted file mode 100644 index 27524e2b1f49..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/59/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/59/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/59/output.json new file mode 100644 index 000000000000..26af843c60e5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/59/output.json @@ -0,0 +1,132 @@ +{ + "type": "File", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "value": { + "raw": "left", + "cooked": "left" + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 9, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "raw": "\\u{0", + "cooked": null + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/6/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/6/options.json deleted file mode 100644 index fd4da953a419..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/6/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/6/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/6/output.json new file mode 100644 index 000000000000..cf4eef5577aa --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/6/output.json @@ -0,0 +1,132 @@ +{ + "type": "File", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "value": { + "raw": "\\1", + "cooked": null + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 7, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": { + "raw": "right", + "cooked": "right" + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/60/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/60/options.json deleted file mode 100644 index 27524e2b1f49..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/60/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/60/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/60/output.json new file mode 100644 index 000000000000..ad94447a587d --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/60/output.json @@ -0,0 +1,172 @@ +{ + "type": "File", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + }, + { + "type": "NumericLiteral", + "start": 15, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "value": { + "raw": "left", + "cooked": "left" + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 9, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "value": { + "raw": "\\u{0", + "cooked": null + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 17, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "value": { + "raw": "right", + "cooked": "right" + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/61/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/61/options.json deleted file mode 100644 index fd4da953a419..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/61/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/61/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/61/output.json new file mode 100644 index 000000000000..c1f7f255feb4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/61/output.json @@ -0,0 +1,91 @@ +{ + "type": "File", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "expressions": [], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "value": { + "raw": "\\u{\\u{0}", + "cooked": null + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/62/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/62/options.json deleted file mode 100644 index fd4da953a419..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/62/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/62/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/62/output.json new file mode 100644 index 000000000000..5782d9c9baef --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/62/output.json @@ -0,0 +1,132 @@ +{ + "type": "File", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 11, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "value": { + "raw": "\\u{\\u{0}", + "cooked": null + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 13, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "value": { + "raw": "right", + "cooked": "right" + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/63/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/63/options.json deleted file mode 100644 index 27524e2b1f49..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/63/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/63/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/63/output.json new file mode 100644 index 000000000000..2c3d41a7a407 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/63/output.json @@ -0,0 +1,132 @@ +{ + "type": "File", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "value": { + "raw": "left", + "cooked": "left" + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 9, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "value": { + "raw": "\\u{\\u{0}", + "cooked": null + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/64/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/64/options.json deleted file mode 100644 index 27524e2b1f49..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/64/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/64/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/64/output.json new file mode 100644 index 000000000000..4dccbdb5cd3d --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/64/output.json @@ -0,0 +1,172 @@ +{ + "type": "File", + "start": 0, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + }, + { + "type": "NumericLiteral", + "start": 19, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "value": { + "raw": "left", + "cooked": "left" + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 9, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "value": { + "raw": "\\u{\\u{0}", + "cooked": null + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 21, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "value": { + "raw": "right", + "cooked": "right" + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/65/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/65/options.json deleted file mode 100644 index fd4da953a419..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/65/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/65/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/65/output.json new file mode 100644 index 000000000000..ae5fba46a8cd --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/65/output.json @@ -0,0 +1,91 @@ +{ + "type": "File", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "expressions": [], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "value": { + "raw": "\\u{110000}", + "cooked": null + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/66/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/66/options.json deleted file mode 100644 index fd4da953a419..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/66/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/66/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/66/output.json new file mode 100644 index 000000000000..ea93f11c4126 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/66/output.json @@ -0,0 +1,132 @@ +{ + "type": "File", + "start": 0, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 13, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "value": { + "raw": "\\u{110000}", + "cooked": null + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 15, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "value": { + "raw": "right", + "cooked": "right" + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/67/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/67/options.json deleted file mode 100644 index 27524e2b1f49..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/67/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/67/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/67/output.json new file mode 100644 index 000000000000..a37b45899de0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/67/output.json @@ -0,0 +1,132 @@ +{ + "type": "File", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "value": { + "raw": "left", + "cooked": "left" + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 9, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "value": { + "raw": "\\u{110000}", + "cooked": null + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/68/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/68/options.json deleted file mode 100644 index 27524e2b1f49..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/68/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/68/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/68/output.json new file mode 100644 index 000000000000..22154057933d --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/68/output.json @@ -0,0 +1,172 @@ +{ + "type": "File", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + }, + { + "type": "NumericLiteral", + "start": 21, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "value": { + "raw": "left", + "cooked": "left" + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 9, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "value": { + "raw": "\\u{110000}", + "cooked": null + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 23, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "value": { + "raw": "right", + "cooked": "right" + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/7/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/7/options.json deleted file mode 100644 index 27524e2b1f49..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/7/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/7/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/7/output.json new file mode 100644 index 000000000000..ce27b82a7d1e --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/7/output.json @@ -0,0 +1,132 @@ +{ + "type": "File", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "value": { + "raw": "left", + "cooked": "left" + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 9, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "value": { + "raw": "\\1", + "cooked": null + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/8/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/8/options.json deleted file mode 100644 index 27524e2b1f49..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/8/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/8/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/8/output.json new file mode 100644 index 000000000000..81d9e807fc24 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/8/output.json @@ -0,0 +1,172 @@ +{ + "type": "File", + "start": 0, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "expressions": [ + { + "type": "NumericLiteral", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + }, + { + "type": "NumericLiteral", + "start": 13, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "value": { + "raw": "left", + "cooked": "left" + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 9, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "value": { + "raw": "\\1", + "cooked": null + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 15, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "value": { + "raw": "right", + "cooked": "right" + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/9/options.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/9/options.json deleted file mode 100644 index fd4da953a419..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/9/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid escape sequence in template (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/9/output.json b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/9/output.json new file mode 100644 index 000000000000..67d2c1d0b2d0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/template-literal-invalid-escapes-untagged/9/output.json @@ -0,0 +1,91 @@ +{ + "type": "File", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "errors": [ + "SyntaxError: Invalid escape sequence in template (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "expressions": [], + "quasis": [ + { + "type": "TemplateElement", + "start": 1, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "value": { + "raw": "\\xg", + "cooked": null + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/top-level-await/inside-arrow/options.json b/packages/babel-parser/test/fixtures/experimental/top-level-await/inside-arrow/options.json index 95eb740f8dfb..64cfc06e5014 100644 --- a/packages/babel-parser/test/fixtures/experimental/top-level-await/inside-arrow/options.json +++ b/packages/babel-parser/test/fixtures/experimental/top-level-await/inside-arrow/options.json @@ -1,5 +1,6 @@ { "plugins": ["topLevelAwait"], "sourceType": "module", + "errorRecovery": false, "throws": "Can not use keyword 'await' outside an async function (1:6)" } diff --git a/packages/babel-parser/test/fixtures/experimental/top-level-await/inside-function/options.json b/packages/babel-parser/test/fixtures/experimental/top-level-await/inside-function/options.json index d09f3f654766..8eade50d15b5 100644 --- a/packages/babel-parser/test/fixtures/experimental/top-level-await/inside-function/options.json +++ b/packages/babel-parser/test/fixtures/experimental/top-level-await/inside-function/options.json @@ -1,5 +1,6 @@ { "plugins": ["topLevelAwait"], "sourceType": "module", + "errorRecovery": false, "throws": "Can not use keyword 'await' outside an async function (2:2)" } diff --git a/packages/babel-parser/test/fixtures/flow/classes/constructor-override-with-class-prop-plugin/options.json b/packages/babel-parser/test/fixtures/flow/classes/constructor-override-with-class-prop-plugin/options.json index 382ffd0c6970..493880101c16 100644 --- a/packages/babel-parser/test/fixtures/flow/classes/constructor-override-with-class-prop-plugin/options.json +++ b/packages/babel-parser/test/fixtures/flow/classes/constructor-override-with-class-prop-plugin/options.json @@ -1,4 +1,8 @@ { - "throws": "Classes may not have a field named 'constructor' (2:2)", - "plugins": ["jsx", "flow", "classProperties"] -} + "sourceType": "module", + "plugins": [ + "jsx", + "flow", + "classProperties" + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/classes/constructor-override-with-class-prop-plugin/output.json b/packages/babel-parser/test/fixtures/flow/classes/constructor-override-with-class-prop-plugin/output.json new file mode 100644 index 000000000000..3d9ad56d93cd --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/classes/constructor-override-with-class-prop-plugin/output.json @@ -0,0 +1,172 @@ +{ + "type": "File", + "start": 0, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Classes may not have a field named 'constructor' (2:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + }, + "identifierName": "Foo" + }, + "name": "Foo" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 10, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ClassProperty", + "start": 14, + "end": 38, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 26 + } + }, + "static": false, + "key": { + "type": "Identifier", + "start": 14, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 13 + }, + "identifierName": "constructor" + }, + "name": "constructor" + }, + "computed": false, + "variance": null, + "typeAnnotation": { + "type": "TypeAnnotation", + "start": 25, + "end": 37, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 25 + } + }, + "typeAnnotation": { + "type": "FunctionTypeAnnotation", + "start": 27, + "end": 37, + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 25 + } + }, + "params": [], + "rest": null, + "returnType": { + "type": "ThisTypeAnnotation", + "start": 33, + "end": 37, + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 25 + } + } + }, + "typeParameters": null + } + }, + "value": null + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/comment/12-line-comment-nested-invalid/options.json b/packages/babel-parser/test/fixtures/flow/comment/12-line-comment-nested-invalid/options.json deleted file mode 100644 index 9a7e0e3402af..000000000000 --- a/packages/babel-parser/test/fixtures/flow/comment/12-line-comment-nested-invalid/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unterminated flow-comment (1:13)" -} diff --git a/packages/babel-parser/test/fixtures/flow/comment/12-line-comment-nested-invalid/output.json b/packages/babel-parser/test/fixtures/flow/comment/12-line-comment-nested-invalid/output.json new file mode 100644 index 000000000000..bd82aabe61e4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/comment/12-line-comment-nested-invalid/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "errors": [ + "SyntaxError: Unterminated flow-comment (1:13)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [], + "directives": [], + "innerComments": [ + { + "type": "CommentLine", + "value": "asd */", + "start": 5, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 13 + } + } + } + ] + }, + "comments": [ + { + "type": "CommentLine", + "value": "asd */", + "start": 5, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 13 + } + } + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/declare-module/invalid-commonjs-module/options.json b/packages/babel-parser/test/fixtures/flow/declare-module/invalid-commonjs-module/options.json deleted file mode 100644 index adfde3236356..000000000000 --- a/packages/babel-parser/test/fixtures/flow/declare-module/invalid-commonjs-module/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Found both `declare module.exports` and `declare export` in the same module. Modules can only have 1 since they are either an ES module or they are a CommonJS module (1:55)" -} diff --git a/packages/babel-parser/test/fixtures/flow/declare-module/invalid-commonjs-module/output.json b/packages/babel-parser/test/fixtures/flow/declare-module/invalid-commonjs-module/output.json new file mode 100644 index 000000000000..43cb8ee092f2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/declare-module/invalid-commonjs-module/output.json @@ -0,0 +1,214 @@ +{ + "type": "File", + "start": 0, + "end": 87, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 87 + } + }, + "errors": [ + "SyntaxError: Found both `declare module.exports` and `declare export` in the same module. Modules can only have 1 since they are either an ES module or they are a CommonJS module (1:55)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 87, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 87 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "DeclareModule", + "start": 0, + "end": 87, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 87 + } + }, + "id": { + "type": "StringLiteral", + "start": 15, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "extra": { + "rawValue": "foo", + "raw": "\"foo\"" + }, + "value": "foo" + }, + "body": { + "type": "BlockStatement", + "start": 21, + "end": 87, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 87 + } + }, + "body": [ + { + "type": "DeclareModuleExports", + "start": 23, + "end": 54, + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 54 + } + }, + "typeAnnotation": { + "type": "TypeAnnotation", + "start": 45, + "end": 53, + "loc": { + "start": { + "line": 1, + "column": 45 + }, + "end": { + "line": 1, + "column": 53 + } + }, + "typeAnnotation": { + "type": "NumberTypeAnnotation", + "start": 47, + "end": 53, + "loc": { + "start": { + "line": 1, + "column": 47 + }, + "end": { + "line": 1, + "column": 53 + } + } + } + } + }, + { + "type": "DeclareExportDeclaration", + "start": 55, + "end": 84, + "loc": { + "start": { + "line": 1, + "column": 55 + }, + "end": { + "line": 1, + "column": 84 + } + }, + "declaration": { + "type": "DeclareVariable", + "start": 70, + "end": 84, + "loc": { + "start": { + "line": 1, + "column": 70 + }, + "end": { + "line": 1, + "column": 84 + } + }, + "id": { + "type": "Identifier", + "start": 74, + "end": 83, + "loc": { + "start": { + "line": 1, + "column": 74 + }, + "end": { + "line": 1, + "column": 83 + }, + "identifierName": "a" + }, + "name": "a", + "typeAnnotation": { + "type": "TypeAnnotation", + "start": 75, + "end": 83, + "loc": { + "start": { + "line": 1, + "column": 75 + }, + "end": { + "line": 1, + "column": 83 + } + }, + "typeAnnotation": { + "type": "NumberTypeAnnotation", + "start": 77, + "end": 83, + "loc": { + "start": { + "line": 1, + "column": 77 + }, + "end": { + "line": 1, + "column": 83 + } + } + } + } + } + }, + "default": false + } + ] + }, + "kind": "ES" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/declare-module/invalid-es-module/options.json b/packages/babel-parser/test/fixtures/flow/declare-module/invalid-es-module/options.json deleted file mode 100644 index b40239a5609c..000000000000 --- a/packages/babel-parser/test/fixtures/flow/declare-module/invalid-es-module/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Found both `declare module.exports` and `declare export` in the same module. Modules can only have 1 since they are either an ES module or they are a CommonJS module (1:53)" -} diff --git a/packages/babel-parser/test/fixtures/flow/declare-module/invalid-es-module/output.json b/packages/babel-parser/test/fixtures/flow/declare-module/invalid-es-module/output.json new file mode 100644 index 000000000000..536157fab722 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/declare-module/invalid-es-module/output.json @@ -0,0 +1,214 @@ +{ + "type": "File", + "start": 0, + "end": 86, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 86 + } + }, + "errors": [ + "SyntaxError: Found both `declare module.exports` and `declare export` in the same module. Modules can only have 1 since they are either an ES module or they are a CommonJS module (1:53)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 86, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 86 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "DeclareModule", + "start": 0, + "end": 86, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 86 + } + }, + "id": { + "type": "StringLiteral", + "start": 15, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "extra": { + "rawValue": "foo", + "raw": "\"foo\"" + }, + "value": "foo" + }, + "body": { + "type": "BlockStatement", + "start": 21, + "end": 86, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 86 + } + }, + "body": [ + { + "type": "DeclareExportDeclaration", + "start": 23, + "end": 52, + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 52 + } + }, + "declaration": { + "type": "DeclareVariable", + "start": 38, + "end": 52, + "loc": { + "start": { + "line": 1, + "column": 38 + }, + "end": { + "line": 1, + "column": 52 + } + }, + "id": { + "type": "Identifier", + "start": 42, + "end": 51, + "loc": { + "start": { + "line": 1, + "column": 42 + }, + "end": { + "line": 1, + "column": 51 + }, + "identifierName": "a" + }, + "name": "a", + "typeAnnotation": { + "type": "TypeAnnotation", + "start": 43, + "end": 51, + "loc": { + "start": { + "line": 1, + "column": 43 + }, + "end": { + "line": 1, + "column": 51 + } + }, + "typeAnnotation": { + "type": "NumberTypeAnnotation", + "start": 45, + "end": 51, + "loc": { + "start": { + "line": 1, + "column": 45 + }, + "end": { + "line": 1, + "column": 51 + } + } + } + } + } + }, + "default": false + }, + { + "type": "DeclareModuleExports", + "start": 53, + "end": 84, + "loc": { + "start": { + "line": 1, + "column": 53 + }, + "end": { + "line": 1, + "column": 84 + } + }, + "typeAnnotation": { + "type": "TypeAnnotation", + "start": 75, + "end": 83, + "loc": { + "start": { + "line": 1, + "column": 75 + }, + "end": { + "line": 1, + "column": 83 + } + }, + "typeAnnotation": { + "type": "NumberTypeAnnotation", + "start": 77, + "end": 83, + "loc": { + "start": { + "line": 1, + "column": 77 + }, + "end": { + "line": 1, + "column": 83 + } + } + } + } + } + ] + }, + "kind": "CommonJS" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/declare-module/invalid-import/options.json b/packages/babel-parser/test/fixtures/flow/declare-module/invalid-import/options.json deleted file mode 100644 index c237bb99a73b..000000000000 --- a/packages/babel-parser/test/fixtures/flow/declare-module/invalid-import/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Imports within a `declare module` body must always be `import type` or `import typeof` (1:21)" -} diff --git a/packages/babel-parser/test/fixtures/flow/declare-module/invalid-import/output.json b/packages/babel-parser/test/fixtures/flow/declare-module/invalid-import/output.json new file mode 100644 index 000000000000..2d33b963c778 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/declare-module/invalid-import/output.json @@ -0,0 +1,161 @@ +{ + "type": "File", + "start": 0, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 42 + } + }, + "errors": [ + "SyntaxError: Imports within a `declare module` body must always be `import type` or `import typeof` (1:21)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 42 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "DeclareModule", + "start": 0, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 42 + } + }, + "id": { + "type": "StringLiteral", + "start": 15, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "extra": { + "rawValue": "M", + "raw": "\"M\"" + }, + "value": "M" + }, + "body": { + "type": "BlockStatement", + "start": 19, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 42 + } + }, + "body": [ + { + "type": "ImportDeclaration", + "start": 21, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start": 28, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "local": { + "type": "Identifier", + "start": 28, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + }, + "identifierName": "T" + }, + "name": "T" + } + } + ], + "importKind": "value", + "source": { + "type": "StringLiteral", + "start": 35, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "extra": { + "rawValue": "TM", + "raw": "\"TM\"" + }, + "value": "TM" + } + } + ] + }, + "kind": "CommonJS" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/declare-module/invalid-module-in-module/options.json b/packages/babel-parser/test/fixtures/flow/declare-module/invalid-module-in-module/options.json deleted file mode 100644 index cd823bd7c4e0..000000000000 --- a/packages/babel-parser/test/fixtures/flow/declare-module/invalid-module-in-module/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "`declare module` cannot be used inside another `declare module` (1:27)" -} diff --git a/packages/babel-parser/test/fixtures/flow/declare-module/invalid-module-in-module/output.json b/packages/babel-parser/test/fixtures/flow/declare-module/invalid-module-in-module/output.json new file mode 100644 index 000000000000..0a3fe70d8611 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/declare-module/invalid-module-in-module/output.json @@ -0,0 +1,137 @@ +{ + "type": "File", + "start": 0, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "errors": [ + "SyntaxError: `declare module` cannot be used inside another `declare module` (1:27)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "DeclareModule", + "start": 0, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "id": { + "type": "Identifier", + "start": 15, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + }, + "identifierName": "A" + }, + "name": "A" + }, + "body": { + "type": "BlockStatement", + "start": 17, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "body": [ + { + "type": "DeclareModule", + "start": 19, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "id": { + "type": "Identifier", + "start": 34, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 35 + }, + "identifierName": "B" + }, + "name": "B" + }, + "body": { + "type": "BlockStatement", + "start": 36, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "body": [] + }, + "kind": "CommonJS" + } + ] + }, + "kind": "CommonJS" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/declare-module/invalid-multiple-commonjs/options.json b/packages/babel-parser/test/fixtures/flow/declare-module/invalid-multiple-commonjs/options.json deleted file mode 100644 index 1520d766b062..000000000000 --- a/packages/babel-parser/test/fixtures/flow/declare-module/invalid-multiple-commonjs/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Duplicate `declare module.exports` statement (1:55)" -} diff --git a/packages/babel-parser/test/fixtures/flow/declare-module/invalid-multiple-commonjs/output.json b/packages/babel-parser/test/fixtures/flow/declare-module/invalid-multiple-commonjs/output.json new file mode 100644 index 000000000000..4339f6dbf5c6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/declare-module/invalid-multiple-commonjs/output.json @@ -0,0 +1,181 @@ +{ + "type": "File", + "start": 0, + "end": 88, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 88 + } + }, + "errors": [ + "SyntaxError: Duplicate `declare module.exports` statement (1:55)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 88, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 88 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "DeclareModule", + "start": 0, + "end": 88, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 88 + } + }, + "id": { + "type": "StringLiteral", + "start": 15, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "extra": { + "rawValue": "foo", + "raw": "\"foo\"" + }, + "value": "foo" + }, + "body": { + "type": "BlockStatement", + "start": 21, + "end": 88, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 88 + } + }, + "body": [ + { + "type": "DeclareModuleExports", + "start": 23, + "end": 54, + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 54 + } + }, + "typeAnnotation": { + "type": "TypeAnnotation", + "start": 45, + "end": 53, + "loc": { + "start": { + "line": 1, + "column": 45 + }, + "end": { + "line": 1, + "column": 53 + } + }, + "typeAnnotation": { + "type": "StringTypeAnnotation", + "start": 47, + "end": 53, + "loc": { + "start": { + "line": 1, + "column": 47 + }, + "end": { + "line": 1, + "column": 53 + } + } + } + } + }, + { + "type": "DeclareModuleExports", + "start": 55, + "end": 86, + "loc": { + "start": { + "line": 1, + "column": 55 + }, + "end": { + "line": 1, + "column": 86 + } + }, + "typeAnnotation": { + "type": "TypeAnnotation", + "start": 77, + "end": 85, + "loc": { + "start": { + "line": 1, + "column": 77 + }, + "end": { + "line": 1, + "column": 85 + } + }, + "typeAnnotation": { + "type": "NumberTypeAnnotation", + "start": 79, + "end": 85, + "loc": { + "start": { + "line": 1, + "column": 79 + }, + "end": { + "line": 1, + "column": 85 + } + } + } + } + } + ] + }, + "kind": "CommonJS" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/boolean-member-not-initialized-explicit/options.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/boolean-member-not-initialized-explicit/options.json index b3b5dfd8b08f..53fd48c051cb 100644 --- a/packages/babel-parser/test/fixtures/flow/enum-declaration/boolean-member-not-initialized-explicit/options.json +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/boolean-member-not-initialized-explicit/options.json @@ -1,4 +1,3 @@ { - "plugins": [["flow", { "enums": true }]], - "throws": "Boolean enum members need to be initialized. Use either `A = true,` or `A = false,` in enum `E`. (2:2)" + "plugins": [["flow", { "enums": true }]] } diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/boolean-member-not-initialized-explicit/output.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/boolean-member-not-initialized-explicit/output.json new file mode 100644 index 000000000000..8ca6221bd05f --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/boolean-member-not-initialized-explicit/output.json @@ -0,0 +1,87 @@ +{ + "type": "File", + "start": 0, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Boolean enum members need to be initialized. Use either `A = true,` or `A = false,` in enum `E`. (2:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "EnumDeclaration", + "start": 0, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "E" + }, + "name": "E" + }, + "body": { + "type": "EnumBooleanBody", + "start": 22, + "end": 24, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 4 + } + }, + "explicitType": true, + "members": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/boolean-member-not-initialized-implicit/options.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/boolean-member-not-initialized-implicit/options.json index b3b5dfd8b08f..53fd48c051cb 100644 --- a/packages/babel-parser/test/fixtures/flow/enum-declaration/boolean-member-not-initialized-implicit/options.json +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/boolean-member-not-initialized-implicit/options.json @@ -1,4 +1,3 @@ { - "plugins": [["flow", { "enums": true }]], - "throws": "Boolean enum members need to be initialized. Use either `A = true,` or `A = false,` in enum `E`. (2:2)" + "plugins": [["flow", { "enums": true }]] } diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/boolean-member-not-initialized-implicit/output.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/boolean-member-not-initialized-implicit/output.json new file mode 100644 index 000000000000..de57afc78eea --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/boolean-member-not-initialized-implicit/output.json @@ -0,0 +1,136 @@ +{ + "type": "File", + "start": 0, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Boolean enum members need to be initialized. Use either `A = true,` or `A = false,` in enum `E`. (2:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "EnumDeclaration", + "start": 0, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "E" + }, + "name": "E" + }, + "body": { + "type": "EnumBooleanBody", + "start": 11, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 3, + "column": 11 + } + }, + "explicitType": false, + "members": [ + { + "type": "EnumBooleanMember", + "start": 16, + "end": 24, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 10 + } + }, + "id": { + "type": "Identifier", + "start": 16, + "end": 17, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 3 + }, + "identifierName": "B" + }, + "name": "B" + }, + "init": { + "type": "BooleanLiteral", + "start": 20, + "end": 24, + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 10 + } + }, + "value": true + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/duplicate-member-name/options.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/duplicate-member-name/options.json index d769b33ba2c2..53fd48c051cb 100644 --- a/packages/babel-parser/test/fixtures/flow/enum-declaration/duplicate-member-name/options.json +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/duplicate-member-name/options.json @@ -1,4 +1,3 @@ { - "plugins": [["flow", { "enums": true }]], - "throws": "Enum member names need to be unique, but the name `A` has already been used before in enum `E`. (3:2)" + "plugins": [["flow", { "enums": true }]] } diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/duplicate-member-name/output.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/duplicate-member-name/output.json new file mode 100644 index 000000000000..419248b77ef1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/duplicate-member-name/output.json @@ -0,0 +1,152 @@ +{ + "type": "File", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Enum member names need to be unique, but the name `A` has already been used before in enum `E`. (3:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "EnumDeclaration", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "E" + }, + "name": "E" + }, + "body": { + "type": "EnumStringBody", + "start": 11, + "end": 18, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 3, + "column": 4 + } + }, + "explicitType": false, + "members": [ + { + "type": "EnumDefaultedMember", + "start": 11, + "end": 12, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 3 + } + }, + "id": { + "type": "Identifier", + "start": 11, + "end": 12, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 3 + }, + "identifierName": "A" + }, + "name": "A" + } + }, + { + "type": "EnumDefaultedMember", + "start": 16, + "end": 17, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 3 + } + }, + "id": { + "type": "Identifier", + "start": 16, + "end": 17, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 3 + }, + "identifierName": "A" + }, + "name": "A" + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/export/options.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/export/options.json index f17ece27cf57..9d3b4fdaaa37 100644 --- a/packages/babel-parser/test/fixtures/flow/enum-declaration/export/options.json +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/export/options.json @@ -1,11 +1,4 @@ { - "plugins": [ - [ - "flow", - { - "enums": true - } - ] - ], + "plugins": [["flow", { "enums": true }]], "sourceType": "module" } diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/inconsistent-member-values-majority-defaulted/options.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/inconsistent-member-values-majority-defaulted/options.json index 3dbe8477d0ab..53fd48c051cb 100644 --- a/packages/babel-parser/test/fixtures/flow/enum-declaration/inconsistent-member-values-majority-defaulted/options.json +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/inconsistent-member-values-majority-defaulted/options.json @@ -1,4 +1,3 @@ { - "plugins": [["flow", { "enums": true }]], - "throws": "Enum `E` has inconsistent member initializers. Either use no initializers, or consistently use literals (either booleans, numbers, or strings) for all member initializers. (1:5)" + "plugins": [["flow", { "enums": true }]] } diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/inconsistent-member-values-majority-defaulted/output.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/inconsistent-member-values-majority-defaulted/output.json new file mode 100644 index 000000000000..b9a7090addd4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/inconsistent-member-values-majority-defaulted/output.json @@ -0,0 +1,87 @@ +{ + "type": "File", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Enum `E` has inconsistent member initializers. Either use no initializers, or consistently use literals (either booleans, numbers, or strings) for all member initializers. (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "EnumDeclaration", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "E" + }, + "name": "E" + }, + "body": { + "type": "EnumStringBody", + "start": 11, + "end": 27, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 4, + "column": 8 + } + }, + "explicitType": false, + "members": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/inconsistent-member-values-mixed-initializers/options.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/inconsistent-member-values-mixed-initializers/options.json index 3dbe8477d0ab..53fd48c051cb 100644 --- a/packages/babel-parser/test/fixtures/flow/enum-declaration/inconsistent-member-values-mixed-initializers/options.json +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/inconsistent-member-values-mixed-initializers/options.json @@ -1,4 +1,3 @@ { - "plugins": [["flow", { "enums": true }]], - "throws": "Enum `E` has inconsistent member initializers. Either use no initializers, or consistently use literals (either booleans, numbers, or strings) for all member initializers. (1:5)" + "plugins": [["flow", { "enums": true }]] } diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/inconsistent-member-values-mixed-initializers/output.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/inconsistent-member-values-mixed-initializers/output.json new file mode 100644 index 000000000000..a6954ed31095 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/inconsistent-member-values-mixed-initializers/output.json @@ -0,0 +1,87 @@ +{ + "type": "File", + "start": 0, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Enum `E` has inconsistent member initializers. Either use no initializers, or consistently use literals (either booleans, numbers, or strings) for all member initializers. (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "EnumDeclaration", + "start": 0, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "E" + }, + "name": "E" + }, + "body": { + "type": "EnumStringBody", + "start": 11, + "end": 29, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 3, + "column": 11 + } + }, + "explicitType": false, + "members": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-explicit-type-identifier/options.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-explicit-type-identifier/options.json index 7684531c52f1..30df8c2ef701 100644 --- a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-explicit-type-identifier/options.json +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-explicit-type-identifier/options.json @@ -1,4 +1,4 @@ { - "plugins": [["flow", { "enums": true }]], - "throws": "Enum type `xxx` is not valid. Use one of `boolean`, `number`, `string`, or `symbol` in enum `E`. (1:10)" -} + "plugins": [["flow", { "enums": true }]] + +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-explicit-type-identifier/output.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-explicit-type-identifier/output.json new file mode 100644 index 000000000000..7b6a1da0ed1f --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-explicit-type-identifier/output.json @@ -0,0 +1,87 @@ +{ + "type": "File", + "start": 0, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Enum type `xxx` is not valid. Use one of `boolean`, `number`, `string`, or `symbol` in enum `E`. (1:14)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "EnumDeclaration", + "start": 0, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "E" + }, + "name": "E" + }, + "body": { + "type": "EnumStringBody", + "start": 16, + "end": 15, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "explicitType": false, + "members": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-boolean-explicit-string/options.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-boolean-explicit-string/options.json index 1587909dd62e..53fd48c051cb 100644 --- a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-boolean-explicit-string/options.json +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-boolean-explicit-string/options.json @@ -1,4 +1,3 @@ { - "plugins": [["flow", { "enums": true }]], - "throws": "Enum `E` has type `string`, so the initializer of `A` needs to be a string literal. (2:6)" + "plugins": [["flow", { "enums": true }]] } diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-boolean-explicit-string/output.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-boolean-explicit-string/output.json new file mode 100644 index 000000000000..a8f898034c39 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-boolean-explicit-string/output.json @@ -0,0 +1,87 @@ +{ + "type": "File", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Enum `E` has type `string`, so the initializer of `A` needs to be a string literal. (2:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "EnumDeclaration", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "E" + }, + "name": "E" + }, + "body": { + "type": "EnumStringBody", + "start": 21, + "end": 30, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "explicitType": true, + "members": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-literal-explicit-symbol/options.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-literal-explicit-symbol/options.json index e9b2692f126a..53fd48c051cb 100644 --- a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-literal-explicit-symbol/options.json +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-literal-explicit-symbol/options.json @@ -1,4 +1,3 @@ { - "plugins": [["flow", { "enums": true }]], - "throws": "Symbol enum members cannot be initialized. Use `A,` in enum `E`. (2:6)" + "plugins": [["flow", { "enums": true }]] } diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-literal-explicit-symbol/output.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-literal-explicit-symbol/output.json new file mode 100644 index 000000000000..4cf1122979e8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-literal-explicit-symbol/output.json @@ -0,0 +1,86 @@ +{ + "type": "File", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Symbol enum members cannot be initialized. Use `A,` in enum `E`. (2:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "EnumDeclaration", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "E" + }, + "name": "E" + }, + "body": { + "type": "EnumSymbolBody", + "start": 21, + "end": 27, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 8 + } + }, + "members": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-number-explicit-boolean/options.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-number-explicit-boolean/options.json index 14ed173defa0..53fd48c051cb 100644 --- a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-number-explicit-boolean/options.json +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-number-explicit-boolean/options.json @@ -1,4 +1,3 @@ { - "plugins": [["flow", { "enums": true }]], - "throws": "Enum `E` has type `boolean`, so the initializer of `A` needs to be a boolean literal. (2:6)" + "plugins": [["flow", { "enums": true }]] } diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-number-explicit-boolean/output.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-number-explicit-boolean/output.json new file mode 100644 index 000000000000..c737d1129440 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-number-explicit-boolean/output.json @@ -0,0 +1,87 @@ +{ + "type": "File", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Enum `E` has type `boolean`, so the initializer of `A` needs to be a boolean literal. (2:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "EnumDeclaration", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "E" + }, + "name": "E" + }, + "body": { + "type": "EnumBooleanBody", + "start": 22, + "end": 28, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 8 + } + }, + "explicitType": true, + "members": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-number-explicit-string/options.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-number-explicit-string/options.json index 1587909dd62e..53fd48c051cb 100644 --- a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-number-explicit-string/options.json +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-number-explicit-string/options.json @@ -1,4 +1,3 @@ { - "plugins": [["flow", { "enums": true }]], - "throws": "Enum `E` has type `string`, so the initializer of `A` needs to be a string literal. (2:6)" + "plugins": [["flow", { "enums": true }]] } diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-number-explicit-string/output.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-number-explicit-string/output.json new file mode 100644 index 000000000000..653573513644 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-number-explicit-string/output.json @@ -0,0 +1,87 @@ +{ + "type": "File", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Enum `E` has type `string`, so the initializer of `A` needs to be a string literal. (2:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "EnumDeclaration", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "E" + }, + "name": "E" + }, + "body": { + "type": "EnumStringBody", + "start": 21, + "end": 27, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 8 + } + }, + "explicitType": true, + "members": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-parenthesized/options.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-parenthesized/options.json index 282f44e03ab4..db9720997638 100644 --- a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-parenthesized/options.json +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-parenthesized/options.json @@ -1,4 +1,4 @@ { "plugins": [["flow", { "enums": true }]], "throws": "The enum member initializer for `A` needs to be a literal (either a boolean, number, or string) in enum `E`. (2:6)" -} +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-string-explicit-boolean/options.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-string-explicit-boolean/options.json index 14ed173defa0..53fd48c051cb 100644 --- a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-string-explicit-boolean/options.json +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-string-explicit-boolean/options.json @@ -1,4 +1,3 @@ { - "plugins": [["flow", { "enums": true }]], - "throws": "Enum `E` has type `boolean`, so the initializer of `A` needs to be a boolean literal. (2:6)" + "plugins": [["flow", { "enums": true }]] } diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-string-explicit-boolean/output.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-string-explicit-boolean/output.json new file mode 100644 index 000000000000..2f1b07d00c15 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-string-explicit-boolean/output.json @@ -0,0 +1,87 @@ +{ + "type": "File", + "start": 0, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Enum `E` has type `boolean`, so the initializer of `A` needs to be a boolean literal. (2:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "EnumDeclaration", + "start": 0, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "E" + }, + "name": "E" + }, + "body": { + "type": "EnumBooleanBody", + "start": 22, + "end": 31, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "explicitType": true, + "members": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-string-explicit-number/options.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-string-explicit-number/options.json index 7a8a81f75442..53fd48c051cb 100644 --- a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-string-explicit-number/options.json +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-string-explicit-number/options.json @@ -1,4 +1,3 @@ { - "plugins": [["flow", { "enums": true }]], - "throws": "Enum `E` has type `number`, so the initializer of `A` needs to be a number literal. (2:6)" + "plugins": [["flow", { "enums": true }]] } diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-string-explicit-number/output.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-string-explicit-number/output.json new file mode 100644 index 000000000000..263ac8c203cb --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-initializer-string-explicit-number/output.json @@ -0,0 +1,87 @@ +{ + "type": "File", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Enum `E` has type `number`, so the initializer of `A` needs to be a number literal. (2:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "EnumDeclaration", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "E" + }, + "name": "E" + }, + "body": { + "type": "EnumNumberBody", + "start": 21, + "end": 30, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "explicitType": true, + "members": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-name/options.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-name/options.json index 3a3974fd4b9d..53fd48c051cb 100644 --- a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-name/options.json +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-name/options.json @@ -1,4 +1,3 @@ { - "plugins": [["flow", { "enums": true }]], - "throws": "Enum member names cannot start with lowercase 'a' through 'z'. Instead of using `foo`, consider using `Foo`, in enum `E`. (2:2)" + "plugins": [["flow", { "enums": true }]] } diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-name/output.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-name/output.json new file mode 100644 index 000000000000..f4f24a70b045 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/invalid-member-name/output.json @@ -0,0 +1,153 @@ +{ + "type": "File", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Enum member names cannot start with lowercase 'a' through 'z'. Instead of using `foo`, consider using `Foo`, in enum `E`. (2:2)", + "SyntaxError: Enum member names cannot start with lowercase 'a' through 'z'. Instead of using `bar`, consider using `Bar`, in enum `E`. (3:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "EnumDeclaration", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "E" + }, + "name": "E" + }, + "body": { + "type": "EnumStringBody", + "start": 11, + "end": 22, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 3, + "column": 6 + } + }, + "explicitType": false, + "members": [ + { + "type": "EnumDefaultedMember", + "start": 11, + "end": 14, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 5 + } + }, + "id": { + "type": "Identifier", + "start": 11, + "end": 14, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 5 + }, + "identifierName": "foo" + }, + "name": "foo" + } + }, + { + "type": "EnumDefaultedMember", + "start": 18, + "end": 21, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 5 + } + }, + "id": { + "type": "Identifier", + "start": 18, + "end": 21, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 5 + }, + "identifierName": "bar" + }, + "name": "bar" + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/number-member-not-initialized-explicit/options.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/number-member-not-initialized-explicit/options.json index b668cbc42536..53fd48c051cb 100644 --- a/packages/babel-parser/test/fixtures/flow/enum-declaration/number-member-not-initialized-explicit/options.json +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/number-member-not-initialized-explicit/options.json @@ -1,4 +1,3 @@ { - "plugins": [["flow", { "enums": true }]], - "throws": "Number enum members need to be initialized, e.g. `A = 1` in enum `E`. (2:2)" + "plugins": [["flow", { "enums": true }]] } diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/number-member-not-initialized-explicit/output.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/number-member-not-initialized-explicit/output.json new file mode 100644 index 000000000000..8408025e1256 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/number-member-not-initialized-explicit/output.json @@ -0,0 +1,87 @@ +{ + "type": "File", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Number enum members need to be initialized, e.g. `A = 1` in enum `E`. (2:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "EnumDeclaration", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "E" + }, + "name": "E" + }, + "body": { + "type": "EnumNumberBody", + "start": 21, + "end": 23, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 4 + } + }, + "explicitType": true, + "members": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/number-member-not-initialized-implicit/options.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/number-member-not-initialized-implicit/options.json index b668cbc42536..53fd48c051cb 100644 --- a/packages/babel-parser/test/fixtures/flow/enum-declaration/number-member-not-initialized-implicit/options.json +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/number-member-not-initialized-implicit/options.json @@ -1,4 +1,3 @@ { - "plugins": [["flow", { "enums": true }]], - "throws": "Number enum members need to be initialized, e.g. `A = 1` in enum `E`. (2:2)" + "plugins": [["flow", { "enums": true }]] } diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/number-member-not-initialized-implicit/output.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/number-member-not-initialized-implicit/output.json new file mode 100644 index 000000000000..67dae3487d84 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/number-member-not-initialized-implicit/output.json @@ -0,0 +1,140 @@ +{ + "type": "File", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Number enum members need to be initialized, e.g. `A = 1` in enum `E`. (2:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "EnumDeclaration", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "E" + }, + "name": "E" + }, + "body": { + "type": "EnumNumberBody", + "start": 11, + "end": 22, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 3, + "column": 8 + } + }, + "explicitType": false, + "members": [ + { + "type": "EnumNumberMember", + "start": 16, + "end": 21, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 7 + } + }, + "id": { + "type": "Identifier", + "start": 16, + "end": 17, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 3 + }, + "identifierName": "B" + }, + "name": "B" + }, + "init": { + "type": "NumericLiteral", + "start": 20, + "end": 21, + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 7 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/reserved-word-enum-name/options.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/reserved-word-enum-name/options.json index 50d57cc99e4d..53fd48c051cb 100644 --- a/packages/babel-parser/test/fixtures/flow/enum-declaration/reserved-word-enum-name/options.json +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/reserved-word-enum-name/options.json @@ -1,4 +1,3 @@ { - "plugins": [["flow", { "enums": true }]], - "throws": "Unexpected keyword 'class' (1:5)" + "plugins": [["flow", { "enums": true }]] } diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/reserved-word-enum-name/output.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/reserved-word-enum-name/output.json new file mode 100644 index 000000000000..f80ecb8f4d3d --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/reserved-word-enum-name/output.json @@ -0,0 +1,87 @@ +{ + "type": "File", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Unexpected keyword 'class' (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "EnumDeclaration", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "class" + }, + "name": "class" + }, + "body": { + "type": "EnumStringBody", + "start": 13, + "end": 12, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "explicitType": false, + "members": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/string-member-inconsistently-initialized-majority-defaulted/options.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/string-member-inconsistently-initialized-majority-defaulted/options.json index 71e396752a2e..53fd48c051cb 100644 --- a/packages/babel-parser/test/fixtures/flow/enum-declaration/string-member-inconsistently-initialized-majority-defaulted/options.json +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/string-member-inconsistently-initialized-majority-defaulted/options.json @@ -1,4 +1,3 @@ { - "plugins": [["flow", { "enums": true }]], - "throws": "String enum members need to consistently either all use initializers, or use no initializers, in enum `E`. (2:2)" + "plugins": [["flow", { "enums": true }]] } diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/string-member-inconsistently-initialized-majority-defaulted/output.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/string-member-inconsistently-initialized-majority-defaulted/output.json new file mode 100644 index 000000000000..f3a0304fb310 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/string-member-inconsistently-initialized-majority-defaulted/output.json @@ -0,0 +1,152 @@ +{ + "type": "File", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "errors": [ + "SyntaxError: String enum members need to consistently either all use initializers, or use no initializers, in enum `E`. (2:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "EnumDeclaration", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "E" + }, + "name": "E" + }, + "body": { + "type": "EnumStringBody", + "start": 21, + "end": 39, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 4, + "column": 4 + } + }, + "explicitType": true, + "members": [ + { + "type": "EnumDefaultedMember", + "start": 32, + "end": 33, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 3 + } + }, + "id": { + "type": "Identifier", + "start": 32, + "end": 33, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 3 + }, + "identifierName": "B" + }, + "name": "B" + } + }, + { + "type": "EnumDefaultedMember", + "start": 37, + "end": 38, + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 4, + "column": 3 + } + }, + "id": { + "type": "Identifier", + "start": 37, + "end": 38, + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 4, + "column": 3 + }, + "identifierName": "C" + }, + "name": "C" + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/string-member-inconsistently-initialized-majority-initialized/options.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/string-member-inconsistently-initialized-majority-initialized/options.json index 71e396752a2e..53fd48c051cb 100644 --- a/packages/babel-parser/test/fixtures/flow/enum-declaration/string-member-inconsistently-initialized-majority-initialized/options.json +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/string-member-inconsistently-initialized-majority-initialized/options.json @@ -1,4 +1,3 @@ { - "plugins": [["flow", { "enums": true }]], - "throws": "String enum members need to consistently either all use initializers, or use no initializers, in enum `E`. (2:2)" + "plugins": [["flow", { "enums": true }]] } diff --git a/packages/babel-parser/test/fixtures/flow/enum-declaration/string-member-inconsistently-initialized-majority-initialized/output.json b/packages/babel-parser/test/fixtures/flow/enum-declaration/string-member-inconsistently-initialized-majority-initialized/output.json new file mode 100644 index 000000000000..9a637136e9c2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/enum-declaration/string-member-inconsistently-initialized-majority-initialized/output.json @@ -0,0 +1,192 @@ +{ + "type": "File", + "start": 0, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "errors": [ + "SyntaxError: String enum members need to consistently either all use initializers, or use no initializers, in enum `E`. (2:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "EnumDeclaration", + "start": 0, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "E" + }, + "name": "E" + }, + "body": { + "type": "EnumStringBody", + "start": 21, + "end": 45, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 4, + "column": 10 + } + }, + "explicitType": true, + "members": [ + { + "type": "EnumStringMember", + "start": 26, + "end": 33, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 9 + } + }, + "id": { + "type": "Identifier", + "start": 26, + "end": 27, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 3 + }, + "identifierName": "B" + }, + "name": "B" + }, + "init": { + "type": "StringLiteral", + "start": 30, + "end": 33, + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 9 + } + }, + "extra": { + "rawValue": "b", + "raw": "\"b\"" + }, + "value": "b" + } + }, + { + "type": "EnumStringMember", + "start": 37, + "end": 44, + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 4, + "column": 9 + } + }, + "id": { + "type": "Identifier", + "start": 37, + "end": 38, + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 4, + "column": 3 + }, + "identifierName": "C" + }, + "name": "C" + }, + "init": { + "type": "StringLiteral", + "start": 41, + "end": 44, + "loc": { + "start": { + "line": 4, + "column": 6 + }, + "end": { + "line": 4, + "column": 9 + } + }, + "extra": { + "rawValue": "c", + "raw": "\"c\"" + }, + "value": "c" + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects1/options.json b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects1/options.json index c9188366d4e8..2104ca43283f 100644 --- a/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects1/options.json +++ b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects1/options.json @@ -1,5 +1,3 @@ { - "sourceType": "module", - "plugins": ["jsx", "flow"], - "throws": "Spread operator cannot appear in class or interface definitions (3:2)" + "sourceType": "module" } diff --git a/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects1/output.json b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects1/output.json new file mode 100644 index 000000000000..f896b9fffbcb --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects1/output.json @@ -0,0 +1,130 @@ +{ + "type": "File", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Explicit inexact syntax cannot appear in class or interface definitions (3:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "DeclareClass", + "start": 8, + "end": 34, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 22, + "end": 23, + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 15 + }, + "identifierName": "A" + }, + "name": "A" + }, + "typeParameters": null, + "extends": [], + "implements": [], + "mixins": [], + "body": { + "type": "ObjectTypeAnnotation", + "start": 24, + "end": 34, + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false + }, + "leadingComments": [ + { + "type": "CommentLine", + "value": "@flow", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ] + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentLine", + "value": "@flow", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects2/options.json b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects2/options.json index 658f8c434773..2104ca43283f 100644 --- a/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects2/options.json +++ b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects2/options.json @@ -1,5 +1,3 @@ { - "sourceType": "module", - "plugins": ["jsx", "flow"], - "throws": "Spread operator cannot appear in class or interface definitions (4:2)" + "sourceType": "module" } diff --git a/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects2/output.json b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects2/output.json new file mode 100644 index 000000000000..6a0edc43c316 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects2/output.json @@ -0,0 +1,184 @@ +{ + "type": "File", + "start": 0, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Explicit inexact syntax cannot appear in class or interface definitions (4:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "DeclareClass", + "start": 8, + "end": 49, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 22, + "end": 23, + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 15 + }, + "identifierName": "B" + }, + "name": "B" + }, + "typeParameters": null, + "extends": [], + "implements": [], + "mixins": [], + "body": { + "type": "ObjectTypeAnnotation", + "start": 24, + "end": 49, + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "callProperties": [], + "properties": [ + { + "type": "ObjectTypeProperty", + "start": 28, + "end": 39, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 13 + } + }, + "key": { + "type": "Identifier", + "start": 28, + "end": 31, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 5 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "static": false, + "proto": false, + "kind": "init", + "method": false, + "value": { + "type": "NumberTypeAnnotation", + "start": 33, + "end": 39, + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 13 + } + } + }, + "variance": null, + "optional": false + } + ], + "indexers": [], + "internalSlots": [], + "exact": false + }, + "leadingComments": [ + { + "type": "CommentLine", + "value": "@flow", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ] + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentLine", + "value": "@flow", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects3/options.json b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects3/options.json index c9188366d4e8..d822c40fbba2 100644 --- a/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects3/options.json +++ b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects3/options.json @@ -1,5 +1,4 @@ { "sourceType": "module", - "plugins": ["jsx", "flow"], - "throws": "Spread operator cannot appear in class or interface definitions (3:2)" + "plugins": ["jsx", "flow"] } diff --git a/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects3/output.json b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects3/output.json new file mode 100644 index 000000000000..7fa5b4a0b07f --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects3/output.json @@ -0,0 +1,185 @@ +{ + "type": "File", + "start": 0, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Explicit inexact syntax cannot appear in class or interface definitions (3:2)", + "SyntaxError: Explicit inexact syntax must appear at the end of an inexact object (3:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "DeclareClass", + "start": 8, + "end": 49, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 22, + "end": 23, + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 15 + }, + "identifierName": "C" + }, + "name": "C" + }, + "typeParameters": null, + "extends": [], + "implements": [], + "mixins": [], + "body": { + "type": "ObjectTypeAnnotation", + "start": 24, + "end": 49, + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "callProperties": [], + "properties": [ + { + "type": "ObjectTypeProperty", + "start": 35, + "end": 46, + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 4, + "column": 13 + } + }, + "key": { + "type": "Identifier", + "start": 35, + "end": 38, + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 4, + "column": 5 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "static": false, + "proto": false, + "kind": "init", + "method": false, + "value": { + "type": "NumberTypeAnnotation", + "start": 40, + "end": 46, + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 13 + } + } + }, + "variance": null, + "optional": false + } + ], + "indexers": [], + "internalSlots": [], + "exact": false + }, + "leadingComments": [ + { + "type": "CommentLine", + "value": "@flow", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ] + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentLine", + "value": "@flow", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects4/options.json b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects4/options.json index 658f8c434773..d822c40fbba2 100644 --- a/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects4/options.json +++ b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects4/options.json @@ -1,5 +1,4 @@ { "sourceType": "module", - "plugins": ["jsx", "flow"], - "throws": "Spread operator cannot appear in class or interface definitions (4:2)" + "plugins": ["jsx", "flow"] } diff --git a/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects4/output.json b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects4/output.json new file mode 100644 index 000000000000..224a0566437c --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects4/output.json @@ -0,0 +1,238 @@ +{ + "type": "File", + "start": 0, + "end": 64, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 6, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Explicit inexact syntax cannot appear in class or interface definitions (4:2)", + "SyntaxError: Explicit inexact syntax must appear at the end of an inexact object (4:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 64, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 6, + "column": 1 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "DeclareClass", + "start": 8, + "end": 64, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 6, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 22, + "end": 23, + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 15 + }, + "identifierName": "D" + }, + "name": "D" + }, + "typeParameters": null, + "extends": [], + "implements": [], + "mixins": [], + "body": { + "type": "ObjectTypeAnnotation", + "start": 24, + "end": 64, + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 6, + "column": 1 + } + }, + "callProperties": [], + "properties": [ + { + "type": "ObjectTypeProperty", + "start": 28, + "end": 39, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 13 + } + }, + "key": { + "type": "Identifier", + "start": 28, + "end": 31, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 5 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "static": false, + "proto": false, + "kind": "init", + "method": false, + "value": { + "type": "NumberTypeAnnotation", + "start": 33, + "end": 39, + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 13 + } + } + }, + "variance": null, + "optional": false + }, + { + "type": "ObjectTypeProperty", + "start": 50, + "end": 61, + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 13 + } + }, + "key": { + "type": "Identifier", + "start": 50, + "end": 53, + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 5 + }, + "identifierName": "bar" + }, + "name": "bar" + }, + "static": false, + "proto": false, + "kind": "init", + "method": false, + "value": { + "type": "NumberTypeAnnotation", + "start": 55, + "end": 61, + "loc": { + "start": { + "line": 5, + "column": 7 + }, + "end": { + "line": 5, + "column": 13 + } + } + }, + "variance": null, + "optional": false + } + ], + "indexers": [], + "internalSlots": [], + "exact": false + }, + "leadingComments": [ + { + "type": "CommentLine", + "value": "@flow", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ] + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentLine", + "value": "@flow", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects5/options.json b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects5/options.json deleted file mode 100644 index 658f8c434773..000000000000 --- a/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects5/options.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "sourceType": "module", - "plugins": ["jsx", "flow"], - "throws": "Spread operator cannot appear in class or interface definitions (4:2)" -} diff --git a/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects5/output.json b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects5/output.json new file mode 100644 index 000000000000..0f4fe47c8e64 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects5/output.json @@ -0,0 +1,184 @@ +{ + "type": "File", + "start": 0, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Explicit inexact syntax cannot appear in class or interface definitions (4:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "InterfaceDeclaration", + "start": 8, + "end": 45, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 18, + "end": 19, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + }, + "identifierName": "F" + }, + "name": "F" + }, + "typeParameters": null, + "extends": [], + "implements": [], + "mixins": [], + "body": { + "type": "ObjectTypeAnnotation", + "start": 20, + "end": 45, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "callProperties": [], + "properties": [ + { + "type": "ObjectTypeProperty", + "start": 24, + "end": 35, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 13 + } + }, + "key": { + "type": "Identifier", + "start": 24, + "end": 27, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 5 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "static": false, + "proto": false, + "kind": "init", + "method": false, + "value": { + "type": "NumberTypeAnnotation", + "start": 29, + "end": 35, + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 13 + } + } + }, + "variance": null, + "optional": false + } + ], + "indexers": [], + "internalSlots": [], + "exact": false + }, + "leadingComments": [ + { + "type": "CommentLine", + "value": "@flow", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ] + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentLine", + "value": "@flow", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects6/options.json b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects6/options.json index c9188366d4e8..d822c40fbba2 100644 --- a/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects6/options.json +++ b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects6/options.json @@ -1,5 +1,4 @@ { "sourceType": "module", - "plugins": ["jsx", "flow"], - "throws": "Spread operator cannot appear in class or interface definitions (3:2)" + "plugins": ["jsx", "flow"] } diff --git a/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects6/output.json b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects6/output.json new file mode 100644 index 000000000000..685bd5b4d17e --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects6/output.json @@ -0,0 +1,185 @@ +{ + "type": "File", + "start": 0, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Explicit inexact syntax cannot appear in class or interface definitions (3:2)", + "SyntaxError: Explicit inexact syntax must appear at the end of an inexact object (3:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "InterfaceDeclaration", + "start": 8, + "end": 45, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 18, + "end": 19, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + }, + "identifierName": "G" + }, + "name": "G" + }, + "typeParameters": null, + "extends": [], + "implements": [], + "mixins": [], + "body": { + "type": "ObjectTypeAnnotation", + "start": 20, + "end": 45, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "callProperties": [], + "properties": [ + { + "type": "ObjectTypeProperty", + "start": 31, + "end": 42, + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 4, + "column": 13 + } + }, + "key": { + "type": "Identifier", + "start": 31, + "end": 34, + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 4, + "column": 5 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "static": false, + "proto": false, + "kind": "init", + "method": false, + "value": { + "type": "NumberTypeAnnotation", + "start": 36, + "end": 42, + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 13 + } + } + }, + "variance": null, + "optional": false + } + ], + "indexers": [], + "internalSlots": [], + "exact": false + }, + "leadingComments": [ + { + "type": "CommentLine", + "value": "@flow", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ] + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentLine", + "value": "@flow", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects7/options.json b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects7/options.json index 658f8c434773..d822c40fbba2 100644 --- a/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects7/options.json +++ b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects7/options.json @@ -1,5 +1,4 @@ { "sourceType": "module", - "plugins": ["jsx", "flow"], - "throws": "Spread operator cannot appear in class or interface definitions (4:2)" + "plugins": ["jsx", "flow"] } diff --git a/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects7/output.json b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects7/output.json new file mode 100644 index 000000000000..37b85349439d --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_disallowed_in_non_objects7/output.json @@ -0,0 +1,238 @@ +{ + "type": "File", + "start": 0, + "end": 60, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 6, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Explicit inexact syntax cannot appear in class or interface definitions (4:2)", + "SyntaxError: Explicit inexact syntax must appear at the end of an inexact object (4:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 60, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 6, + "column": 1 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "InterfaceDeclaration", + "start": 8, + "end": 60, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 6, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 18, + "end": 19, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + }, + "identifierName": "H" + }, + "name": "H" + }, + "typeParameters": null, + "extends": [], + "implements": [], + "mixins": [], + "body": { + "type": "ObjectTypeAnnotation", + "start": 20, + "end": 60, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 6, + "column": 1 + } + }, + "callProperties": [], + "properties": [ + { + "type": "ObjectTypeProperty", + "start": 24, + "end": 35, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 13 + } + }, + "key": { + "type": "Identifier", + "start": 24, + "end": 27, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 5 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "static": false, + "proto": false, + "kind": "init", + "method": false, + "value": { + "type": "NumberTypeAnnotation", + "start": 29, + "end": 35, + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 13 + } + } + }, + "variance": null, + "optional": false + }, + { + "type": "ObjectTypeProperty", + "start": 46, + "end": 57, + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 13 + } + }, + "key": { + "type": "Identifier", + "start": 46, + "end": 49, + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 5 + }, + "identifierName": "bar" + }, + "name": "bar" + }, + "static": false, + "proto": false, + "kind": "init", + "method": false, + "value": { + "type": "NumberTypeAnnotation", + "start": 51, + "end": 57, + "loc": { + "start": { + "line": 5, + "column": 7 + }, + "end": { + "line": 5, + "column": 13 + } + } + }, + "variance": null, + "optional": false + } + ], + "indexers": [], + "internalSlots": [], + "exact": false + }, + "leadingComments": [ + { + "type": "CommentLine", + "value": "@flow", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ] + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentLine", + "value": "@flow", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_forbidden_in_exact/options.json b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_forbidden_in_exact/options.json index 49936ac94990..d822c40fbba2 100644 --- a/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_forbidden_in_exact/options.json +++ b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_forbidden_in_exact/options.json @@ -1,5 +1,4 @@ { "sourceType": "module", - "plugins": ["jsx", "flow"], - "throws": "Explicit inexact syntax cannot appear inside an explicit exact object type (2:29)" + "plugins": ["jsx", "flow"] } diff --git a/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_forbidden_in_exact/output.json b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_forbidden_in_exact/output.json new file mode 100644 index 000000000000..98ff5ceeead4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_forbidden_in_exact/output.json @@ -0,0 +1,182 @@ +{ + "type": "File", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 31 + } + }, + "errors": [ + "SyntaxError: Explicit inexact syntax cannot appear inside an explicit exact object type (2:25)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 31 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TypeAlias", + "start": 8, + "end": 39, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 31 + } + }, + "id": { + "type": "Identifier", + "start": 13, + "end": 14, + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 6 + }, + "identifierName": "T" + }, + "name": "T" + }, + "typeParameters": null, + "right": { + "type": "ObjectTypeAnnotation", + "start": 17, + "end": 39, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 31 + } + }, + "callProperties": [], + "properties": [ + { + "type": "ObjectTypeProperty", + "start": 20, + "end": 31, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 23 + } + }, + "key": { + "type": "Identifier", + "start": 20, + "end": 23, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 15 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "static": false, + "proto": false, + "kind": "init", + "method": false, + "value": { + "type": "NumberTypeAnnotation", + "start": 25, + "end": 31, + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 23 + } + } + }, + "variance": null, + "optional": false + } + ], + "indexers": [], + "internalSlots": [], + "exact": true, + "inexact": true + }, + "leadingComments": [ + { + "type": "CommentLine", + "value": "@flow", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ] + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentLine", + "value": "@flow", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_must_appear_last/options.json b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_must_appear_last/options.json index ebb74417a527..d822c40fbba2 100644 --- a/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_must_appear_last/options.json +++ b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_must_appear_last/options.json @@ -1,5 +1,4 @@ { "sourceType": "module", - "plugins": ["jsx", "flow"], - "throws": "Explicit inexact syntax must appear at the end of an inexact object (2:15)" + "plugins": ["jsx", "flow"] } diff --git a/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_must_appear_last/output.json b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_must_appear_last/output.json new file mode 100644 index 000000000000..24b9575138dc --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_must_appear_last/output.json @@ -0,0 +1,182 @@ +{ + "type": "File", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 28 + } + }, + "errors": [ + "SyntaxError: Explicit inexact syntax must appear at the end of an inexact object (2:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 28 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TypeAlias", + "start": 8, + "end": 36, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 28 + } + }, + "id": { + "type": "Identifier", + "start": 13, + "end": 14, + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 6 + }, + "identifierName": "T" + }, + "name": "T" + }, + "typeParameters": null, + "right": { + "type": "ObjectTypeAnnotation", + "start": 17, + "end": 35, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 27 + } + }, + "callProperties": [], + "properties": [ + { + "type": "ObjectTypeProperty", + "start": 23, + "end": 34, + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 26 + } + }, + "key": { + "type": "Identifier", + "start": 23, + "end": 26, + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 18 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "static": false, + "proto": false, + "kind": "init", + "method": false, + "value": { + "type": "NumberTypeAnnotation", + "start": 28, + "end": 34, + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 26 + } + } + }, + "variance": null, + "optional": false + } + ], + "indexers": [], + "internalSlots": [], + "exact": false, + "inexact": true + }, + "leadingComments": [ + { + "type": "CommentLine", + "value": "@flow", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ] + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentLine", + "value": "@flow", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_object_invalid1/options.json b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_object_invalid1/options.json index 6d703769bf61..d822c40fbba2 100644 --- a/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_object_invalid1/options.json +++ b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_object_invalid1/options.json @@ -1,5 +1,4 @@ { "sourceType": "module", - "plugins": ["jsx", "flow"], - "throws": "Explicit inexact syntax must appear at the end of an inexact object (2:26)" + "plugins": ["jsx", "flow"] } diff --git a/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_object_invalid1/output.json b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_object_invalid1/output.json new file mode 100644 index 000000000000..8efbd4b84fe9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_object_invalid1/output.json @@ -0,0 +1,235 @@ +{ + "type": "File", + "start": 0, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 37 + } + }, + "errors": [ + "SyntaxError: Explicit inexact syntax must appear at the end of an inexact object (2:21)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 45, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 37 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TypeAlias", + "start": 8, + "end": 45, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 37 + } + }, + "id": { + "type": "Identifier", + "start": 13, + "end": 14, + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 6 + }, + "identifierName": "T" + }, + "name": "T" + }, + "typeParameters": null, + "right": { + "type": "ObjectTypeAnnotation", + "start": 17, + "end": 44, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 36 + } + }, + "callProperties": [], + "properties": [ + { + "type": "ObjectTypeProperty", + "start": 18, + "end": 27, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "key": { + "type": "Identifier", + "start": 18, + "end": 19, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + }, + "identifierName": "x" + }, + "name": "x" + }, + "static": false, + "proto": false, + "kind": "init", + "method": false, + "value": { + "type": "NumberTypeAnnotation", + "start": 21, + "end": 27, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + "variance": null, + "optional": false + }, + { + "type": "ObjectTypeProperty", + "start": 34, + "end": 43, + "loc": { + "start": { + "line": 2, + "column": 26 + }, + "end": { + "line": 2, + "column": 35 + } + }, + "key": { + "type": "Identifier", + "start": 34, + "end": 35, + "loc": { + "start": { + "line": 2, + "column": 26 + }, + "end": { + "line": 2, + "column": 27 + }, + "identifierName": "y" + }, + "name": "y" + }, + "static": false, + "proto": false, + "kind": "init", + "method": false, + "value": { + "type": "NumberTypeAnnotation", + "start": 37, + "end": 43, + "loc": { + "start": { + "line": 2, + "column": 29 + }, + "end": { + "line": 2, + "column": 35 + } + } + }, + "variance": null, + "optional": false + } + ], + "indexers": [], + "internalSlots": [], + "exact": false, + "inexact": true + }, + "leadingComments": [ + { + "type": "CommentLine", + "value": "@flow", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ] + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentLine", + "value": "@flow", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_object_invalid2/options.json b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_object_invalid2/options.json index 6d703769bf61..d822c40fbba2 100644 --- a/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_object_invalid2/options.json +++ b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_object_invalid2/options.json @@ -1,5 +1,4 @@ { "sourceType": "module", - "plugins": ["jsx", "flow"], - "throws": "Explicit inexact syntax must appear at the end of an inexact object (2:26)" + "plugins": ["jsx", "flow"] } diff --git a/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_object_invalid2/output.json b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_object_invalid2/output.json new file mode 100644 index 000000000000..fe5b3ee400f9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_object_invalid2/output.json @@ -0,0 +1,182 @@ +{ + "type": "File", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 31 + } + }, + "errors": [ + "SyntaxError: Explicit inexact syntax must appear at the end of an inexact object (2:21)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 31 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TypeAlias", + "start": 8, + "end": 39, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 31 + } + }, + "id": { + "type": "Identifier", + "start": 13, + "end": 14, + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 6 + }, + "identifierName": "U" + }, + "name": "U" + }, + "typeParameters": null, + "right": { + "type": "ObjectTypeAnnotation", + "start": 17, + "end": 38, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 30 + } + }, + "callProperties": [], + "properties": [ + { + "type": "ObjectTypeProperty", + "start": 18, + "end": 27, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "key": { + "type": "Identifier", + "start": 18, + "end": 19, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + }, + "identifierName": "x" + }, + "name": "x" + }, + "static": false, + "proto": false, + "kind": "init", + "method": false, + "value": { + "type": "NumberTypeAnnotation", + "start": 21, + "end": 27, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + "variance": null, + "optional": false + } + ], + "indexers": [], + "internalSlots": [], + "exact": false, + "inexact": true + }, + "leadingComments": [ + { + "type": "CommentLine", + "value": "@flow", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ] + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentLine", + "value": "@flow", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_object_invalid3/options.json b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_object_invalid3/options.json index 6d703769bf61..d822c40fbba2 100644 --- a/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_object_invalid3/options.json +++ b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_object_invalid3/options.json @@ -1,5 +1,4 @@ { "sourceType": "module", - "plugins": ["jsx", "flow"], - "throws": "Explicit inexact syntax must appear at the end of an inexact object (2:26)" + "plugins": ["jsx", "flow"] } diff --git a/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_object_invalid3/output.json b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_object_invalid3/output.json new file mode 100644 index 000000000000..0bedbf8f82e4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/explicit-inexact-object/explicit_inexact_object_invalid3/output.json @@ -0,0 +1,230 @@ +{ + "type": "File", + "start": 0, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 32 + } + }, + "errors": [ + "SyntaxError: Explicit inexact syntax must appear at the end of an inexact object (2:21)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 32 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TypeAlias", + "start": 8, + "end": 40, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 32 + } + }, + "id": { + "type": "Identifier", + "start": 13, + "end": 14, + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 6 + }, + "identifierName": "V" + }, + "name": "V" + }, + "typeParameters": null, + "right": { + "type": "ObjectTypeAnnotation", + "start": 17, + "end": 39, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 31 + } + }, + "callProperties": [], + "properties": [ + { + "type": "ObjectTypeProperty", + "start": 18, + "end": 27, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "key": { + "type": "Identifier", + "start": 18, + "end": 19, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + }, + "identifierName": "x" + }, + "name": "x" + }, + "static": false, + "proto": false, + "kind": "init", + "method": false, + "value": { + "type": "NumberTypeAnnotation", + "start": 21, + "end": 27, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + "variance": null, + "optional": false + }, + { + "type": "ObjectTypeSpreadProperty", + "start": 34, + "end": 38, + "loc": { + "start": { + "line": 2, + "column": 26 + }, + "end": { + "line": 2, + "column": 30 + } + }, + "argument": { + "type": "GenericTypeAnnotation", + "start": 37, + "end": 38, + "loc": { + "start": { + "line": 2, + "column": 29 + }, + "end": { + "line": 2, + "column": 30 + } + }, + "typeParameters": null, + "id": { + "type": "Identifier", + "start": 37, + "end": 38, + "loc": { + "start": { + "line": 2, + "column": 29 + }, + "end": { + "line": 2, + "column": 30 + }, + "identifierName": "X" + }, + "name": "X" + } + } + } + ], + "indexers": [], + "internalSlots": [], + "exact": false, + "inexact": true + }, + "leadingComments": [ + { + "type": "CommentLine", + "value": "@flow", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ] + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentLine", + "value": "@flow", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/id-reserved-type-invalid/options.json b/packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/id-reserved-type-invalid/options.json deleted file mode 100644 index b945b9a0a123..000000000000 --- a/packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/id-reserved-type-invalid/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Cannot overwrite reserved type string (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/id-reserved-type-invalid/output.json b/packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/id-reserved-type-invalid/output.json new file mode 100644 index 000000000000..b4b12c31dccb --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/id-reserved-type-invalid/output.json @@ -0,0 +1,94 @@ +{ + "type": "File", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "errors": [ + "SyntaxError: Cannot overwrite reserved type string (1:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "InterfaceDeclaration", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "id": { + "type": "Identifier", + "start": 10, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 16 + }, + "identifierName": "string" + }, + "name": "string" + }, + "typeParameters": null, + "extends": [], + "implements": [], + "mixins": [], + "body": { + "type": "ObjectTypeAnnotation", + "start": 17, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/implements-reserved-type-invalid/options.json b/packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/implements-reserved-type-invalid/options.json deleted file mode 100644 index 7aecee1ff0ae..000000000000 --- a/packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/implements-reserved-type-invalid/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Cannot overwrite reserved type string (1:21)" -} diff --git a/packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/implements-reserved-type-invalid/output.json b/packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/implements-reserved-type-invalid/output.json new file mode 100644 index 000000000000..1765354398c7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/interfaces-module-and-script/implements-reserved-type-invalid/output.json @@ -0,0 +1,122 @@ +{ + "type": "File", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "errors": [ + "SyntaxError: Cannot overwrite reserved type string (1:21)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + }, + "identifierName": "Foo" + }, + "name": "Foo" + }, + "superClass": null, + "implements": [ + { + "type": "ClassImplements", + "start": 21, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "id": { + "type": "Identifier", + "start": 21, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 27 + }, + "identifierName": "string" + }, + "name": "string" + }, + "typeParameters": null + } + ], + "body": { + "type": "ClassBody", + "start": 28, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "body": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/iterator/03/options.json b/packages/babel-parser/test/fixtures/flow/iterator/03/options.json deleted file mode 100644 index 7bad2fe143ae..000000000000 --- a/packages/babel-parser/test/fixtures/flow/iterator/03/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid identifier @@asyncIterator (1:19)" -} diff --git a/packages/babel-parser/test/fixtures/flow/iterator/03/output.json b/packages/babel-parser/test/fixtures/flow/iterator/03/output.json new file mode 100644 index 000000000000..cac241733955 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/iterator/03/output.json @@ -0,0 +1,89 @@ +{ + "type": "File", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "errors": [ + "SyntaxError: Invalid identifier @@asyncIterator (1:19)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "id": { + "type": "Identifier", + "start": 4, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 19 + }, + "identifierName": "@@asyncIterator" + }, + "name": "@@asyncIterator" + }, + "init": null + } + ], + "kind": "var" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/iterator/04/options.json b/packages/babel-parser/test/fixtures/flow/iterator/04/options.json deleted file mode 100644 index ae3871cf99a0..000000000000 --- a/packages/babel-parser/test/fixtures/flow/iterator/04/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid identifier @@iterator (1:14)" -} diff --git a/packages/babel-parser/test/fixtures/flow/iterator/04/output.json b/packages/babel-parser/test/fixtures/flow/iterator/04/output.json new file mode 100644 index 000000000000..e86fe7ccc7a0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/iterator/04/output.json @@ -0,0 +1,89 @@ +{ + "type": "File", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "errors": [ + "SyntaxError: Invalid identifier @@iterator (1:14)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "id": { + "type": "Identifier", + "start": 4, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "@@iterator" + }, + "name": "@@iterator" + }, + "init": null + } + ], + "kind": "var" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/iterator/05/options.json b/packages/babel-parser/test/fixtures/flow/iterator/05/options.json deleted file mode 100644 index 9d235ec74a06..000000000000 --- a/packages/babel-parser/test/fixtures/flow/iterator/05/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid identifier @@asyncIterator (2:17)" -} diff --git a/packages/babel-parser/test/fixtures/flow/iterator/05/output.json b/packages/babel-parser/test/fixtures/flow/iterator/05/output.json new file mode 100644 index 000000000000..a5e29cf34dc2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/iterator/05/output.json @@ -0,0 +1,144 @@ +{ + "type": "File", + "start": 0, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Invalid identifier @@asyncIterator (2:17)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "T" + }, + "name": "T" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ClassMethod", + "start": 12, + "end": 31, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 21 + } + }, + "static": false, + "key": { + "type": "Identifier", + "start": 12, + "end": 27, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 17 + }, + "identifierName": "@@asyncIterator" + }, + "name": "@@asyncIterator" + }, + "computed": false, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 29, + "end": 31, + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 21 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/iterator/06/options.json b/packages/babel-parser/test/fixtures/flow/iterator/06/options.json deleted file mode 100644 index 515a2cba19f8..000000000000 --- a/packages/babel-parser/test/fixtures/flow/iterator/06/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid identifier @@iterator (2:12)" -} diff --git a/packages/babel-parser/test/fixtures/flow/iterator/06/output.json b/packages/babel-parser/test/fixtures/flow/iterator/06/output.json new file mode 100644 index 000000000000..08e5603a221c --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/iterator/06/output.json @@ -0,0 +1,144 @@ +{ + "type": "File", + "start": 0, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Invalid identifier @@iterator (2:12)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "T" + }, + "name": "T" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ClassMethod", + "start": 12, + "end": 26, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "static": false, + "key": { + "type": "Identifier", + "start": 12, + "end": 22, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 12 + }, + "identifierName": "@@iterator" + }, + "name": "@@iterator" + }, + "computed": false, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 24, + "end": 26, + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/iterator/07/options.json b/packages/babel-parser/test/fixtures/flow/iterator/07/options.json deleted file mode 100644 index 4c1f323d1622..000000000000 --- a/packages/babel-parser/test/fixtures/flow/iterator/07/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid identifier @@iterator (1:15)" -} diff --git a/packages/babel-parser/test/fixtures/flow/iterator/07/output.json b/packages/babel-parser/test/fixtures/flow/iterator/07/output.json new file mode 100644 index 000000000000..60d612821347 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/iterator/07/output.json @@ -0,0 +1,86 @@ +{ + "type": "File", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "errors": [ + "SyntaxError: Invalid identifier @@iterator (1:15)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TypeAlias", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 15 + }, + "identifierName": "@@iterator" + }, + "name": "@@iterator" + }, + "typeParameters": null, + "right": { + "type": "NumberTypeAnnotation", + "start": 18, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 24 + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/iterator/08/options.json b/packages/babel-parser/test/fixtures/flow/iterator/08/options.json deleted file mode 100644 index 3efa2ffcd0a1..000000000000 --- a/packages/babel-parser/test/fixtures/flow/iterator/08/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid identifier @@asyncIterator (1:20)" -} diff --git a/packages/babel-parser/test/fixtures/flow/iterator/08/output.json b/packages/babel-parser/test/fixtures/flow/iterator/08/output.json new file mode 100644 index 000000000000..3994f46fa03e --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/iterator/08/output.json @@ -0,0 +1,86 @@ +{ + "type": "File", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "errors": [ + "SyntaxError: Invalid identifier @@asyncIterator (1:20)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TypeAlias", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 20 + }, + "identifierName": "@@asyncIterator" + }, + "name": "@@asyncIterator" + }, + "typeParameters": null, + "right": { + "type": "NumberTypeAnnotation", + "start": 23, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 29 + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/iterator/09/options.json b/packages/babel-parser/test/fixtures/flow/iterator/09/options.json deleted file mode 100644 index 515a2cba19f8..000000000000 --- a/packages/babel-parser/test/fixtures/flow/iterator/09/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid identifier @@iterator (2:12)" -} diff --git a/packages/babel-parser/test/fixtures/flow/iterator/09/output.json b/packages/babel-parser/test/fixtures/flow/iterator/09/output.json new file mode 100644 index 000000000000..95c09f5b7c60 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/iterator/09/output.json @@ -0,0 +1,161 @@ +{ + "type": "File", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Invalid identifier @@iterator (2:12)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 4, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "x" + }, + "name": "x" + }, + "init": { + "type": "ObjectExpression", + "start": 8, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "properties": [ + { + "type": "ObjectMethod", + "start": 12, + "end": 27, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 17 + } + }, + "method": true, + "key": { + "type": "Identifier", + "start": 12, + "end": 22, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 12 + }, + "identifierName": "@@iterator" + }, + "name": "@@iterator" + }, + "computed": false, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 25, + "end": 27, + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 17 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "kind": "let" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/iterator/10/options.json b/packages/babel-parser/test/fixtures/flow/iterator/10/options.json deleted file mode 100644 index 9d235ec74a06..000000000000 --- a/packages/babel-parser/test/fixtures/flow/iterator/10/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid identifier @@asyncIterator (2:17)" -} diff --git a/packages/babel-parser/test/fixtures/flow/iterator/10/output.json b/packages/babel-parser/test/fixtures/flow/iterator/10/output.json new file mode 100644 index 000000000000..9e58c564ebbf --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/iterator/10/output.json @@ -0,0 +1,161 @@ +{ + "type": "File", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Invalid identifier @@asyncIterator (2:17)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 4, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "x" + }, + "name": "x" + }, + "init": { + "type": "ObjectExpression", + "start": 8, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "properties": [ + { + "type": "ObjectMethod", + "start": 12, + "end": 32, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "method": true, + "key": { + "type": "Identifier", + "start": 12, + "end": 27, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 17 + }, + "identifierName": "@@asyncIterator" + }, + "name": "@@asyncIterator" + }, + "computed": false, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 30, + "end": 32, + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "kind": "let" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/iterator/11/options.json b/packages/babel-parser/test/fixtures/flow/iterator/11/options.json deleted file mode 100644 index 248b8a4d9d0a..000000000000 --- a/packages/babel-parser/test/fixtures/flow/iterator/11/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid identifier @@random (2:10)" -} diff --git a/packages/babel-parser/test/fixtures/flow/iterator/11/output.json b/packages/babel-parser/test/fixtures/flow/iterator/11/output.json new file mode 100644 index 000000000000..b43086a4226b --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/iterator/11/output.json @@ -0,0 +1,161 @@ +{ + "type": "File", + "start": 0, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Invalid identifier @@random (2:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 4, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "x" + }, + "name": "x" + }, + "init": { + "type": "ObjectExpression", + "start": 8, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "properties": [ + { + "type": "ObjectMethod", + "start": 12, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "method": true, + "key": { + "type": "Identifier", + "start": 12, + "end": 20, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 10 + }, + "identifierName": "@@random" + }, + "name": "@@random" + }, + "computed": false, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 23, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "kind": "let" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/multiple-declarations/class/options.json b/packages/babel-parser/test/fixtures/flow/multiple-declarations/class/options.json index 06ad6ded6032..3962be507d38 100644 --- a/packages/babel-parser/test/fixtures/flow/multiple-declarations/class/options.json +++ b/packages/babel-parser/test/fixtures/flow/multiple-declarations/class/options.json @@ -3,6 +3,5 @@ "plugins": [ "jsx", "flow" - ], - "throws": "Identifier 'C1' has already been declared (2:6)" + ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/multiple-declarations/class/output.json b/packages/babel-parser/test/fixtures/flow/multiple-declarations/class/output.json new file mode 100644 index 000000000000..c350f1ed1904 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/multiple-declarations/class/output.json @@ -0,0 +1,143 @@ +{ + "type": "File", + "start": 0, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "errors": [ + "SyntaxError: Identifier 'C1' has already been declared (2:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "DeclareClass", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "id": { + "type": "Identifier", + "start": 14, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 16 + }, + "identifierName": "C1" + }, + "name": "C1" + }, + "typeParameters": null, + "extends": [], + "implements": [], + "mixins": [], + "body": { + "type": "ObjectTypeAnnotation", + "start": 17, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false + } + }, + { + "type": "ClassDeclaration", + "start": 20, + "end": 31, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "id": { + "type": "Identifier", + "start": 26, + "end": 28, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 8 + }, + "identifierName": "C1" + }, + "name": "C1" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 29, + "end": 31, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "body": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/multiple-declarations/interface/options.json b/packages/babel-parser/test/fixtures/flow/multiple-declarations/interface/options.json index 5672ce1b6444..3962be507d38 100644 --- a/packages/babel-parser/test/fixtures/flow/multiple-declarations/interface/options.json +++ b/packages/babel-parser/test/fixtures/flow/multiple-declarations/interface/options.json @@ -3,6 +3,5 @@ "plugins": [ "jsx", "flow" - ], - "throws": "Identifier 'I' has already been declared (2:10)" + ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/multiple-declarations/interface/output.json b/packages/babel-parser/test/fixtures/flow/multiple-declarations/interface/output.json new file mode 100644 index 000000000000..823ca9be9eac --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/multiple-declarations/interface/output.json @@ -0,0 +1,180 @@ +{ + "type": "File", + "start": 0, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "errors": [ + "SyntaxError: Identifier 'I' has already been declared (2:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "InterfaceDeclaration", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "id": { + "type": "Identifier", + "start": 10, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + }, + "identifierName": "I" + }, + "name": "I" + }, + "typeParameters": null, + "extends": [], + "implements": [], + "mixins": [], + "body": { + "type": "ObjectTypeAnnotation", + "start": 12, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false + } + }, + { + "type": "EmptyStatement", + "start": 14, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "InterfaceDeclaration", + "start": 16, + "end": 30, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "id": { + "type": "Identifier", + "start": 26, + "end": 27, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + }, + "identifierName": "I" + }, + "name": "I" + }, + "typeParameters": null, + "extends": [], + "implements": [], + "mixins": [], + "body": { + "type": "ObjectTypeAnnotation", + "start": 28, + "end": 30, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false + } + }, + { + "type": "EmptyStatement", + "start": 30, + "end": 31, + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 15 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/multiple-declarations/type/options.json b/packages/babel-parser/test/fixtures/flow/multiple-declarations/type/options.json index 946261f4e872..3962be507d38 100644 --- a/packages/babel-parser/test/fixtures/flow/multiple-declarations/type/options.json +++ b/packages/babel-parser/test/fixtures/flow/multiple-declarations/type/options.json @@ -3,6 +3,5 @@ "plugins": [ "jsx", "flow" - ], - "throws": "Identifier 'T1' has already been declared (2:5)" + ] } \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/multiple-declarations/type/output.json b/packages/babel-parser/test/fixtures/flow/multiple-declarations/type/output.json new file mode 100644 index 000000000000..080077918fd1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/multiple-declarations/type/output.json @@ -0,0 +1,134 @@ +{ + "type": "File", + "start": 0, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 17 + } + }, + "errors": [ + "SyntaxError: Identifier 'T1' has already been declared (2:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 17 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TypeAlias", + "start": 0, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "T1" + }, + "name": "T1" + }, + "typeParameters": null, + "right": { + "type": "StringTypeAnnotation", + "start": 10, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 16 + } + } + } + }, + { + "type": "TypeAlias", + "start": 18, + "end": 35, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 17 + } + }, + "id": { + "type": "Identifier", + "start": 23, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 7 + }, + "identifierName": "T1" + }, + "name": "T1" + }, + "typeParameters": null, + "right": { + "type": "NumberTypeAnnotation", + "start": 28, + "end": 34, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 16 + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/object-types/invalid-getter-param-count-rest/options.json b/packages/babel-parser/test/fixtures/flow/object-types/invalid-getter-param-count-rest/options.json deleted file mode 100644 index 65bc24a66fcd..000000000000 --- a/packages/babel-parser/test/fixtures/flow/object-types/invalid-getter-param-count-rest/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "getter must not have any formal parameters (2:2)" -} diff --git a/packages/babel-parser/test/fixtures/flow/object-types/invalid-getter-param-count-rest/output.json b/packages/babel-parser/test/fixtures/flow/object-types/invalid-getter-param-count-rest/output.json new file mode 100644 index 000000000000..efdc8832124e --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/object-types/invalid-getter-param-count-rest/output.json @@ -0,0 +1,212 @@ +{ + "type": "File", + "start": 0, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: getter must not have any formal parameters (2:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TypeAlias", + "start": 0, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "B" + }, + "name": "B" + }, + "typeParameters": null, + "right": { + "type": "ObjectTypeAnnotation", + "start": 9, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "callProperties": [], + "properties": [ + { + "type": "ObjectTypeProperty", + "start": 13, + "end": 34, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 23 + } + }, + "key": { + "type": "Identifier", + "start": 17, + "end": 18, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 7 + }, + "identifierName": "a" + }, + "name": "a" + }, + "static": false, + "proto": false, + "kind": "get", + "method": true, + "value": { + "type": "FunctionTypeAnnotation", + "start": 13, + "end": 34, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 23 + } + }, + "params": [], + "rest": { + "type": "FunctionTypeParam", + "start": 22, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "name": null, + "optional": false, + "typeAnnotation": { + "type": "GenericTypeAnnotation", + "start": 22, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "typeParameters": null, + "id": { + "type": "Identifier", + "start": 22, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 14 + }, + "identifierName": "foo" + }, + "name": "foo" + } + } + }, + "typeParameters": null, + "returnType": { + "type": "NumberTypeAnnotation", + "start": 28, + "end": 34, + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 23 + } + } + } + }, + "optional": false + } + ], + "indexers": [], + "internalSlots": [], + "exact": false, + "inexact": false + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/object-types/invalid-getter-param-count/options.json b/packages/babel-parser/test/fixtures/flow/object-types/invalid-getter-param-count/options.json deleted file mode 100644 index 65bc24a66fcd..000000000000 --- a/packages/babel-parser/test/fixtures/flow/object-types/invalid-getter-param-count/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "getter must not have any formal parameters (2:2)" -} diff --git a/packages/babel-parser/test/fixtures/flow/object-types/invalid-getter-param-count/output.json b/packages/babel-parser/test/fixtures/flow/object-types/invalid-getter-param-count/output.json new file mode 100644 index 000000000000..66bd6ed1baf2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/object-types/invalid-getter-param-count/output.json @@ -0,0 +1,212 @@ +{ + "type": "File", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: getter must not have any formal parameters (2:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TypeAlias", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "B" + }, + "name": "B" + }, + "typeParameters": null, + "right": { + "type": "ObjectTypeAnnotation", + "start": 9, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "callProperties": [], + "properties": [ + { + "type": "ObjectTypeProperty", + "start": 13, + "end": 38, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 27 + } + }, + "key": { + "type": "Identifier", + "start": 17, + "end": 18, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 7 + }, + "identifierName": "a" + }, + "name": "a" + }, + "static": false, + "proto": false, + "kind": "get", + "method": true, + "value": { + "type": "FunctionTypeAnnotation", + "start": 13, + "end": 38, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 27 + } + }, + "params": [ + { + "type": "FunctionTypeParam", + "start": 19, + "end": 29, + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "name": { + "type": "Identifier", + "start": 19, + "end": 22, + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 11 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "optional": false, + "typeAnnotation": { + "type": "NumberTypeAnnotation", + "start": 23, + "end": 29, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 18 + } + } + } + } + ], + "rest": null, + "typeParameters": null, + "returnType": { + "type": "NumberTypeAnnotation", + "start": 32, + "end": 38, + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 27 + } + } + } + }, + "optional": false + } + ], + "indexers": [], + "internalSlots": [], + "exact": false, + "inexact": false + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/object-types/invalid-setter-param-count/options.json b/packages/babel-parser/test/fixtures/flow/object-types/invalid-setter-param-count/options.json deleted file mode 100644 index 6a1567782202..000000000000 --- a/packages/babel-parser/test/fixtures/flow/object-types/invalid-setter-param-count/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "setter must have exactly one formal parameter (2:2)" -} diff --git a/packages/babel-parser/test/fixtures/flow/object-types/invalid-setter-param-count/output.json b/packages/babel-parser/test/fixtures/flow/object-types/invalid-setter-param-count/output.json new file mode 100644 index 000000000000..b79f9a52c897 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/object-types/invalid-setter-param-count/output.json @@ -0,0 +1,163 @@ +{ + "type": "File", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: setter must have exactly one formal parameter (2:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TypeAlias", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "B" + }, + "name": "B" + }, + "typeParameters": null, + "right": { + "type": "ObjectTypeAnnotation", + "start": 9, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "callProperties": [], + "properties": [ + { + "type": "ObjectTypeProperty", + "start": 13, + "end": 26, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "key": { + "type": "Identifier", + "start": 17, + "end": 18, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 7 + }, + "identifierName": "a" + }, + "name": "a" + }, + "static": false, + "proto": false, + "kind": "set", + "method": true, + "value": { + "type": "FunctionTypeAnnotation", + "start": 13, + "end": 26, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "params": [], + "rest": null, + "typeParameters": null, + "returnType": { + "type": "VoidTypeAnnotation", + "start": 22, + "end": 26, + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 15 + } + } + } + }, + "optional": false + } + ], + "indexers": [], + "internalSlots": [], + "exact": false, + "inexact": false + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/object-types/invalid-setter-param-type/options.json b/packages/babel-parser/test/fixtures/flow/object-types/invalid-setter-param-type/options.json deleted file mode 100644 index 15ce6a4c5a51..000000000000 --- a/packages/babel-parser/test/fixtures/flow/object-types/invalid-setter-param-type/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "setter function argument must not be a rest parameter (2:2)" -} diff --git a/packages/babel-parser/test/fixtures/flow/object-types/invalid-setter-param-type/output.json b/packages/babel-parser/test/fixtures/flow/object-types/invalid-setter-param-type/output.json new file mode 100644 index 000000000000..5171dbc8a45f --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/object-types/invalid-setter-param-type/output.json @@ -0,0 +1,212 @@ +{ + "type": "File", + "start": 0, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: setter function argument must not be a rest parameter (2:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TypeAlias", + "start": 0, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "B" + }, + "name": "B" + }, + "typeParameters": null, + "right": { + "type": "ObjectTypeAnnotation", + "start": 9, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "callProperties": [], + "properties": [ + { + "type": "ObjectTypeProperty", + "start": 13, + "end": 30, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "key": { + "type": "Identifier", + "start": 17, + "end": 18, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 7 + }, + "identifierName": "a" + }, + "name": "a" + }, + "static": false, + "proto": false, + "kind": "set", + "method": true, + "value": { + "type": "FunctionTypeAnnotation", + "start": 13, + "end": 30, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "params": [], + "rest": { + "type": "FunctionTypeParam", + "start": 22, + "end": 23, + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 12 + } + }, + "name": null, + "optional": false, + "typeAnnotation": { + "type": "GenericTypeAnnotation", + "start": 22, + "end": 23, + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 12 + } + }, + "typeParameters": null, + "id": { + "type": "Identifier", + "start": 22, + "end": 23, + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 12 + }, + "identifierName": "w" + }, + "name": "w" + } + } + }, + "typeParameters": null, + "returnType": { + "type": "VoidTypeAnnotation", + "start": 26, + "end": 30, + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 19 + } + } + } + }, + "optional": false + } + ], + "indexers": [], + "internalSlots": [], + "exact": false, + "inexact": false + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/opaque-type-alias/reserved-type-invalid/options.json b/packages/babel-parser/test/fixtures/flow/opaque-type-alias/reserved-type-invalid/options.json deleted file mode 100644 index 0c2cdd4d777c..000000000000 --- a/packages/babel-parser/test/fixtures/flow/opaque-type-alias/reserved-type-invalid/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Cannot overwrite reserved type string (1:12)" -} diff --git a/packages/babel-parser/test/fixtures/flow/opaque-type-alias/reserved-type-invalid/output.json b/packages/babel-parser/test/fixtures/flow/opaque-type-alias/reserved-type-invalid/output.json new file mode 100644 index 000000000000..bc568d5767be --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/opaque-type-alias/reserved-type-invalid/output.json @@ -0,0 +1,87 @@ +{ + "type": "File", + "start": 0, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "errors": [ + "SyntaxError: Cannot overwrite reserved type string (1:12)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "OpaqueType", + "start": 0, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "id": { + "type": "Identifier", + "start": 12, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 18 + }, + "identifierName": "string" + }, + "name": "string" + }, + "typeParameters": null, + "supertype": null, + "impltype": { + "type": "NumberTypeAnnotation", + "start": 21, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 27 + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/optional-type/6/options.json b/packages/babel-parser/test/fixtures/flow/optional-type/6/options.json deleted file mode 100644 index fb2831d6188b..000000000000 --- a/packages/babel-parser/test/fixtures/flow/optional-type/6/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "A binding pattern parameter cannot be optional in an implementation signature. (1:11)" -} diff --git a/packages/babel-parser/test/fixtures/flow/optional-type/6/output.json b/packages/babel-parser/test/fixtures/flow/optional-type/6/output.json new file mode 100644 index 000000000000..3ef0fdc07d93 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/optional-type/6/output.json @@ -0,0 +1,124 @@ +{ + "type": "File", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "errors": [ + "SyntaxError: A binding pattern parameter cannot be optional in an implementation signature. (1:11)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "f" + }, + "name": "f" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "ArrayPattern", + "start": 11, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "elements": [], + "optional": true + }, + { + "type": "ObjectPattern", + "start": 16, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "properties": [] + } + ], + "body": { + "type": "BlockStatement", + "start": 20, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/predicates/4/options.json b/packages/babel-parser/test/fixtures/flow/predicates/4/options.json deleted file mode 100644 index cec83fa54fba..000000000000 --- a/packages/babel-parser/test/fixtures/flow/predicates/4/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected token, expected \";\" (1:18)" -} diff --git a/packages/babel-parser/test/fixtures/flow/predicates/4/output.json b/packages/babel-parser/test/fixtures/flow/predicates/4/output.json new file mode 100644 index 000000000000..e1e9eeffbc7b --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/predicates/4/output.json @@ -0,0 +1,241 @@ +{ + "type": "File", + "start": 0, + "end": 54, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 54 + } + }, + "errors": [ + "SyntaxError: Spaces between ´%´ and ´checks´ are not allowed here. (1:20)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 54, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 54 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 54, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 54 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 53, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 53 + } + }, + "id": { + "type": "Identifier", + "start": 4, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "f" + }, + "name": "f" + }, + "init": { + "type": "ArrowFunctionExpression", + "start": 8, + "end": 53, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 53 + } + }, + "predicate": { + "type": "InferredPredicate", + "start": 20, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + "returnType": null, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 9, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 17 + }, + "identifierName": "x" + }, + "name": "x", + "typeAnnotation": { + "type": "TypeAnnotation", + "start": 10, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "typeAnnotation": { + "type": "MixedTypeAnnotation", + "start": 12, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 17 + } + } + } + } + } + ], + "body": { + "type": "BinaryExpression", + "start": 32, + "end": 53, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 53 + } + }, + "left": { + "type": "UnaryExpression", + "start": 32, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "operator": "typeof", + "prefix": true, + "argument": { + "type": "Identifier", + "start": 39, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 39 + }, + "end": { + "line": 1, + "column": 40 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "operator": "===", + "right": { + "type": "StringLiteral", + "start": 45, + "end": 53, + "loc": { + "start": { + "line": 1, + "column": 45 + }, + "end": { + "line": 1, + "column": 53 + } + }, + "extra": { + "rawValue": "string", + "raw": "\"string\"" + }, + "value": "string" + } + } + } + } + ], + "kind": "var" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/predicates/5/options.json b/packages/babel-parser/test/fixtures/flow/predicates/5/options.json deleted file mode 100644 index dbdc7697ac5b..000000000000 --- a/packages/babel-parser/test/fixtures/flow/predicates/5/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Spaces between ´%´ and ´checks´ are not allowed here. (1:17)" -} diff --git a/packages/babel-parser/test/fixtures/flow/predicates/5/output.json b/packages/babel-parser/test/fixtures/flow/predicates/5/output.json new file mode 100644 index 000000000000..0d7a47afacfd --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/predicates/5/output.json @@ -0,0 +1,210 @@ +{ + "type": "File", + "start": 0, + "end": 61, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Spaces between ´%´ and ´checks´ are not allowed here. (1:17)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 61, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 61, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 13, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "x" + }, + "name": "x" + } + ], + "predicate": { + "type": "InferredPredicate", + "start": 17, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + "returnType": null, + "body": { + "type": "BlockStatement", + "start": 26, + "end": 61, + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ReturnStatement", + "start": 30, + "end": 59, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 31 + } + }, + "argument": { + "type": "BinaryExpression", + "start": 37, + "end": 58, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 30 + } + }, + "left": { + "type": "UnaryExpression", + "start": 37, + "end": 45, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 17 + } + }, + "operator": "typeof", + "prefix": true, + "argument": { + "type": "Identifier", + "start": 44, + "end": 45, + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 17 + }, + "identifierName": "x" + }, + "name": "x" + } + }, + "operator": "===", + "right": { + "type": "StringLiteral", + "start": 50, + "end": 58, + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 30 + } + }, + "extra": { + "rawValue": "string", + "raw": "\"string\"" + }, + "value": "string" + } + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/regression/issue-58-ambiguous/options.json b/packages/babel-parser/test/fixtures/flow/regression/issue-58-ambiguous/options.json index 49dc6c3d5a6a..abfcf6f44eba 100644 --- a/packages/babel-parser/test/fixtures/flow/regression/issue-58-ambiguous/options.json +++ b/packages/babel-parser/test/fixtures/flow/regression/issue-58-ambiguous/options.json @@ -1,3 +1,3 @@ { - "throws": "Ambiguous expression: wrap the arrow functions in parentheses to disambiguate. (4:4)" + "throws": "Unexpected token, expected \":\" (4:27)" } diff --git a/packages/babel-parser/test/fixtures/flow/regression/issue-58-failing-1/options.json b/packages/babel-parser/test/fixtures/flow/regression/issue-58-failing-1/options.json deleted file mode 100644 index 215199590424..000000000000 --- a/packages/babel-parser/test/fixtures/flow/regression/issue-58-failing-1/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in arrow function parameters (2:11)" -} diff --git a/packages/babel-parser/test/fixtures/flow/regression/issue-58-failing-1/output.json b/packages/babel-parser/test/fixtures/flow/regression/issue-58-failing-1/output.json new file mode 100644 index 000000000000..598107b6493b --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/regression/issue-58-failing-1/output.json @@ -0,0 +1,233 @@ +{ + "type": "File", + "start": 0, + "end": 67, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 24 + } + }, + "errors": [ + "SyntaxError: Binding invalid left-hand side in function parameter list (2:11)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 67, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 24 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 43, + "end": 67, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 24 + } + }, + "expression": { + "type": "ConditionalExpression", + "start": 43, + "end": 66, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 23 + } + }, + "test": { + "type": "Identifier", + "start": 43, + "end": 44, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 1 + }, + "identifierName": "a" + }, + "name": "a" + }, + "consequent": { + "type": "Identifier", + "start": 48, + "end": 49, + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 6 + }, + "identifierName": "b" + }, + "name": "b", + "extra": { + "parenthesized": true, + "parenStart": 47 + } + }, + "alternate": { + "type": "ArrowFunctionExpression", + "start": 53, + "end": 66, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 23 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "ArrowFunctionExpression", + "start": 54, + "end": 60, + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 17 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 54, + "end": 55, + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 12 + }, + "identifierName": "c" + }, + "name": "c" + } + ], + "body": { + "type": "Identifier", + "start": 59, + "end": 60, + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 17 + }, + "identifierName": "d" + }, + "name": "d" + } + } + ], + "body": { + "type": "Identifier", + "start": 65, + "end": 66, + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 23 + }, + "identifierName": "e" + }, + "name": "e" + } + } + }, + "leadingComments": [ + { + "type": "CommentLine", + "value": " Function which looks like a return type", + "start": 0, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 42 + } + } + } + ] + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentLine", + "value": " Function which looks like a return type", + "start": 0, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 42 + } + } + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/regression/issue-58-failing-2/options.json b/packages/babel-parser/test/fixtures/flow/regression/issue-58-failing-2/options.json deleted file mode 100644 index 36a678e0e538..000000000000 --- a/packages/babel-parser/test/fixtures/flow/regression/issue-58-failing-2/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in arrow function parameters (2:8)" -} diff --git a/packages/babel-parser/test/fixtures/flow/regression/issue-58-failing-2/output.json b/packages/babel-parser/test/fixtures/flow/regression/issue-58-failing-2/output.json new file mode 100644 index 000000000000..c65e342557c3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/regression/issue-58-failing-2/output.json @@ -0,0 +1,353 @@ +{ + "type": "File", + "start": 0, + "end": 83, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 36 + } + }, + "errors": [ + "SyntaxError: Binding invalid left-hand side in function parameter list (2:8)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 83, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 36 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 47, + "end": 83, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 36 + } + }, + "expression": { + "type": "ConditionalExpression", + "start": 47, + "end": 82, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 35 + } + }, + "test": { + "type": "Identifier", + "start": 47, + "end": 48, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 1 + }, + "identifierName": "a" + }, + "name": "a" + }, + "consequent": { + "type": "ArrowFunctionExpression", + "start": 51, + "end": 73, + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 26 + } + }, + "predicate": null, + "returnType": { + "type": "TypeAnnotation", + "start": 63, + "end": 66, + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "typeAnnotation": { + "type": "GenericTypeAnnotation", + "start": 65, + "end": 66, + "loc": { + "start": { + "line": 2, + "column": 18 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "typeParameters": null, + "id": { + "type": "Identifier", + "start": 65, + "end": 66, + "loc": { + "start": { + "line": 2, + "column": 18 + }, + "end": { + "line": 2, + "column": 19 + }, + "identifierName": "d" + }, + "name": "d" + } + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "ArrowFunctionExpression", + "start": 55, + "end": 61, + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 55, + "end": 56, + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 9 + }, + "identifierName": "b" + }, + "name": "b" + } + ], + "body": { + "type": "Identifier", + "start": 60, + "end": 61, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 14 + }, + "identifierName": "c" + }, + "name": "c" + } + } + ], + "body": { + "type": "Identifier", + "start": 71, + "end": 72, + "loc": { + "start": { + "line": 2, + "column": 24 + }, + "end": { + "line": 2, + "column": 25 + }, + "identifierName": "e" + }, + "name": "e", + "extra": { + "parenthesized": true, + "parenStart": 70 + } + }, + "typeParameters": { + "type": "TypeParameterDeclaration", + "start": 51, + "end": 54, + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 7 + } + }, + "params": [ + { + "type": "TypeParameter", + "start": 52, + "end": 53, + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 6 + } + }, + "name": "T", + "variance": null + } + ] + } + }, + "alternate": { + "type": "ArrowFunctionExpression", + "start": 76, + "end": 82, + "loc": { + "start": { + "line": 2, + "column": 29 + }, + "end": { + "line": 2, + "column": 35 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 76, + "end": 77, + "loc": { + "start": { + "line": 2, + "column": 29 + }, + "end": { + "line": 2, + "column": 30 + }, + "identifierName": "f" + }, + "name": "f" + } + ], + "body": { + "type": "Identifier", + "start": 81, + "end": 82, + "loc": { + "start": { + "line": 2, + "column": 34 + }, + "end": { + "line": 2, + "column": 35 + }, + "identifierName": "g" + }, + "name": "g" + } + } + }, + "leadingComments": [ + { + "type": "CommentLine", + "value": " Invalid LHS parameter after type parameters", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 46 + } + } + } + ] + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentLine", + "value": " Invalid LHS parameter after type parameters", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 46 + } + } + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/regression/issue-58-failing-3/options.json b/packages/babel-parser/test/fixtures/flow/regression/issue-58-failing-3/options.json deleted file mode 100644 index 2fc0696df35a..000000000000 --- a/packages/babel-parser/test/fixtures/flow/regression/issue-58-failing-3/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in arrow function parameters (2:5)" -} diff --git a/packages/babel-parser/test/fixtures/flow/regression/issue-58-failing-3/output.json b/packages/babel-parser/test/fixtures/flow/regression/issue-58-failing-3/output.json new file mode 100644 index 000000000000..ae2fe29bafc4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/regression/issue-58-failing-3/output.json @@ -0,0 +1,270 @@ +{ + "type": "File", + "start": 0, + "end": 76, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 29 + } + }, + "errors": [ + "SyntaxError: Binding invalid left-hand side in function parameter list (2:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 76, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 29 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 47, + "end": 76, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 29 + } + }, + "expression": { + "type": "ConditionalExpression", + "start": 47, + "end": 75, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 28 + } + }, + "test": { + "type": "Identifier", + "start": 47, + "end": 48, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 1 + }, + "identifierName": "a" + }, + "name": "a" + }, + "consequent": { + "type": "ArrowFunctionExpression", + "start": 51, + "end": 66, + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "ArrowFunctionExpression", + "start": 52, + "end": 58, + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 52, + "end": 53, + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 6 + }, + "identifierName": "b" + }, + "name": "b" + } + ], + "body": { + "type": "Identifier", + "start": 57, + "end": 58, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + }, + "identifierName": "c" + }, + "name": "c" + } + } + ], + "body": { + "type": "Identifier", + "start": 64, + "end": 65, + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 18 + }, + "identifierName": "e" + }, + "name": "e", + "extra": { + "parenthesized": true, + "parenStart": 63 + } + } + }, + "alternate": { + "type": "ArrowFunctionExpression", + "start": 69, + "end": 75, + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 28 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 69, + "end": 70, + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 23 + }, + "identifierName": "f" + }, + "name": "f" + } + ], + "body": { + "type": "Identifier", + "start": 74, + "end": 75, + "loc": { + "start": { + "line": 2, + "column": 27 + }, + "end": { + "line": 2, + "column": 28 + }, + "identifierName": "g" + }, + "name": "g" + } + } + }, + "leadingComments": [ + { + "type": "CommentLine", + "value": " Invalid LHS parameter after type parameters", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 46 + } + } + } + ] + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentLine", + "value": " Invalid LHS parameter after type parameters", + "start": 0, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 46 + } + } + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/regression/issue-58-failing-4/options.json b/packages/babel-parser/test/fixtures/flow/regression/issue-58-failing-4/options.json deleted file mode 100644 index 215199590424..000000000000 --- a/packages/babel-parser/test/fixtures/flow/regression/issue-58-failing-4/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Invalid left-hand side in arrow function parameters (2:11)" -} diff --git a/packages/babel-parser/test/fixtures/flow/regression/issue-58-failing-4/output.json b/packages/babel-parser/test/fixtures/flow/regression/issue-58-failing-4/output.json new file mode 100644 index 000000000000..2479192b7877 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/regression/issue-58-failing-4/output.json @@ -0,0 +1,270 @@ +{ + "type": "File", + "start": 0, + "end": 60, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 35 + } + }, + "errors": [ + "SyntaxError: Binding invalid left-hand side in function parameter list (2:11)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 60, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 35 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 25, + "end": 60, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 35 + } + }, + "expression": { + "type": "ConditionalExpression", + "start": 25, + "end": 59, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 34 + } + }, + "test": { + "type": "Identifier", + "start": 25, + "end": 26, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 1 + }, + "identifierName": "a" + }, + "name": "a" + }, + "consequent": { + "type": "ArrowFunctionExpression", + "start": 29, + "end": 50, + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 25 + } + }, + "id": null, + "generator": false, + "async": true, + "params": [ + { + "type": "ArrowFunctionExpression", + "start": 36, + "end": 42, + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 17 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 36, + "end": 37, + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 12 + }, + "identifierName": "b" + }, + "name": "b" + } + ], + "body": { + "type": "Identifier", + "start": 41, + "end": 42, + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 17 + }, + "identifierName": "c" + }, + "name": "c" + } + } + ], + "body": { + "type": "Identifier", + "start": 48, + "end": 49, + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 24 + }, + "identifierName": "d" + }, + "name": "d", + "extra": { + "parenthesized": true, + "parenStart": 47 + } + } + }, + "alternate": { + "type": "ArrowFunctionExpression", + "start": 53, + "end": 59, + "loc": { + "start": { + "line": 2, + "column": 28 + }, + "end": { + "line": 2, + "column": 34 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 53, + "end": 54, + "loc": { + "start": { + "line": 2, + "column": 28 + }, + "end": { + "line": 2, + "column": 29 + }, + "identifierName": "f" + }, + "name": "f" + } + ], + "body": { + "type": "Identifier", + "start": 58, + "end": 59, + "loc": { + "start": { + "line": 2, + "column": 33 + }, + "end": { + "line": 2, + "column": 34 + }, + "identifierName": "g" + }, + "name": "g" + } + } + }, + "leadingComments": [ + { + "type": "CommentLine", + "value": " Invalid LHS parameter", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + } + } + ] + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentLine", + "value": " Invalid LHS parameter", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + } + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-const-declare-class/options.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-const-declare-class/options.json index 4a1b4e5c5cd4..3962be507d38 100644 --- a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-const-declare-class/options.json +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-const-declare-class/options.json @@ -1,3 +1,7 @@ { - "throws": "Identifier 'A' has already been declared (2:14)" -} + "sourceType": "module", + "plugins": [ + "jsx", + "flow" + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-const-declare-class/output.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-const-declare-class/output.json new file mode 100644 index 000000000000..a5fb057eb10c --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-const-declare-class/output.json @@ -0,0 +1,164 @@ +{ + "type": "File", + "start": 0, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "errors": [ + "SyntaxError: Identifier 'A' has already been declared (2:14)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 6, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "init": { + "type": "NumericLiteral", + "start": 10, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "const" + }, + { + "type": "DeclareClass", + "start": 13, + "end": 31, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "id": { + "type": "Identifier", + "start": 27, + "end": 28, + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 15 + }, + "identifierName": "A" + }, + "name": "A" + }, + "typeParameters": null, + "extends": [], + "implements": [], + "mixins": [], + "body": { + "type": "ObjectTypeAnnotation", + "start": 29, + "end": 31, + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-const-declare-interface/options.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-const-declare-interface/options.json index 187fea591b95..3962be507d38 100644 --- a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-const-declare-interface/options.json +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-const-declare-interface/options.json @@ -1,3 +1,7 @@ { - "throws": "Identifier 'A' has already been declared (2:18)" -} + "sourceType": "module", + "plugins": [ + "jsx", + "flow" + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-const-declare-interface/output.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-const-declare-interface/output.json new file mode 100644 index 000000000000..93ec46f9bc31 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-const-declare-interface/output.json @@ -0,0 +1,164 @@ +{ + "type": "File", + "start": 0, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "errors": [ + "SyntaxError: Identifier 'A' has already been declared (2:18)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 6, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "init": { + "type": "NumericLiteral", + "start": 10, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "const" + }, + { + "type": "DeclareInterface", + "start": 13, + "end": 35, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "id": { + "type": "Identifier", + "start": 31, + "end": 32, + "loc": { + "start": { + "line": 2, + "column": 18 + }, + "end": { + "line": 2, + "column": 19 + }, + "identifierName": "A" + }, + "name": "A" + }, + "typeParameters": null, + "extends": [], + "implements": [], + "mixins": [], + "body": { + "type": "ObjectTypeAnnotation", + "start": 33, + "end": 35, + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-const-interface/options.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-const-interface/options.json index 04242bd1565b..3962be507d38 100644 --- a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-const-interface/options.json +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-const-interface/options.json @@ -1,3 +1,7 @@ { - "throws": "Identifier 'A' has already been declared (2:10)" -} + "sourceType": "module", + "plugins": [ + "jsx", + "flow" + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-const-interface/output.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-const-interface/output.json new file mode 100644 index 000000000000..9de1cc4338cf --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-const-interface/output.json @@ -0,0 +1,164 @@ +{ + "type": "File", + "start": 0, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "errors": [ + "SyntaxError: Identifier 'A' has already been declared (2:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 6, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "init": { + "type": "NumericLiteral", + "start": 10, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "const" + }, + { + "type": "InterfaceDeclaration", + "start": 13, + "end": 27, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "id": { + "type": "Identifier", + "start": 23, + "end": 24, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + }, + "identifierName": "A" + }, + "name": "A" + }, + "typeParameters": null, + "extends": [], + "implements": [], + "mixins": [], + "body": { + "type": "ObjectTypeAnnotation", + "start": 25, + "end": 27, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-const-opaque-type/options.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-const-opaque-type/options.json deleted file mode 100644 index 81dc2c90799f..000000000000 --- a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-const-opaque-type/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'A' has already been declared (2:12)" -} diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-const-opaque-type/output.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-const-opaque-type/output.json new file mode 100644 index 000000000000..7b807528c3b9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-const-opaque-type/output.json @@ -0,0 +1,163 @@ +{ + "type": "File", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "errors": [ + "SyntaxError: Identifier 'A' has already been declared (2:12)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 6, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "init": { + "type": "NumericLiteral", + "start": 10, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "const" + }, + { + "type": "OpaqueType", + "start": 13, + "end": 32, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "id": { + "type": "Identifier", + "start": 25, + "end": 26, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 13 + }, + "identifierName": "A" + }, + "name": "A" + }, + "typeParameters": null, + "supertype": null, + "impltype": { + "type": "ObjectTypeAnnotation", + "start": 29, + "end": 31, + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false, + "inexact": false + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-const-type/options.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-const-type/options.json deleted file mode 100644 index 1eed93f49a0e..000000000000 --- a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-const-type/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'A' has already been declared (2:5)" -} diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-const-type/output.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-const-type/output.json new file mode 100644 index 000000000000..a69cbb049a89 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-const-type/output.json @@ -0,0 +1,162 @@ +{ + "type": "File", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 12 + } + }, + "errors": [ + "SyntaxError: Identifier 'A' has already been declared (2:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 12 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 6, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "init": { + "type": "NumericLiteral", + "start": 10, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "const" + }, + { + "type": "TypeAlias", + "start": 13, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 12 + } + }, + "id": { + "type": "Identifier", + "start": 18, + "end": 19, + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 6 + }, + "identifierName": "A" + }, + "name": "A" + }, + "typeParameters": null, + "right": { + "type": "ObjectTypeAnnotation", + "start": 22, + "end": 24, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false, + "inexact": false + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-class-declare-interface/options.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-class-declare-interface/options.json index 187fea591b95..3962be507d38 100644 --- a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-class-declare-interface/options.json +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-class-declare-interface/options.json @@ -1,3 +1,7 @@ { - "throws": "Identifier 'A' has already been declared (2:18)" -} + "sourceType": "module", + "plugins": [ + "jsx", + "flow" + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-class-declare-interface/output.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-class-declare-interface/output.json new file mode 100644 index 000000000000..a5e92908c53a --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-class-declare-interface/output.json @@ -0,0 +1,150 @@ +{ + "type": "File", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "errors": [ + "SyntaxError: Identifier 'A' has already been declared (2:18)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "DeclareClass", + "start": 0, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "id": { + "type": "Identifier", + "start": 14, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + }, + "identifierName": "A" + }, + "name": "A" + }, + "typeParameters": null, + "extends": [], + "implements": [], + "mixins": [], + "body": { + "type": "ObjectTypeAnnotation", + "start": 16, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false + } + }, + { + "type": "DeclareInterface", + "start": 19, + "end": 41, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "id": { + "type": "Identifier", + "start": 37, + "end": 38, + "loc": { + "start": { + "line": 2, + "column": 18 + }, + "end": { + "line": 2, + "column": 19 + }, + "identifierName": "A" + }, + "name": "A" + }, + "typeParameters": null, + "extends": [], + "implements": [], + "mixins": [], + "body": { + "type": "ObjectTypeAnnotation", + "start": 39, + "end": 41, + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-interface-declare-class/options.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-interface-declare-class/options.json index 4a1b4e5c5cd4..3962be507d38 100644 --- a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-interface-declare-class/options.json +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-interface-declare-class/options.json @@ -1,3 +1,7 @@ { - "throws": "Identifier 'A' has already been declared (2:14)" -} + "sourceType": "module", + "plugins": [ + "jsx", + "flow" + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-interface-declare-class/output.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-interface-declare-class/output.json new file mode 100644 index 000000000000..b2a4c51e2bc0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-interface-declare-class/output.json @@ -0,0 +1,150 @@ +{ + "type": "File", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "errors": [ + "SyntaxError: Identifier 'A' has already been declared (2:14)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "DeclareInterface", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "id": { + "type": "Identifier", + "start": 18, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + }, + "identifierName": "A" + }, + "name": "A" + }, + "typeParameters": null, + "extends": [], + "implements": [], + "mixins": [], + "body": { + "type": "ObjectTypeAnnotation", + "start": 20, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false + } + }, + { + "type": "DeclareClass", + "start": 23, + "end": 41, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "id": { + "type": "Identifier", + "start": 37, + "end": 38, + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 15 + }, + "identifierName": "A" + }, + "name": "A" + }, + "typeParameters": null, + "extends": [], + "implements": [], + "mixins": [], + "body": { + "type": "ObjectTypeAnnotation", + "start": 39, + "end": 41, + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-var-let/options.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-var-let/options.json index b6ff3a4b0987..3962be507d38 100644 --- a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-var-let/options.json +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-var-let/options.json @@ -1,3 +1,7 @@ { - "throws": "Identifier 'A' has already been declared (2:4)" -} + "sourceType": "module", + "plugins": [ + "jsx", + "flow" + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-var-let/output.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-var-let/output.json new file mode 100644 index 000000000000..8389c568e814 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-declare-var-let/output.json @@ -0,0 +1,151 @@ +{ + "type": "File", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 6 + } + }, + "errors": [ + "SyntaxError: Identifier 'A' has already been declared (2:4)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 6 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "DeclareVariable", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "id": { + "type": "Identifier", + "start": 12, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 21 + }, + "identifierName": "A" + }, + "name": "A", + "typeAnnotation": { + "type": "TypeAnnotation", + "start": 13, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "typeAnnotation": { + "type": "NumberTypeAnnotation", + "start": 15, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 21 + } + } + } + } + } + }, + { + "type": "VariableDeclaration", + "start": 23, + "end": 29, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 6 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 27, + "end": 28, + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 5 + } + }, + "id": { + "type": "Identifier", + "start": 27, + "end": 28, + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 5 + }, + "identifierName": "A" + }, + "name": "A" + }, + "init": null + } + ], + "kind": "let" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-interface-interface/options.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-interface-interface/options.json index 04242bd1565b..3962be507d38 100644 --- a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-interface-interface/options.json +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-interface-interface/options.json @@ -1,3 +1,7 @@ { - "throws": "Identifier 'A' has already been declared (2:10)" -} + "sourceType": "module", + "plugins": [ + "jsx", + "flow" + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-interface-interface/output.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-interface-interface/output.json new file mode 100644 index 000000000000..d79d846383cf --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-interface-interface/output.json @@ -0,0 +1,150 @@ +{ + "type": "File", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "errors": [ + "SyntaxError: Identifier 'A' has already been declared (2:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "InterfaceDeclaration", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "id": { + "type": "Identifier", + "start": 10, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + }, + "identifierName": "A" + }, + "name": "A" + }, + "typeParameters": null, + "extends": [], + "implements": [], + "mixins": [], + "body": { + "type": "ObjectTypeAnnotation", + "start": 12, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false + } + }, + { + "type": "InterfaceDeclaration", + "start": 15, + "end": 29, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "id": { + "type": "Identifier", + "start": 25, + "end": 26, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + }, + "identifierName": "A" + }, + "name": "A" + }, + "typeParameters": null, + "extends": [], + "implements": [], + "mixins": [], + "body": { + "type": "ObjectTypeAnnotation", + "start": 27, + "end": 29, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-let-declare-class/options.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-let-declare-class/options.json index 4a1b4e5c5cd4..3962be507d38 100644 --- a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-let-declare-class/options.json +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-let-declare-class/options.json @@ -1,3 +1,7 @@ { - "throws": "Identifier 'A' has already been declared (2:14)" -} + "sourceType": "module", + "plugins": [ + "jsx", + "flow" + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-let-declare-class/output.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-let-declare-class/output.json new file mode 100644 index 000000000000..2dbdc1e727c2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-let-declare-class/output.json @@ -0,0 +1,164 @@ +{ + "type": "File", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "errors": [ + "SyntaxError: Identifier 'A' has already been declared (2:14)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "id": { + "type": "Identifier", + "start": 4, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "A" + }, + "name": "A" + }, + "init": { + "type": "NumericLiteral", + "start": 8, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "let" + }, + { + "type": "DeclareClass", + "start": 11, + "end": 29, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "id": { + "type": "Identifier", + "start": 25, + "end": 26, + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 15 + }, + "identifierName": "A" + }, + "name": "A" + }, + "typeParameters": null, + "extends": [], + "implements": [], + "mixins": [], + "body": { + "type": "ObjectTypeAnnotation", + "start": 27, + "end": 29, + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-let-declare-interface/options.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-let-declare-interface/options.json index 187fea591b95..3962be507d38 100644 --- a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-let-declare-interface/options.json +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-let-declare-interface/options.json @@ -1,3 +1,7 @@ { - "throws": "Identifier 'A' has already been declared (2:18)" -} + "sourceType": "module", + "plugins": [ + "jsx", + "flow" + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-let-declare-interface/output.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-let-declare-interface/output.json new file mode 100644 index 000000000000..a13ba7dc082c --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-let-declare-interface/output.json @@ -0,0 +1,164 @@ +{ + "type": "File", + "start": 0, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "errors": [ + "SyntaxError: Identifier 'A' has already been declared (2:18)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "id": { + "type": "Identifier", + "start": 4, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "A" + }, + "name": "A" + }, + "init": { + "type": "NumericLiteral", + "start": 8, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "let" + }, + { + "type": "DeclareInterface", + "start": 11, + "end": 33, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "id": { + "type": "Identifier", + "start": 29, + "end": 30, + "loc": { + "start": { + "line": 2, + "column": 18 + }, + "end": { + "line": 2, + "column": 19 + }, + "identifierName": "A" + }, + "name": "A" + }, + "typeParameters": null, + "extends": [], + "implements": [], + "mixins": [], + "body": { + "type": "ObjectTypeAnnotation", + "start": 31, + "end": 33, + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-let-interface/options.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-let-interface/options.json index 04242bd1565b..3962be507d38 100644 --- a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-let-interface/options.json +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-let-interface/options.json @@ -1,3 +1,7 @@ { - "throws": "Identifier 'A' has already been declared (2:10)" -} + "sourceType": "module", + "plugins": [ + "jsx", + "flow" + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-let-interface/output.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-let-interface/output.json new file mode 100644 index 000000000000..a8dc40e08d4c --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-let-interface/output.json @@ -0,0 +1,164 @@ +{ + "type": "File", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "errors": [ + "SyntaxError: Identifier 'A' has already been declared (2:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "id": { + "type": "Identifier", + "start": 4, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "A" + }, + "name": "A" + }, + "init": { + "type": "NumericLiteral", + "start": 8, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "let" + }, + { + "type": "InterfaceDeclaration", + "start": 11, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "id": { + "type": "Identifier", + "start": 21, + "end": 22, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + }, + "identifierName": "A" + }, + "name": "A" + }, + "typeParameters": null, + "extends": [], + "implements": [], + "mixins": [], + "body": { + "type": "ObjectTypeAnnotation", + "start": 23, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-let-opaque-type/options.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-let-opaque-type/options.json deleted file mode 100644 index 81dc2c90799f..000000000000 --- a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-let-opaque-type/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'A' has already been declared (2:12)" -} diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-let-opaque-type/output.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-let-opaque-type/output.json new file mode 100644 index 000000000000..07a5a53fbc08 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-let-opaque-type/output.json @@ -0,0 +1,163 @@ +{ + "type": "File", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "errors": [ + "SyntaxError: Identifier 'A' has already been declared (2:12)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "id": { + "type": "Identifier", + "start": 4, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "A" + }, + "name": "A" + }, + "init": { + "type": "NumericLiteral", + "start": 8, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "let" + }, + { + "type": "OpaqueType", + "start": 11, + "end": 30, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "id": { + "type": "Identifier", + "start": 23, + "end": 24, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 13 + }, + "identifierName": "A" + }, + "name": "A" + }, + "typeParameters": null, + "supertype": null, + "impltype": { + "type": "ObjectTypeAnnotation", + "start": 27, + "end": 29, + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false, + "inexact": false + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-let-type/options.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-let-type/options.json deleted file mode 100644 index 1eed93f49a0e..000000000000 --- a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-let-type/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'A' has already been declared (2:5)" -} diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-let-type/output.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-let-type/output.json new file mode 100644 index 000000000000..6833e37c4de1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-let-type/output.json @@ -0,0 +1,162 @@ +{ + "type": "File", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 12 + } + }, + "errors": [ + "SyntaxError: Identifier 'A' has already been declared (2:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 12 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "id": { + "type": "Identifier", + "start": 4, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "A" + }, + "name": "A" + }, + "init": { + "type": "NumericLiteral", + "start": 8, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "let" + }, + { + "type": "TypeAlias", + "start": 11, + "end": 23, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 12 + } + }, + "id": { + "type": "Identifier", + "start": 16, + "end": 17, + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 6 + }, + "identifierName": "A" + }, + "name": "A" + }, + "typeParameters": null, + "right": { + "type": "ObjectTypeAnnotation", + "start": 20, + "end": 22, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false, + "inexact": false + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-opaque-type-const/options.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-opaque-type-const/options.json deleted file mode 100644 index 336686170eb0..000000000000 --- a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-opaque-type-const/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'A' has already been declared (2:6)" -} diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-opaque-type-const/output.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-opaque-type-const/output.json new file mode 100644 index 000000000000..b374e2bcebd9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-opaque-type-const/output.json @@ -0,0 +1,163 @@ +{ + "type": "File", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 12 + } + }, + "errors": [ + "SyntaxError: Identifier 'A' has already been declared (2:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 12 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "OpaqueType", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "id": { + "type": "Identifier", + "start": 12, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + }, + "identifierName": "A" + }, + "name": "A" + }, + "typeParameters": null, + "supertype": null, + "impltype": { + "type": "ObjectTypeAnnotation", + "start": 16, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false, + "inexact": false + } + }, + { + "type": "VariableDeclaration", + "start": 20, + "end": 32, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 12 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 26, + "end": 31, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "id": { + "type": "Identifier", + "start": 26, + "end": 27, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "init": { + "type": "NumericLiteral", + "start": 30, + "end": 31, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "const" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-opaque-type-let/options.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-opaque-type-let/options.json deleted file mode 100644 index b6ff3a4b0987..000000000000 --- a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-opaque-type-let/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'A' has already been declared (2:4)" -} diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-opaque-type-let/output.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-opaque-type-let/output.json new file mode 100644 index 000000000000..9f326dfe3e5e --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-opaque-type-let/output.json @@ -0,0 +1,163 @@ +{ + "type": "File", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 10 + } + }, + "errors": [ + "SyntaxError: Identifier 'A' has already been declared (2:4)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 10 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "OpaqueType", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "id": { + "type": "Identifier", + "start": 12, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + }, + "identifierName": "A" + }, + "name": "A" + }, + "typeParameters": null, + "supertype": null, + "impltype": { + "type": "ObjectTypeAnnotation", + "start": 16, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false, + "inexact": false + } + }, + { + "type": "VariableDeclaration", + "start": 20, + "end": 30, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 10 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 24, + "end": 29, + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 9 + } + }, + "id": { + "type": "Identifier", + "start": 24, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 5 + }, + "identifierName": "A" + }, + "name": "A" + }, + "init": { + "type": "NumericLiteral", + "start": 28, + "end": 29, + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 9 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "let" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-opaque-type-opaque-type/options.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-opaque-type-opaque-type/options.json deleted file mode 100644 index 81dc2c90799f..000000000000 --- a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-opaque-type-opaque-type/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'A' has already been declared (2:12)" -} diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-opaque-type-opaque-type/output.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-opaque-type-opaque-type/output.json new file mode 100644 index 000000000000..86b98af15006 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-opaque-type-opaque-type/output.json @@ -0,0 +1,148 @@ +{ + "type": "File", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "errors": [ + "SyntaxError: Identifier 'A' has already been declared (2:12)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "OpaqueType", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "id": { + "type": "Identifier", + "start": 12, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + }, + "identifierName": "A" + }, + "name": "A" + }, + "typeParameters": null, + "supertype": null, + "impltype": { + "type": "ObjectTypeAnnotation", + "start": 16, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false, + "inexact": false + } + }, + { + "type": "OpaqueType", + "start": 20, + "end": 39, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "id": { + "type": "Identifier", + "start": 32, + "end": 33, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 13 + }, + "identifierName": "A" + }, + "name": "A" + }, + "typeParameters": null, + "supertype": null, + "impltype": { + "type": "ObjectTypeAnnotation", + "start": 36, + "end": 38, + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false, + "inexact": false + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-opaque-type-type/options.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-opaque-type-type/options.json deleted file mode 100644 index 1eed93f49a0e..000000000000 --- a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-opaque-type-type/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'A' has already been declared (2:5)" -} diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-opaque-type-type/output.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-opaque-type-type/output.json new file mode 100644 index 000000000000..76300249f569 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-opaque-type-type/output.json @@ -0,0 +1,147 @@ +{ + "type": "File", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 12 + } + }, + "errors": [ + "SyntaxError: Identifier 'A' has already been declared (2:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 12 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "OpaqueType", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "id": { + "type": "Identifier", + "start": 12, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + }, + "identifierName": "A" + }, + "name": "A" + }, + "typeParameters": null, + "supertype": null, + "impltype": { + "type": "ObjectTypeAnnotation", + "start": 16, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false, + "inexact": false + } + }, + { + "type": "TypeAlias", + "start": 20, + "end": 32, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 12 + } + }, + "id": { + "type": "Identifier", + "start": 25, + "end": 26, + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 6 + }, + "identifierName": "A" + }, + "name": "A" + }, + "typeParameters": null, + "right": { + "type": "ObjectTypeAnnotation", + "start": 29, + "end": 31, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false, + "inexact": false + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-opaque-type-var/options.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-opaque-type-var/options.json deleted file mode 100644 index b6ff3a4b0987..000000000000 --- a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-opaque-type-var/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'A' has already been declared (2:4)" -} diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-opaque-type-var/output.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-opaque-type-var/output.json new file mode 100644 index 000000000000..b5b462a59cf5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-opaque-type-var/output.json @@ -0,0 +1,163 @@ +{ + "type": "File", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 10 + } + }, + "errors": [ + "SyntaxError: Identifier 'A' has already been declared (2:4)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 10 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "OpaqueType", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "id": { + "type": "Identifier", + "start": 12, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + }, + "identifierName": "A" + }, + "name": "A" + }, + "typeParameters": null, + "supertype": null, + "impltype": { + "type": "ObjectTypeAnnotation", + "start": 16, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false, + "inexact": false + } + }, + { + "type": "VariableDeclaration", + "start": 20, + "end": 30, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 10 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 24, + "end": 29, + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 9 + } + }, + "id": { + "type": "Identifier", + "start": 24, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 5 + }, + "identifierName": "A" + }, + "name": "A" + }, + "init": { + "type": "NumericLiteral", + "start": 28, + "end": 29, + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 9 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "var" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-const/options.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-const/options.json deleted file mode 100644 index 336686170eb0..000000000000 --- a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-const/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'A' has already been declared (2:6)" -} diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-const/output.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-const/output.json new file mode 100644 index 000000000000..916e60eaa94a --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-const/output.json @@ -0,0 +1,162 @@ +{ + "type": "File", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 12 + } + }, + "errors": [ + "SyntaxError: Identifier 'A' has already been declared (2:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 12 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TypeAlias", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "A" + }, + "name": "A" + }, + "typeParameters": null, + "right": { + "type": "ObjectTypeAnnotation", + "start": 9, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false, + "inexact": false + } + }, + { + "type": "VariableDeclaration", + "start": 13, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 12 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 19, + "end": 24, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "id": { + "type": "Identifier", + "start": 19, + "end": 20, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "init": { + "type": "NumericLiteral", + "start": 23, + "end": 24, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "const" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-interface/options.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-interface/options.json index 04242bd1565b..3962be507d38 100644 --- a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-interface/options.json +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-interface/options.json @@ -1,3 +1,7 @@ { - "throws": "Identifier 'A' has already been declared (2:10)" -} + "sourceType": "module", + "plugins": [ + "jsx", + "flow" + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-interface/output.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-interface/output.json new file mode 100644 index 000000000000..0aa57e51c3ff --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-interface/output.json @@ -0,0 +1,142 @@ +{ + "type": "File", + "start": 0, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "errors": [ + "SyntaxError: Identifier 'A' has already been declared (2:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TypeAlias", + "start": 0, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "A" + }, + "name": "A" + }, + "typeParameters": null, + "right": { + "type": "NumberTypeAnnotation", + "start": 9, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 15 + } + } + } + }, + { + "type": "InterfaceDeclaration", + "start": 17, + "end": 31, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "id": { + "type": "Identifier", + "start": 27, + "end": 28, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + }, + "identifierName": "A" + }, + "name": "A" + }, + "typeParameters": null, + "extends": [], + "implements": [], + "mixins": [], + "body": { + "type": "ObjectTypeAnnotation", + "start": 29, + "end": 31, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-let/options.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-let/options.json deleted file mode 100644 index b6ff3a4b0987..000000000000 --- a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-let/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'A' has already been declared (2:4)" -} diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-let/output.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-let/output.json new file mode 100644 index 000000000000..6e394ffbcda1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-let/output.json @@ -0,0 +1,162 @@ +{ + "type": "File", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 10 + } + }, + "errors": [ + "SyntaxError: Identifier 'A' has already been declared (2:4)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 10 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TypeAlias", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "A" + }, + "name": "A" + }, + "typeParameters": null, + "right": { + "type": "ObjectTypeAnnotation", + "start": 9, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false, + "inexact": false + } + }, + { + "type": "VariableDeclaration", + "start": 13, + "end": 23, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 10 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 17, + "end": 22, + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 9 + } + }, + "id": { + "type": "Identifier", + "start": 17, + "end": 18, + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 5 + }, + "identifierName": "A" + }, + "name": "A" + }, + "init": { + "type": "NumericLiteral", + "start": 21, + "end": 22, + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 9 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "let" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-opaque-type/options.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-opaque-type/options.json deleted file mode 100644 index 81dc2c90799f..000000000000 --- a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-opaque-type/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'A' has already been declared (2:12)" -} diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-opaque-type/output.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-opaque-type/output.json new file mode 100644 index 000000000000..95d0b22f7cfd --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-opaque-type/output.json @@ -0,0 +1,147 @@ +{ + "type": "File", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "errors": [ + "SyntaxError: Identifier 'A' has already been declared (2:12)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TypeAlias", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "A" + }, + "name": "A" + }, + "typeParameters": null, + "right": { + "type": "ObjectTypeAnnotation", + "start": 9, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false, + "inexact": false + } + }, + { + "type": "OpaqueType", + "start": 13, + "end": 32, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "id": { + "type": "Identifier", + "start": 25, + "end": 26, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 13 + }, + "identifierName": "A" + }, + "name": "A" + }, + "typeParameters": null, + "supertype": null, + "impltype": { + "type": "ObjectTypeAnnotation", + "start": 29, + "end": 31, + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false, + "inexact": false + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-type/options.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-type/options.json deleted file mode 100644 index 1eed93f49a0e..000000000000 --- a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-type/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'A' has already been declared (2:5)" -} diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-type/output.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-type/output.json new file mode 100644 index 000000000000..09c73482f8f1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-type/output.json @@ -0,0 +1,146 @@ +{ + "type": "File", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 12 + } + }, + "errors": [ + "SyntaxError: Identifier 'A' has already been declared (2:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 12 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TypeAlias", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "A" + }, + "name": "A" + }, + "typeParameters": null, + "right": { + "type": "ObjectTypeAnnotation", + "start": 9, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false, + "inexact": false + } + }, + { + "type": "TypeAlias", + "start": 13, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 12 + } + }, + "id": { + "type": "Identifier", + "start": 18, + "end": 19, + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 6 + }, + "identifierName": "A" + }, + "name": "A" + }, + "typeParameters": null, + "right": { + "type": "ObjectTypeAnnotation", + "start": 22, + "end": 24, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false, + "inexact": false + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-var/options.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-var/options.json deleted file mode 100644 index b6ff3a4b0987..000000000000 --- a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-var/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'A' has already been declared (2:4)" -} diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-var/output.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-var/output.json new file mode 100644 index 000000000000..52626b852e33 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-type-var/output.json @@ -0,0 +1,162 @@ +{ + "type": "File", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 10 + } + }, + "errors": [ + "SyntaxError: Identifier 'A' has already been declared (2:4)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 10 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TypeAlias", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "A" + }, + "name": "A" + }, + "typeParameters": null, + "right": { + "type": "ObjectTypeAnnotation", + "start": 9, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false, + "inexact": false + } + }, + { + "type": "VariableDeclaration", + "start": 13, + "end": 23, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 10 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 17, + "end": 22, + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 9 + } + }, + "id": { + "type": "Identifier", + "start": 17, + "end": 18, + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 5 + }, + "identifierName": "A" + }, + "name": "A" + }, + "init": { + "type": "NumericLiteral", + "start": 21, + "end": 22, + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 9 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "var" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-var-declare-interface/options.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-var-declare-interface/options.json index 187fea591b95..3962be507d38 100644 --- a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-var-declare-interface/options.json +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-var-declare-interface/options.json @@ -1,3 +1,7 @@ { - "throws": "Identifier 'A' has already been declared (2:18)" -} + "sourceType": "module", + "plugins": [ + "jsx", + "flow" + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-var-declare-interface/output.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-var-declare-interface/output.json new file mode 100644 index 000000000000..f60940e178bf --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-var-declare-interface/output.json @@ -0,0 +1,164 @@ +{ + "type": "File", + "start": 0, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "errors": [ + "SyntaxError: Identifier 'A' has already been declared (2:18)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "id": { + "type": "Identifier", + "start": 4, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "A" + }, + "name": "A" + }, + "init": { + "type": "NumericLiteral", + "start": 8, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "var" + }, + { + "type": "DeclareInterface", + "start": 11, + "end": 33, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "id": { + "type": "Identifier", + "start": 29, + "end": 30, + "loc": { + "start": { + "line": 2, + "column": 18 + }, + "end": { + "line": 2, + "column": 19 + }, + "identifierName": "A" + }, + "name": "A" + }, + "typeParameters": null, + "extends": [], + "implements": [], + "mixins": [], + "body": { + "type": "ObjectTypeAnnotation", + "start": 31, + "end": 33, + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-var-interface/options.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-var-interface/options.json index 04242bd1565b..3962be507d38 100644 --- a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-var-interface/options.json +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-var-interface/options.json @@ -1,3 +1,7 @@ { - "throws": "Identifier 'A' has already been declared (2:10)" -} + "sourceType": "module", + "plugins": [ + "jsx", + "flow" + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-var-interface/output.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-var-interface/output.json new file mode 100644 index 000000000000..271c66e47dd7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-var-interface/output.json @@ -0,0 +1,164 @@ +{ + "type": "File", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "errors": [ + "SyntaxError: Identifier 'A' has already been declared (2:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "id": { + "type": "Identifier", + "start": 4, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "A" + }, + "name": "A" + }, + "init": { + "type": "NumericLiteral", + "start": 8, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "var" + }, + { + "type": "InterfaceDeclaration", + "start": 11, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "id": { + "type": "Identifier", + "start": 21, + "end": 22, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + }, + "identifierName": "A" + }, + "name": "A" + }, + "typeParameters": null, + "extends": [], + "implements": [], + "mixins": [], + "body": { + "type": "ObjectTypeAnnotation", + "start": 23, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-var-opaque-type/options.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-var-opaque-type/options.json deleted file mode 100644 index 81dc2c90799f..000000000000 --- a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-var-opaque-type/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'A' has already been declared (2:12)" -} diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-var-opaque-type/output.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-var-opaque-type/output.json new file mode 100644 index 000000000000..d41f91a9d947 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-var-opaque-type/output.json @@ -0,0 +1,163 @@ +{ + "type": "File", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "errors": [ + "SyntaxError: Identifier 'A' has already been declared (2:12)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "id": { + "type": "Identifier", + "start": 4, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "A" + }, + "name": "A" + }, + "init": { + "type": "NumericLiteral", + "start": 8, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "var" + }, + { + "type": "OpaqueType", + "start": 11, + "end": 30, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "id": { + "type": "Identifier", + "start": 23, + "end": 24, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 13 + }, + "identifierName": "A" + }, + "name": "A" + }, + "typeParameters": null, + "supertype": null, + "impltype": { + "type": "ObjectTypeAnnotation", + "start": 27, + "end": 29, + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false, + "inexact": false + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-var-type/options.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-var-type/options.json deleted file mode 100644 index 1eed93f49a0e..000000000000 --- a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-var-type/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'A' has already been declared (2:5)" -} diff --git a/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-var-type/output.json b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-var-type/output.json new file mode 100644 index 000000000000..4f1dcc135976 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/scope/dupl-decl-var-type/output.json @@ -0,0 +1,162 @@ +{ + "type": "File", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 12 + } + }, + "errors": [ + "SyntaxError: Identifier 'A' has already been declared (2:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 12 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "id": { + "type": "Identifier", + "start": 4, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "A" + }, + "name": "A" + }, + "init": { + "type": "NumericLiteral", + "start": 8, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + ], + "kind": "var" + }, + { + "type": "TypeAlias", + "start": 11, + "end": 23, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 12 + } + }, + "id": { + "type": "Identifier", + "start": 16, + "end": 17, + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 6 + }, + "identifierName": "A" + }, + "name": "A" + }, + "typeParameters": null, + "right": { + "type": "ObjectTypeAnnotation", + "start": 20, + "end": 22, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false, + "inexact": false + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/131/options.json b/packages/babel-parser/test/fixtures/flow/type-annotations/131/options.json deleted file mode 100644 index 50bea8a5db27..000000000000 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/131/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Cannot overwrite reserved type number (1:5)" -} diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/131/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/131/output.json new file mode 100644 index 000000000000..ef2bc17e2d96 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/131/output.json @@ -0,0 +1,86 @@ +{ + "type": "File", + "start": 0, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "errors": [ + "SyntaxError: Cannot overwrite reserved type number (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TypeAlias", + "start": 0, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 11 + }, + "identifierName": "number" + }, + "name": "number" + }, + "typeParameters": null, + "right": { + "type": "StringTypeAnnotation", + "start": 14, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 20 + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/132/options.json b/packages/babel-parser/test/fixtures/flow/type-annotations/132/options.json deleted file mode 100644 index 257d651b33e2..000000000000 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/132/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Cannot overwrite reserved type number (1:9)" -} diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/132/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/132/output.json new file mode 100644 index 000000000000..aa2b8b19ecb0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/132/output.json @@ -0,0 +1,119 @@ +{ + "type": "File", + "start": 0, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "errors": [ + "SyntaxError: Cannot overwrite reserved type number (1:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TypeAlias", + "start": 0, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 8 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "typeParameters": { + "type": "TypeParameterDeclaration", + "start": 8, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "params": [ + { + "type": "TypeParameter", + "start": 9, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "name": "number", + "variance": null + } + ] + }, + "right": { + "type": "StringTypeAnnotation", + "start": 19, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 25 + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/133/options.json b/packages/babel-parser/test/fixtures/flow/type-annotations/133/options.json deleted file mode 100644 index 2c7a5836d8bc..000000000000 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/133/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Cannot overwrite reserved type string (1:11)" -} diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/133/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/133/output.json new file mode 100644 index 000000000000..bb722c84feec --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/133/output.json @@ -0,0 +1,236 @@ +{ + "type": "File", + "start": 0, + "end": 53, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Cannot overwrite reserved type string (1:11)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 53, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 53, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "a" + }, + "name": "a" + }, + "generator": false, + "async": false, + "typeParameters": { + "type": "TypeParameterDeclaration", + "start": 10, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "params": [ + { + "type": "TypeParameter", + "start": 11, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "name": "string", + "variance": null + } + ] + }, + "params": [ + { + "type": "Identifier", + "start": 19, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 28 + }, + "identifierName": "x" + }, + "name": "x", + "typeAnnotation": { + "type": "TypeAnnotation", + "start": 20, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "typeAnnotation": { + "type": "StringTypeAnnotation", + "start": 22, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 28 + } + } + } + } + } + ], + "predicate": null, + "returnType": { + "type": "TypeAnnotation", + "start": 29, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "typeAnnotation": { + "type": "StringTypeAnnotation", + "start": 31, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 37 + } + } + } + }, + "body": { + "type": "BlockStatement", + "start": 38, + "end": 53, + "loc": { + "start": { + "line": 1, + "column": 38 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ReturnStatement", + "start": 42, + "end": 51, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "argument": { + "type": "Identifier", + "start": 49, + "end": 50, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 10 + }, + "identifierName": "x" + }, + "name": "x" + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/134/options.json b/packages/babel-parser/test/fixtures/flow/type-annotations/134/options.json deleted file mode 100644 index 396a14ca22d4..000000000000 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/134/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Cannot overwrite reserved type bool (1:13)" -} diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/134/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/134/output.json new file mode 100644 index 000000000000..c88abb4a585c --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/134/output.json @@ -0,0 +1,86 @@ +{ + "type": "File", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "errors": [ + "SyntaxError: Cannot overwrite reserved type bool (1:13)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "DeclareTypeAlias", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "id": { + "type": "Identifier", + "start": 13, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 17 + }, + "identifierName": "bool" + }, + "name": "bool" + }, + "typeParameters": null, + "right": { + "type": "AnyTypeAnnotation", + "start": 20, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 23 + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/137/options.json b/packages/babel-parser/test/fixtures/flow/type-annotations/137/options.json deleted file mode 100644 index 786acad32af0..000000000000 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/137/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Spread operator cannot appear in class or interface definitions (2:1)" -} diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/137/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/137/output.json new file mode 100644 index 000000000000..2e33b31f6c8f --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/137/output.json @@ -0,0 +1,140 @@ +{ + "type": "File", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 2 + } + }, + "errors": [ + "SyntaxError: Spread operator cannot appear in class or interface definitions (2:1)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 2 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "InterfaceDeclaration", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 10, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + }, + "identifierName": "A" + }, + "name": "A" + }, + "typeParameters": null, + "extends": [], + "implements": [], + "mixins": [], + "body": { + "type": "ObjectTypeAnnotation", + "start": 12, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "callProperties": [], + "properties": [ + { + "type": "ObjectTypeSpreadProperty", + "start": 15, + "end": 21, + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 7 + } + }, + "argument": { + "type": "AnyTypeAnnotation", + "start": 18, + "end": 21, + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 7 + } + } + } + } + ], + "indexers": [], + "internalSlots": [], + "exact": false + } + }, + { + "type": "EmptyStatement", + "start": 24, + "end": 25, + "loc": { + "start": { + "line": 3, + "column": 1 + }, + "end": { + "line": 3, + "column": 2 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/139/options.json b/packages/babel-parser/test/fixtures/flow/type-annotations/139/options.json deleted file mode 100644 index 2b0782bcbc3e..000000000000 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/139/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Spread properties cannot have variance (3:1)" -} diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/139/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/139/output.json new file mode 100644 index 000000000000..6d1756ac6212 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/139/output.json @@ -0,0 +1,190 @@ +{ + "type": "File", + "start": 0, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 2 + } + }, + "errors": [ + "SyntaxError: Spread properties cannot have variance (3:1)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 2 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "body": [] + } + }, + { + "type": "TypeAlias", + "start": 11, + "end": 31, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 4, + "column": 2 + } + }, + "id": { + "type": "Identifier", + "start": 16, + "end": 17, + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 6 + }, + "identifierName": "C" + }, + "name": "C" + }, + "typeParameters": null, + "right": { + "type": "ObjectTypeAnnotation", + "start": 20, + "end": 30, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "callProperties": [], + "properties": [ + { + "type": "ObjectTypeSpreadProperty", + "start": 23, + "end": 28, + "loc": { + "start": { + "line": 3, + "column": 1 + }, + "end": { + "line": 3, + "column": 6 + } + }, + "argument": { + "type": "GenericTypeAnnotation", + "start": 27, + "end": 28, + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 6 + } + }, + "typeParameters": null, + "id": { + "type": "Identifier", + "start": 27, + "end": 28, + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 6 + }, + "identifierName": "A" + }, + "name": "A" + } + } + } + ], + "indexers": [], + "internalSlots": [], + "exact": false, + "inexact": false + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/with-default-invalid/options.json b/packages/babel-parser/test/fixtures/flow/type-annotations/with-default-invalid/options.json deleted file mode 100644 index 24792311b3e9..000000000000 --- a/packages/babel-parser/test/fixtures/flow/type-annotations/with-default-invalid/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Type annotations must come before default assignments, e.g. instead of `age = 25: number` use `age: number = 25` (1:20)" -} diff --git a/packages/babel-parser/test/fixtures/flow/type-annotations/with-default-invalid/output.json b/packages/babel-parser/test/fixtures/flow/type-annotations/with-default-invalid/output.json new file mode 100644 index 000000000000..a08797bcf335 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/type-annotations/with-default-invalid/output.json @@ -0,0 +1,173 @@ +{ + "type": "File", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "errors": [ + "SyntaxError: Type annotations must come before default assignments, e.g. instead of `age = 25: number` use `age: number = 25` (1:20)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "x" + }, + "name": "x" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "AssignmentPattern", + "start": 11, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "left": { + "type": "Identifier", + "start": 11, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 14 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "right": { + "type": "StringLiteral", + "start": 17, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "extra": { + "rawValue": "1", + "raw": "\"1\"" + }, + "value": "1" + }, + "typeAnnotation": { + "type": "TypeAnnotation", + "start": 20, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "typeAnnotation": { + "type": "StringTypeAnnotation", + "start": 22, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 28 + } + } + } + } + } + ], + "body": { + "type": "BlockStatement", + "start": 30, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-2/options.json b/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-2/options.json deleted file mode 100644 index 7624c4d3b99a..000000000000 --- a/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-2/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Cannot overwrite reserved type string (1:14)" -} diff --git a/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-2/output.json b/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-2/output.json new file mode 100644 index 000000000000..5ac98d7b46b7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-2/output.json @@ -0,0 +1,126 @@ +{ + "type": "File", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "errors": [ + "SyntaxError: Cannot overwrite reserved type string (1:14)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ImportDeclaration", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "specifiers": [ + { + "type": "ImportSpecifier", + "start": 14, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "imported": { + "type": "Identifier", + "start": 14, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 20 + }, + "identifierName": "string" + }, + "name": "string" + }, + "importKind": null, + "local": { + "type": "Identifier", + "start": 14, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 20 + }, + "identifierName": "string" + }, + "name": "string" + } + } + ], + "importKind": "type", + "source": { + "type": "StringLiteral", + "start": 28, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "extra": { + "rawValue": "foo", + "raw": "\"foo\"" + }, + "value": "foo" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-3/options.json b/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-3/options.json deleted file mode 100644 index 7624c4d3b99a..000000000000 --- a/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-3/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Cannot overwrite reserved type string (1:14)" -} diff --git a/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-3/output.json b/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-3/output.json new file mode 100644 index 000000000000..3a1010d807fe --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-3/output.json @@ -0,0 +1,108 @@ +{ + "type": "File", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "errors": [ + "SyntaxError: Cannot overwrite reserved type string (1:14)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ImportDeclaration", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start": 14, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "local": { + "type": "Identifier", + "start": 14, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 20 + }, + "identifierName": "string" + }, + "name": "string" + } + } + ], + "importKind": "typeof", + "source": { + "type": "StringLiteral", + "start": 26, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "extra": { + "rawValue": "foo", + "raw": "\"foo\"" + }, + "value": "foo" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-4/options.json b/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-4/options.json deleted file mode 100644 index d64a5d353bf8..000000000000 --- a/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-4/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Cannot overwrite reserved type string (1:19)" -} diff --git a/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-4/output.json b/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-4/output.json new file mode 100644 index 000000000000..dcbca6978a12 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-4/output.json @@ -0,0 +1,108 @@ +{ + "type": "File", + "start": 0, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "errors": [ + "SyntaxError: Cannot overwrite reserved type string (1:19)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ImportDeclaration", + "start": 0, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "specifiers": [ + { + "type": "ImportNamespaceSpecifier", + "start": 14, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "local": { + "type": "Identifier", + "start": 19, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 25 + }, + "identifierName": "string" + }, + "name": "string" + } + } + ], + "importKind": "typeof", + "source": { + "type": "StringLiteral", + "start": 31, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "extra": { + "rawValue": "foo", + "raw": "\"foo\"" + }, + "value": "foo" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-as/options.json b/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-as/options.json index 5133797973d2..3962be507d38 100644 --- a/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-as/options.json +++ b/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-as/options.json @@ -1,3 +1,7 @@ { - "throws": "Unexpected keyword 'debugger' (1:17)" -} + "sourceType": "module", + "plugins": [ + "jsx", + "flow" + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-as/output.json b/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-as/output.json new file mode 100644 index 000000000000..05cc09533a23 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-as/output.json @@ -0,0 +1,126 @@ +{ + "type": "File", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "errors": [ + "SyntaxError: Unexpected keyword 'debugger' (1:17)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ImportDeclaration", + "start": 0, + "end": 39, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "specifiers": [ + { + "type": "ImportSpecifier", + "start": 9, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "imported": { + "type": "Identifier", + "start": 9, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 13 + }, + "identifierName": "type" + }, + "name": "type" + }, + "importKind": null, + "local": { + "type": "Identifier", + "start": 17, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 25 + }, + "identifierName": "debugger" + }, + "name": "debugger" + } + } + ], + "importKind": "value", + "source": { + "type": "StringLiteral", + "start": 33, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "extra": { + "rawValue": "foo", + "raw": "\"foo\"" + }, + "value": "foo" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-shorthand-2/options.json b/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-shorthand-2/options.json deleted file mode 100644 index 036229c5b95a..000000000000 --- a/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-shorthand-2/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "The `type` and `typeof` keywords on named imports can only be used on regular `import` statements. It cannot be used with `import type` or `import typeof` statements (1:13)" -} diff --git a/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-shorthand-2/output.json b/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-shorthand-2/output.json new file mode 100644 index 000000000000..90585f1b4f80 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-shorthand-2/output.json @@ -0,0 +1,126 @@ +{ + "type": "File", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "errors": [ + "SyntaxError: The `type` and `typeof` keywords on named imports can only be used on regular `import` statements. It cannot be used with `import type` or `import typeof` statements (1:13)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ImportDeclaration", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "specifiers": [ + { + "type": "ImportSpecifier", + "start": 13, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "imported": { + "type": "Identifier", + "start": 18, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + }, + "identifierName": "t" + }, + "name": "t" + }, + "importKind": "type", + "local": { + "type": "Identifier", + "start": 18, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + }, + "identifierName": "t" + }, + "name": "t" + } + } + ], + "importKind": "type", + "source": { + "type": "StringLiteral", + "start": 26, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "extra": { + "rawValue": "foo", + "raw": "\"foo\"" + }, + "value": "foo" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-shorthand-3/options.json b/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-shorthand-3/options.json deleted file mode 100644 index e425b795f180..000000000000 --- a/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-shorthand-3/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Cannot overwrite reserved type string (1:16)" -} diff --git a/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-shorthand-3/output.json b/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-shorthand-3/output.json new file mode 100644 index 000000000000..4969f577a320 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-shorthand-3/output.json @@ -0,0 +1,126 @@ +{ + "type": "File", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "errors": [ + "SyntaxError: Cannot overwrite reserved type string (1:16)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ImportDeclaration", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "specifiers": [ + { + "type": "ImportSpecifier", + "start": 9, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "imported": { + "type": "Identifier", + "start": 16, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 22 + }, + "identifierName": "string" + }, + "name": "string" + }, + "importKind": "typeof", + "local": { + "type": "Identifier", + "start": 16, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 22 + }, + "identifierName": "string" + }, + "name": "string" + } + } + ], + "importKind": "value", + "source": { + "type": "StringLiteral", + "start": 30, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "extra": { + "rawValue": "foo", + "raw": "\"foo\"" + }, + "value": "foo" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-shorthand-4/options.json b/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-shorthand-4/options.json deleted file mode 100644 index 7624c4d3b99a..000000000000 --- a/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-shorthand-4/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Cannot overwrite reserved type string (1:14)" -} diff --git a/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-shorthand-4/output.json b/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-shorthand-4/output.json new file mode 100644 index 000000000000..2b57e99a30e7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-shorthand-4/output.json @@ -0,0 +1,126 @@ +{ + "type": "File", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "errors": [ + "SyntaxError: Cannot overwrite reserved type string (1:14)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ImportDeclaration", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "specifiers": [ + { + "type": "ImportSpecifier", + "start": 9, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "imported": { + "type": "Identifier", + "start": 14, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 20 + }, + "identifierName": "string" + }, + "name": "string" + }, + "importKind": "type", + "local": { + "type": "Identifier", + "start": 14, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 20 + }, + "identifierName": "string" + }, + "name": "string" + } + } + ], + "importKind": "value", + "source": { + "type": "StringLiteral", + "start": 28, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "extra": { + "rawValue": "foo", + "raw": "\"foo\"" + }, + "value": "foo" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-shorthand/options.json b/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-shorthand/options.json deleted file mode 100644 index 7aa4274c7160..000000000000 --- a/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-shorthand/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "The `type` and `typeof` keywords on named imports can only be used on regular `import` statements. It cannot be used with `import type` or `import typeof` statements (1:15)" -} diff --git a/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-shorthand/output.json b/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-shorthand/output.json new file mode 100644 index 000000000000..174e856304f7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type-shorthand/output.json @@ -0,0 +1,126 @@ +{ + "type": "File", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "errors": [ + "SyntaxError: The `type` and `typeof` keywords on named imports can only be used on regular `import` statements. It cannot be used with `import type` or `import typeof` statements (1:15)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ImportDeclaration", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "specifiers": [ + { + "type": "ImportSpecifier", + "start": 15, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "imported": { + "type": "Identifier", + "start": 22, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + }, + "identifierName": "t" + }, + "name": "t" + }, + "importKind": "typeof", + "local": { + "type": "Identifier", + "start": 22, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + }, + "identifierName": "t" + }, + "name": "t" + } + } + ], + "importKind": "typeof", + "source": { + "type": "StringLiteral", + "start": 30, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "extra": { + "rawValue": "foo", + "raw": "\"foo\"" + }, + "value": "foo" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type/options.json b/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type/options.json deleted file mode 100644 index 0c2cdd4d777c..000000000000 --- a/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Cannot overwrite reserved type string (1:12)" -} diff --git a/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type/output.json b/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type/output.json new file mode 100644 index 000000000000..95872d960a5c --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/type-imports/invalid-import-type/output.json @@ -0,0 +1,108 @@ +{ + "type": "File", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "errors": [ + "SyntaxError: Cannot overwrite reserved type string (1:12)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ImportDeclaration", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start": 12, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "local": { + "type": "Identifier", + "start": 12, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 18 + }, + "identifierName": "string" + }, + "name": "string" + } + } + ], + "importKind": "type", + "source": { + "type": "StringLiteral", + "start": 24, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "extra": { + "rawValue": "foo", + "raw": "\"foo\"" + }, + "value": "foo" + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/type-parameter-declaration/default-missing/options.json b/packages/babel-parser/test/fixtures/flow/type-parameter-declaration/default-missing/options.json deleted file mode 100644 index 022607b81797..000000000000 --- a/packages/babel-parser/test/fixtures/flow/type-parameter-declaration/default-missing/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Type parameter declaration needs a default, since a preceding type parameter declaration has a default. (1:28)" -} diff --git a/packages/babel-parser/test/fixtures/flow/type-parameter-declaration/default-missing/output.json b/packages/babel-parser/test/fixtures/flow/type-parameter-declaration/default-missing/output.json new file mode 100644 index 000000000000..b902d88e157e --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/type-parameter-declaration/default-missing/output.json @@ -0,0 +1,169 @@ +{ + "type": "File", + "start": 0, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "errors": [ + "SyntaxError: Type parameter declaration needs a default, since a preceding type parameter declaration has a default. (1:28)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TypeAlias", + "start": 0, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "A" + }, + "name": "A" + }, + "typeParameters": { + "type": "TypeParameterDeclaration", + "start": 6, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "params": [ + { + "type": "TypeParameter", + "start": 7, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "name": "HasDefault", + "variance": null, + "default": { + "type": "StringTypeAnnotation", + "start": 20, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 26 + } + } + } + }, + { + "type": "TypeParameter", + "start": 28, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "name": "NoDefault", + "variance": null + } + ] + }, + "right": { + "type": "GenericTypeAnnotation", + "start": 41, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 41 + }, + "end": { + "line": 1, + "column": 42 + } + }, + "typeParameters": null, + "id": { + "type": "Identifier", + "start": 41, + "end": 42, + "loc": { + "start": { + "line": 1, + "column": 41 + }, + "end": { + "line": 1, + "column": 42 + }, + "identifierName": "T" + }, + "name": "T" + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/type-parameter-declaration/reserved-word-class-name-failure/options.json b/packages/babel-parser/test/fixtures/flow/type-parameter-declaration/reserved-word-class-name-failure/options.json index f45196d78df9..a282a109bf16 100644 --- a/packages/babel-parser/test/fixtures/flow/type-parameter-declaration/reserved-word-class-name-failure/options.json +++ b/packages/babel-parser/test/fixtures/flow/type-parameter-declaration/reserved-word-class-name-failure/options.json @@ -1,4 +1,7 @@ { - "throws": "Unexpected keyword 'delete' (1:14)", - "plugins": ["flow", "jsx"] -} + "sourceType": "module", + "plugins": [ + "flow", + "jsx" + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/type-parameter-declaration/reserved-word-class-name-failure/output.json b/packages/babel-parser/test/fixtures/flow/type-parameter-declaration/reserved-word-class-name-failure/output.json new file mode 100644 index 000000000000..a86c5b5aebde --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/type-parameter-declaration/reserved-word-class-name-failure/output.json @@ -0,0 +1,94 @@ +{ + "type": "File", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "errors": [ + "SyntaxError: Unexpected keyword 'delete' (1:14)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "DeclareClass", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "id": { + "type": "Identifier", + "start": 14, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 20 + }, + "identifierName": "delete" + }, + "name": "delete" + }, + "typeParameters": null, + "extends": [], + "implements": [], + "mixins": [], + "body": { + "type": "ObjectTypeAnnotation", + "start": 21, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "callProperties": [], + "properties": [], + "indexers": [], + "internalSlots": [], + "exact": false + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/typeapp-call/underscore_is_illegal_param_instantiation_otherwise/options.json b/packages/babel-parser/test/fixtures/flow/typeapp-call/underscore_is_illegal_param_instantiation_otherwise/options.json deleted file mode 100644 index 101e77f3861c..000000000000 --- a/packages/babel-parser/test/fixtures/flow/typeapp-call/underscore_is_illegal_param_instantiation_otherwise/options.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "sourceType": "module", - "plugins": ["jsx", "flow"], - "throws": "`_` is only allowed as a type argument to call or new (2:16)" -} diff --git a/packages/babel-parser/test/fixtures/flow/typeapp-call/underscore_is_illegal_param_instantiation_otherwise/output.json b/packages/babel-parser/test/fixtures/flow/typeapp-call/underscore_is_illegal_param_instantiation_otherwise/output.json new file mode 100644 index 000000000000..297c8d177689 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/typeapp-call/underscore_is_illegal_param_instantiation_otherwise/output.json @@ -0,0 +1,241 @@ +{ + "type": "File", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "errors": [ + "SyntaxError: `_` is only allowed as a type argument to call or new (2:16)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 8, + "end": 30, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 12, + "end": 29, + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 21 + } + }, + "id": { + "type": "Identifier", + "start": 12, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 17 + }, + "identifierName": "x" + }, + "name": "x", + "typeAnnotation": { + "type": "TypeAnnotation", + "start": 13, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 17 + } + }, + "typeAnnotation": { + "type": "GenericTypeAnnotation", + "start": 15, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 17 + } + }, + "typeParameters": { + "type": "TypeParameterInstantiation", + "start": 22, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 17 + } + }, + "params": [ + { + "type": "GenericTypeAnnotation", + "start": 23, + "end": 24, + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "typeParameters": null, + "id": { + "type": "Identifier", + "start": 23, + "end": 24, + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 16 + }, + "identifierName": "_" + }, + "name": "_" + } + } + ] + }, + "id": { + "type": "Identifier", + "start": 15, + "end": 22, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 14 + }, + "identifierName": "Generic" + }, + "name": "Generic" + } + } + } + }, + "init": { + "type": "NumericLiteral", + "start": 28, + "end": 29, + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 21 + } + }, + "extra": { + "rawValue": 3, + "raw": "3" + }, + "value": 3 + } + } + ], + "kind": "var", + "leadingComments": [ + { + "type": "CommentLine", + "value": "@flow", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ] + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentLine", + "value": "@flow", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/typeapp-call/underscore_is_illegal_type_name/options.json b/packages/babel-parser/test/fixtures/flow/typeapp-call/underscore_is_illegal_type_name/options.json index 85a0456eceff..d822c40fbba2 100644 --- a/packages/babel-parser/test/fixtures/flow/typeapp-call/underscore_is_illegal_type_name/options.json +++ b/packages/babel-parser/test/fixtures/flow/typeapp-call/underscore_is_illegal_type_name/options.json @@ -1,5 +1,4 @@ { "sourceType": "module", - "plugins": ["jsx", "flow"], - "throws": "Cannot overwrite reserved type _ (2:5)" + "plugins": ["jsx", "flow"] } diff --git a/packages/babel-parser/test/fixtures/flow/typeapp-call/underscore_is_illegal_type_name/output.json b/packages/babel-parser/test/fixtures/flow/typeapp-call/underscore_is_illegal_type_name/output.json new file mode 100644 index 000000000000..53ac01f6fe9a --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/typeapp-call/underscore_is_illegal_type_name/output.json @@ -0,0 +1,122 @@ +{ + "type": "File", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "errors": [ + "SyntaxError: Cannot overwrite reserved type _ (2:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TypeAlias", + "start": 8, + "end": 24, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "id": { + "type": "Identifier", + "start": 13, + "end": 14, + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 6 + }, + "identifierName": "_" + }, + "name": "_" + }, + "typeParameters": null, + "right": { + "type": "NumberTypeAnnotation", + "start": 17, + "end": 23, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 15 + } + } + }, + "leadingComments": [ + { + "type": "CommentLine", + "value": "@flow", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ] + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentLine", + "value": "@flow", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/typeapp-call/underscore_is_illegal_type_param_name/options.json b/packages/babel-parser/test/fixtures/flow/typeapp-call/underscore_is_illegal_type_param_name/options.json deleted file mode 100644 index 872ad2f73408..000000000000 --- a/packages/babel-parser/test/fixtures/flow/typeapp-call/underscore_is_illegal_type_param_name/options.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "sourceType": "module", - "plugins": ["jsx", "flow"], - "throws": "Cannot overwrite reserved type _ (2:13)" -} diff --git a/packages/babel-parser/test/fixtures/flow/typeapp-call/underscore_is_illegal_type_param_name/output.json b/packages/babel-parser/test/fixtures/flow/typeapp-call/underscore_is_illegal_type_param_name/output.json new file mode 100644 index 000000000000..e89da7ec21b6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/typeapp-call/underscore_is_illegal_type_param_name/output.json @@ -0,0 +1,174 @@ +{ + "type": "File", + "start": 0, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 20 + } + }, + "errors": [ + "SyntaxError: Cannot overwrite reserved type _ (2:13)", + "SyntaxError: `_` is only allowed as a type argument to call or new (2:19)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 20 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TypeAlias", + "start": 8, + "end": 28, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 20 + } + }, + "id": { + "type": "Identifier", + "start": 13, + "end": 20, + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 12 + }, + "identifierName": "Generic" + }, + "name": "Generic" + }, + "typeParameters": { + "type": "TypeParameterDeclaration", + "start": 20, + "end": 23, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "params": [ + { + "type": "TypeParameter", + "start": 21, + "end": 22, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "name": "_", + "variance": null + } + ] + }, + "right": { + "type": "GenericTypeAnnotation", + "start": 26, + "end": 27, + "loc": { + "start": { + "line": 2, + "column": 18 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "typeParameters": null, + "id": { + "type": "Identifier", + "start": 26, + "end": 27, + "loc": { + "start": { + "line": 2, + "column": 18 + }, + "end": { + "line": 2, + "column": 19 + }, + "identifierName": "_" + }, + "name": "_" + } + }, + "leadingComments": [ + { + "type": "CommentLine", + "value": "@flow", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ] + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentLine", + "value": "@flow", + "start": 0, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/typecasts/fail-in-calls-with-one-arg/options.json b/packages/babel-parser/test/fixtures/flow/typecasts/fail-in-calls-with-one-arg/options.json deleted file mode 100644 index e4012a53ad5d..000000000000 --- a/packages/babel-parser/test/fixtures/flow/typecasts/fail-in-calls-with-one-arg/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "The type cast expression is expected to be wrapped with parenthesis (1:10)" -} diff --git a/packages/babel-parser/test/fixtures/flow/typecasts/fail-in-calls-with-one-arg/output.json b/packages/babel-parser/test/fixtures/flow/typecasts/fail-in-calls-with-one-arg/output.json new file mode 100644 index 000000000000..098b44cec651 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/typecasts/fail-in-calls-with-one-arg/output.json @@ -0,0 +1,149 @@ +{ + "type": "File", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "errors": [ + "SyntaxError: The type cast expression is expected to be wrapped with parenthesis (1:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "expression": { + "type": "CallExpression", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "callee": { + "type": "Identifier", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + }, + "identifierName": "funccall" + }, + "name": "funccall" + }, + "arguments": [ + { + "type": "TypeCastExpression", + "start": 9, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "expression": { + "type": "Identifier", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "b" + }, + "name": "b" + }, + "typeAnnotation": { + "type": "TypeAnnotation", + "start": 10, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "typeAnnotation": { + "type": "StringTypeAnnotation", + "start": 12, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 18 + } + } + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/typecasts/fail-in-calls/options.json b/packages/babel-parser/test/fixtures/flow/typecasts/fail-in-calls/options.json deleted file mode 100644 index 3f861de320eb..000000000000 --- a/packages/babel-parser/test/fixtures/flow/typecasts/fail-in-calls/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "The type cast expression is expected to be wrapped with parenthesis (1:13)" -} diff --git a/packages/babel-parser/test/fixtures/flow/typecasts/fail-in-calls/output.json b/packages/babel-parser/test/fixtures/flow/typecasts/fail-in-calls/output.json new file mode 100644 index 000000000000..6b5b957074e0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/typecasts/fail-in-calls/output.json @@ -0,0 +1,166 @@ +{ + "type": "File", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "errors": [ + "SyntaxError: The type cast expression is expected to be wrapped with parenthesis (1:13)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "expression": { + "type": "CallExpression", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "callee": { + "type": "Identifier", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + }, + "identifierName": "funccall" + }, + "name": "funccall" + }, + "arguments": [ + { + "type": "Identifier", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "a" + }, + "name": "a" + }, + { + "type": "TypeCastExpression", + "start": 12, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "expression": { + "type": "Identifier", + "start": 12, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + }, + "identifierName": "b" + }, + "name": "b" + }, + "typeAnnotation": { + "type": "TypeAnnotation", + "start": 13, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "typeAnnotation": { + "type": "StringTypeAnnotation", + "start": 15, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 21 + } + } + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/typecasts/fail-without-parens/options.json b/packages/babel-parser/test/fixtures/flow/typecasts/fail-without-parens/options.json deleted file mode 100644 index 847e987ef0af..000000000000 --- a/packages/babel-parser/test/fixtures/flow/typecasts/fail-without-parens/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "The type cast expression is expected to be wrapped with parenthesis (1:5)" -} diff --git a/packages/babel-parser/test/fixtures/flow/typecasts/fail-without-parens/output.json b/packages/babel-parser/test/fixtures/flow/typecasts/fail-without-parens/output.json new file mode 100644 index 000000000000..0e18e29a41ea --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/typecasts/fail-without-parens/output.json @@ -0,0 +1,171 @@ +{ + "type": "File", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "errors": [ + "SyntaxError: The type cast expression is expected to be wrapped with parenthesis (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "expression": { + "type": "SequenceExpression", + "start": 1, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "expressions": [ + { + "type": "Identifier", + "start": 1, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + }, + "identifierName": "A" + }, + "name": "A" + }, + { + "type": "TypeCastExpression", + "start": 4, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "expression": { + "type": "Identifier", + "start": 4, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "B" + }, + "name": "B" + }, + "typeAnnotation": { + "type": "TypeAnnotation", + "start": 5, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "typeAnnotation": { + "type": "GenericTypeAnnotation", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "typeParameters": null, + "id": { + "type": "Identifier", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + }, + "identifierName": "T" + }, + "name": "T" + } + } + } + } + ], + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-1/options.json b/packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-1/options.json deleted file mode 100644 index 18cdf0d35e40..000000000000 --- a/packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-1/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "The type cast expression is expected to be wrapped with parenthesis (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-1/output.json b/packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-1/output.json new file mode 100644 index 000000000000..8170ccf4c8d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-1/output.json @@ -0,0 +1,132 @@ +{ + "type": "File", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "errors": [ + "SyntaxError: The type cast expression is expected to be wrapped with parenthesis (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "expression": { + "type": "ArrayExpression", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "elements": [ + { + "type": "TypeCastExpression", + "start": 1, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "expression": { + "type": "Identifier", + "start": 1, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + }, + "identifierName": "a" + }, + "name": "a" + }, + "typeAnnotation": { + "type": "TypeAnnotation", + "start": 2, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "typeAnnotation": { + "type": "StringTypeAnnotation", + "start": 4, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 10 + } + } + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-2/options.json b/packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-2/options.json deleted file mode 100644 index 624681c0d415..000000000000 --- a/packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-2/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "The type cast expression is expected to be wrapped with parenthesis (1:3)" -} diff --git a/packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-2/output.json b/packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-2/output.json new file mode 100644 index 000000000000..c5ba396b8101 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-2/output.json @@ -0,0 +1,136 @@ +{ + "type": "File", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "errors": [ + "SyntaxError: The type cast expression is expected to be wrapped with parenthesis (1:3)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "expression": { + "type": "ArrayExpression", + "start": 1, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "elements": [ + { + "type": "TypeCastExpression", + "start": 2, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "expression": { + "type": "Identifier", + "start": 2, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + }, + "identifierName": "a" + }, + "name": "a" + }, + "typeAnnotation": { + "type": "TypeAnnotation", + "start": 3, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "typeAnnotation": { + "type": "StringTypeAnnotation", + "start": 5, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 11 + } + } + } + } + } + ], + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-3/options.json b/packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-3/options.json deleted file mode 100644 index 7f8da08031af..000000000000 --- a/packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-3/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "The type cast expression is expected to be wrapped with parenthesis (1:7)" -} diff --git a/packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-3/output.json b/packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-3/output.json new file mode 100644 index 000000000000..d8bfbe9b1216 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-3/output.json @@ -0,0 +1,170 @@ +{ + "type": "File", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "errors": [ + "SyntaxError: The type cast expression is expected to be wrapped with parenthesis (1:7)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "expression": { + "type": "ArrayExpression", + "start": 1, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "elements": [ + { + "type": "Identifier", + "start": 2, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + }, + "identifierName": "a" + }, + "name": "a" + }, + { + "type": "ArrayExpression", + "start": 5, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "elements": [ + { + "type": "TypeCastExpression", + "start": 6, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "expression": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "b" + }, + "name": "b" + }, + "typeAnnotation": { + "type": "TypeAnnotation", + "start": 7, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "typeAnnotation": { + "type": "StringTypeAnnotation", + "start": 9, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 15 + } + } + } + } + } + ] + } + ], + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-4/options.json b/packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-4/options.json deleted file mode 100644 index 23c75013dad4..000000000000 --- a/packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-4/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "The type cast expression is expected to be wrapped with parenthesis (1:9)" -} diff --git a/packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-4/output.json b/packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-4/output.json new file mode 100644 index 000000000000..517f9d043755 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-4/output.json @@ -0,0 +1,166 @@ +{ + "type": "File", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "errors": [ + "SyntaxError: The type cast expression is expected to be wrapped with parenthesis (1:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "expression": { + "type": "CallExpression", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "callee": { + "type": "Identifier", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "async" + }, + "name": "async" + }, + "arguments": [ + { + "type": "ArrayExpression", + "start": 7, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "elements": [ + { + "type": "TypeCastExpression", + "start": 8, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "expression": { + "type": "Identifier", + "start": 8, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + }, + "identifierName": "a" + }, + "name": "a" + }, + "typeAnnotation": { + "type": "TypeAnnotation", + "start": 9, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "typeAnnotation": { + "type": "StringTypeAnnotation", + "start": 11, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 17 + } + } + } + } + } + ] + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-5/options.json b/packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-5/options.json deleted file mode 100644 index 3f861de320eb..000000000000 --- a/packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-5/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "The type cast expression is expected to be wrapped with parenthesis (1:13)" -} diff --git a/packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-5/output.json b/packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-5/output.json new file mode 100644 index 000000000000..5ae330ce23f7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/typecasts/fails-in-array-expression-5/output.json @@ -0,0 +1,200 @@ +{ + "type": "File", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "errors": [ + "SyntaxError: The type cast expression is expected to be wrapped with parenthesis (1:13)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "expression": { + "type": "CallExpression", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "callee": { + "type": "Identifier", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "async" + }, + "name": "async" + }, + "arguments": [ + { + "type": "ArrayExpression", + "start": 7, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "elements": [ + { + "type": "Identifier", + "start": 8, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + }, + "identifierName": "a" + }, + "name": "a" + }, + { + "type": "ArrayExpression", + "start": 11, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "elements": [ + { + "type": "TypeCastExpression", + "start": 12, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "expression": { + "type": "Identifier", + "start": 12, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + }, + "identifierName": "b" + }, + "name": "b" + }, + "typeAnnotation": { + "type": "TypeAnnotation", + "start": 13, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "typeAnnotation": { + "type": "StringTypeAnnotation", + "start": 15, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 21 + } + } + } + } + } + ] + } + ] + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/jsx/errors/adjacent-tags/options.json b/packages/babel-parser/test/fixtures/jsx/errors/adjacent-tags/options.json deleted file mode 100644 index 182a3a9016d8..000000000000 --- a/packages/babel-parser/test/fixtures/jsx/errors/adjacent-tags/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Adjacent JSX elements must be wrapped in an enclosing tag. Did you want a JSX fragment <>...? (1:22)" -} diff --git a/packages/babel-parser/test/fixtures/jsx/errors/adjacent-tags/output.json b/packages/babel-parser/test/fixtures/jsx/errors/adjacent-tags/output.json new file mode 100644 index 000000000000..b657e0982552 --- /dev/null +++ b/packages/babel-parser/test/fixtures/jsx/errors/adjacent-tags/output.json @@ -0,0 +1,189 @@ +{ + "type": "File", + "start": 0, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "errors": [ + "SyntaxError: Adjacent JSX elements must be wrapped in an enclosing tag. Did you want a JSX fragment <>...? (1:22)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "id": { + "type": "Identifier", + "start": 4, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "x" + }, + "name": "x" + }, + "init": { + "type": "JSXElement", + "start": 8, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "openingElement": { + "type": "JSXOpeningElement", + "start": 8, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "name": { + "type": "JSXIdentifier", + "start": 9, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "name": "div" + }, + "attributes": [], + "selfClosing": false + }, + "closingElement": { + "type": "JSXClosingElement", + "start": 16, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "name": { + "type": "JSXIdentifier", + "start": 18, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "name": "div" + } + }, + "children": [ + { + "type": "JSXText", + "start": 13, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "extra": { + "rawValue": "one", + "raw": "one" + }, + "value": "one" + } + ] + } + } + ], + "kind": "var" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/jsx/errors/attribute-empty-expression/options.json b/packages/babel-parser/test/fixtures/jsx/errors/attribute-empty-expression/options.json deleted file mode 100644 index d5960e11a308..000000000000 --- a/packages/babel-parser/test/fixtures/jsx/errors/attribute-empty-expression/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "JSX attributes must only be assigned a non-empty expression (1:9)" -} diff --git a/packages/babel-parser/test/fixtures/jsx/errors/attribute-empty-expression/output.json b/packages/babel-parser/test/fixtures/jsx/errors/attribute-empty-expression/output.json new file mode 100644 index 000000000000..a58504569cb5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/jsx/errors/attribute-empty-expression/output.json @@ -0,0 +1,165 @@ +{ + "type": "File", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "errors": [ + "SyntaxError: JSX attributes must only be assigned a non-empty expression (1:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "expression": { + "type": "JSXElement", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "openingElement": { + "type": "JSXOpeningElement", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "name": { + "type": "JSXIdentifier", + "start": 1, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "name": "foo" + }, + "attributes": [ + { + "type": "JSXAttribute", + "start": 5, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "name": { + "type": "JSXIdentifier", + "start": 5, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "name": "bar" + }, + "value": { + "type": "JSXExpressionContainer", + "start": 9, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "expression": { + "type": "JSXEmptyExpression", + "start": 10, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 10 + } + } + } + } + } + ], + "selfClosing": true + }, + "closingElement": null, + "children": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/jsx/errors/wrong-closing-tag-fragment/options.json b/packages/babel-parser/test/fixtures/jsx/errors/wrong-closing-tag-fragment/options.json deleted file mode 100644 index 4ca478c5b41f..000000000000 --- a/packages/babel-parser/test/fixtures/jsx/errors/wrong-closing-tag-fragment/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Expected corresponding JSX closing tag for <> (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/jsx/errors/wrong-closing-tag-fragment/output.json b/packages/babel-parser/test/fixtures/jsx/errors/wrong-closing-tag-fragment/output.json new file mode 100644 index 000000000000..8a88583570c3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/jsx/errors/wrong-closing-tag-fragment/output.json @@ -0,0 +1,115 @@ +{ + "type": "File", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "errors": [ + "SyntaxError: Expected corresponding JSX closing tag for <> (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "expression": { + "type": "JSXFragment", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "openingFragment": { + "type": "JSXOpeningFragment", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + "closingFragment": { + "type": "JSXClosingElement", + "start": 2, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "name": { + "type": "JSXIdentifier", + "start": 4, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "name": "something" + } + }, + "children": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/jsx/errors/wrong-closing-tag/options.json b/packages/babel-parser/test/fixtures/jsx/errors/wrong-closing-tag/options.json deleted file mode 100644 index f3afda9ee91d..000000000000 --- a/packages/babel-parser/test/fixtures/jsx/errors/wrong-closing-tag/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Expected corresponding JSX closing tag for (1:5)" -} diff --git a/packages/babel-parser/test/fixtures/jsx/errors/wrong-closing-tag/output.json b/packages/babel-parser/test/fixtures/jsx/errors/wrong-closing-tag/output.json new file mode 100644 index 000000000000..29ab5696546f --- /dev/null +++ b/packages/babel-parser/test/fixtures/jsx/errors/wrong-closing-tag/output.json @@ -0,0 +1,133 @@ +{ + "type": "File", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "errors": [ + "SyntaxError: Expected corresponding JSX closing tag for (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "expression": { + "type": "JSXElement", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "openingElement": { + "type": "JSXOpeningElement", + "start": 0, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "name": { + "type": "JSXIdentifier", + "start": 1, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "name": "Foo" + }, + "attributes": [], + "selfClosing": false + }, + "closingElement": { + "type": "JSXClosingElement", + "start": 5, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "name": { + "type": "JSXIdentifier", + "start": 7, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "name": "Bar" + } + }, + "children": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/jsx/errors/wrong-opening-tag-fragment/options.json b/packages/babel-parser/test/fixtures/jsx/errors/wrong-opening-tag-fragment/options.json deleted file mode 100644 index 25d9465b06be..000000000000 --- a/packages/babel-parser/test/fixtures/jsx/errors/wrong-opening-tag-fragment/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Expected corresponding JSX closing tag for (1:11)" -} diff --git a/packages/babel-parser/test/fixtures/jsx/errors/wrong-opening-tag-fragment/output.json b/packages/babel-parser/test/fixtures/jsx/errors/wrong-opening-tag-fragment/output.json new file mode 100644 index 000000000000..63350c9eb5d8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/jsx/errors/wrong-opening-tag-fragment/output.json @@ -0,0 +1,117 @@ +{ + "type": "File", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "errors": [ + "SyntaxError: Expected corresponding JSX closing tag for (1:11)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "expression": { + "type": "JSXElement", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "openingElement": { + "type": "JSXOpeningElement", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "name": { + "type": "JSXIdentifier", + "start": 1, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "name": "something" + }, + "attributes": [], + "selfClosing": false + }, + "closingElement": { + "type": "JSXClosingFragment", + "start": 11, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "children": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/placeholders/_errors/space-after/options.json b/packages/babel-parser/test/fixtures/placeholders/_errors/space-after/options.json index a307a35df63e..92404e501295 100644 --- a/packages/babel-parser/test/fixtures/placeholders/_errors/space-after/options.json +++ b/packages/babel-parser/test/fixtures/placeholders/_errors/space-after/options.json @@ -1,4 +1,3 @@ { - "plugins": ["placeholders"], - "throws": "Unexpected space in placeholder. (1:5)" + "plugins": ["placeholders"] } diff --git a/packages/babel-parser/test/fixtures/placeholders/_errors/space-after/output.json b/packages/babel-parser/test/fixtures/placeholders/_errors/space-after/output.json new file mode 100644 index 000000000000..4d13018c3020 --- /dev/null +++ b/packages/babel-parser/test/fixtures/placeholders/_errors/space-after/output.json @@ -0,0 +1,71 @@ +{ + "type": "File", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "errors": [ + "SyntaxError: Unexpected space in placeholder. (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "Placeholder", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "name": { + "type": "Identifier", + "start": 2, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 5 + }, + "identifierName": "FOO" + }, + "name": "FOO" + }, + "expectedNode": "Statement" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/placeholders/_errors/space-before/options.json b/packages/babel-parser/test/fixtures/placeholders/_errors/space-before/options.json index 2d76cfab7e2f..92404e501295 100644 --- a/packages/babel-parser/test/fixtures/placeholders/_errors/space-before/options.json +++ b/packages/babel-parser/test/fixtures/placeholders/_errors/space-before/options.json @@ -1,4 +1,3 @@ { - "plugins": ["placeholders"], - "throws": "Unexpected space in placeholder. (1:2)" + "plugins": ["placeholders"] } diff --git a/packages/babel-parser/test/fixtures/placeholders/_errors/space-before/output.json b/packages/babel-parser/test/fixtures/placeholders/_errors/space-before/output.json new file mode 100644 index 000000000000..0bd5ffb6bd40 --- /dev/null +++ b/packages/babel-parser/test/fixtures/placeholders/_errors/space-before/output.json @@ -0,0 +1,71 @@ +{ + "type": "File", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "errors": [ + "SyntaxError: Unexpected space in placeholder. (1:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "Placeholder", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "name": { + "type": "Identifier", + "start": 3, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "FOO" + }, + "name": "FOO" + }, + "expectedNode": "Statement" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/cast/arrow-async-parameter-as/options.json b/packages/babel-parser/test/fixtures/typescript/cast/arrow-async-parameter-as/options.json deleted file mode 100644 index 69d91502496d..000000000000 --- a/packages/babel-parser/test/fixtures/typescript/cast/arrow-async-parameter-as/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected type cast in parameter position. (1:7)" -} diff --git a/packages/babel-parser/test/fixtures/typescript/cast/arrow-async-parameter-as/output.json b/packages/babel-parser/test/fixtures/typescript/cast/arrow-async-parameter-as/output.json new file mode 100644 index 000000000000..84bb9f048205 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/cast/arrow-async-parameter-as/output.json @@ -0,0 +1,154 @@ +{ + "type": "File", + "start": 0, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "errors": [ + "SyntaxError: Unexpected type cast in parameter position. (1:7)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "id": null, + "generator": false, + "async": true, + "params": [ + { + "type": "TSAsExpression", + "start": 7, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "expression": { + "type": "Identifier", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + }, + "identifierName": "a" + }, + "name": "a" + }, + "typeAnnotation": { + "type": "TSTypeReference", + "start": 12, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "typeName": { + "type": "Identifier", + "start": 12, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + }, + "identifierName": "T" + }, + "name": "T" + } + } + } + ], + "body": { + "type": "BlockStatement", + "start": 18, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "body": [], + "directives": [] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/cast/arrow-async-parameter-assertion/options.json b/packages/babel-parser/test/fixtures/typescript/cast/arrow-async-parameter-assertion/options.json deleted file mode 100644 index 69d91502496d..000000000000 --- a/packages/babel-parser/test/fixtures/typescript/cast/arrow-async-parameter-assertion/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected type cast in parameter position. (1:7)" -} diff --git a/packages/babel-parser/test/fixtures/typescript/cast/arrow-async-parameter-assertion/output.json b/packages/babel-parser/test/fixtures/typescript/cast/arrow-async-parameter-assertion/output.json new file mode 100644 index 000000000000..5825bdc4db33 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/cast/arrow-async-parameter-assertion/output.json @@ -0,0 +1,154 @@ +{ + "type": "File", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "errors": [ + "SyntaxError: Unexpected type cast in parameter position. (1:7)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 0, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "id": null, + "generator": false, + "async": true, + "params": [ + { + "type": "TSTypeAssertion", + "start": 7, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "typeAnnotation": { + "type": "TSTypeReference", + "start": 8, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "typeName": { + "type": "Identifier", + "start": 8, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + }, + "identifierName": "T" + }, + "name": "T" + } + }, + "expression": { + "type": "Identifier", + "start": 11, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "a" + }, + "name": "a" + } + } + ], + "body": { + "type": "BlockStatement", + "start": 17, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "body": [], + "directives": [] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/cast/arrow-parameter-as/options.json b/packages/babel-parser/test/fixtures/typescript/cast/arrow-parameter-as/options.json deleted file mode 100644 index b5bdba868c9f..000000000000 --- a/packages/babel-parser/test/fixtures/typescript/cast/arrow-parameter-as/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected type cast in parameter position. (1:1)" -} diff --git a/packages/babel-parser/test/fixtures/typescript/cast/arrow-parameter-as/output.json b/packages/babel-parser/test/fixtures/typescript/cast/arrow-parameter-as/output.json new file mode 100644 index 000000000000..369ec9d0eb08 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/cast/arrow-parameter-as/output.json @@ -0,0 +1,154 @@ +{ + "type": "File", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "errors": [ + "SyntaxError: Unexpected type cast in parameter position. (1:1)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "TSAsExpression", + "start": 1, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "expression": { + "type": "Identifier", + "start": 1, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + }, + "identifierName": "a" + }, + "name": "a" + }, + "typeAnnotation": { + "type": "TSTypeReference", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "typeName": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "T" + }, + "name": "T" + } + } + } + ], + "body": { + "type": "BlockStatement", + "start": 12, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "body": [], + "directives": [] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/cast/arrow-parameter-assertion/options.json b/packages/babel-parser/test/fixtures/typescript/cast/arrow-parameter-assertion/options.json deleted file mode 100644 index b5bdba868c9f..000000000000 --- a/packages/babel-parser/test/fixtures/typescript/cast/arrow-parameter-assertion/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected type cast in parameter position. (1:1)" -} diff --git a/packages/babel-parser/test/fixtures/typescript/cast/arrow-parameter-assertion/output.json b/packages/babel-parser/test/fixtures/typescript/cast/arrow-parameter-assertion/output.json new file mode 100644 index 000000000000..52cb7ee9d5a9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/cast/arrow-parameter-assertion/output.json @@ -0,0 +1,154 @@ +{ + "type": "File", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "errors": [ + "SyntaxError: Unexpected type cast in parameter position. (1:1)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "TSTypeAssertion", + "start": 1, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "typeAnnotation": { + "type": "TSTypeReference", + "start": 2, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "typeName": { + "type": "Identifier", + "start": 2, + "end": 3, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + }, + "identifierName": "T" + }, + "name": "T" + } + }, + "expression": { + "type": "Identifier", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "a" + }, + "name": "a" + } + } + ], + "body": { + "type": "BlockStatement", + "start": 11, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "body": [], + "directives": [] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/class/extends-empty/options.json b/packages/babel-parser/test/fixtures/typescript/class/extends-empty/options.json deleted file mode 100644 index 3de0ab8596c4..000000000000 --- a/packages/babel-parser/test/fixtures/typescript/class/extends-empty/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "'extends' list cannot be empty. (1:22)" -} diff --git a/packages/babel-parser/test/fixtures/typescript/class/extends-empty/output.json b/packages/babel-parser/test/fixtures/typescript/class/extends-empty/output.json new file mode 100644 index 000000000000..0fe556a129e5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/class/extends-empty/output.json @@ -0,0 +1,87 @@ +{ + "type": "File", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 1 + } + }, + "errors": [ + "SyntaxError: 'extends' list cannot be empty. (1:22)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 1 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TSInterfaceDeclaration", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 10, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 13 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "extends": [], + "body": { + "type": "TSInterfaceBody", + "start": 22, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 2, + "column": 1 + } + }, + "body": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/class/extends-implements-empty/options.json b/packages/babel-parser/test/fixtures/typescript/class/extends-implements-empty/options.json deleted file mode 100644 index 950506446835..000000000000 --- a/packages/babel-parser/test/fixtures/typescript/class/extends-implements-empty/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "'implements' list cannot be empty. (1:33)" -} diff --git a/packages/babel-parser/test/fixtures/typescript/class/extends-implements-empty/output.json b/packages/babel-parser/test/fixtures/typescript/class/extends-implements-empty/output.json new file mode 100644 index 000000000000..a84755dbbeb5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/class/extends-implements-empty/output.json @@ -0,0 +1,104 @@ +{ + "type": "File", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 1 + } + }, + "errors": [ + "SyntaxError: 'implements' list cannot be empty. (1:33)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 1 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + }, + "identifierName": "Foo" + }, + "name": "Foo" + }, + "superClass": { + "type": "Identifier", + "start": 18, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 21 + }, + "identifierName": "Bar" + }, + "name": "Bar" + }, + "implements": [], + "body": { + "type": "ClassBody", + "start": 33, + "end": 36, + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 2, + "column": 1 + } + }, + "body": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/class/implements-empty/options.json b/packages/babel-parser/test/fixtures/typescript/class/implements-empty/options.json deleted file mode 100644 index 6751fbcc5443..000000000000 --- a/packages/babel-parser/test/fixtures/typescript/class/implements-empty/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "'implements' list cannot be empty. (1:21)" -} diff --git a/packages/babel-parser/test/fixtures/typescript/class/implements-empty/output.json b/packages/babel-parser/test/fixtures/typescript/class/implements-empty/output.json new file mode 100644 index 000000000000..bcf3445883b0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/class/implements-empty/output.json @@ -0,0 +1,88 @@ +{ + "type": "File", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 1 + } + }, + "errors": [ + "SyntaxError: 'implements' list cannot be empty. (1:21)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 1 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + }, + "identifierName": "Foo" + }, + "name": "Foo" + }, + "superClass": null, + "implements": [], + "body": { + "type": "ClassBody", + "start": 21, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 2, + "column": 1 + } + }, + "body": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/class/parameter-properties-binding-patterns/options.json b/packages/babel-parser/test/fixtures/typescript/class/parameter-properties-binding-patterns/options.json deleted file mode 100644 index b84b0421721a..000000000000 --- a/packages/babel-parser/test/fixtures/typescript/class/parameter-properties-binding-patterns/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "A parameter property may not be declared using a binding pattern. (2:16)" -} diff --git a/packages/babel-parser/test/fixtures/typescript/class/parameter-properties-binding-patterns/output.json b/packages/babel-parser/test/fixtures/typescript/class/parameter-properties-binding-patterns/output.json new file mode 100644 index 000000000000..9436fb7283a9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/class/parameter-properties-binding-patterns/output.json @@ -0,0 +1,177 @@ +{ + "type": "File", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: A parameter property may not be declared using a binding pattern. (2:16)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "C" + }, + "name": "C" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ClassMethod", + "start": 14, + "end": 39, + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 29 + } + }, + "static": false, + "key": { + "type": "Identifier", + "start": 14, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 15 + }, + "identifierName": "constructor" + }, + "name": "constructor" + }, + "computed": false, + "kind": "constructor", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "TSParameterProperty", + "start": 26, + "end": 35, + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 25 + } + }, + "accessibility": "public", + "parameter": { + "type": "ArrayPattern", + "start": 33, + "end": 35, + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 25 + } + }, + "elements": [] + } + } + ], + "body": { + "type": "BlockStatement", + "start": 37, + "end": 39, + "loc": { + "start": { + "line": 2, + "column": 27 + }, + "end": { + "line": 2, + "column": 29 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-abstract/options.json b/packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-abstract/options.json deleted file mode 100644 index 7c4adceba22a..000000000000 --- a/packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-abstract/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Private elements cannot have the 'abstract' modifier. (2:2)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-abstract/output.json b/packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-abstract/output.json new file mode 100644 index 000000000000..9107b0794815 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-abstract/output.json @@ -0,0 +1,139 @@ +{ + "type": "File", + "start": 0, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Private elements cannot have the 'abstract' modifier. (2:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "abstract": true, + "id": { + "type": "Identifier", + "start": 15, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 17, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ClassPrivateProperty", + "start": 21, + "end": 33, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "abstract": true, + "static": false, + "key": { + "type": "PrivateName", + "start": 30, + "end": 32, + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 13 + } + }, + "id": { + "type": "Identifier", + "start": 31, + "end": 32, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 13 + }, + "identifierName": "a" + }, + "name": "a" + } + }, + "value": null + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-private/options.json b/packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-private/options.json deleted file mode 100644 index a183ce2e7550..000000000000 --- a/packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-private/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Private elements cannot have an accessibility modifier ('private') (2:2)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-private/output.json b/packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-private/output.json new file mode 100644 index 000000000000..360a75b9f7a1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-private/output.json @@ -0,0 +1,138 @@ +{ + "type": "File", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Private elements cannot have an accessibility modifier ('private') (2:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ClassPrivateProperty", + "start": 12, + "end": 23, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 13 + } + }, + "accessibility": "private", + "static": false, + "key": { + "type": "PrivateName", + "start": 20, + "end": 22, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 12 + } + }, + "id": { + "type": "Identifier", + "start": 21, + "end": 22, + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 12 + }, + "identifierName": "a" + }, + "name": "a" + } + }, + "value": null + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-protected/options.json b/packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-protected/options.json deleted file mode 100644 index e6c1bebe1ab9..000000000000 --- a/packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-protected/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Private elements cannot have an accessibility modifier ('protected') (2:2)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-protected/output.json b/packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-protected/output.json new file mode 100644 index 000000000000..60afa0c3bc76 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-protected/output.json @@ -0,0 +1,138 @@ +{ + "type": "File", + "start": 0, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Private elements cannot have an accessibility modifier ('protected') (2:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ClassPrivateProperty", + "start": 12, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "accessibility": "protected", + "static": false, + "key": { + "type": "PrivateName", + "start": 22, + "end": 24, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "id": { + "type": "Identifier", + "start": 23, + "end": 24, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 14 + }, + "identifierName": "a" + }, + "name": "a" + } + }, + "value": null + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-public/options.json b/packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-public/options.json deleted file mode 100644 index 7fb90279eae1..000000000000 --- a/packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-public/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Private elements cannot have an accessibility modifier ('public') (2:2)" -} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-public/output.json b/packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-public/output.json new file mode 100644 index 000000000000..3f526e42418c --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-public/output.json @@ -0,0 +1,138 @@ +{ + "type": "File", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Private elements cannot have an accessibility modifier ('public') (2:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ClassPrivateProperty", + "start": 12, + "end": 22, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 12 + } + }, + "accessibility": "public", + "static": false, + "key": { + "type": "PrivateName", + "start": 19, + "end": 21, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "id": { + "type": "Identifier", + "start": 20, + "end": 21, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + }, + "identifierName": "a" + }, + "name": "a" + } + }, + "value": null + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/function/pattern-parameters/options.json b/packages/babel-parser/test/fixtures/typescript/function/pattern-parameters/options.json deleted file mode 100644 index fb2831d6188b..000000000000 --- a/packages/babel-parser/test/fixtures/typescript/function/pattern-parameters/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "A binding pattern parameter cannot be optional in an implementation signature. (1:11)" -} diff --git a/packages/babel-parser/test/fixtures/typescript/function/pattern-parameters/output.json b/packages/babel-parser/test/fixtures/typescript/function/pattern-parameters/output.json new file mode 100644 index 000000000000..3ef0fdc07d93 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/function/pattern-parameters/output.json @@ -0,0 +1,124 @@ +{ + "type": "File", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "errors": [ + "SyntaxError: A binding pattern parameter cannot be optional in an implementation signature. (1:11)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "f" + }, + "name": "f" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "ArrayPattern", + "start": 11, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "elements": [], + "optional": true + }, + { + "type": "ObjectPattern", + "start": 16, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "properties": [] + } + ], + "body": { + "type": "BlockStatement", + "start": 20, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-class-class/options.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-class-class/options.json deleted file mode 100644 index 336686170eb0..000000000000 --- a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-class-class/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'A' has already been declared (2:6)" -} diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-class-class/output.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-class-class/output.json new file mode 100644 index 000000000000..5642df62a53c --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-class-class/output.json @@ -0,0 +1,136 @@ +{ + "type": "File", + "start": 0, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 10 + } + }, + "errors": [ + "SyntaxError: Identifier 'A' has already been declared (2:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 10 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "body": [] + } + }, + { + "type": "ClassDeclaration", + "start": 11, + "end": 21, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 10 + } + }, + "id": { + "type": "Identifier", + "start": 17, + "end": 18, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 19, + "end": 21, + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 10 + } + }, + "body": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-class-enum/options.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-class-enum/options.json deleted file mode 100644 index 1eed93f49a0e..000000000000 --- a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-class-enum/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'A' has already been declared (2:5)" -} diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-class-enum/output.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-class-enum/output.json new file mode 100644 index 000000000000..6d6bbe962695 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-class-enum/output.json @@ -0,0 +1,120 @@ +{ + "type": "File", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 9 + } + }, + "errors": [ + "SyntaxError: Identifier 'A' has already been declared (2:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 9 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "body": [] + } + }, + { + "type": "TSEnumDeclaration", + "start": 11, + "end": 20, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 9 + } + }, + "id": { + "type": "Identifier", + "start": 16, + "end": 17, + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 6 + }, + "identifierName": "A" + }, + "name": "A" + }, + "members": [] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-class-type/options.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-class-type/options.json deleted file mode 100644 index 1eed93f49a0e..000000000000 --- a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-class-type/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'A' has already been declared (2:5)" -} diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-class-type/output.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-class-type/output.json new file mode 100644 index 000000000000..c6886d19470d --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-class-type/output.json @@ -0,0 +1,134 @@ +{ + "type": "File", + "start": 0, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "errors": [ + "SyntaxError: Identifier 'A' has already been declared (2:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "body": [] + } + }, + { + "type": "TSTypeAliasDeclaration", + "start": 11, + "end": 27, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "id": { + "type": "Identifier", + "start": 16, + "end": 17, + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 6 + }, + "identifierName": "A" + }, + "name": "A" + }, + "typeAnnotation": { + "type": "TSNumberKeyword", + "start": 20, + "end": 26, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 15 + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-constenum-enum/options.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-constenum-enum/options.json deleted file mode 100644 index ee82975e59a3..000000000000 --- a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-constenum-enum/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'X' has already been declared (2:5)" -} diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-constenum-enum/output.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-constenum-enum/output.json new file mode 100644 index 000000000000..b6b67ebef96c --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-constenum-enum/output.json @@ -0,0 +1,105 @@ +{ + "type": "File", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 9 + } + }, + "errors": [ + "SyntaxError: Identifier 'X' has already been declared (2:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 9 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TSEnumDeclaration", + "start": 0, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "const": true, + "id": { + "type": "Identifier", + "start": 11, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "X" + }, + "name": "X" + }, + "members": [] + }, + { + "type": "TSEnumDeclaration", + "start": 16, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 9 + } + }, + "id": { + "type": "Identifier", + "start": 21, + "end": 22, + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 6 + }, + "identifierName": "X" + }, + "name": "X" + }, + "members": [] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-class/options.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-class/options.json deleted file mode 100644 index 69462b29a995..000000000000 --- a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-class/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'X' has already been declared (2:6)" -} diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-class/output.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-class/output.json new file mode 100644 index 000000000000..8518fac0e7e9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-class/output.json @@ -0,0 +1,120 @@ +{ + "type": "File", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 10 + } + }, + "errors": [ + "SyntaxError: Identifier 'X' has already been declared (2:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 10 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TSEnumDeclaration", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "X" + }, + "name": "X" + }, + "members": [] + }, + { + "type": "ClassDeclaration", + "start": 10, + "end": 20, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 10 + } + }, + "id": { + "type": "Identifier", + "start": 16, + "end": 17, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 7 + }, + "identifierName": "X" + }, + "name": "X" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 18, + "end": 20, + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 10 + } + }, + "body": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-constenum/options.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-constenum/options.json deleted file mode 100644 index c77fcb7927ac..000000000000 --- a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-constenum/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'X' has already been declared (2:11)" -} diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-constenum/output.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-constenum/output.json new file mode 100644 index 000000000000..8a9778e36851 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-constenum/output.json @@ -0,0 +1,105 @@ +{ + "type": "File", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "errors": [ + "SyntaxError: Identifier 'X' has already been declared (2:11)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TSEnumDeclaration", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "X" + }, + "name": "X" + }, + "members": [] + }, + { + "type": "TSEnumDeclaration", + "start": 10, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "const": true, + "id": { + "type": "Identifier", + "start": 21, + "end": 22, + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 12 + }, + "identifierName": "X" + }, + "name": "X" + }, + "members": [] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-function/options.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-function/options.json deleted file mode 100644 index ee47ddce75a8..000000000000 --- a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-function/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'Foo' has already been declared (2:9)" -} diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-function/output.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-function/output.json new file mode 100644 index 000000000000..ab31065f580b --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-function/output.json @@ -0,0 +1,123 @@ +{ + "type": "File", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 17 + } + }, + "errors": [ + "SyntaxError: Identifier 'Foo' has already been declared (2:9)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 17 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TSEnumDeclaration", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 8 + }, + "identifierName": "Foo" + }, + "name": "Foo" + }, + "members": [] + }, + { + "type": "FunctionDeclaration", + "start": 12, + "end": 29, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 17 + } + }, + "id": { + "type": "Identifier", + "start": 21, + "end": 24, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 12 + }, + "identifierName": "Foo" + }, + "name": "Foo" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 27, + "end": 29, + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 17 + } + }, + "body": [], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-interface/options.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-interface/options.json deleted file mode 100644 index a5f623f4e212..000000000000 --- a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-interface/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'X' has already been declared (2:10)" -} diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-interface/output.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-interface/output.json new file mode 100644 index 000000000000..80905a927dc9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-interface/output.json @@ -0,0 +1,119 @@ +{ + "type": "File", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "errors": [ + "SyntaxError: Identifier 'X' has already been declared (2:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TSEnumDeclaration", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "X" + }, + "name": "X" + }, + "members": [] + }, + { + "type": "TSInterfaceDeclaration", + "start": 10, + "end": 24, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "id": { + "type": "Identifier", + "start": 20, + "end": 21, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + }, + "identifierName": "X" + }, + "name": "X" + }, + "body": { + "type": "TSInterfaceBody", + "start": 22, + "end": 24, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "body": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-let/options.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-let/options.json deleted file mode 100644 index 4172f917bdb1..000000000000 --- a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-let/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'Foo' has already been declared (2:4)" -} diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-let/output.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-let/output.json new file mode 100644 index 000000000000..4f8b4783578a --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-let/output.json @@ -0,0 +1,122 @@ +{ + "type": "File", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 8 + } + }, + "errors": [ + "SyntaxError: Identifier 'Foo' has already been declared (2:4)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 8 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TSEnumDeclaration", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 8 + }, + "identifierName": "Foo" + }, + "name": "Foo" + }, + "members": [] + }, + { + "type": "VariableDeclaration", + "start": 12, + "end": 20, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 8 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 16, + "end": 19, + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 7 + } + }, + "id": { + "type": "Identifier", + "start": 16, + "end": 19, + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 7 + }, + "identifierName": "Foo" + }, + "name": "Foo" + }, + "init": null + } + ], + "kind": "let" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-type/options.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-type/options.json deleted file mode 100644 index ee82975e59a3..000000000000 --- a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-type/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'X' has already been declared (2:5)" -} diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-type/output.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-type/output.json new file mode 100644 index 000000000000..e347d9e0a548 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-type/output.json @@ -0,0 +1,118 @@ +{ + "type": "File", + "start": 0, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "errors": [ + "SyntaxError: Identifier 'X' has already been declared (2:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TSEnumDeclaration", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "X" + }, + "name": "X" + }, + "members": [] + }, + { + "type": "TSTypeAliasDeclaration", + "start": 10, + "end": 26, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "id": { + "type": "Identifier", + "start": 15, + "end": 16, + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 6 + }, + "identifierName": "X" + }, + "name": "X" + }, + "typeAnnotation": { + "type": "TSNumberKeyword", + "start": 19, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 15 + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-var/options.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-var/options.json deleted file mode 100644 index 4172f917bdb1..000000000000 --- a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-var/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'Foo' has already been declared (2:4)" -} diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-var/output.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-var/output.json new file mode 100644 index 000000000000..4f8b4783578a --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-enum-var/output.json @@ -0,0 +1,122 @@ +{ + "type": "File", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 8 + } + }, + "errors": [ + "SyntaxError: Identifier 'Foo' has already been declared (2:4)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 8 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TSEnumDeclaration", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 8 + }, + "identifierName": "Foo" + }, + "name": "Foo" + }, + "members": [] + }, + { + "type": "VariableDeclaration", + "start": 12, + "end": 20, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 8 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 16, + "end": 19, + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 7 + } + }, + "id": { + "type": "Identifier", + "start": 16, + "end": 19, + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 7 + }, + "identifierName": "Foo" + }, + "name": "Foo" + }, + "init": null + } + ], + "kind": "let" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-function-enum/options.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-function-enum/options.json deleted file mode 100644 index 92349410e8cf..000000000000 --- a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-function-enum/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'Foo' has already been declared (2:5)" -} diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-function-enum/output.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-function-enum/output.json new file mode 100644 index 000000000000..c8a1a8f8dc65 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-function-enum/output.json @@ -0,0 +1,123 @@ +{ + "type": "File", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "errors": [ + "SyntaxError: Identifier 'Foo' has already been declared (2:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start": 0, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "id": { + "type": "Identifier", + "start": 9, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "Foo" + }, + "name": "Foo" + }, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 15, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "body": [], + "directives": [] + } + }, + { + "type": "TSEnumDeclaration", + "start": 18, + "end": 29, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "id": { + "type": "Identifier", + "start": 23, + "end": 26, + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 8 + }, + "identifierName": "Foo" + }, + "name": "Foo" + }, + "members": [] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-interface-enum/options.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-interface-enum/options.json deleted file mode 100644 index ee82975e59a3..000000000000 --- a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-interface-enum/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'X' has already been declared (2:5)" -} diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-interface-enum/output.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-interface-enum/output.json new file mode 100644 index 000000000000..63b26bca4458 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-interface-enum/output.json @@ -0,0 +1,119 @@ +{ + "type": "File", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 9 + } + }, + "errors": [ + "SyntaxError: Identifier 'X' has already been declared (2:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 9 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TSInterfaceDeclaration", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "id": { + "type": "Identifier", + "start": 10, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + }, + "identifierName": "X" + }, + "name": "X" + }, + "body": { + "type": "TSInterfaceBody", + "start": 12, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "body": [] + } + }, + { + "type": "TSEnumDeclaration", + "start": 15, + "end": 24, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 9 + } + }, + "id": { + "type": "Identifier", + "start": 20, + "end": 21, + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 6 + }, + "identifierName": "X" + }, + "name": "X" + }, + "members": [] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-let-enum/options.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-let-enum/options.json deleted file mode 100644 index 92349410e8cf..000000000000 --- a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-let-enum/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'Foo' has already been declared (2:5)" -} diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-let-enum/output.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-let-enum/output.json new file mode 100644 index 000000000000..1c1cfb5c1696 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-let-enum/output.json @@ -0,0 +1,122 @@ +{ + "type": "File", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "errors": [ + "SyntaxError: Identifier 'Foo' has already been declared (2:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "id": { + "type": "Identifier", + "start": 4, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "Foo" + }, + "name": "Foo" + }, + "init": null + } + ], + "kind": "let" + }, + { + "type": "TSEnumDeclaration", + "start": 9, + "end": 20, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "id": { + "type": "Identifier", + "start": 14, + "end": 17, + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 8 + }, + "identifierName": "Foo" + }, + "name": "Foo" + }, + "members": [] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-type-class/options.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-type-class/options.json deleted file mode 100644 index 336686170eb0..000000000000 --- a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-type-class/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'A' has already been declared (2:6)" -} diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-type-class/output.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-type-class/output.json new file mode 100644 index 000000000000..3e63a0f7f298 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-type-class/output.json @@ -0,0 +1,134 @@ +{ + "type": "File", + "start": 0, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 10 + } + }, + "errors": [ + "SyntaxError: Identifier 'A' has already been declared (2:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 10 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TSTypeAliasDeclaration", + "start": 0, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "A" + }, + "name": "A" + }, + "typeAnnotation": { + "type": "TSNumberKeyword", + "start": 9, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 15 + } + } + } + }, + { + "type": "ClassDeclaration", + "start": 17, + "end": 27, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 10 + } + }, + "id": { + "type": "Identifier", + "start": 23, + "end": 24, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 25, + "end": 27, + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 10 + } + }, + "body": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-type-enum/options.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-type-enum/options.json deleted file mode 100644 index 1eed93f49a0e..000000000000 --- a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-type-enum/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'A' has already been declared (2:5)" -} diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-type-enum/output.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-type-enum/output.json new file mode 100644 index 000000000000..ba27b683a4b7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-type-enum/output.json @@ -0,0 +1,118 @@ +{ + "type": "File", + "start": 0, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 9 + } + }, + "errors": [ + "SyntaxError: Identifier 'A' has already been declared (2:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 9 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TSTypeAliasDeclaration", + "start": 0, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "A" + }, + "name": "A" + }, + "typeAnnotation": { + "type": "TSNumberKeyword", + "start": 9, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 15 + } + } + } + }, + { + "type": "TSEnumDeclaration", + "start": 17, + "end": 26, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 9 + } + }, + "id": { + "type": "Identifier", + "start": 22, + "end": 23, + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 6 + }, + "identifierName": "A" + }, + "name": "A" + }, + "members": [] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-type-interface/options.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-type-interface/options.json deleted file mode 100644 index 04242bd1565b..000000000000 --- a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-type-interface/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'A' has already been declared (2:10)" -} diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-type-interface/output.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-type-interface/output.json new file mode 100644 index 000000000000..4983be36642d --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-type-interface/output.json @@ -0,0 +1,133 @@ +{ + "type": "File", + "start": 0, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "errors": [ + "SyntaxError: Identifier 'A' has already been declared (2:10)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TSTypeAliasDeclaration", + "start": 0, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "A" + }, + "name": "A" + }, + "typeAnnotation": { + "type": "TSNumberKeyword", + "start": 9, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 15 + } + } + } + }, + { + "type": "TSInterfaceDeclaration", + "start": 17, + "end": 31, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "id": { + "type": "Identifier", + "start": 27, + "end": 28, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + }, + "identifierName": "A" + }, + "name": "A" + }, + "body": { + "type": "TSInterfaceBody", + "start": 29, + "end": 31, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "body": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-type-type/options.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-type-type/options.json deleted file mode 100644 index 1eed93f49a0e..000000000000 --- a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-type-type/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'A' has already been declared (2:5)" -} diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-type-type/output.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-type-type/output.json new file mode 100644 index 000000000000..02fde75620f0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-type-type/output.json @@ -0,0 +1,132 @@ +{ + "type": "File", + "start": 0, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "errors": [ + "SyntaxError: Identifier 'A' has already been declared (2:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TSTypeAliasDeclaration", + "start": 0, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "A" + }, + "name": "A" + }, + "typeAnnotation": { + "type": "TSNumberKeyword", + "start": 9, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 15 + } + } + } + }, + { + "type": "TSTypeAliasDeclaration", + "start": 17, + "end": 33, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "id": { + "type": "Identifier", + "start": 22, + "end": 23, + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 6 + }, + "identifierName": "A" + }, + "name": "A" + }, + "typeAnnotation": { + "type": "TSStringKeyword", + "start": 26, + "end": 32, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 15 + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-var-enum/options.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-var-enum/options.json deleted file mode 100644 index 92349410e8cf..000000000000 --- a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-var-enum/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Identifier 'Foo' has already been declared (2:5)" -} diff --git a/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-var-enum/output.json b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-var-enum/output.json new file mode 100644 index 000000000000..1c1cfb5c1696 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/scope/redeclaration-var-enum/output.json @@ -0,0 +1,122 @@ +{ + "type": "File", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "errors": [ + "SyntaxError: Identifier 'Foo' has already been declared (2:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "id": { + "type": "Identifier", + "start": 4, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "Foo" + }, + "name": "Foo" + }, + "init": null + } + ], + "kind": "let" + }, + { + "type": "TSEnumDeclaration", + "start": 9, + "end": 20, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "id": { + "type": "Identifier", + "start": 14, + "end": 17, + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 8 + }, + "identifierName": "Foo" + }, + "name": "Foo" + }, + "members": [] + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/types/literal-string-2/options.json b/packages/babel-parser/test/fixtures/typescript/types/literal-string-2/options.json deleted file mode 100644 index 856a8477d1ca..000000000000 --- a/packages/babel-parser/test/fixtures/typescript/types/literal-string-2/options.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "sourceType": "module", - "plugins": ["typescript"], - "throws": "Template literal types cannot have any substitution (1:14)" -} diff --git a/packages/babel-parser/test/fixtures/typescript/types/literal-string-2/output.json b/packages/babel-parser/test/fixtures/typescript/types/literal-string-2/output.json new file mode 100644 index 000000000000..ee3c9e5da012 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/types/literal-string-2/output.json @@ -0,0 +1,195 @@ +{ + "type": "File", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "errors": [ + "SyntaxError: Template literal types cannot have any substitution (1:14)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "id": { + "type": "Identifier", + "start": 4, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 19 + }, + "identifierName": "x" + }, + "name": "x", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "start": 5, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "typeAnnotation": { + "type": "TSLiteralType", + "start": 7, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "literal": { + "type": "TemplateLiteral", + "start": 7, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "expressions": [ + { + "type": "Identifier", + "start": 14, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 17 + }, + "identifierName": "bar" + }, + "name": "bar" + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start": 8, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": { + "raw": "foo-", + "cooked": "foo-" + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 18, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "value": { + "raw": "", + "cooked": "" + }, + "tail": true + } + ] + } + } + } + }, + "init": null + } + ], + "kind": "let" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/types/read-only-1/options.json b/packages/babel-parser/test/fixtures/typescript/types/read-only-1/options.json deleted file mode 100644 index 0a91d0015278..000000000000 --- a/packages/babel-parser/test/fixtures/typescript/types/read-only-1/options.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "sourceType": "module", - "plugins": ["typescript"], - "throws": "'readonly' type modifier is only permitted on array and tuple literal types. (1:11)" -} diff --git a/packages/babel-parser/test/fixtures/typescript/types/read-only-1/output.json b/packages/babel-parser/test/fixtures/typescript/types/read-only-1/output.json new file mode 100644 index 000000000000..ced722e79dd3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/types/read-only-1/output.json @@ -0,0 +1,137 @@ +{ + "type": "File", + "start": 0, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "errors": [ + "SyntaxError: 'readonly' type modifier is only permitted on array and tuple literal types. (1:11)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TSTypeAliasDeclaration", + "start": 0, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 8 + }, + "identifierName": "T30" + }, + "name": "T30" + }, + "typeAnnotation": { + "type": "TSTypeOperator", + "start": 11, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "operator": "readonly", + "typeAnnotation": { + "type": "TSStringKeyword", + "start": 20, + "end": 26, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 26 + } + } + } + }, + "trailingComments": [ + { + "type": "CommentLine", + "value": " Error", + "start": 29, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 37 + } + } + } + ] + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentLine", + "value": " Error", + "start": 29, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 37 + } + } + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/types/read-only-2/options.json b/packages/babel-parser/test/fixtures/typescript/types/read-only-2/options.json deleted file mode 100644 index 0a91d0015278..000000000000 --- a/packages/babel-parser/test/fixtures/typescript/types/read-only-2/options.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "sourceType": "module", - "plugins": ["typescript"], - "throws": "'readonly' type modifier is only permitted on array and tuple literal types. (1:11)" -} diff --git a/packages/babel-parser/test/fixtures/typescript/types/read-only-2/output.json b/packages/babel-parser/test/fixtures/typescript/types/read-only-2/output.json new file mode 100644 index 000000000000..73c4d7d4cd3f --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/types/read-only-2/output.json @@ -0,0 +1,154 @@ +{ + "type": "File", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "errors": [ + "SyntaxError: 'readonly' type modifier is only permitted on array and tuple literal types. (1:11)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TSTypeAliasDeclaration", + "start": 0, + "end": 22, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 8 + }, + "identifierName": "T31" + }, + "name": "T31" + }, + "typeAnnotation": { + "type": "TSTypeOperator", + "start": 11, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "operator": "readonly", + "typeAnnotation": { + "type": "TSTypeReference", + "start": 20, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "typeName": { + "type": "Identifier", + "start": 20, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + }, + "identifierName": "T" + }, + "name": "T" + } + } + }, + "trailingComments": [ + { + "type": "CommentLine", + "value": " Error", + "start": 24, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 32 + } + } + } + ] + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentLine", + "value": " Error", + "start": 24, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 32 + } + } + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/types/read-only-3/options.json b/packages/babel-parser/test/fixtures/typescript/types/read-only-3/options.json deleted file mode 100644 index 0a91d0015278..000000000000 --- a/packages/babel-parser/test/fixtures/typescript/types/read-only-3/options.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "sourceType": "module", - "plugins": ["typescript"], - "throws": "'readonly' type modifier is only permitted on array and tuple literal types. (1:11)" -} diff --git a/packages/babel-parser/test/fixtures/typescript/types/read-only-3/output.json b/packages/babel-parser/test/fixtures/typescript/types/read-only-3/output.json new file mode 100644 index 000000000000..8a977f1e3987 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/types/read-only-3/output.json @@ -0,0 +1,168 @@ +{ + "type": "File", + "start": 0, + "end": 48, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 48 + } + }, + "errors": [ + "SyntaxError: 'readonly' type modifier is only permitted on array and tuple literal types. (1:11)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 48, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 48 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TSTypeAliasDeclaration", + "start": 0, + "end": 38, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 8 + }, + "identifierName": "T32" + }, + "name": "T32" + }, + "typeAnnotation": { + "type": "TSTypeOperator", + "start": 11, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "operator": "readonly", + "typeAnnotation": { + "type": "TSTypeOperator", + "start": 20, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "operator": "readonly", + "typeAnnotation": { + "type": "TSArrayType", + "start": 29, + "end": 37, + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "elementType": { + "type": "TSStringKeyword", + "start": 29, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 35 + } + } + } + } + } + }, + "trailingComments": [ + { + "type": "CommentLine", + "value": " Error", + "start": 40, + "end": 48, + "loc": { + "start": { + "line": 1, + "column": 40 + }, + "end": { + "line": 1, + "column": 48 + } + } + } + ] + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentLine", + "value": " Error", + "start": 40, + "end": 48, + "loc": { + "start": { + "line": 1, + "column": 40 + }, + "end": { + "line": 1, + "column": 48 + } + } + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/types/read-only-4/options.json b/packages/babel-parser/test/fixtures/typescript/types/read-only-4/options.json deleted file mode 100644 index 0a91d0015278..000000000000 --- a/packages/babel-parser/test/fixtures/typescript/types/read-only-4/options.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "sourceType": "module", - "plugins": ["typescript"], - "throws": "'readonly' type modifier is only permitted on array and tuple literal types. (1:11)" -} diff --git a/packages/babel-parser/test/fixtures/typescript/types/read-only-4/output.json b/packages/babel-parser/test/fixtures/typescript/types/read-only-4/output.json new file mode 100644 index 000000000000..0e0dd2eb9f49 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/types/read-only-4/output.json @@ -0,0 +1,186 @@ +{ + "type": "File", + "start": 0, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 44 + } + }, + "errors": [ + "SyntaxError: 'readonly' type modifier is only permitted on array and tuple literal types. (1:11)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 44 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TSTypeAliasDeclaration", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "id": { + "type": "Identifier", + "start": 5, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 8 + }, + "identifierName": "T33" + }, + "name": "T33" + }, + "typeAnnotation": { + "type": "TSTypeOperator", + "start": 11, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "operator": "readonly", + "typeAnnotation": { + "type": "TSTypeReference", + "start": 20, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "typeName": { + "type": "Identifier", + "start": 20, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 25 + }, + "identifierName": "Array" + }, + "name": "Array" + }, + "typeParameters": { + "type": "TSTypeParameterInstantiation", + "start": 25, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "params": [ + { + "type": "TSStringKeyword", + "start": 26, + "end": 32, + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 32 + } + } + } + ] + } + } + }, + "trailingComments": [ + { + "type": "CommentLine", + "value": " Error", + "start": 36, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 44 + } + } + } + ] + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentLine", + "value": " Error", + "start": 36, + "end": 44, + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 44 + } + } + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/types/tuple-optional-invalid/options.json b/packages/babel-parser/test/fixtures/typescript/types/tuple-optional-invalid/options.json deleted file mode 100644 index 15111b29065f..000000000000 --- a/packages/babel-parser/test/fixtures/typescript/types/tuple-optional-invalid/options.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "sourceType": "module", - "plugins": ["typescript"], - "throws": "A required element cannot follow an optional element. (1:17)" -} diff --git a/packages/babel-parser/test/fixtures/typescript/types/tuple-optional-invalid/output.json b/packages/babel-parser/test/fixtures/typescript/types/tuple-optional-invalid/output.json new file mode 100644 index 000000000000..b66ac1ec7326 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/types/tuple-optional-invalid/output.json @@ -0,0 +1,166 @@ +{ + "type": "File", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "errors": [ + "SyntaxError: A required element cannot follow an optional element. (1:17)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "id": { + "type": "Identifier", + "start": 4, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 24 + }, + "identifierName": "x" + }, + "name": "x", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "start": 5, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "typeAnnotation": { + "type": "TSTupleType", + "start": 7, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "elementTypes": [ + { + "type": "TSOptionalType", + "start": 8, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "typeAnnotation": { + "type": "TSStringKeyword", + "start": 8, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 14 + } + } + } + }, + { + "type": "TSNumberKeyword", + "start": 17, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 23 + } + } + } + ] + } + } + }, + "init": null + } + ], + "kind": "let" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/variable-declarator/definite-assignment-not-allowed/options.json b/packages/babel-parser/test/fixtures/typescript/variable-declarator/definite-assignment-not-allowed/options.json index 57893e4eee56..c4c1edaca3c6 100644 --- a/packages/babel-parser/test/fixtures/typescript/variable-declarator/definite-assignment-not-allowed/options.json +++ b/packages/babel-parser/test/fixtures/typescript/variable-declarator/definite-assignment-not-allowed/options.json @@ -1,3 +1,3 @@ { - "throws": "Complex binding patterns require an initialization value (1:6)" + "throws": "Unexpected token, expected \";\" (1:6)" } diff --git a/packages/babel-parser/test/helpers/runFixtureTests.js b/packages/babel-parser/test/helpers/runFixtureTests.js index 9e97ee46f727..f08ed2312101 100644 --- a/packages/babel-parser/test/helpers/runFixtureTests.js +++ b/packages/babel-parser/test/helpers/runFixtureTests.js @@ -107,11 +107,19 @@ export function runThrowTestsWithEstree(fixturesPath, parseFunction) { } function save(test, ast) { - // Ensure that RegExp are serialized as strings - const toJSON = RegExp.prototype.toJSON; - RegExp.prototype.toJSON = RegExp.prototype.toString; - require("fs").writeFileSync(test.expect.loc, JSON.stringify(ast, null, " ")); - RegExp.prototype.toJSON = toJSON; + // Ensure that RegExp and Errors are serialized as strings + forceToString(RegExp, () => + forceToString(Error, () => + fs.writeFileSync(test.expect.loc, JSON.stringify(ast, null, " ")), + ), + ); +} + +function forceToString(obj, cb) { + const { toJSON } = obj.prototype; + obj.prototype.toJSON = obj.prototype.toString; + cb(); + obj.prototype.toJSON = toJSON; } function runTest(test, parseFunction) { @@ -125,7 +133,7 @@ function runTest(test, parseFunction) { let ast; try { - ast = parseFunction(test.actual.code, opts); + ast = parseFunction(test.actual.code, { errorRecovery: true, ...opts }); } catch (err) { if (opts.throws) { if (err.message === opts.throws) { @@ -152,6 +160,7 @@ function runTest(test, parseFunction) { } if (ast.comments && !ast.comments.length) delete ast.comments; + if (ast.errors && !ast.errors.length) delete ast.errors; if (!test.expect.code && !opts.throws && !process.env.CI) { test.expect.loc += "on"; @@ -159,6 +168,20 @@ function runTest(test, parseFunction) { } if (opts.throws) { + if (process.env.OVERWRITE) { + const fn = path.dirname(test.expect.loc) + "/options.json"; + test.options = test.options || {}; + delete test.options.throws; + const contents = JSON.stringify(test.options, null, " "); + if (contents === "{}") { + fs.unlinkSync(fn); + } else { + fs.writeFileSync(fn, JSON.stringify(test.options, null, " ")); + } + test.expect.loc += "on"; + return save(test, ast); + } + throw new Error( "Expected error message: " + opts.throws + ". But parsing succeeded.", ); @@ -175,7 +198,7 @@ function runTest(test, parseFunction) { } function ppJSON(v) { - v = v instanceof RegExp ? v.toString() : v; + v = v instanceof RegExp || v instanceof Error ? v.toString() : v; return JSON.stringify(v, null, 2); } @@ -188,7 +211,12 @@ function addPath(str, pt) { } function misMatch(exp, act) { - if (exp instanceof RegExp || act instanceof RegExp) { + if ( + exp instanceof RegExp || + act instanceof RegExp || + exp instanceof Error || + act instanceof Error + ) { const left = ppJSON(exp); const right = ppJSON(act); if (left !== right) return left + " !== " + right; diff --git a/packages/babel-preset-typescript/test/fixtures/jsx-compat/ts-invalid/options.json b/packages/babel-preset-typescript/test/fixtures/jsx-compat/ts-invalid/options.json index 4c0aa124656f..c11cb6fdfbdf 100644 --- a/packages/babel-preset-typescript/test/fixtures/jsx-compat/ts-invalid/options.json +++ b/packages/babel-preset-typescript/test/fixtures/jsx-compat/ts-invalid/options.json @@ -1,3 +1,3 @@ { - "throws": "Unexpected token, expected \"/<=/>=\" (1:6)" + "throws": "Unexpected token, expected \",\" (1:6)" } From e9c1bce50f590c484e9ba7cc0b19caa88e66659d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?= Date: Tue, 5 Nov 2019 10:56:57 +0100 Subject: [PATCH 041/648] Add support for TS declare modifier on fields (#10545) * [parser] Add support for TS declare modifier on fields (#10484) * [parser] Add support for TS declare modifier on fields * Use Object.create(null) * Comment * Add support for TS declare types to types and generator (#10544) * Transform TypeScript "declare" fields (#10546) * Transform TypeScript "declare" fields * Remove multiple spaces * declareFields -> allowDeclareFields * Update after rebase --- .../babel-generator/src/generators/classes.js | 39 +--- .../src/generators/typescript.js | 23 +++ .../typescript/class-field-declare/input.js | 5 + .../class-field-declare/options.json | 4 + .../typescript/class-field-declare/output.js | 5 + .../src/fields.js | 4 + .../src/typescript.js | 19 ++ .../src/plugins/typescript/index.js | 115 +++++++---- packages/babel-parser/src/types.js | 21 +- .../class/declare-field-initializer/input.ts | 3 + .../declare-field-initializer/output.json | 170 ++++++++++++++++ .../typescript/class/declare-field/input.ts | 4 + .../class/declare-field/output.json | 187 ++++++++++++++++++ .../typescript/class/declare-method/input.ts | 3 + .../class/declare-method/output.json | 145 ++++++++++++++ .../class/method-readonly/options.json | 3 - .../class/method-readonly/output.json | 145 ++++++++++++++ .../output.json | 4 +- .../src/index.js | 158 ++++++++------- .../class/declare-not-enabled/input.ts | 3 + .../class/declare-not-enabled/options.json | 4 + .../class/declare-not-initialized/input.ts | 3 + .../declare-not-initialized/options.json | 3 + .../class/declare-not-initialized/output.js | 3 + .../test/fixtures/class/declare/input.ts | 3 + .../test/fixtures/class/declare/options.json | 3 + .../test/fixtures/class/declare/output.js | 1 + .../test/fixtures/class/properties/input.ts | 3 +- .../input.ts | 4 + .../options.json | 7 + .../transform-properties-declare/input.ts | 4 + .../transform-properties-declare/options.json | 6 + .../transform-properties-declare/output.js | 8 + .../input.ts | 3 + .../options.json | 3 + .../output.js | 1 + packages/babel-preset-typescript/src/index.js | 28 +-- .../src/definitions/experimental.js | 4 + 38 files changed, 985 insertions(+), 166 deletions(-) create mode 100644 packages/babel-generator/test/fixtures/typescript/class-field-declare/input.js create mode 100644 packages/babel-generator/test/fixtures/typescript/class-field-declare/options.json create mode 100644 packages/babel-generator/test/fixtures/typescript/class-field-declare/output.js create mode 100644 packages/babel-helper-create-class-features-plugin/src/typescript.js create mode 100644 packages/babel-parser/test/fixtures/typescript/class/declare-field-initializer/input.ts create mode 100644 packages/babel-parser/test/fixtures/typescript/class/declare-field-initializer/output.json create mode 100644 packages/babel-parser/test/fixtures/typescript/class/declare-field/input.ts create mode 100644 packages/babel-parser/test/fixtures/typescript/class/declare-field/output.json create mode 100644 packages/babel-parser/test/fixtures/typescript/class/declare-method/input.ts create mode 100644 packages/babel-parser/test/fixtures/typescript/class/declare-method/output.json delete mode 100644 packages/babel-parser/test/fixtures/typescript/class/method-readonly/options.json create mode 100644 packages/babel-parser/test/fixtures/typescript/class/method-readonly/output.json create mode 100644 packages/babel-plugin-transform-typescript/test/fixtures/class/declare-not-enabled/input.ts create mode 100644 packages/babel-plugin-transform-typescript/test/fixtures/class/declare-not-enabled/options.json create mode 100644 packages/babel-plugin-transform-typescript/test/fixtures/class/declare-not-initialized/input.ts create mode 100644 packages/babel-plugin-transform-typescript/test/fixtures/class/declare-not-initialized/options.json create mode 100644 packages/babel-plugin-transform-typescript/test/fixtures/class/declare-not-initialized/output.js create mode 100644 packages/babel-plugin-transform-typescript/test/fixtures/class/declare/input.ts create mode 100644 packages/babel-plugin-transform-typescript/test/fixtures/class/declare/options.json create mode 100644 packages/babel-plugin-transform-typescript/test/fixtures/class/declare/output.js create mode 100644 packages/babel-plugin-transform-typescript/test/fixtures/class/transform-properties-declare-wrong-order/input.ts create mode 100644 packages/babel-plugin-transform-typescript/test/fixtures/class/transform-properties-declare-wrong-order/options.json create mode 100644 packages/babel-plugin-transform-typescript/test/fixtures/class/transform-properties-declare/input.ts create mode 100644 packages/babel-plugin-transform-typescript/test/fixtures/class/transform-properties-declare/options.json create mode 100644 packages/babel-plugin-transform-typescript/test/fixtures/class/transform-properties-declare/output.js create mode 100644 packages/babel-plugin-transform-typescript/test/fixtures/class/uninitialized-definite-with-declare-enabled/input.ts create mode 100644 packages/babel-plugin-transform-typescript/test/fixtures/class/uninitialized-definite-with-declare-enabled/options.json create mode 100644 packages/babel-plugin-transform-typescript/test/fixtures/class/uninitialized-definite-with-declare-enabled/output.js diff --git a/packages/babel-generator/src/generators/classes.js b/packages/babel-generator/src/generators/classes.js index e8c62339a6d2..1713293369d4 100644 --- a/packages/babel-generator/src/generators/classes.js +++ b/packages/babel-generator/src/generators/classes.js @@ -71,26 +71,8 @@ export function ClassBody(node: Object) { export function ClassProperty(node: Object) { this.printJoin(node.decorators, node); + this.tsPrintClassMemberModifiers(node, /* isField */ true); - if (node.accessibility) { - // TS - this.word(node.accessibility); - this.space(); - } - if (node.static) { - this.word("static"); - this.space(); - } - if (node.abstract) { - // TS - this.word("abstract"); - this.space(); - } - if (node.readonly) { - // TS - this.word("readonly"); - this.space(); - } if (node.computed) { this.token("["); this.print(node.key, node); @@ -148,23 +130,6 @@ export function ClassPrivateMethod(node: Object) { export function _classMethodHead(node) { this.printJoin(node.decorators, node); - - if (node.accessibility) { - // TS - this.word(node.accessibility); - this.space(); - } - - if (node.abstract) { - // TS - this.word("abstract"); - this.space(); - } - - if (node.static) { - this.word("static"); - this.space(); - } - + this.tsPrintClassMemberModifiers(node, /* isField */ false); this._methodHead(node); } diff --git a/packages/babel-generator/src/generators/typescript.js b/packages/babel-generator/src/generators/typescript.js index a201a5d5d658..39c580d74d2f 100644 --- a/packages/babel-generator/src/generators/typescript.js +++ b/packages/babel-generator/src/generators/typescript.js @@ -556,3 +556,26 @@ export function tsPrintSignatureDeclarationBase(node) { this.token(")"); this.print(node.typeAnnotation, node); } + +export function tsPrintClassMemberModifiers(node, isField) { + if (isField && node.declare) { + this.word("declare"); + this.space(); + } + if (node.accessibility) { + this.word(node.accessibility); + this.space(); + } + if (node.static) { + this.word("static"); + this.space(); + } + if (node.abstract) { + this.word("abstract"); + this.space(); + } + if (isField && node.readonly) { + this.word("readonly"); + this.space(); + } +} diff --git a/packages/babel-generator/test/fixtures/typescript/class-field-declare/input.js b/packages/babel-generator/test/fixtures/typescript/class-field-declare/input.js new file mode 100644 index 000000000000..0e524a92bb8a --- /dev/null +++ b/packages/babel-generator/test/fixtures/typescript/class-field-declare/input.js @@ -0,0 +1,5 @@ +class A { + declare foo; + declare bar: string; + declare readonly bax: number; +} diff --git a/packages/babel-generator/test/fixtures/typescript/class-field-declare/options.json b/packages/babel-generator/test/fixtures/typescript/class-field-declare/options.json new file mode 100644 index 000000000000..9f3a0c2c0ff1 --- /dev/null +++ b/packages/babel-generator/test/fixtures/typescript/class-field-declare/options.json @@ -0,0 +1,4 @@ +{ + "sourceType": "module", + "plugins": ["typescript", "classProperties"] +} diff --git a/packages/babel-generator/test/fixtures/typescript/class-field-declare/output.js b/packages/babel-generator/test/fixtures/typescript/class-field-declare/output.js new file mode 100644 index 000000000000..d1d7b1be56aa --- /dev/null +++ b/packages/babel-generator/test/fixtures/typescript/class-field-declare/output.js @@ -0,0 +1,5 @@ +class A { + declare foo; + declare bar: string; + declare readonly bax: number; +} \ No newline at end of file diff --git a/packages/babel-helper-create-class-features-plugin/src/fields.js b/packages/babel-helper-create-class-features-plugin/src/fields.js index 4cdaccd1bbb5..167e894cae33 100644 --- a/packages/babel-helper-create-class-features-plugin/src/fields.js +++ b/packages/babel-helper-create-class-features-plugin/src/fields.js @@ -5,6 +5,8 @@ import ReplaceSupers, { import memberExpressionToFunctions from "@babel/helper-member-expression-to-functions"; import optimiseCall from "@babel/helper-optimise-call-expression"; +import * as ts from "./typescript"; + export function buildPrivateNamesMap(props) { const privateNamesMap = new Map(); for (const prop of props) { @@ -556,6 +558,8 @@ export function buildFieldsInitNodes( let needsClassRef = false; for (const prop of props) { + ts.assertFieldTransformed(prop); + const isStatic = prop.node.static; const isInstance = !isStatic; const isPrivate = prop.isPrivate(); diff --git a/packages/babel-helper-create-class-features-plugin/src/typescript.js b/packages/babel-helper-create-class-features-plugin/src/typescript.js new file mode 100644 index 000000000000..c18f0ea17389 --- /dev/null +++ b/packages/babel-helper-create-class-features-plugin/src/typescript.js @@ -0,0 +1,19 @@ +// @flow + +import type { NodePath } from "@babel/traverse"; + +export function assertFieldTransformed(path: NodePath) { + // TODO (Babel 8): Also check path.node.definite + + if (path.node.declare) { + throw path.buildCodeFrameError( + `TypeScript 'declare' fields must first be transformed by ` + + `@babel/plugin-transform-typescript.\n` + + `If you have already enabled that plugin (or '@babel/preset-typescript'), make sure ` + + `that it runs before any plugin related to additional class features:\n` + + ` - @babel/plugin-proposal-class-properties\n` + + ` - @babel/plugin-proposal-private-methods\n` + + ` - @babel/plugin-proposal-decorators`, + ); + } +} diff --git a/packages/babel-parser/src/plugins/typescript/index.js b/packages/babel-parser/src/plugins/typescript/index.js index e5d461b55e46..9fabb50cd0a2 100644 --- a/packages/babel-parser/src/plugins/typescript/index.js +++ b/packages/babel-parser/src/plugins/typescript/index.js @@ -28,6 +28,7 @@ import * as charCodes from "charcodes"; type TsModifier = | "readonly" | "abstract" + | "declare" | "static" | "public" | "private" @@ -129,6 +130,31 @@ export default (superClass: Class): Class => return undefined; } + /** Parses a list of modifiers, in any order. + * If you need a specific order, you must call this function multiple times: + * this.tsParseModifiers(["public"]); + * this.tsParseModifiers(["abstract", "readonly"]); + */ + tsParseModifiers( + allowedModifiers: T[], + ): { [key: TsModifier]: ?true, __proto__: null } { + const modifiers = Object.create(null); + + while (true) { + const startPos = this.state.start; + const modifier: ?T = this.tsParseModifier(allowedModifiers); + + if (!modifier) break; + + if (Object.hasOwnProperty.call(modifiers, modifier)) { + this.raise(startPos, `Duplicate modifier: '${modifier}'`); + } + modifiers[modifier] = true; + } + + return modifiers; + } + tsIsListTerminator(kind: ParsingContext): boolean { switch (kind) { case "EnumMembers": @@ -405,7 +431,7 @@ export default (superClass: Class): Class => return this.eat(tt.name) && this.match(tt.colon); } - tsTryParseIndexSignature(node: N.TsIndexSignature): ?N.TsIndexSignature { + tsTryParseIndexSignature(node: N.Node): ?N.TsIndexSignature { if ( !( this.match(tt.bracketL) && @@ -1844,50 +1870,49 @@ export default (superClass: Class): Class => parseClassMemberWithIsStatic( classBody: N.ClassBody, - member: any, + member: N.ClassMember | N.TsIndexSignature, state: { hadConstructor: boolean }, isStatic: boolean, constructorAllowsSuper: boolean, ): void { - const methodOrProp: N.ClassMethod | N.ClassProperty = member; - const prop: N.ClassProperty = member; - const propOrIdx: N.ClassProperty | N.TsIndexSignature = member; - - let abstract = false, - readonly = false; - - const mod = this.tsParseModifier(["abstract", "readonly"]); - switch (mod) { - case "readonly": - readonly = true; - abstract = !!this.tsParseModifier(["abstract"]); - break; - case "abstract": - abstract = true; - readonly = !!this.tsParseModifier(["readonly"]); - break; - } + const modifiers = this.tsParseModifiers([ + "abstract", + "readonly", + "declare", + ]); - if (abstract) methodOrProp.abstract = true; - if (readonly) propOrIdx.readonly = true; + Object.assign(member, modifiers); - if (!abstract && !isStatic && !methodOrProp.accessibility) { - const idx = this.tsTryParseIndexSignature(member); - if (idx) { - classBody.body.push(idx); - return; + const idx = this.tsTryParseIndexSignature(member); + if (idx) { + classBody.body.push(idx); + + if (modifiers.abstract) { + this.raise( + member.start, + "Index signatures cannot have the 'abstract' modifier", + ); + } + if (isStatic) { + this.raise( + member.start, + "Index signatures cannot have the 'static' modifier", + ); + } + if ((member: any).accessibility) { + this.raise( + member.start, + `Index signatures cannot have an accessibility modifier ('${ + (member: any).accessibility + }')`, + ); } - } - if (readonly) { - // Must be a property (if not an index signature). - methodOrProp.static = isStatic; - this.parseClassPropertyName(prop); - this.parsePostMemberNameModifiers(methodOrProp); - this.pushClassProperty(classBody, prop); return; } + /*:: invariant(member.type !== "TSIndexSignature") */ + super.parseClassMemberWithIsStatic( classBody, member, @@ -1902,6 +1927,20 @@ export default (superClass: Class): Class => ): void { const optional = this.eat(tt.question); if (optional) methodOrProp.optional = true; + + if ((methodOrProp: any).readonly && this.match(tt.parenL)) { + this.raise( + methodOrProp.start, + "Class methods cannot have the 'readonly' modifier", + ); + } + + if ((methodOrProp: any).declare && this.match(tt.parenL)) { + this.raise( + methodOrProp.start, + "Class methods cannot have the 'declare' modifier", + ); + } } // Note: The reason we do this in `parseExpressionStatement` and not `parseStatement` @@ -2048,6 +2087,14 @@ export default (superClass: Class): Class => parseClassProperty(node: N.ClassProperty): N.ClassProperty { this.parseClassPropertyAnnotation(node); + + if (node.declare && this.match(tt.equal)) { + this.raise( + this.state.start, + "'declare' class fields cannot have an initializer", + ); + } + return super.parseClassProperty(node); } diff --git a/packages/babel-parser/src/types.js b/packages/babel-parser/src/types.js index f5b34a2db0a3..8392a58db0f2 100644 --- a/packages/babel-parser/src/types.js +++ b/packages/babel-parser/src/types.js @@ -743,18 +743,19 @@ export type ClassPrivateMethod = NodeBase & computed: false, }; -export type ClassProperty = ClassMemberBase & { - type: "ClassProperty", - key: Expression, - value: ?Expression, // TODO: Not in spec that this is nullable. +export type ClassProperty = ClassMemberBase & + DeclarationBase & { + type: "ClassProperty", + key: Expression, + value: ?Expression, // TODO: Not in spec that this is nullable. - typeAnnotation?: ?TypeAnnotationBase, // TODO: Not in spec - variance?: ?FlowVariance, // TODO: Not in spec + typeAnnotation?: ?TypeAnnotationBase, // TODO: Not in spec + variance?: ?FlowVariance, // TODO: Not in spec - // TypeScript only: (TODO: Not in spec) - readonly?: true, - definite?: true, -}; + // TypeScript only: (TODO: Not in spec) + readonly?: true, + definite?: true, + }; export type ClassPrivateProperty = NodeBase & { type: "ClassPrivateProperty", diff --git a/packages/babel-parser/test/fixtures/typescript/class/declare-field-initializer/input.ts b/packages/babel-parser/test/fixtures/typescript/class/declare-field-initializer/input.ts new file mode 100644 index 000000000000..b77a17738bf5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/class/declare-field-initializer/input.ts @@ -0,0 +1,3 @@ +class A { + declare bar: string = "test"; +} diff --git a/packages/babel-parser/test/fixtures/typescript/class/declare-field-initializer/output.json b/packages/babel-parser/test/fixtures/typescript/class/declare-field-initializer/output.json new file mode 100644 index 000000000000..fb27f3055064 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/class/declare-field-initializer/output.json @@ -0,0 +1,170 @@ +{ + "type": "File", + "start": 0, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 43, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ClassProperty", + "start": 12, + "end": 41, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 31 + } + }, + "declare": true, + "static": false, + "key": { + "type": "Identifier", + "start": 20, + "end": 23, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 13 + }, + "identifierName": "bar" + }, + "name": "bar" + }, + "computed": false, + "typeAnnotation": { + "type": "TSTypeAnnotation", + "start": 23, + "end": 31, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 21 + } + }, + "typeAnnotation": { + "type": "TSStringKeyword", + "start": 25, + "end": 31, + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 21 + } + } + } + }, + "value": { + "type": "StringLiteral", + "start": 34, + "end": 40, + "loc": { + "start": { + "line": 2, + "column": 24 + }, + "end": { + "line": 2, + "column": 30 + } + }, + "extra": { + "rawValue": "test", + "raw": "\"test\"" + }, + "value": "test" + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/class/declare-field/input.ts b/packages/babel-parser/test/fixtures/typescript/class/declare-field/input.ts new file mode 100644 index 000000000000..a7a8b2d36280 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/class/declare-field/input.ts @@ -0,0 +1,4 @@ +class A { + declare foo; + declare bar: string; +} diff --git a/packages/babel-parser/test/fixtures/typescript/class/declare-field/output.json b/packages/babel-parser/test/fixtures/typescript/class/declare-field/output.json new file mode 100644 index 000000000000..746e2964f438 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/class/declare-field/output.json @@ -0,0 +1,187 @@ +{ + "type": "File", + "start": 0, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 49, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "ClassProperty", + "start": 12, + "end": 24, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "declare": true, + "static": false, + "key": { + "type": "Identifier", + "start": 20, + "end": 23, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 13 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "computed": false, + "value": null + }, + { + "type": "ClassProperty", + "start": 27, + "end": 47, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 22 + } + }, + "declare": true, + "static": false, + "key": { + "type": "Identifier", + "start": 35, + "end": 38, + "loc": { + "start": { + "line": 3, + "column": 10 + }, + "end": { + "line": 3, + "column": 13 + }, + "identifierName": "bar" + }, + "name": "bar" + }, + "computed": false, + "typeAnnotation": { + "type": "TSTypeAnnotation", + "start": 38, + "end": 46, + "loc": { + "start": { + "line": 3, + "column": 13 + }, + "end": { + "line": 3, + "column": 21 + } + }, + "typeAnnotation": { + "type": "TSStringKeyword", + "start": 40, + "end": 46, + "loc": { + "start": { + "line": 3, + "column": 15 + }, + "end": { + "line": 3, + "column": 21 + } + } + } + }, + "value": null + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/class/declare-method/input.ts b/packages/babel-parser/test/fixtures/typescript/class/declare-method/input.ts new file mode 100644 index 000000000000..0e539a84a2a5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/class/declare-method/input.ts @@ -0,0 +1,3 @@ +class A { + declare foo() {} +} diff --git a/packages/babel-parser/test/fixtures/typescript/class/declare-method/output.json b/packages/babel-parser/test/fixtures/typescript/class/declare-method/output.json new file mode 100644 index 000000000000..0219c43119d2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/class/declare-method/output.json @@ -0,0 +1,145 @@ +{ + "type": "File", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Class methods cannot have the 'declare' modifier (2:2)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ClassMethod", + "start": 12, + "end": 28, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "declare": true, + "static": false, + "key": { + "type": "Identifier", + "start": 20, + "end": 23, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 13 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "computed": false, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 26, + "end": 28, + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/class/method-readonly/options.json b/packages/babel-parser/test/fixtures/typescript/class/method-readonly/options.json deleted file mode 100644 index f7dd2e27ef2c..000000000000 --- a/packages/babel-parser/test/fixtures/typescript/class/method-readonly/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected token, expected \";\" (2:14)" -} diff --git a/packages/babel-parser/test/fixtures/typescript/class/method-readonly/output.json b/packages/babel-parser/test/fixtures/typescript/class/method-readonly/output.json new file mode 100644 index 000000000000..198e2e1cf0c9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/class/method-readonly/output.json @@ -0,0 +1,145 @@ +{ + "type": "File", + "start": 0, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "errors": [ + "SyntaxError: Class methods cannot have the 'readonly' modifier (2:4)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "C" + }, + "name": "C" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ClassMethod", + "start": 14, + "end": 29, + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "readonly": true, + "static": false, + "key": { + "type": "Identifier", + "start": 23, + "end": 24, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 14 + }, + "identifierName": "m" + }, + "name": "m" + }, + "computed": false, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 27, + "end": 29, + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-readonly/output.json b/packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-readonly/output.json index f883e0b00b2a..456ca59ae4ae 100644 --- a/packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-readonly/output.json +++ b/packages/babel-parser/test/fixtures/typescript/class/private-fields-modifier-readonly/output.json @@ -77,7 +77,7 @@ }, "body": [ { - "type": "ClassProperty", + "type": "ClassPrivateProperty", "start": 12, "end": 24, "loc": { @@ -127,7 +127,7 @@ "value": null }, { - "type": "ClassProperty", + "type": "ClassPrivateProperty", "start": 27, "end": 47, "loc": { diff --git a/packages/babel-plugin-transform-typescript/src/index.js b/packages/babel-plugin-transform-typescript/src/index.js index c89e2dbe8185..ed7d927fe595 100644 --- a/packages/babel-plugin-transform-typescript/src/index.js +++ b/packages/babel-plugin-transform-typescript/src/index.js @@ -44,11 +44,94 @@ function registerGlobalType(programScope, name) { } export default declare( - (api, { jsxPragma = "React", allowNamespaces = false }) => { + ( + api, + { + jsxPragma = "React", + allowNamespaces = false, + allowDeclareFields = false, + }, + ) => { api.assertVersion(7); const JSX_ANNOTATION_REGEX = /\*?\s*@jsx\s+([^\s]+)/; + const classMemberVisitors = { + field(path) { + const { node } = path; + + if (!allowDeclareFields && node.declare) { + throw path.buildCodeFrameError( + `The 'declare' modifier is only allowed when the 'allowDeclareFields' option of ` + + `@babel/plugin-transform-typescript or @babel/preset-typescript is enabled.`, + ); + } + if (node.definite || node.declare) { + if (node.value) { + throw path.buildCodeFrameError( + `Definietly assigned fields and fields with the 'declare' modifier cannot` + + ` be initialized here, but only in the constructor`, + ); + } + + path.remove(); + } else if (!allowDeclareFields && !node.value && !node.decorators) { + path.remove(); + } + + if (node.accessibility) node.accessibility = null; + if (node.abstract) node.abstract = null; + if (node.readonly) node.readonly = null; + if (node.optional) node.optional = null; + if (node.typeAnnotation) node.typeAnnotation = null; + }, + method({ node }) { + if (node.accessibility) node.accessibility = null; + if (node.abstract) node.abstract = null; + if (node.optional) node.optional = null; + + // Rest handled by Function visitor + }, + constructor(path, classPath) { + // Collects parameter properties so that we can add an assignment + // for each of them in the constructor body + // + // We use a WeakSet to ensure an assignment for a parameter + // property is only added once. This is necessary for cases like + // using `transform-classes`, which causes this visitor to run + // twice. + const parameterProperties = []; + for (const param of path.node.params) { + if ( + param.type === "TSParameterProperty" && + !PARSED_PARAMS.has(param.parameter) + ) { + PARSED_PARAMS.add(param.parameter); + parameterProperties.push(param.parameter); + } + } + + if (parameterProperties.length) { + const assigns = parameterProperties.map(p => { + let id; + if (t.isIdentifier(p)) { + id = p; + } else if (t.isAssignmentPattern(p) && t.isIdentifier(p.left)) { + id = p.left; + } else { + throw path.buildCodeFrameError( + "Parameter properties can not be destructuring patterns.", + ); + } + + return template.statement.ast`this.${id} = ${id}`; + }); + + injectInitialization(classPath, path, assigns); + } + }, + }; + return { name: "transform-typescript", inherits: syntaxTypeScript, @@ -192,27 +275,6 @@ export default declare( if (node.definite) node.definite = null; }, - ClassMethod(path) { - const { node } = path; - - if (node.accessibility) node.accessibility = null; - if (node.abstract) node.abstract = null; - if (node.optional) node.optional = null; - - // Rest handled by Function visitor - }, - - ClassProperty(path) { - const { node } = path; - - if (node.accessibility) node.accessibility = null; - if (node.abstract) node.abstract = null; - if (node.readonly) node.readonly = null; - if (node.optional) node.optional = null; - if (node.definite) node.definite = null; - if (node.typeAnnotation) node.typeAnnotation = null; - }, - TSIndexSignature(path) { path.remove(); }, @@ -238,54 +300,14 @@ export default declare( // class transform would transform the class, causing more specific // visitors to not run. path.get("body.body").forEach(child => { - const childNode = child.node; - - if (t.isClassMethod(childNode, { kind: "constructor" })) { - // Collects parameter properties so that we can add an assignment - // for each of them in the constructor body - // - // We use a WeakSet to ensure an assignment for a parameter - // property is only added once. This is necessary for cases like - // using `transform-classes`, which causes this visitor to run - // twice. - const parameterProperties = []; - for (const param of childNode.params) { - if ( - param.type === "TSParameterProperty" && - !PARSED_PARAMS.has(param.parameter) - ) { - PARSED_PARAMS.add(param.parameter); - parameterProperties.push(param.parameter); - } - } - - if (parameterProperties.length) { - const assigns = parameterProperties.map(p => { - let id; - if (t.isIdentifier(p)) { - id = p; - } else if ( - t.isAssignmentPattern(p) && - t.isIdentifier(p.left) - ) { - id = p.left; - } else { - throw path.buildCodeFrameError( - "Parameter properties can not be destructuring patterns.", - ); - } - - return template.statement.ast`this.${id} = ${id}`; - }); - - injectInitialization(path, child, assigns); + if (child.isClassMethod()) { + if (child.node.kind === "constructor") { + classMemberVisitors.constructor(child, path); + } else { + classMemberVisitors.method(child, path); } } else if (child.isClassProperty()) { - childNode.typeAnnotation = null; - - if (!childNode.value && !childNode.decorators) { - child.remove(); - } + classMemberVisitors.field(child, path); } }); }, diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/class/declare-not-enabled/input.ts b/packages/babel-plugin-transform-typescript/test/fixtures/class/declare-not-enabled/input.ts new file mode 100644 index 000000000000..3cb9d54665fa --- /dev/null +++ b/packages/babel-plugin-transform-typescript/test/fixtures/class/declare-not-enabled/input.ts @@ -0,0 +1,3 @@ +class A { + declare x; +} diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/class/declare-not-enabled/options.json b/packages/babel-plugin-transform-typescript/test/fixtures/class/declare-not-enabled/options.json new file mode 100644 index 000000000000..c844b0ad736c --- /dev/null +++ b/packages/babel-plugin-transform-typescript/test/fixtures/class/declare-not-enabled/options.json @@ -0,0 +1,4 @@ +{ + "plugins": ["transform-typescript"], + "throws": "The 'declare' modifier is only allowed when the 'allowDeclareFields' option of @babel/plugin-transform-typescript or @babel/preset-typescript is enabled." +} diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/class/declare-not-initialized/input.ts b/packages/babel-plugin-transform-typescript/test/fixtures/class/declare-not-initialized/input.ts new file mode 100644 index 000000000000..c7c42323a390 --- /dev/null +++ b/packages/babel-plugin-transform-typescript/test/fixtures/class/declare-not-initialized/input.ts @@ -0,0 +1,3 @@ +class A { + x; +} \ No newline at end of file diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/class/declare-not-initialized/options.json b/packages/babel-plugin-transform-typescript/test/fixtures/class/declare-not-initialized/options.json new file mode 100644 index 000000000000..a6d406a50e49 --- /dev/null +++ b/packages/babel-plugin-transform-typescript/test/fixtures/class/declare-not-initialized/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["transform-typescript", { "allowDeclareFields": true }]] +} diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/class/declare-not-initialized/output.js b/packages/babel-plugin-transform-typescript/test/fixtures/class/declare-not-initialized/output.js new file mode 100644 index 000000000000..eebf5c5c33db --- /dev/null +++ b/packages/babel-plugin-transform-typescript/test/fixtures/class/declare-not-initialized/output.js @@ -0,0 +1,3 @@ +class A { + x; +} diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/class/declare/input.ts b/packages/babel-plugin-transform-typescript/test/fixtures/class/declare/input.ts new file mode 100644 index 000000000000..7ab37b71fb39 --- /dev/null +++ b/packages/babel-plugin-transform-typescript/test/fixtures/class/declare/input.ts @@ -0,0 +1,3 @@ +class A { + declare x; +} \ No newline at end of file diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/class/declare/options.json b/packages/babel-plugin-transform-typescript/test/fixtures/class/declare/options.json new file mode 100644 index 000000000000..a6d406a50e49 --- /dev/null +++ b/packages/babel-plugin-transform-typescript/test/fixtures/class/declare/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["transform-typescript", { "allowDeclareFields": true }]] +} diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/class/declare/output.js b/packages/babel-plugin-transform-typescript/test/fixtures/class/declare/output.js new file mode 100644 index 000000000000..a869c2849526 --- /dev/null +++ b/packages/babel-plugin-transform-typescript/test/fixtures/class/declare/output.js @@ -0,0 +1 @@ +class A {} diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/class/properties/input.ts b/packages/babel-plugin-transform-typescript/test/fixtures/class/properties/input.ts index abb53ac69bc3..b59f26e0c387 100644 --- a/packages/babel-plugin-transform-typescript/test/fixtures/class/properties/input.ts +++ b/packages/babel-plugin-transform-typescript/test/fixtures/class/properties/input.ts @@ -1,7 +1,8 @@ class C { public a?: number; private b: number = 0; - readonly c!: number = 1; + readonly c: number = 1; @foo d: number; @foo e: number = 3; + f!: number; } diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/class/transform-properties-declare-wrong-order/input.ts b/packages/babel-plugin-transform-typescript/test/fixtures/class/transform-properties-declare-wrong-order/input.ts new file mode 100644 index 000000000000..afc220470140 --- /dev/null +++ b/packages/babel-plugin-transform-typescript/test/fixtures/class/transform-properties-declare-wrong-order/input.ts @@ -0,0 +1,4 @@ +class A { + declare x; + y; +} \ No newline at end of file diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/class/transform-properties-declare-wrong-order/options.json b/packages/babel-plugin-transform-typescript/test/fixtures/class/transform-properties-declare-wrong-order/options.json new file mode 100644 index 000000000000..8a07f1cc2003 --- /dev/null +++ b/packages/babel-plugin-transform-typescript/test/fixtures/class/transform-properties-declare-wrong-order/options.json @@ -0,0 +1,7 @@ +{ + "plugins": [ + "proposal-class-properties", + ["transform-typescript", { "allowDeclareFields": true }] + ], + "throws": "TypeScript 'declare' fields must first be transformed by @babel/plugin-transform-typescript.\nIf you have already enabled that plugin (or '@babel/preset-typescript'), make sure that it runs before any plugin related to additional class features:\n - @babel/plugin-proposal-class-properties\n - @babel/plugin-proposal-private-methods\n - @babel/plugin-proposal-decorators" +} diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/class/transform-properties-declare/input.ts b/packages/babel-plugin-transform-typescript/test/fixtures/class/transform-properties-declare/input.ts new file mode 100644 index 000000000000..afc220470140 --- /dev/null +++ b/packages/babel-plugin-transform-typescript/test/fixtures/class/transform-properties-declare/input.ts @@ -0,0 +1,4 @@ +class A { + declare x; + y; +} \ No newline at end of file diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/class/transform-properties-declare/options.json b/packages/babel-plugin-transform-typescript/test/fixtures/class/transform-properties-declare/options.json new file mode 100644 index 000000000000..18a1de9a1531 --- /dev/null +++ b/packages/babel-plugin-transform-typescript/test/fixtures/class/transform-properties-declare/options.json @@ -0,0 +1,6 @@ +{ + "plugins": [ + ["transform-typescript", { "allowDeclareFields": true }], + "proposal-class-properties" + ] +} \ No newline at end of file diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/class/transform-properties-declare/output.js b/packages/babel-plugin-transform-typescript/test/fixtures/class/transform-properties-declare/output.js new file mode 100644 index 000000000000..44b56f160013 --- /dev/null +++ b/packages/babel-plugin-transform-typescript/test/fixtures/class/transform-properties-declare/output.js @@ -0,0 +1,8 @@ +function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } + +class A { + constructor() { + _defineProperty(this, "y", void 0); + } + +} diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/class/uninitialized-definite-with-declare-enabled/input.ts b/packages/babel-plugin-transform-typescript/test/fixtures/class/uninitialized-definite-with-declare-enabled/input.ts new file mode 100644 index 000000000000..4bb8da7936c6 --- /dev/null +++ b/packages/babel-plugin-transform-typescript/test/fixtures/class/uninitialized-definite-with-declare-enabled/input.ts @@ -0,0 +1,3 @@ +class A { + x!; +} \ No newline at end of file diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/class/uninitialized-definite-with-declare-enabled/options.json b/packages/babel-plugin-transform-typescript/test/fixtures/class/uninitialized-definite-with-declare-enabled/options.json new file mode 100644 index 000000000000..a6d406a50e49 --- /dev/null +++ b/packages/babel-plugin-transform-typescript/test/fixtures/class/uninitialized-definite-with-declare-enabled/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["transform-typescript", { "allowDeclareFields": true }]] +} diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/class/uninitialized-definite-with-declare-enabled/output.js b/packages/babel-plugin-transform-typescript/test/fixtures/class/uninitialized-definite-with-declare-enabled/output.js new file mode 100644 index 000000000000..a869c2849526 --- /dev/null +++ b/packages/babel-plugin-transform-typescript/test/fixtures/class/uninitialized-definite-with-declare-enabled/output.js @@ -0,0 +1 @@ +class A {} diff --git a/packages/babel-preset-typescript/src/index.js b/packages/babel-preset-typescript/src/index.js index bb1687e623c4..f7dc5eefae00 100644 --- a/packages/babel-preset-typescript/src/index.js +++ b/packages/babel-preset-typescript/src/index.js @@ -4,7 +4,13 @@ import transformTypeScript from "@babel/plugin-transform-typescript"; export default declare( ( api, - { jsxPragma, allExtensions = false, isTSX = false, allowNamespaces }, + { + jsxPragma, + allExtensions = false, + isTSX = false, + allowNamespaces, + allowDeclareFields, + }, ) => { api.assertVersion(7); @@ -19,13 +25,18 @@ export default declare( throw new Error("isTSX:true requires allExtensions:true"); } + const pluginOptions = isTSX => ({ + jsxPragma, + isTSX, + allowNamespaces, + allowDeclareFields, + }); + return { overrides: allExtensions ? [ { - plugins: [ - [transformTypeScript, { jsxPragma, isTSX, allowNamespaces }], - ], + plugins: [[transformTypeScript, pluginOptions(isTSX)]], }, ] : [ @@ -33,18 +44,13 @@ export default declare( // Only set 'test' if explicitly requested, since it requires that // Babel is being called` test: /\.ts$/, - plugins: [[transformTypeScript, { jsxPragma, allowNamespaces }]], + plugins: [[transformTypeScript, pluginOptions(false)]], }, { // Only set 'test' if explicitly requested, since it requires that // Babel is being called` test: /\.tsx$/, - plugins: [ - [ - transformTypeScript, - { jsxPragma, isTSX: true, allowNamespaces }, - ], - ], + plugins: [[transformTypeScript, pluginOptions(true)]], }, ], }; diff --git a/packages/babel-types/src/definitions/experimental.js b/packages/babel-types/src/definitions/experimental.js index d344630dcc75..f4e110e1002f 100644 --- a/packages/babel-types/src/definitions/experimental.js +++ b/packages/babel-types/src/definitions/experimental.js @@ -67,6 +67,10 @@ defineType("ClassProperty", { validate: assertValueType("boolean"), optional: true, }, + declare: { + validate: assertValueType("boolean"), + optional: true, + }, }, }); From b114486bc111ff2a74afb3b17ff073f20436e129 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hu=C3=A1ng=20J=C3=B9nli=C3=A0ng?= Date: Tue, 5 Nov 2019 05:11:58 -0500 Subject: [PATCH 042/648] Traverse performance (#10480) * perf: remove this.inList assignment * perf: convert NodePath.parentKey into accessor function * perf: compress shouldSkip/shouldStop/removed traverse flags * perf: lazy initialize this.skipKeys * perf: lazily initialize NodePath.data * add code comments before bit operations * remove unused typeAnnotation property # Conflicts: # packages/babel-traverse/src/path/index.js * early return when visitor keys are empty --- packages/babel-traverse/src/index.js | 4 ++ packages/babel-traverse/src/path/context.js | 22 ++++--- packages/babel-traverse/src/path/index.js | 67 ++++++++++++++++++--- packages/babel-traverse/src/path/removal.js | 5 +- 4 files changed, 77 insertions(+), 21 deletions(-) diff --git a/packages/babel-traverse/src/index.js b/packages/babel-traverse/src/index.js index fa0306e07cd0..da880632ad40 100644 --- a/packages/babel-traverse/src/index.js +++ b/packages/babel-traverse/src/index.js @@ -31,6 +31,10 @@ export default function traverse( } } + if (!t.VISITOR_KEYS[parent.type]) { + return; + } + visitors.explode(opts); traverse.node(parent, opts, scope, state, parentPath); diff --git a/packages/babel-traverse/src/path/context.js b/packages/babel-traverse/src/path/context.js index 47c8f831f429..4a8c54197bb7 100644 --- a/packages/babel-traverse/src/path/context.js +++ b/packages/babel-traverse/src/path/context.js @@ -1,6 +1,7 @@ // This file contains methods responsible for maintaining a TraversalContext. import traverse from "../index"; +import { SHOULD_SKIP, SHOULD_STOP } from "./index"; export function call(key): boolean { const opts = this.opts; @@ -43,7 +44,8 @@ export function _call(fns?: Array): boolean { // node has been replaced, it will have been requeued if (this.node !== node) return true; - if (this.shouldStop || this.shouldSkip || this.removed) return true; + // this.shouldSkip || this.shouldStop || this.removed + if (this._traverseFlags > 0) return true; } return false; @@ -97,12 +99,15 @@ export function skip() { } export function skipKey(key) { + if (this.skipKeys == null) { + this.skipKeys = {}; + } this.skipKeys[key] = true; } export function stop() { - this.shouldStop = true; - this.shouldSkip = true; + // this.shouldSkip = true; this.shouldStop = true; + this._traverseFlags |= SHOULD_SKIP | SHOULD_STOP; } export function setScope() { @@ -122,10 +127,11 @@ export function setScope() { } export function setContext(context) { - this.shouldSkip = false; - this.shouldStop = false; - this.removed = false; - this.skipKeys = {}; + if (this.skipKeys != null) { + this.skipKeys = {}; + } + // this.shouldSkip = false; this.shouldStop = false; this.removed = false; + this._traverseFlags = 0; if (context) { this.context = context; @@ -220,9 +226,7 @@ export function pushContext(context) { } export function setup(parentPath, container, listKey, key) { - this.inList = !!listKey; this.listKey = listKey; - this.parentKey = listKey || key; this.container = container; this.parentPath = parentPath || this.parentPath; diff --git a/packages/babel-traverse/src/path/index.js b/packages/babel-traverse/src/path/index.js index a1be4f5d8d00..e73cbde9d1ee 100644 --- a/packages/babel-traverse/src/path/index.js +++ b/packages/babel-traverse/src/path/index.js @@ -23,15 +23,18 @@ import * as NodePath_comments from "./comments"; const debug = buildDebug("babel"); +export const REMOVED = 1 << 0; +export const SHOULD_STOP = 1 << 1; +export const SHOULD_SKIP = 1 << 2; + export default class NodePath { constructor(hub: HubInterface, parent: Object) { this.parent = parent; this.hub = hub; this.contexts = []; - this.data = Object.create(null); - this.shouldSkip = false; - this.shouldStop = false; - this.removed = false; + this.data = null; + // this.shouldSkip = false; this.shouldStop = false; this.removed = false; + this._traverseFlags = 0; this.state = null; this.opts = null; this.skipKeys = null; @@ -39,13 +42,10 @@ export default class NodePath { this.context = null; this.container = null; this.listKey = null; - this.inList = false; - this.parentKey = null; this.key = null; this.node = null; this.scope = null; this.type = null; - this.typeAnnotation = null; } parent: Object; @@ -57,18 +57,16 @@ export default class NodePath { removed: boolean; state: any; opts: ?Object; + _traverseFlags: number; skipKeys: ?Object; parentPath: ?NodePath; context: TraversalContext; container: ?Object | Array; listKey: ?string; - inList: boolean; - parentKey: ?string; key: ?string; node: ?Object; scope: Scope; type: ?string; - typeAnnotation: ?Object; static get({ hub, parentPath, parent, container, listKey, key }): NodePath { if (!hub && parentPath) { @@ -111,10 +109,16 @@ export default class NodePath { } setData(key: string, val: any): any { + if (this.data == null) { + this.data = Object.create(null); + } return (this.data[key] = val); } getData(key: string, def?: any): any { + if (this.data == null) { + this.data = Object.create(null); + } let val = this.data[key]; if (val === undefined && def !== undefined) val = this.data[key] = def; return val; @@ -152,6 +156,49 @@ export default class NodePath { toString() { return generator(this.node).code; } + + get inList() { + return !!this.listKey; + } + + get parentKey() { + return this.listKey || this.key; + } + + get shouldSkip() { + return !!(this._traverseFlags & SHOULD_SKIP); + } + + set shouldSkip(v) { + if (v) { + this._traverseFlags |= SHOULD_SKIP; + } else { + this._traverseFlags &= ~SHOULD_SKIP; + } + } + + get shouldStop() { + return !!(this._traverseFlags & SHOULD_STOP); + } + + set shouldStop(v) { + if (v) { + this._traverseFlags |= SHOULD_STOP; + } else { + this._traverseFlags &= ~SHOULD_STOP; + } + } + + get removed() { + return !!(this._traverseFlags & REMOVED); + } + set removed(v) { + if (v) { + this._traverseFlags |= REMOVED; + } else { + this._traverseFlags &= ~REMOVED; + } + } } Object.assign( diff --git a/packages/babel-traverse/src/path/removal.js b/packages/babel-traverse/src/path/removal.js index b4d1330b256d..9ddf0a201448 100644 --- a/packages/babel-traverse/src/path/removal.js +++ b/packages/babel-traverse/src/path/removal.js @@ -1,6 +1,7 @@ // This file contains methods responsible for removing a node. import { hooks } from "./lib/removal-hooks"; +import { REMOVED, SHOULD_SKIP } from "./index"; export function remove() { this._assertUnremoved(); @@ -39,8 +40,8 @@ export function _remove() { } export function _markRemoved() { - this.shouldSkip = true; - this.removed = true; + // this.shouldSkip = true; this.removed = true; + this._traverseFlags |= SHOULD_SKIP | REMOVED; this.node = null; } From cdbffe39908cbb5f69f4f67363a715378f9dbb89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?= Date: Tue, 5 Nov 2019 11:25:15 +0100 Subject: [PATCH 043/648] Remove --require-scripts from publish-ci [skip ci] --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index acec39fa4486..2c077a3fbd87 100644 --- a/Makefile +++ b/Makefile @@ -203,7 +203,7 @@ else echo "Missing NPM_TOKEN env var" exit 1 endif - yarn lerna publish from-git --require-scripts --yes + yarn lerna publish from-git --yes rm -f .npmrc $(MAKE) clean From 97faa83953cb87e332554fa559a4956d202343ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?= Date: Tue, 5 Nov 2019 11:27:14 +0100 Subject: [PATCH 044/648] v7.7.0 --- lerna.json | 2 +- packages/babel-cli/package.json | 4 +- packages/babel-core/package.json | 14 +++---- packages/babel-generator/package.json | 6 +-- .../package.json | 4 +- .../package.json | 6 +-- .../package.json | 6 +-- .../package.json | 4 +- .../babel-helper-call-delegate/package.json | 8 ++-- .../package.json | 14 +++---- .../package.json | 4 +- packages/babel-helper-define-map/package.json | 6 +-- .../package.json | 6 +-- .../babel-helper-explode-class/package.json | 8 ++-- .../babel-helper-function-name/package.json | 8 ++-- .../package.json | 4 +- .../babel-helper-hoist-variables/package.json | 4 +- .../package.json | 4 +- .../babel-helper-module-imports/package.json | 6 +-- .../package.json | 12 +++--- .../package.json | 4 +- .../package.json | 12 +++--- .../babel-helper-replace-supers/package.json | 10 ++--- .../babel-helper-simple-access/package.json | 6 +-- .../package.json | 4 +- .../babel-helper-wrap-function/package.json | 10 ++--- packages/babel-helpers/package.json | 8 ++-- packages/babel-node/package.json | 6 +-- packages/babel-parser/package.json | 2 +- .../package.json | 6 +-- .../package.json | 6 +-- .../package.json | 6 +-- .../package.json | 4 +- .../package.json | 6 +-- .../package.json | 6 +-- .../babel-plugin-syntax-flow/package.json | 4 +- .../package.json | 4 +- .../package.json | 8 ++-- .../package.json | 16 +++---- .../package.json | 6 +-- .../package.json | 6 +-- .../package.json | 8 ++-- .../package.json | 6 +-- .../package.json | 6 +-- .../package.json | 6 +-- .../package.json | 6 +-- .../package.json | 4 +- .../package.json | 6 +-- .../package.json | 6 +-- packages/babel-polyfill/package.json | 2 +- .../babel-preset-env-standalone/package.json | 10 ++--- packages/babel-preset-env/package.json | 38 ++++++++--------- packages/babel-preset-react/package.json | 6 +-- packages/babel-preset-typescript/package.json | 6 +-- packages/babel-register/package.json | 4 +- packages/babel-runtime-corejs2/package.json | 4 +- packages/babel-runtime-corejs3/package.json | 2 +- packages/babel-runtime/package.json | 8 ++-- packages/babel-standalone/package.json | 42 +++++++++---------- packages/babel-template/package.json | 6 +-- packages/babel-traverse/package.json | 12 +++--- packages/babel-types/package.json | 6 +-- 62 files changed, 232 insertions(+), 232 deletions(-) diff --git a/lerna.json b/lerna.json index 551e14079f47..33ce123064ca 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "7.6.4", + "version": "7.7.0", "changelog": { "repo": "babel/babel", "cacheDir": ".changelog", diff --git a/packages/babel-cli/package.json b/packages/babel-cli/package.json index 843c7c3c8787..0328b7596c27 100644 --- a/packages/babel-cli/package.json +++ b/packages/babel-cli/package.json @@ -1,6 +1,6 @@ { "name": "@babel/cli", - "version": "7.6.4", + "version": "7.7.0", "description": "Babel command line.", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", @@ -35,7 +35,7 @@ "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.6.4", + "@babel/core": "^7.7.0", "@babel/helper-fixtures": "^7.6.3" }, "bin": { diff --git a/packages/babel-core/package.json b/packages/babel-core/package.json index f4dd6723634d..d07ab536efce 100644 --- a/packages/babel-core/package.json +++ b/packages/babel-core/package.json @@ -1,6 +1,6 @@ { "name": "@babel/core", - "version": "7.6.4", + "version": "7.7.0", "description": "Babel compiler core.", "main": "lib/index.js", "author": "Sebastian McKenzie ", @@ -34,12 +34,12 @@ }, "dependencies": { "@babel/code-frame": "^7.5.5", - "@babel/generator": "^7.6.4", - "@babel/helpers": "^7.6.2", - "@babel/parser": "^7.6.4", - "@babel/template": "^7.6.0", - "@babel/traverse": "^7.6.3", - "@babel/types": "^7.6.3", + "@babel/generator": "^7.7.0", + "@babel/helpers": "^7.7.0", + "@babel/parser": "^7.7.0", + "@babel/template": "^7.7.0", + "@babel/traverse": "^7.7.0", + "@babel/types": "^7.7.0", "convert-source-map": "^1.1.0", "debug": "^4.1.0", "json5": "^2.1.0", diff --git a/packages/babel-generator/package.json b/packages/babel-generator/package.json index 92dc51d1bda9..a51ad5d38e7c 100644 --- a/packages/babel-generator/package.json +++ b/packages/babel-generator/package.json @@ -1,6 +1,6 @@ { "name": "@babel/generator", - "version": "7.6.4", + "version": "7.7.0", "description": "Turns an AST into code.", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", @@ -14,13 +14,13 @@ "lib" ], "dependencies": { - "@babel/types": "^7.6.3", + "@babel/types": "^7.7.0", "jsesc": "^2.5.1", "lodash": "^4.17.13", "source-map": "^0.5.0" }, "devDependencies": { "@babel/helper-fixtures": "^7.6.3", - "@babel/parser": "^7.6.4" + "@babel/parser": "^7.7.0" } } diff --git a/packages/babel-helper-annotate-as-pure/package.json b/packages/babel-helper-annotate-as-pure/package.json index 0ccaace9f494..49ad791e871f 100644 --- a/packages/babel-helper-annotate-as-pure/package.json +++ b/packages/babel-helper-annotate-as-pure/package.json @@ -1,6 +1,6 @@ { "name": "@babel/helper-annotate-as-pure", - "version": "7.0.0", + "version": "7.7.0", "description": "Helper function to annotate paths and nodes with #__PURE__ comment", "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-annotate-as-pure", "license": "MIT", @@ -9,6 +9,6 @@ }, "main": "lib/index.js", "dependencies": { - "@babel/types": "^7.6.3" + "@babel/types": "^7.7.0" } } diff --git a/packages/babel-helper-bindify-decorators/package.json b/packages/babel-helper-bindify-decorators/package.json index 0b3c4c587696..855c07d721a1 100644 --- a/packages/babel-helper-bindify-decorators/package.json +++ b/packages/babel-helper-bindify-decorators/package.json @@ -1,6 +1,6 @@ { "name": "@babel/helper-bindify-decorators", - "version": "7.1.0", + "version": "7.7.0", "description": "Helper function to bindify decorators", "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-bindify-decorators", "license": "MIT", @@ -9,7 +9,7 @@ }, "main": "lib/index.js", "dependencies": { - "@babel/traverse": "^7.1.0", - "@babel/types": "^7.6.3" + "@babel/traverse": "^7.7.0", + "@babel/types": "^7.7.0" } } diff --git a/packages/babel-helper-builder-binary-assignment-operator-visitor/package.json b/packages/babel-helper-builder-binary-assignment-operator-visitor/package.json index f52081203a1e..de2fdf665951 100644 --- a/packages/babel-helper-builder-binary-assignment-operator-visitor/package.json +++ b/packages/babel-helper-builder-binary-assignment-operator-visitor/package.json @@ -1,6 +1,6 @@ { "name": "@babel/helper-builder-binary-assignment-operator-visitor", - "version": "7.1.0", + "version": "7.7.0", "description": "Helper function to build binary assignment operator visitors", "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-builder-binary-assignment-operator-visitor", "license": "MIT", @@ -9,7 +9,7 @@ }, "main": "lib/index.js", "dependencies": { - "@babel/helper-explode-assignable-expression": "^7.1.0", - "@babel/types": "^7.6.3" + "@babel/helper-explode-assignable-expression": "^7.7.0", + "@babel/types": "^7.7.0" } } diff --git a/packages/babel-helper-builder-react-jsx/package.json b/packages/babel-helper-builder-react-jsx/package.json index cf082d88cf9c..d0d46f8fecb1 100644 --- a/packages/babel-helper-builder-react-jsx/package.json +++ b/packages/babel-helper-builder-react-jsx/package.json @@ -1,6 +1,6 @@ { "name": "@babel/helper-builder-react-jsx", - "version": "7.3.0", + "version": "7.7.0", "description": "Helper function to build react jsx", "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-builder-react-jsx", "license": "MIT", @@ -9,7 +9,7 @@ }, "main": "lib/index.js", "dependencies": { - "@babel/types": "^7.6.3", + "@babel/types": "^7.7.0", "esutils": "^2.0.0" } } diff --git a/packages/babel-helper-call-delegate/package.json b/packages/babel-helper-call-delegate/package.json index c7e9e0222d25..e978c18e56b5 100644 --- a/packages/babel-helper-call-delegate/package.json +++ b/packages/babel-helper-call-delegate/package.json @@ -1,6 +1,6 @@ { "name": "@babel/helper-call-delegate", - "version": "7.4.4", + "version": "7.7.0", "description": "Helper function to call delegate", "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-call-delegate", "license": "MIT", @@ -9,8 +9,8 @@ }, "main": "lib/index.js", "dependencies": { - "@babel/helper-hoist-variables": "^7.4.4", - "@babel/traverse": "^7.4.4", - "@babel/types": "^7.6.3" + "@babel/helper-hoist-variables": "^7.7.0", + "@babel/traverse": "^7.7.0", + "@babel/types": "^7.7.0" } } diff --git a/packages/babel-helper-create-class-features-plugin/package.json b/packages/babel-helper-create-class-features-plugin/package.json index 3884dece47f5..10a9d838580a 100644 --- a/packages/babel-helper-create-class-features-plugin/package.json +++ b/packages/babel-helper-create-class-features-plugin/package.json @@ -1,6 +1,6 @@ { "name": "@babel/helper-create-class-features-plugin", - "version": "7.6.0", + "version": "7.7.0", "author": "The Babel Team (https://babeljs.io/team)", "license": "MIT", "description": "Compile class public and private fields, private methods and decorators to ES6", @@ -14,18 +14,18 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-function-name": "^7.1.0", - "@babel/helper-member-expression-to-functions": "^7.5.5", - "@babel/helper-optimise-call-expression": "^7.0.0", + "@babel/helper-function-name": "^7.7.0", + "@babel/helper-member-expression-to-functions": "^7.7.0", + "@babel/helper-optimise-call-expression": "^7.7.0", "@babel/helper-plugin-utils": "^7.0.0", - "@babel/helper-replace-supers": "^7.5.5", - "@babel/helper-split-export-declaration": "^7.4.4" + "@babel/helper-replace-supers": "^7.7.0", + "@babel/helper-split-export-declaration": "^7.7.0" }, "peerDependencies": { "@babel/core": "^7.0.0" }, "devDependencies": { - "@babel/core": "^7.6.0", + "@babel/core": "^7.7.0", "@babel/helper-plugin-test-runner": "^7.0.0" } } diff --git a/packages/babel-helper-create-regexp-features-plugin/package.json b/packages/babel-helper-create-regexp-features-plugin/package.json index 7d49d45d507b..71abede86fb5 100644 --- a/packages/babel-helper-create-regexp-features-plugin/package.json +++ b/packages/babel-helper-create-regexp-features-plugin/package.json @@ -1,6 +1,6 @@ { "name": "@babel/helper-create-regexp-features-plugin", - "version": "7.6.0", + "version": "7.7.0", "author": "The Babel Team (https://babeljs.io/team)", "license": "MIT", "description": "Compile ESNext Regular Expressions to ES5", @@ -25,7 +25,7 @@ "@babel/core": "^7.0.0" }, "devDependencies": { - "@babel/core": "^7.6.0", + "@babel/core": "^7.7.0", "@babel/helper-plugin-test-runner": "^7.0.0" } } diff --git a/packages/babel-helper-define-map/package.json b/packages/babel-helper-define-map/package.json index ac574448da1f..dd8f635f8fc2 100644 --- a/packages/babel-helper-define-map/package.json +++ b/packages/babel-helper-define-map/package.json @@ -1,6 +1,6 @@ { "name": "@babel/helper-define-map", - "version": "7.5.5", + "version": "7.7.0", "description": "Helper function to define a map", "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-define-map", "license": "MIT", @@ -9,8 +9,8 @@ }, "main": "lib/index.js", "dependencies": { - "@babel/helper-function-name": "^7.1.0", - "@babel/types": "^7.6.3", + "@babel/helper-function-name": "^7.7.0", + "@babel/types": "^7.7.0", "lodash": "^4.17.13" } } diff --git a/packages/babel-helper-explode-assignable-expression/package.json b/packages/babel-helper-explode-assignable-expression/package.json index 8cbf2aaeb781..3dd23b0405c3 100644 --- a/packages/babel-helper-explode-assignable-expression/package.json +++ b/packages/babel-helper-explode-assignable-expression/package.json @@ -1,6 +1,6 @@ { "name": "@babel/helper-explode-assignable-expression", - "version": "7.1.0", + "version": "7.7.0", "description": "Helper function to explode an assignable expression", "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-explode-assignable-expression", "license": "MIT", @@ -9,7 +9,7 @@ }, "main": "lib/index.js", "dependencies": { - "@babel/traverse": "^7.1.0", - "@babel/types": "^7.6.3" + "@babel/traverse": "^7.7.0", + "@babel/types": "^7.7.0" } } diff --git a/packages/babel-helper-explode-class/package.json b/packages/babel-helper-explode-class/package.json index 630951905259..a30a169acc57 100644 --- a/packages/babel-helper-explode-class/package.json +++ b/packages/babel-helper-explode-class/package.json @@ -1,6 +1,6 @@ { "name": "@babel/helper-explode-class", - "version": "7.1.0", + "version": "7.7.0", "description": "Helper function to explode class", "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-explode-class", "license": "MIT", @@ -9,8 +9,8 @@ }, "main": "lib/index.js", "dependencies": { - "@babel/helper-bindify-decorators": "^7.1.0", - "@babel/traverse": "^7.1.0", - "@babel/types": "^7.6.3" + "@babel/helper-bindify-decorators": "^7.7.0", + "@babel/traverse": "^7.7.0", + "@babel/types": "^7.7.0" } } diff --git a/packages/babel-helper-function-name/package.json b/packages/babel-helper-function-name/package.json index ab39d5f4d5db..c4a46b4c9279 100644 --- a/packages/babel-helper-function-name/package.json +++ b/packages/babel-helper-function-name/package.json @@ -1,6 +1,6 @@ { "name": "@babel/helper-function-name", - "version": "7.1.0", + "version": "7.7.0", "description": "Helper function to change the property 'name' of every function", "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-function-name", "license": "MIT", @@ -9,8 +9,8 @@ }, "main": "lib/index.js", "dependencies": { - "@babel/helper-get-function-arity": "^7.0.0", - "@babel/template": "^7.1.0", - "@babel/types": "^7.6.3" + "@babel/helper-get-function-arity": "^7.7.0", + "@babel/template": "^7.7.0", + "@babel/types": "^7.7.0" } } diff --git a/packages/babel-helper-get-function-arity/package.json b/packages/babel-helper-get-function-arity/package.json index ec3f4a85c2cf..a9ab2ebebed2 100644 --- a/packages/babel-helper-get-function-arity/package.json +++ b/packages/babel-helper-get-function-arity/package.json @@ -1,6 +1,6 @@ { "name": "@babel/helper-get-function-arity", - "version": "7.0.0", + "version": "7.7.0", "description": "Helper function to get function arity", "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-get-function-arity", "license": "MIT", @@ -9,6 +9,6 @@ }, "main": "lib/index.js", "dependencies": { - "@babel/types": "^7.6.3" + "@babel/types": "^7.7.0" } } diff --git a/packages/babel-helper-hoist-variables/package.json b/packages/babel-helper-hoist-variables/package.json index 98cb86eec955..51acf5b0def5 100644 --- a/packages/babel-helper-hoist-variables/package.json +++ b/packages/babel-helper-hoist-variables/package.json @@ -1,6 +1,6 @@ { "name": "@babel/helper-hoist-variables", - "version": "7.4.4", + "version": "7.7.0", "description": "Helper function to hoist variables", "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-hoist-variables", "license": "MIT", @@ -9,6 +9,6 @@ }, "main": "lib/index.js", "dependencies": { - "@babel/types": "^7.6.3" + "@babel/types": "^7.7.0" } } diff --git a/packages/babel-helper-member-expression-to-functions/package.json b/packages/babel-helper-member-expression-to-functions/package.json index 571c84a18a7b..ddf3f9e002ce 100644 --- a/packages/babel-helper-member-expression-to-functions/package.json +++ b/packages/babel-helper-member-expression-to-functions/package.json @@ -1,6 +1,6 @@ { "name": "@babel/helper-member-expression-to-functions", - "version": "7.5.5", + "version": "7.7.0", "description": "Helper function to replace certain member expressions with function calls", "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-member-expression-to-functions", "license": "MIT", @@ -10,6 +10,6 @@ "main": "lib/index.js", "author": "Justin Ridgewell ", "dependencies": { - "@babel/types": "^7.6.3" + "@babel/types": "^7.7.0" } } diff --git a/packages/babel-helper-module-imports/package.json b/packages/babel-helper-module-imports/package.json index 7e6bad8b26c9..ee5f134217e3 100644 --- a/packages/babel-helper-module-imports/package.json +++ b/packages/babel-helper-module-imports/package.json @@ -1,6 +1,6 @@ { "name": "@babel/helper-module-imports", - "version": "7.0.0", + "version": "7.7.0", "description": "Babel helper functions for inserting module loads", "author": "Logan Smyth ", "homepage": "https://babeljs.io/", @@ -11,9 +11,9 @@ "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-module-imports", "main": "lib/index.js", "dependencies": { - "@babel/types": "^7.6.3" + "@babel/types": "^7.7.0" }, "devDependencies": { - "@babel/core": "^7.0.0" + "@babel/core": "^7.7.0" } } diff --git a/packages/babel-helper-module-transforms/package.json b/packages/babel-helper-module-transforms/package.json index f8f7ef94092a..7d1e61d78dfa 100644 --- a/packages/babel-helper-module-transforms/package.json +++ b/packages/babel-helper-module-transforms/package.json @@ -1,6 +1,6 @@ { "name": "@babel/helper-module-transforms", - "version": "7.5.5", + "version": "7.7.0", "description": "Babel helper functions for implementing ES6 module transformations", "author": "Logan Smyth ", "homepage": "https://babeljs.io/", @@ -11,11 +11,11 @@ "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-module-transforms", "main": "lib/index.js", "dependencies": { - "@babel/helper-module-imports": "^7.0.0", - "@babel/helper-simple-access": "^7.1.0", - "@babel/helper-split-export-declaration": "^7.4.4", - "@babel/template": "^7.4.4", - "@babel/types": "^7.6.3", + "@babel/helper-module-imports": "^7.7.0", + "@babel/helper-simple-access": "^7.7.0", + "@babel/helper-split-export-declaration": "^7.7.0", + "@babel/template": "^7.7.0", + "@babel/types": "^7.7.0", "lodash": "^4.17.13" } } diff --git a/packages/babel-helper-optimise-call-expression/package.json b/packages/babel-helper-optimise-call-expression/package.json index 9c9245260c78..374d7d4ba5f2 100644 --- a/packages/babel-helper-optimise-call-expression/package.json +++ b/packages/babel-helper-optimise-call-expression/package.json @@ -1,6 +1,6 @@ { "name": "@babel/helper-optimise-call-expression", - "version": "7.0.0", + "version": "7.7.0", "description": "Helper function to optimise call expression", "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-optimise-call-expression", "license": "MIT", @@ -9,6 +9,6 @@ }, "main": "lib/index.js", "dependencies": { - "@babel/types": "^7.6.3" + "@babel/types": "^7.7.0" } } diff --git a/packages/babel-helper-remap-async-to-generator/package.json b/packages/babel-helper-remap-async-to-generator/package.json index e0033b85c2c4..09149e3704de 100644 --- a/packages/babel-helper-remap-async-to-generator/package.json +++ b/packages/babel-helper-remap-async-to-generator/package.json @@ -1,6 +1,6 @@ { "name": "@babel/helper-remap-async-to-generator", - "version": "7.1.0", + "version": "7.7.0", "description": "Helper function to remap async functions to generators", "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-remap-async-to-generator", "license": "MIT", @@ -9,10 +9,10 @@ }, "main": "lib/index.js", "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.6.3" + "@babel/helper-annotate-as-pure": "^7.7.0", + "@babel/helper-wrap-function": "^7.7.0", + "@babel/template": "^7.7.0", + "@babel/traverse": "^7.7.0", + "@babel/types": "^7.7.0" } } diff --git a/packages/babel-helper-replace-supers/package.json b/packages/babel-helper-replace-supers/package.json index b762e5ea0f2a..1291e2a4a9a2 100644 --- a/packages/babel-helper-replace-supers/package.json +++ b/packages/babel-helper-replace-supers/package.json @@ -1,6 +1,6 @@ { "name": "@babel/helper-replace-supers", - "version": "7.5.5", + "version": "7.7.0", "description": "Helper function to replace supers", "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-replace-supers", "license": "MIT", @@ -9,9 +9,9 @@ }, "main": "lib/index.js", "dependencies": { - "@babel/helper-member-expression-to-functions": "^7.5.5", - "@babel/helper-optimise-call-expression": "^7.0.0", - "@babel/traverse": "^7.5.5", - "@babel/types": "^7.6.3" + "@babel/helper-member-expression-to-functions": "^7.7.0", + "@babel/helper-optimise-call-expression": "^7.7.0", + "@babel/traverse": "^7.7.0", + "@babel/types": "^7.7.0" } } diff --git a/packages/babel-helper-simple-access/package.json b/packages/babel-helper-simple-access/package.json index 4fd9ee272372..b904fc3e757f 100644 --- a/packages/babel-helper-simple-access/package.json +++ b/packages/babel-helper-simple-access/package.json @@ -1,6 +1,6 @@ { "name": "@babel/helper-simple-access", - "version": "7.1.0", + "version": "7.7.0", "description": "Babel helper for ensuring that access to a given value is performed through simple accesses", "author": "Logan Smyth ", "homepage": "https://babeljs.io/", @@ -11,7 +11,7 @@ "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-simple-access", "main": "lib/index.js", "dependencies": { - "@babel/template": "^7.1.0", - "@babel/types": "^7.6.3" + "@babel/template": "^7.7.0", + "@babel/types": "^7.7.0" } } diff --git a/packages/babel-helper-split-export-declaration/package.json b/packages/babel-helper-split-export-declaration/package.json index e4ae3ae051fe..c877e501f0d3 100644 --- a/packages/babel-helper-split-export-declaration/package.json +++ b/packages/babel-helper-split-export-declaration/package.json @@ -1,6 +1,6 @@ { "name": "@babel/helper-split-export-declaration", - "version": "7.4.4", + "version": "7.7.0", "description": "", "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-split-export-declaration", "license": "MIT", @@ -9,6 +9,6 @@ }, "main": "lib/index.js", "dependencies": { - "@babel/types": "^7.6.3" + "@babel/types": "^7.7.0" } } diff --git a/packages/babel-helper-wrap-function/package.json b/packages/babel-helper-wrap-function/package.json index 6d06942e0e5c..743c33bf99a4 100644 --- a/packages/babel-helper-wrap-function/package.json +++ b/packages/babel-helper-wrap-function/package.json @@ -1,6 +1,6 @@ { "name": "@babel/helper-wrap-function", - "version": "7.2.0", + "version": "7.7.0", "description": "Helper to wrap functions inside a function call.", "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-wrap-function", "license": "MIT", @@ -9,9 +9,9 @@ }, "main": "lib/index.js", "dependencies": { - "@babel/helper-function-name": "^7.1.0", - "@babel/template": "^7.1.0", - "@babel/traverse": "^7.1.0", - "@babel/types": "^7.6.3" + "@babel/helper-function-name": "^7.7.0", + "@babel/template": "^7.7.0", + "@babel/traverse": "^7.7.0", + "@babel/types": "^7.7.0" } } diff --git a/packages/babel-helpers/package.json b/packages/babel-helpers/package.json index 555a469caa6f..31ff1ee3c5a5 100644 --- a/packages/babel-helpers/package.json +++ b/packages/babel-helpers/package.json @@ -1,6 +1,6 @@ { "name": "@babel/helpers", - "version": "7.6.2", + "version": "7.7.0", "description": "Collection of helper functions used by Babel transforms.", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", @@ -11,9 +11,9 @@ "repository": "https://github.com/babel/babel/tree/master/packages/babel-helpers", "main": "lib/index.js", "dependencies": { - "@babel/template": "^7.6.0", - "@babel/traverse": "^7.6.2", - "@babel/types": "^7.6.3" + "@babel/template": "^7.7.0", + "@babel/traverse": "^7.7.0", + "@babel/types": "^7.7.0" }, "devDependencies": { "@babel/helper-plugin-test-runner": "^7.0.0" diff --git a/packages/babel-node/package.json b/packages/babel-node/package.json index 737f8eadf884..ace2ab57c6ad 100644 --- a/packages/babel-node/package.json +++ b/packages/babel-node/package.json @@ -1,6 +1,6 @@ { "name": "@babel/node", - "version": "7.6.3", + "version": "7.7.0", "description": "Babel command line", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", @@ -19,7 +19,7 @@ "compiler" ], "dependencies": { - "@babel/register": "^7.6.2", + "@babel/register": "^7.7.0", "commander": "^2.8.1", "core-js": "^3.2.1", "lodash": "^4.17.13", @@ -31,7 +31,7 @@ "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.6.3", + "@babel/core": "^7.7.0", "@babel/helper-fixtures": "^7.6.3", "fs-readdir-recursive": "^1.0.0", "make-dir": "^2.1.0" diff --git a/packages/babel-parser/package.json b/packages/babel-parser/package.json index 3760270b1672..0226cc56e6bd 100644 --- a/packages/babel-parser/package.json +++ b/packages/babel-parser/package.json @@ -1,6 +1,6 @@ { "name": "@babel/parser", - "version": "7.6.4", + "version": "7.7.0", "description": "A JavaScript parser", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", diff --git a/packages/babel-plugin-proposal-async-generator-functions/package.json b/packages/babel-plugin-proposal-async-generator-functions/package.json index 81db9bcc3d53..276aa93ea371 100644 --- a/packages/babel-plugin-proposal-async-generator-functions/package.json +++ b/packages/babel-plugin-proposal-async-generator-functions/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-proposal-async-generator-functions", - "version": "7.2.0", + "version": "7.7.0", "description": "Turn async generator functions into ES2015 generators", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-proposal-async-generator-functions", "license": "MIT", @@ -13,14 +13,14 @@ ], "dependencies": { "@babel/helper-plugin-utils": "^7.0.0", - "@babel/helper-remap-async-to-generator": "^7.1.0", + "@babel/helper-remap-async-to-generator": "^7.7.0", "@babel/plugin-syntax-async-generators": "^7.2.0" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.2.0", + "@babel/core": "^7.7.0", "@babel/helper-plugin-test-runner": "^7.0.0" } } diff --git a/packages/babel-plugin-proposal-class-properties/package.json b/packages/babel-plugin-proposal-class-properties/package.json index 9a11e1c822a6..5036770a07d3 100644 --- a/packages/babel-plugin-proposal-class-properties/package.json +++ b/packages/babel-plugin-proposal-class-properties/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-proposal-class-properties", - "version": "7.5.5", + "version": "7.7.0", "description": "This plugin transforms static class properties as well as properties declared with the property initializer syntax", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-proposal-class-properties", "license": "MIT", @@ -12,14 +12,14 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-create-class-features-plugin": "^7.5.5", + "@babel/helper-create-class-features-plugin": "^7.7.0", "@babel/helper-plugin-utils": "^7.0.0" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.5.5", + "@babel/core": "^7.7.0", "@babel/helper-plugin-test-runner": "^7.0.0" } } diff --git a/packages/babel-plugin-proposal-decorators/package.json b/packages/babel-plugin-proposal-decorators/package.json index 6278dff8e544..e7f9f4de57e3 100644 --- a/packages/babel-plugin-proposal-decorators/package.json +++ b/packages/babel-plugin-proposal-decorators/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-proposal-decorators", - "version": "7.6.0", + "version": "7.7.0", "author": "Logan Smyth ", "license": "MIT", "publishConfig": { @@ -15,7 +15,7 @@ "decorators" ], "dependencies": { - "@babel/helper-create-class-features-plugin": "^7.6.0", + "@babel/helper-create-class-features-plugin": "^7.7.0", "@babel/helper-plugin-utils": "^7.0.0", "@babel/plugin-syntax-decorators": "^7.2.0" }, @@ -23,7 +23,7 @@ "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.6.0", + "@babel/core": "^7.7.0", "@babel/helper-plugin-test-runner": "^7.0.0" } } diff --git a/packages/babel-plugin-proposal-dynamic-import/package.json b/packages/babel-plugin-proposal-dynamic-import/package.json index a691155641e4..1ade94814252 100644 --- a/packages/babel-plugin-proposal-dynamic-import/package.json +++ b/packages/babel-plugin-proposal-dynamic-import/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-proposal-dynamic-import", - "version": "7.5.0", + "version": "7.7.0", "description": "Transform import() expressions", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-proposal-dynamic-import", "license": "MIT", @@ -19,7 +19,7 @@ "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.5.0", + "@babel/core": "^7.7.0", "@babel/helper-plugin-test-runner": "^7.0.0" } } diff --git a/packages/babel-plugin-proposal-function-sent/package.json b/packages/babel-plugin-proposal-function-sent/package.json index 0ba394b625af..f8335257f1a6 100644 --- a/packages/babel-plugin-proposal-function-sent/package.json +++ b/packages/babel-plugin-proposal-function-sent/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-proposal-function-sent", - "version": "7.5.0", + "version": "7.7.0", "description": "Compile the function.sent meta property to valid ES2015 code", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-proposal-function-sent", "license": "MIT", @@ -13,14 +13,14 @@ ], "dependencies": { "@babel/helper-plugin-utils": "^7.0.0", - "@babel/helper-wrap-function": "^7.2.0", + "@babel/helper-wrap-function": "^7.7.0", "@babel/plugin-syntax-function-sent": "^7.2.0" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.5.0", + "@babel/core": "^7.7.0", "@babel/helper-plugin-test-runner": "^7.0.0" } } diff --git a/packages/babel-plugin-proposal-unicode-property-regex/package.json b/packages/babel-plugin-proposal-unicode-property-regex/package.json index cfb844aeb1bc..b478bbdde033 100644 --- a/packages/babel-plugin-proposal-unicode-property-regex/package.json +++ b/packages/babel-plugin-proposal-unicode-property-regex/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-proposal-unicode-property-regex", - "version": "7.6.2", + "version": "7.7.0", "description": "Compile Unicode property escapes in Unicode regular expressions to ES5.", "homepage": "https://babeljs.io/", "license": "MIT", @@ -22,14 +22,14 @@ "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-proposal-unicode-property-regex", "bugs": "https://github.com/babel/babel/issues", "dependencies": { - "@babel/helper-create-regexp-features-plugin": "^7.6.0", + "@babel/helper-create-regexp-features-plugin": "^7.7.0", "@babel/helper-plugin-utils": "^7.0.0" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.6.2", + "@babel/core": "^7.7.0", "@babel/helper-plugin-test-runner": "^7.0.0" } } diff --git a/packages/babel-plugin-syntax-flow/package.json b/packages/babel-plugin-syntax-flow/package.json index 864023567a5d..2885aa9f81ec 100644 --- a/packages/babel-plugin-syntax-flow/package.json +++ b/packages/babel-plugin-syntax-flow/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-syntax-flow", - "version": "7.2.0", + "version": "7.7.0", "description": "Allow parsing of the flow syntax", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-syntax-flow", "license": "MIT", @@ -18,6 +18,6 @@ "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.2.0" + "@babel/core": "^7.7.0" } } diff --git a/packages/babel-plugin-syntax-top-level-await/package.json b/packages/babel-plugin-syntax-top-level-await/package.json index 8411ce39f938..5b42d9a1f1c9 100644 --- a/packages/babel-plugin-syntax-top-level-await/package.json +++ b/packages/babel-plugin-syntax-top-level-await/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-syntax-top-level-await", - "version": "7.6.4", + "version": "7.7.0", "description": "Allow parsing of top-level await in modules", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-syntax-top-level-await", "license": "MIT", @@ -18,6 +18,6 @@ "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.4.4" + "@babel/core": "^7.7.0" } } diff --git a/packages/babel-plugin-transform-async-to-generator/package.json b/packages/babel-plugin-transform-async-to-generator/package.json index d6b8b908e89a..7703da8097fe 100644 --- a/packages/babel-plugin-transform-async-to-generator/package.json +++ b/packages/babel-plugin-transform-async-to-generator/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-transform-async-to-generator", - "version": "7.5.0", + "version": "7.7.0", "description": "Turn async functions into ES2015 generators", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-async-to-generator", "license": "MIT", @@ -12,15 +12,15 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-module-imports": "^7.0.0", + "@babel/helper-module-imports": "^7.7.0", "@babel/helper-plugin-utils": "^7.0.0", - "@babel/helper-remap-async-to-generator": "^7.1.0" + "@babel/helper-remap-async-to-generator": "^7.7.0" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.5.0", + "@babel/core": "^7.7.0", "@babel/helper-plugin-test-runner": "^7.0.0" } } diff --git a/packages/babel-plugin-transform-classes/package.json b/packages/babel-plugin-transform-classes/package.json index f1fcc8a2e80b..cfb696cf0a8f 100644 --- a/packages/babel-plugin-transform-classes/package.json +++ b/packages/babel-plugin-transform-classes/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-transform-classes", - "version": "7.5.5", + "version": "7.7.0", "description": "Compile ES2015 classes to ES5", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-classes", "license": "MIT", @@ -9,13 +9,13 @@ }, "main": "lib/index.js", "dependencies": { - "@babel/helper-annotate-as-pure": "^7.0.0", - "@babel/helper-define-map": "^7.5.5", - "@babel/helper-function-name": "^7.1.0", - "@babel/helper-optimise-call-expression": "^7.0.0", + "@babel/helper-annotate-as-pure": "^7.7.0", + "@babel/helper-define-map": "^7.7.0", + "@babel/helper-function-name": "^7.7.0", + "@babel/helper-optimise-call-expression": "^7.7.0", "@babel/helper-plugin-utils": "^7.0.0", - "@babel/helper-replace-supers": "^7.5.5", - "@babel/helper-split-export-declaration": "^7.4.4", + "@babel/helper-replace-supers": "^7.7.0", + "@babel/helper-split-export-declaration": "^7.7.0", "globals": "^11.1.0" }, "keywords": [ @@ -25,7 +25,7 @@ "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.5.5", + "@babel/core": "^7.7.0", "@babel/helper-plugin-test-runner": "^7.0.0" } } diff --git a/packages/babel-plugin-transform-dotall-regex/package.json b/packages/babel-plugin-transform-dotall-regex/package.json index 4ace562398ab..77dc9f4deb5e 100644 --- a/packages/babel-plugin-transform-dotall-regex/package.json +++ b/packages/babel-plugin-transform-dotall-regex/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-transform-dotall-regex", - "version": "7.6.2", + "version": "7.7.0", "description": "Compile regular expressions using the `s` (`dotAll`) flag to ES5.", "homepage": "https://babeljs.io/", "license": "MIT", @@ -18,14 +18,14 @@ "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-dotall-regex", "bugs": "https://github.com/babel/babel/issues", "dependencies": { - "@babel/helper-create-regexp-features-plugin": "^7.6.0", + "@babel/helper-create-regexp-features-plugin": "^7.7.0", "@babel/helper-plugin-utils": "^7.0.0" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.6.2", + "@babel/core": "^7.7.0", "@babel/helper-plugin-test-runner": "^7.0.0" } } diff --git a/packages/babel-plugin-transform-function-name/package.json b/packages/babel-plugin-transform-function-name/package.json index 2a03ae1b21ac..c6be0eee3d0a 100644 --- a/packages/babel-plugin-transform-function-name/package.json +++ b/packages/babel-plugin-transform-function-name/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-transform-function-name", - "version": "7.4.4", + "version": "7.7.0", "description": "Apply ES2015 function.name semantics to all functions", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-function-name", "license": "MIT", @@ -12,14 +12,14 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-function-name": "^7.1.0", + "@babel/helper-function-name": "^7.7.0", "@babel/helper-plugin-utils": "^7.0.0" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.4.4", + "@babel/core": "^7.7.0", "@babel/helper-plugin-test-runner": "^7.0.0" } } diff --git a/packages/babel-plugin-transform-modules-commonjs/package.json b/packages/babel-plugin-transform-modules-commonjs/package.json index e6f010f39412..2b278105db8c 100644 --- a/packages/babel-plugin-transform-modules-commonjs/package.json +++ b/packages/babel-plugin-transform-modules-commonjs/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-transform-modules-commonjs", - "version": "7.6.0", + "version": "7.7.0", "description": "This plugin transforms ES2015 modules to CommonJS", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-modules-commonjs", "license": "MIT", @@ -9,9 +9,9 @@ }, "main": "lib/index.js", "dependencies": { - "@babel/helper-module-transforms": "^7.4.4", + "@babel/helper-module-transforms": "^7.7.0", "@babel/helper-plugin-utils": "^7.0.0", - "@babel/helper-simple-access": "^7.1.0", + "@babel/helper-simple-access": "^7.7.0", "babel-plugin-dynamic-import-node": "^2.3.0" }, "keywords": [ @@ -21,7 +21,7 @@ "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.6.0", + "@babel/core": "^7.7.0", "@babel/helper-plugin-test-runner": "^7.0.0", "@babel/plugin-syntax-object-rest-spread": "^7.2.0" } diff --git a/packages/babel-plugin-transform-modules-systemjs/package.json b/packages/babel-plugin-transform-modules-systemjs/package.json index d827ae959527..381c7ba180a3 100644 --- a/packages/babel-plugin-transform-modules-systemjs/package.json +++ b/packages/babel-plugin-transform-modules-systemjs/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-transform-modules-systemjs", - "version": "7.5.0", + "version": "7.7.0", "description": "This plugin transforms ES2015 modules to SystemJS", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-modules-systemjs", "license": "MIT", @@ -9,7 +9,7 @@ }, "main": "lib/index.js", "dependencies": { - "@babel/helper-hoist-variables": "^7.4.4", + "@babel/helper-hoist-variables": "^7.7.0", "@babel/helper-plugin-utils": "^7.0.0", "babel-plugin-dynamic-import-node": "^2.3.0" }, @@ -20,7 +20,7 @@ "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.5.0", + "@babel/core": "^7.7.0", "@babel/helper-plugin-test-runner": "^7.0.0", "@babel/plugin-syntax-dynamic-import": "^7.2.0" } diff --git a/packages/babel-plugin-transform-modules-umd/package.json b/packages/babel-plugin-transform-modules-umd/package.json index 9dd0f73213e6..8db718dec04f 100644 --- a/packages/babel-plugin-transform-modules-umd/package.json +++ b/packages/babel-plugin-transform-modules-umd/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-transform-modules-umd", - "version": "7.2.0", + "version": "7.7.0", "description": "This plugin transforms ES2015 modules to UMD", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-modules-umd", "license": "MIT", @@ -9,7 +9,7 @@ }, "main": "lib/index.js", "dependencies": { - "@babel/helper-module-transforms": "^7.1.0", + "@babel/helper-module-transforms": "^7.7.0", "@babel/helper-plugin-utils": "^7.0.0" }, "keywords": [ @@ -19,7 +19,7 @@ "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.2.0", + "@babel/core": "^7.7.0", "@babel/helper-plugin-test-runner": "^7.0.0" } } diff --git a/packages/babel-plugin-transform-named-capturing-groups-regex/package.json b/packages/babel-plugin-transform-named-capturing-groups-regex/package.json index 3d1b894fc89a..8186a98c0685 100644 --- a/packages/babel-plugin-transform-named-capturing-groups-regex/package.json +++ b/packages/babel-plugin-transform-named-capturing-groups-regex/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-transform-named-capturing-groups-regex", - "version": "7.6.3", + "version": "7.7.0", "description": "Compile regular expressions using named groups to ES5.", "homepage": "https://babeljs.io/", "license": "MIT", @@ -21,13 +21,13 @@ }, "bugs": "https://github.com/babel/babel/issues", "dependencies": { - "@babel/helper-create-regexp-features-plugin": "^7.6.0" + "@babel/helper-create-regexp-features-plugin": "^7.7.0" }, "peerDependencies": { "@babel/core": "^7.0.0" }, "devDependencies": { - "@babel/core": "^7.6.3", + "@babel/core": "^7.7.0", "@babel/helper-plugin-test-runner": "^7.0.0", "core-js": "^3.2.1", "core-js-pure": "^3.2.1" diff --git a/packages/babel-plugin-transform-react-jsx/package.json b/packages/babel-plugin-transform-react-jsx/package.json index 5af70957b122..a3c3b36d70e1 100644 --- a/packages/babel-plugin-transform-react-jsx/package.json +++ b/packages/babel-plugin-transform-react-jsx/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-transform-react-jsx", - "version": "7.3.0", + "version": "7.7.0", "description": "Turn JSX into React function calls", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-react-jsx", "license": "MIT", @@ -12,7 +12,7 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-builder-react-jsx": "^7.3.0", + "@babel/helper-builder-react-jsx": "^7.7.0", "@babel/helper-plugin-utils": "^7.0.0", "@babel/plugin-syntax-jsx": "^7.2.0" }, @@ -20,7 +20,7 @@ "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.2.0", + "@babel/core": "^7.7.0", "@babel/helper-plugin-test-runner": "^7.0.0" } } diff --git a/packages/babel-plugin-transform-regenerator/package.json b/packages/babel-plugin-transform-regenerator/package.json index 9dbdaa4c6c7c..503edd243e8a 100644 --- a/packages/babel-plugin-transform-regenerator/package.json +++ b/packages/babel-plugin-transform-regenerator/package.json @@ -2,7 +2,7 @@ "name": "@babel/plugin-transform-regenerator", "author": "Ben Newman ", "description": "Explode async and generator functions into a state machine.", - "version": "7.4.5", + "version": "7.7.0", "homepage": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-regenerator", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-regenerator", "main": "lib/index.js", @@ -17,7 +17,7 @@ "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.4.5", + "@babel/core": "^7.7.0", "@babel/helper-plugin-test-runner": "^7.0.0" } } diff --git a/packages/babel-plugin-transform-typescript/package.json b/packages/babel-plugin-transform-typescript/package.json index c685bcda9077..2c96f987306f 100644 --- a/packages/babel-plugin-transform-typescript/package.json +++ b/packages/babel-plugin-transform-typescript/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-transform-typescript", - "version": "7.6.3", + "version": "7.7.0", "description": "Transform TypeScript into ES.next", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-typescript", "license": "MIT", @@ -13,7 +13,7 @@ "typescript" ], "dependencies": { - "@babel/helper-create-class-features-plugin": "^7.6.0", + "@babel/helper-create-class-features-plugin": "^7.7.0", "@babel/helper-plugin-utils": "^7.0.0", "@babel/plugin-syntax-typescript": "^7.2.0" }, @@ -21,7 +21,7 @@ "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.6.3", + "@babel/core": "^7.7.0", "@babel/helper-plugin-test-runner": "^7.0.0" } } diff --git a/packages/babel-plugin-transform-unicode-regex/package.json b/packages/babel-plugin-transform-unicode-regex/package.json index 647fb228ce30..f71c3d1dd38b 100644 --- a/packages/babel-plugin-transform-unicode-regex/package.json +++ b/packages/babel-plugin-transform-unicode-regex/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-transform-unicode-regex", - "version": "7.6.2", + "version": "7.7.0", "description": "Compile ES2015 Unicode regex to ES5", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-unicode-regex", "license": "MIT", @@ -12,14 +12,14 @@ "babel-plugin" ], "dependencies": { - "@babel/helper-create-regexp-features-plugin": "^7.6.0", + "@babel/helper-create-regexp-features-plugin": "^7.7.0", "@babel/helper-plugin-utils": "^7.0.0" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.6.2", + "@babel/core": "^7.7.0", "@babel/helper-plugin-test-runner": "^7.0.0" } } diff --git a/packages/babel-polyfill/package.json b/packages/babel-polyfill/package.json index d3a4055dadf1..013e949556e3 100644 --- a/packages/babel-polyfill/package.json +++ b/packages/babel-polyfill/package.json @@ -1,6 +1,6 @@ { "name": "@babel/polyfill", - "version": "7.6.0", + "version": "7.7.0", "description": "Provides polyfills necessary for a full ES2015+ environment", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", diff --git a/packages/babel-preset-env-standalone/package.json b/packages/babel-preset-env-standalone/package.json index bdda607f1596..42e20fb08b71 100644 --- a/packages/babel-preset-env-standalone/package.json +++ b/packages/babel-preset-env-standalone/package.json @@ -1,6 +1,6 @@ { "name": "@babel/preset-env-standalone", - "version": "7.6.3", + "version": "7.7.0", "description": "Standalone build of babel-prest-env for use in non-Node.js environments.", "main": "babel-preset-env.js", "files": [ @@ -12,12 +12,12 @@ "prepublishOnly": "cd ../.. && make prepublish-build-preset-env-standalone" }, "devDependencies": { - "@babel/plugin-proposal-dynamic-import": "^7.5.0", + "@babel/plugin-proposal-dynamic-import": "^7.7.0", "@babel/plugin-proposal-json-strings": "^7.0.0", - "@babel/plugin-transform-named-capturing-groups-regex": "^7.6.3", + "@babel/plugin-transform-named-capturing-groups-regex": "^7.7.0", "@babel/plugin-transform-new-target": "^7.4.4", - "@babel/preset-env": "^7.6.3", - "@babel/standalone": "^7.6.3" + "@babel/preset-env": "^7.7.0", + "@babel/standalone": "^7.7.0" }, "keywords": [ "babel", diff --git a/packages/babel-preset-env/package.json b/packages/babel-preset-env/package.json index 5cfecce86f6b..a8182900bf5c 100644 --- a/packages/babel-preset-env/package.json +++ b/packages/babel-preset-env/package.json @@ -1,6 +1,6 @@ { "name": "@babel/preset-env", - "version": "7.6.3", + "version": "7.7.0", "description": "A Babel preset for each environment.", "author": "Henry Zhu ", "homepage": "https://babeljs.io/", @@ -14,52 +14,52 @@ "build-data": "node ./scripts/build-data.js; node ./scripts/build-modules-support.js" }, "dependencies": { - "@babel/helper-module-imports": "^7.0.0", + "@babel/helper-module-imports": "^7.7.0", "@babel/helper-plugin-utils": "^7.0.0", - "@babel/plugin-proposal-async-generator-functions": "^7.2.0", - "@babel/plugin-proposal-dynamic-import": "^7.5.0", + "@babel/plugin-proposal-async-generator-functions": "^7.7.0", + "@babel/plugin-proposal-dynamic-import": "^7.7.0", "@babel/plugin-proposal-json-strings": "^7.2.0", "@babel/plugin-proposal-object-rest-spread": "^7.6.2", "@babel/plugin-proposal-optional-catch-binding": "^7.2.0", - "@babel/plugin-proposal-unicode-property-regex": "^7.6.2", + "@babel/plugin-proposal-unicode-property-regex": "^7.7.0", "@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-syntax-top-level-await": "^7.6.4", + "@babel/plugin-syntax-top-level-await": "^7.7.0", "@babel/plugin-transform-arrow-functions": "^7.2.0", - "@babel/plugin-transform-async-to-generator": "^7.5.0", + "@babel/plugin-transform-async-to-generator": "^7.7.0", "@babel/plugin-transform-block-scoped-functions": "^7.2.0", "@babel/plugin-transform-block-scoping": "^7.6.3", - "@babel/plugin-transform-classes": "^7.5.5", + "@babel/plugin-transform-classes": "^7.7.0", "@babel/plugin-transform-computed-properties": "^7.2.0", "@babel/plugin-transform-destructuring": "^7.6.0", - "@babel/plugin-transform-dotall-regex": "^7.6.2", + "@babel/plugin-transform-dotall-regex": "^7.7.0", "@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-function-name": "^7.7.0", "@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.6.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.6.3", + "@babel/plugin-transform-modules-commonjs": "^7.7.0", + "@babel/plugin-transform-modules-systemjs": "^7.7.0", + "@babel/plugin-transform-modules-umd": "^7.7.0", + "@babel/plugin-transform-named-capturing-groups-regex": "^7.7.0", "@babel/plugin-transform-new-target": "^7.4.4", "@babel/plugin-transform-object-super": "^7.5.5", "@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-regenerator": "^7.7.0", "@babel/plugin-transform-reserved-words": "^7.2.0", "@babel/plugin-transform-shorthand-properties": "^7.2.0", "@babel/plugin-transform-spread": "^7.6.2", "@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.6.2", - "@babel/types": "^7.6.3", + "@babel/plugin-transform-unicode-regex": "^7.7.0", + "@babel/types": "^7.7.0", "browserslist": "^4.6.0", "core-js-compat": "^3.1.1", "invariant": "^2.2.2", @@ -70,8 +70,8 @@ "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/cli": "^7.6.3", - "@babel/core": "^7.6.3", + "@babel/cli": "^7.7.0", + "@babel/core": "^7.7.0", "@babel/helper-fixtures": "^7.6.3", "@babel/helper-plugin-test-runner": "^7.0.0", "@babel/plugin-syntax-dynamic-import": "^7.2.0", diff --git a/packages/babel-preset-react/package.json b/packages/babel-preset-react/package.json index f7a255aa8adb..2793bfb44bc6 100644 --- a/packages/babel-preset-react/package.json +++ b/packages/babel-preset-react/package.json @@ -1,6 +1,6 @@ { "name": "@babel/preset-react", - "version": "7.6.3", + "version": "7.7.0", "description": "Babel preset for all React plugins.", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", @@ -13,7 +13,7 @@ "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": "^7.7.0", "@babel/plugin-transform-react-jsx-self": "^7.0.0", "@babel/plugin-transform-react-jsx-source": "^7.0.0" }, @@ -21,7 +21,7 @@ "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.6.3", + "@babel/core": "^7.7.0", "@babel/helper-plugin-test-runner": "^7.0.0", "@babel/helper-transform-fixture-test-runner": "^7.6.3" } diff --git a/packages/babel-preset-typescript/package.json b/packages/babel-preset-typescript/package.json index fb48e54dc063..ce3bb85142c5 100644 --- a/packages/babel-preset-typescript/package.json +++ b/packages/babel-preset-typescript/package.json @@ -1,6 +1,6 @@ { "name": "@babel/preset-typescript", - "version": "7.6.0", + "version": "7.7.0", "description": "Babel preset for TypeScript.", "repository": "https://github.com/babel/babel/tree/master/packages/babel-preset-typescript", "license": "MIT", @@ -14,13 +14,13 @@ ], "dependencies": { "@babel/helper-plugin-utils": "^7.0.0", - "@babel/plugin-transform-typescript": "^7.6.0" + "@babel/plugin-transform-typescript": "^7.7.0" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.6.0", + "@babel/core": "^7.7.0", "@babel/helper-plugin-test-runner": "^7.0.0" } } diff --git a/packages/babel-register/package.json b/packages/babel-register/package.json index 397c70c64f87..5edcac8d4e97 100644 --- a/packages/babel-register/package.json +++ b/packages/babel-register/package.json @@ -1,6 +1,6 @@ { "name": "@babel/register", - "version": "7.6.2", + "version": "7.7.0", "description": "babel require hook", "license": "MIT", "publishConfig": { @@ -23,7 +23,7 @@ "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.6.2", + "@babel/core": "^7.7.0", "default-require-extensions": "^2.0.0" } } diff --git a/packages/babel-runtime-corejs2/package.json b/packages/babel-runtime-corejs2/package.json index 3b2a4defd8c7..b8d0bc49be4c 100644 --- a/packages/babel-runtime-corejs2/package.json +++ b/packages/babel-runtime-corejs2/package.json @@ -1,6 +1,6 @@ { "name": "@babel/runtime-corejs2", - "version": "7.6.3", + "version": "7.7.0", "description": "babel's modular runtime helpers with core-js@2 polyfilling", "license": "MIT", "publishConfig": { @@ -13,6 +13,6 @@ "regenerator-runtime": "^0.13.2" }, "devDependencies": { - "@babel/helpers": "^7.6.2" + "@babel/helpers": "^7.7.0" } } diff --git a/packages/babel-runtime-corejs3/package.json b/packages/babel-runtime-corejs3/package.json index 55b4e26b6571..0948273e927f 100644 --- a/packages/babel-runtime-corejs3/package.json +++ b/packages/babel-runtime-corejs3/package.json @@ -1,6 +1,6 @@ { "name": "@babel/runtime-corejs3", - "version": "7.6.3", + "version": "7.7.0", "description": "babel's modular runtime helpers with core-js@3 polyfilling", "license": "MIT", "publishConfig": { diff --git a/packages/babel-runtime/package.json b/packages/babel-runtime/package.json index afdb001717db..df8449b3858c 100644 --- a/packages/babel-runtime/package.json +++ b/packages/babel-runtime/package.json @@ -1,14 +1,14 @@ { "name": "@babel/runtime", - "version": "7.6.3", + "version": "7.7.0", "description": "babel's modular runtime helpers", "license": "MIT", "publishConfig": { "access": "public" }, "repository": { - "type" : "git", - "url" : "https://github.com/babel/babel.git", + "type": "git", + "url": "https://github.com/babel/babel.git", "directory": "packages/babel-runtime" }, "homepage": "https://babeljs.io/docs/en/next/babel-runtime", @@ -17,6 +17,6 @@ "regenerator-runtime": "^0.13.2" }, "devDependencies": { - "@babel/helpers": "^7.6.2" + "@babel/helpers": "^7.7.0" } } diff --git a/packages/babel-standalone/package.json b/packages/babel-standalone/package.json index bfed051647ec..4aaa2d7aa0f5 100644 --- a/packages/babel-standalone/package.json +++ b/packages/babel-standalone/package.json @@ -1,6 +1,6 @@ { "name": "@babel/standalone", - "version": "7.6.4", + "version": "7.7.0", "description": "Standalone build of Babel for use in non-Node.js environments.", "main": "babel.js", "files": [ @@ -12,17 +12,17 @@ "prepublishOnly": "cd ../.. && make prepublish-build-standalone" }, "devDependencies": { - "@babel/core": "^7.6.4", + "@babel/core": "^7.7.0", "@babel/helper-plugin-utils": "^7.0.0", "@babel/plugin-external-helpers": "^7.2.0", - "@babel/plugin-proposal-async-generator-functions": "^7.2.0", - "@babel/plugin-proposal-class-properties": "^7.5.5", - "@babel/plugin-proposal-decorators": "^7.6.0", + "@babel/plugin-proposal-async-generator-functions": "^7.7.0", + "@babel/plugin-proposal-class-properties": "^7.7.0", + "@babel/plugin-proposal-decorators": "^7.7.0", "@babel/plugin-proposal-do-expressions": "^7.6.0", "@babel/plugin-proposal-export-default-from": "^7.5.2", "@babel/plugin-proposal-export-namespace-from": "^7.5.2", "@babel/plugin-proposal-function-bind": "^7.2.0", - "@babel/plugin-proposal-function-sent": "^7.5.0", + "@babel/plugin-proposal-function-sent": "^7.7.0", "@babel/plugin-proposal-json-strings": "^7.2.0", "@babel/plugin-proposal-logical-assignment-operators": "^7.2.0", "@babel/plugin-proposal-nullish-coalescing-operator": "^7.4.4", @@ -33,7 +33,7 @@ "@babel/plugin-proposal-pipeline-operator": "^7.5.0", "@babel/plugin-proposal-private-methods": "^7.6.0", "@babel/plugin-proposal-throw-expressions": "^7.2.0", - "@babel/plugin-proposal-unicode-property-regex": "^7.6.2", + "@babel/plugin-proposal-unicode-property-regex": "^7.7.0", "@babel/plugin-syntax-async-generators": "^7.2.0", "@babel/plugin-syntax-class-properties": "^7.2.0", "@babel/plugin-syntax-decorators": "^7.2.0", @@ -41,7 +41,7 @@ "@babel/plugin-syntax-dynamic-import": "^7.2.0", "@babel/plugin-syntax-export-default-from": "^7.2.0", "@babel/plugin-syntax-export-namespace-from": "^7.2.0", - "@babel/plugin-syntax-flow": "^7.2.0", + "@babel/plugin-syntax-flow": "^7.7.0", "@babel/plugin-syntax-function-bind": "^7.2.0", "@babel/plugin-syntax-function-sent": "^7.2.0", "@babel/plugin-syntax-import-meta": "^7.2.0", @@ -51,27 +51,27 @@ "@babel/plugin-syntax-pipeline-operator": "^7.5.0", "@babel/plugin-syntax-typescript": "^7.3.3", "@babel/plugin-transform-arrow-functions": "^7.2.0", - "@babel/plugin-transform-async-to-generator": "^7.5.0", + "@babel/plugin-transform-async-to-generator": "^7.7.0", "@babel/plugin-transform-block-scoped-functions": "^7.2.0", "@babel/plugin-transform-block-scoping": "^7.6.3", - "@babel/plugin-transform-classes": "^7.5.5", + "@babel/plugin-transform-classes": "^7.7.0", "@babel/plugin-transform-computed-properties": "^7.2.0", "@babel/plugin-transform-destructuring": "^7.6.0", - "@babel/plugin-transform-dotall-regex": "^7.6.2", + "@babel/plugin-transform-dotall-regex": "^7.7.0", "@babel/plugin-transform-duplicate-keys": "^7.5.0", "@babel/plugin-transform-exponentiation-operator": "^7.2.0", "@babel/plugin-transform-flow-comments": "^7.6.3", "@babel/plugin-transform-flow-strip-types": "^7.6.3", "@babel/plugin-transform-for-of": "^7.4.4", - "@babel/plugin-transform-function-name": "^7.4.4", + "@babel/plugin-transform-function-name": "^7.7.0", "@babel/plugin-transform-instanceof": "^7.5.5", "@babel/plugin-transform-jscript": "^7.2.0", "@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.6.0", - "@babel/plugin-transform-modules-systemjs": "^7.5.0", - "@babel/plugin-transform-modules-umd": "^7.2.0", + "@babel/plugin-transform-modules-commonjs": "^7.7.0", + "@babel/plugin-transform-modules-systemjs": "^7.7.0", + "@babel/plugin-transform-modules-umd": "^7.7.0", "@babel/plugin-transform-new-target": "^7.4.4", "@babel/plugin-transform-object-assign": "^7.2.0", "@babel/plugin-transform-object-set-prototype-of-to-assign": "^7.2.0", @@ -83,11 +83,11 @@ "@babel/plugin-transform-react-constant-elements": "^7.6.3", "@babel/plugin-transform-react-display-name": "^7.2.0", "@babel/plugin-transform-react-inline-elements": "^7.2.0", - "@babel/plugin-transform-react-jsx": "^7.3.0", + "@babel/plugin-transform-react-jsx": "^7.7.0", "@babel/plugin-transform-react-jsx-compat": "^7.2.0", "@babel/plugin-transform-react-jsx-self": "^7.2.0", "@babel/plugin-transform-react-jsx-source": "^7.5.0", - "@babel/plugin-transform-regenerator": "^7.4.5", + "@babel/plugin-transform-regenerator": "^7.7.0", "@babel/plugin-transform-reserved-words": "^7.2.0", "@babel/plugin-transform-runtime": "^7.6.2", "@babel/plugin-transform-shorthand-properties": "^7.2.0", @@ -96,11 +96,11 @@ "@babel/plugin-transform-strict-mode": "^7.2.0", "@babel/plugin-transform-template-literals": "^7.4.4", "@babel/plugin-transform-typeof-symbol": "^7.2.0", - "@babel/plugin-transform-typescript": "^7.6.3", - "@babel/plugin-transform-unicode-regex": "^7.6.2", + "@babel/plugin-transform-typescript": "^7.7.0", + "@babel/plugin-transform-unicode-regex": "^7.7.0", "@babel/preset-flow": "^7.0.0", - "@babel/preset-react": "^7.6.3", - "@babel/preset-typescript": "^7.6.0" + "@babel/preset-react": "^7.7.0", + "@babel/preset-typescript": "^7.7.0" }, "keywords": [ "babel", diff --git a/packages/babel-template/package.json b/packages/babel-template/package.json index cc599610aa84..bf01d6cc6f06 100644 --- a/packages/babel-template/package.json +++ b/packages/babel-template/package.json @@ -1,6 +1,6 @@ { "name": "@babel/template", - "version": "7.6.0", + "version": "7.7.0", "description": "Generate an AST from a string template.", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", @@ -12,7 +12,7 @@ "main": "lib/index.js", "dependencies": { "@babel/code-frame": "^7.0.0", - "@babel/parser": "^7.6.0", - "@babel/types": "^7.6.3" + "@babel/parser": "^7.7.0", + "@babel/types": "^7.7.0" } } diff --git a/packages/babel-traverse/package.json b/packages/babel-traverse/package.json index 049b656f17f2..2665f5bc77b7 100644 --- a/packages/babel-traverse/package.json +++ b/packages/babel-traverse/package.json @@ -1,6 +1,6 @@ { "name": "@babel/traverse", - "version": "7.6.3", + "version": "7.7.0", "description": "The Babel Traverse module maintains the overall tree state, and is responsible for replacing, removing, and adding nodes", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", @@ -12,11 +12,11 @@ "main": "lib/index.js", "dependencies": { "@babel/code-frame": "^7.5.5", - "@babel/generator": "^7.6.3", - "@babel/helper-function-name": "^7.1.0", - "@babel/helper-split-export-declaration": "^7.4.4", - "@babel/parser": "^7.6.3", - "@babel/types": "^7.6.3", + "@babel/generator": "^7.7.0", + "@babel/helper-function-name": "^7.7.0", + "@babel/helper-split-export-declaration": "^7.7.0", + "@babel/parser": "^7.7.0", + "@babel/types": "^7.7.0", "debug": "^4.1.0", "globals": "^11.1.0", "lodash": "^4.17.13" diff --git a/packages/babel-types/package.json b/packages/babel-types/package.json index 75b54493ee97..07cff7f4ac60 100644 --- a/packages/babel-types/package.json +++ b/packages/babel-types/package.json @@ -1,6 +1,6 @@ { "name": "@babel/types", - "version": "7.6.3", + "version": "7.7.0", "description": "Babel Types is a Lodash-esque utility library for AST nodes", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", @@ -17,7 +17,7 @@ "to-fast-properties": "^2.0.0" }, "devDependencies": { - "@babel/generator": "^7.6.3", - "@babel/parser": "^7.6.3" + "@babel/generator": "^7.7.0", + "@babel/parser": "^7.7.0" } } From 5f2240e7ab319c8e22cc6d2405364e439968e1e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?= Date: Tue, 5 Nov 2019 12:06:52 +0100 Subject: [PATCH 045/648] Add v7.7.0 to CHANGELOG.md [skip ci] --- CHANGELOG.md | 102 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 102 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9689c1be5cb1..f0aeed650d2e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,108 @@ See [Babylon's CHANGELOG](packages/babylon/CHANGELOG.md) for the Babylon pre-7.0 + +## v7.7.0 (2019-11-05) + +#### :eyeglasses: Spec Compliance +* `babel-types` + * [#10621](https://github.com/babel/babel/pull/10621) throw a TypeError if identifier validation fails. ([@dentrado](https://github.com/dentrado)) +* `babel-parser` + * [#10559](https://github.com/babel/babel/pull/10559) fix: Exclude catch clause from let identifier error. ([@gonzarodriguezt](https://github.com/gonzarodriguezt)) + * [#10567](https://github.com/babel/babel/pull/10567) [parser] Exception to 8 and 9 in tagged template. ([@pnowak](https://github.com/pnowak)) + * [#10532](https://github.com/babel/babel/pull/10532) Allow duplicate __proto__ keys in patterns, simple case (#6705). ([@alejo90](https://github.com/alejo90)) + +#### :rocket: New Feature +* `babel-generator`, `babel-helper-create-class-features-plugin`, `babel-parser`, `babel-plugin-transform-typescript`, `babel-preset-typescript`, `babel-types` + * [#10545](https://github.com/babel/babel/pull/10545) Add support for TS declare modifier on fields. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) +* `babel-core`, `babel-parser`, `babel-preset-typescript` + * [#10363](https://github.com/babel/babel/pull/10363) @babel/parser error recovery. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) +* `babel-core` + * [#10599](https://github.com/babel/babel/pull/10599) Add support for .cjs config files. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) + * [#10501](https://github.com/babel/babel/pull/10501) Add support for babel.config.json. ([@devongovett](https://github.com/devongovett)) + * [#10361](https://github.com/babel/babel/pull/10361) feat: if code frame error is on a single line, highlight the whole path. ([@SimenB](https://github.com/SimenB)) +* `babel-plugin-syntax-top-level-await`, `babel-preset-env` + * [#10573](https://github.com/babel/babel/pull/10573) Create @babel/plugin-syntax-top-level-await. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) +* `babel-helper-builder-react-jsx`, `babel-plugin-transform-react-jsx`, `babel-preset-react` + * [#10572](https://github.com/babel/babel/pull/10572) [transform-react-jsx] Add useSpread option to transform JSX. ([@ivandevp](https://github.com/ivandevp)) +* `babel-generator`, `babel-parser`, `babel-plugin-proposal-decorators`, `babel-plugin-syntax-flow`, `babel-types` + * [#10344](https://github.com/babel/babel/pull/10344) Flow enums parsing. ([@gkz](https://github.com/gkz)) +* `babel-plugin-transform-function-name`, `babel-plugin-transform-modules-umd`, `babel-preset-env` + * [#10477](https://github.com/babel/babel/pull/10477) Changes UMD callsite to be more likely to pass in the intended object.. ([@MicahZoltu](https://github.com/MicahZoltu)) +* `babel-parser` + * [#10449](https://github.com/babel/babel/pull/10449) Create parser plugin "topLevelAwait". ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) + * [#10521](https://github.com/babel/babel/pull/10521) [parser] Enable "exportNamespaceFrom" by default. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) + * [#10483](https://github.com/babel/babel/pull/10483) [parser] Add support for private fields in TypeScript. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) +* `babel-generator`, `babel-parser`, `babel-types` + * [#10543](https://github.com/babel/babel/pull/10543) add assertions signature for TypeScript. ([@tanhauhau](https://github.com/tanhauhau)) +* `babel-cli`, `babel-register` + * [#8622](https://github.com/babel/babel/pull/8622) Make dir for babel --out-file. ([@TrySound](https://github.com/TrySound)) +* `babel-cli` + * [#10399](https://github.com/babel/babel/pull/10399) Closes [#8326](https://github.com/babel/babel/issues/8326), add back --quiet option.. ([@chris-peng-1244](https://github.com/chris-peng-1244)) + +#### :bug: Bug Fix +* `babel-helpers`, `babel-plugin-proposal-async-generator-functions`, `babel-plugin-proposal-function-sent`, `babel-preset-env` + * [#10422](https://github.com/babel/babel/pull/10422) Correctly delegate .return() in async generator. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) +* `babel-helper-module-transforms`, `babel-plugin-transform-modules-commonjs` + * [#10628](https://github.com/babel/babel/pull/10628) Don't throw when destructuring into a var named as an import. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) +* `babel-plugin-transform-modules-systemjs` + * [#10638](https://github.com/babel/babel/pull/10638) fix: remove ExportNamedDeclaration when the specifier is empty. ([@JLHwung](https://github.com/JLHwung)) +* `babel-parser` + * [#10631](https://github.com/babel/babel/pull/10631) [TS] Parse calls with type args in optional chains. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) + * [#10607](https://github.com/babel/babel/pull/10607) fixed missing errors on assignment pattern in object expression. ([@vivek12345](https://github.com/vivek12345)) + * [#10594](https://github.com/babel/babel/pull/10594) [parser] Parse only modifiers of actual methods. ([@gonzarodriguezt](https://github.com/gonzarodriguezt)) +* `babel-plugin-transform-typescript` + * [#10555](https://github.com/babel/babel/pull/10555) [TS] Correctly transform computed strings and templates in enums. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) +* `babel-core` + * [#10623](https://github.com/babel/babel/pull/10623) Fix: inputSourceMap should work when it is an external file. ([@JLHwung](https://github.com/JLHwung)) + * [#10539](https://github.com/babel/babel/pull/10539) fix: remove filename annotation in buildCodeFrameError. ([@JLHwung](https://github.com/JLHwung)) +* `babel-plugin-proposal-decorators` + * [#10578](https://github.com/babel/babel/pull/10578) [decorators] fix: support string literal properties. ([@mwhitworth](https://github.com/mwhitworth)) +* `babel-helpers`, `babel-plugin-proposal-dynamic-import`, `babel-plugin-transform-modules-commonjs`, `babel-preset-env` + * [#10574](https://github.com/babel/babel/pull/10574) fix: _interopRequireWildcard should only cache objects. ([@samMeow](https://github.com/samMeow)) +* `babel-traverse` + * [#9777](https://github.com/babel/babel/pull/9777) [traverse] Allow skipping nodes inserted with .replaceWith(). ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) +* `babel-preset-env` + * [#10146](https://github.com/babel/babel/pull/10146) Inject core-js@3 imports in Program:exit instead of on post(). ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) +* `babel-generator` + * [#10519](https://github.com/babel/babel/pull/10519) Fix generator missing parens around an arrow returning function type. ([@existentialism](https://github.com/existentialism)) +* `babel-plugin-transform-async-to-generator`, `babel-preset-env`, `babel-traverse` + * [#9939](https://github.com/babel/babel/pull/9939) Don't use args rest/spread to hoist super method calls. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) + +#### :nail_care: Polish +* `babel-plugin-transform-classes`, `babel-plugin-transform-regenerator`, `babel-preset-env` + * [#9481](https://github.com/babel/babel/pull/9481) [preset-env] Don't use async-to-generator when already using regenerator. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) +* `babel-helpers`, `babel-plugin-transform-modules-commonjs`, `babel-preset-env` + * [#10585](https://github.com/babel/babel/pull/10585) fix(babel‑helpers/interopRequireWildcard): Avoid double nullish check. ([@ExE-Boss](https://github.com/ExE-Boss)) +* `babel-register` + * [#10557](https://github.com/babel/babel/pull/10557) fix: disable caching when babel could not read/write cache. ([@JLHwung](https://github.com/JLHwung)) + +#### :house: Internal +* `babel-cli`, `babel-node` + * [#10619](https://github.com/babel/babel/pull/10619) chore: remove output-file-sync dependency. ([@JLHwung](https://github.com/JLHwung)) +* `babel-register` + * [#10614](https://github.com/babel/babel/pull/10614) chore: bump source-map-support to 0.5.14. ([@JLHwung](https://github.com/JLHwung)) +* `babel-helper-create-regexp-features-plugin`, `babel-plugin-proposal-unicode-property-regex`, `babel-plugin-transform-dotall-regex`, `babel-plugin-transform-named-capturing-groups-regex`, `babel-plugin-transform-unicode-regex`, `babel-preset-env` + * [#10447](https://github.com/babel/babel/pull/10447) Merge multiple regex transform plugin. ([@JLHwung](https://github.com/JLHwung)) +* `babel-preset-env` + * [#10612](https://github.com/babel/babel/pull/10612) chore: update web.immediate support fixtures. ([@JLHwung](https://github.com/JLHwung)) +* `babel-helper-module-imports` + * [#10608](https://github.com/babel/babel/pull/10608) Use .find instead of .filter to get targetPath in ImportInjector. ([@Andarist](https://github.com/Andarist)) +* Other + * [#10600](https://github.com/babel/babel/pull/10600) Test node@13 on circle. ([@existentialism](https://github.com/existentialism)) + * [#10593](https://github.com/babel/babel/pull/10593) chore: replace outdated travis-ci.org badges [ci skip]. ([@JLHwung](https://github.com/JLHwung)) + * [#10591](https://github.com/babel/babel/pull/10591) chore: test against Node.js 13. ([@JLHwung](https://github.com/JLHwung)) + * [#10556](https://github.com/babel/babel/pull/10556) Add master branch workflow for test262 tests. ([@jbhoosreddy](https://github.com/jbhoosreddy)) + * [#10553](https://github.com/babel/babel/pull/10553) chore: introduce envinfo into environment section. ([@JLHwung](https://github.com/JLHwung)) +* `babel-runtime` + * [#10418](https://github.com/babel/babel/pull/10418) docs: add homepage link. ([@DanArthurGallagher](https://github.com/DanArthurGallagher)) +* `babel-helper-annotate-as-pure`, `babel-helper-bindify-decorators`, `babel-helper-builder-binary-assignment-operator-visitor`, `babel-helper-builder-react-jsx`, `babel-helper-call-delegate`, `babel-helper-define-map`, `babel-helper-explode-assignable-expression`, `babel-helper-explode-class`, `babel-helper-function-name`, `babel-helper-get-function-arity`, `babel-helper-hoist-variables`, `babel-helper-member-expression-to-functions`, `babel-helper-module-imports`, `babel-helper-module-transforms`, `babel-helper-optimise-call-expression`, `babel-helper-remap-async-to-generator`, `babel-helper-replace-supers`, `babel-helper-simple-access`, `babel-helper-split-export-declaration`, `babel-helper-wrap-function`, `babel-helpers`, `babel-template` + * [#10568](https://github.com/babel/babel/pull/10568) Bump babel-types to ^7.6.3. ([@JLHwung](https://github.com/JLHwung)) + +#### :running_woman: Performance +* `babel-traverse` + * [#10480](https://github.com/babel/babel/pull/10480) Traverse performance. ([@JLHwung](https://github.com/JLHwung)) + ## v7.6.4 (2019-10-10) #### :eyeglasses: Spec Compliance From f8eb290da121c65566f1ce1db90de0b1a9b8e186 Mon Sep 17 00:00:00 2001 From: Archer <836524655@qq.com> Date: Tue, 5 Nov 2019 21:39:14 +0800 Subject: [PATCH 046/648] =?UTF-8?q?Fix(babel-preset-env):=20check=20api.ca?= =?UTF-8?q?ller=20is=20a=20function=20to=20avoid=E2=80=A6=20(#10649)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/babel-preset-env/src/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/babel-preset-env/src/index.js b/packages/babel-preset-env/src/index.js index 1c0b08f853df..17740c4c3586 100644 --- a/packages/babel-preset-env/src/index.js +++ b/packages/babel-preset-env/src/index.js @@ -237,7 +237,7 @@ export default declare((api, opts) => { modules !== "auto" || !api.caller || !api.caller(supportsStaticESM), shouldTransformDynamicImport: modules !== "auto" || !api.caller || !api.caller(supportsDynamicImport), - shouldParseTopLevelAwait: api.caller(supportsTopLevelAwait), + shouldParseTopLevelAwait: !api.caller || api.caller(supportsTopLevelAwait), }); const pluginNames = filterItems( From bf48fca6a07301b536b9cf94edd935dd1072c979 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?= Date: Tue, 5 Nov 2019 14:43:23 +0100 Subject: [PATCH 047/648] =?UTF-8?q?Revert=20"throw=20a=20TypeError=20if=20?= =?UTF-8?q?identifier=20validation=20fails=20(#106=E2=80=A6=20(#10650)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit c7d8b8a37752f42163128cf4d5e8b54c2637cec4. --- packages/babel-types/src/definitions/core.js | 6 +++--- packages/babel-types/src/index.js | 1 - packages/babel-types/src/validators/isIdentifierName.js | 9 --------- 3 files changed, 3 insertions(+), 13 deletions(-) delete mode 100644 packages/babel-types/src/validators/isIdentifierName.js diff --git a/packages/babel-types/src/definitions/core.js b/packages/babel-types/src/definitions/core.js index 2b7802096cd9..09c41c9119a9 100644 --- a/packages/babel-types/src/definitions/core.js +++ b/packages/babel-types/src/definitions/core.js @@ -1,5 +1,5 @@ // @flow -import isIdentifierName from "../validators/isIdentifierName"; +import isValidIdentifier from "../validators/isValidIdentifier"; import { BINARY_OPERATORS, @@ -406,8 +406,8 @@ defineType("Identifier", { ...patternLikeCommon, name: { validate: chain(function(node, key, val) { - if (!isIdentifierName(val)) { - throw new TypeError(`"${val}" is not a valid identifer name`); + if (!isValidIdentifier(val)) { + // throw new TypeError(`"${val}" is not a valid identifer name`); } }, assertValueType("string")), }, diff --git a/packages/babel-types/src/index.js b/packages/babel-types/src/index.js index a34588c85c06..d3311dfc9f2f 100644 --- a/packages/babel-types/src/index.js +++ b/packages/babel-types/src/index.js @@ -109,7 +109,6 @@ export { default as isValidES3Identifier, } from "./validators/isValidES3Identifier"; export { default as isValidIdentifier } from "./validators/isValidIdentifier"; -export { default as isIdentifierName } from "./validators/isIdentifierName"; export { default as isVar } from "./validators/isVar"; export { default as matchesPattern } from "./validators/matchesPattern"; export { default as validate } from "./validators/validate"; diff --git a/packages/babel-types/src/validators/isIdentifierName.js b/packages/babel-types/src/validators/isIdentifierName.js deleted file mode 100644 index 9cae809217cf..000000000000 --- a/packages/babel-types/src/validators/isIdentifierName.js +++ /dev/null @@ -1,9 +0,0 @@ -// @flow -import esutils from "esutils"; - -/** - * Check if the input `name` is a valid identifier name. - */ -export default function isIdentifierName(name: string): boolean { - return esutils.keyword.isIdentifierNameES6(name); -} From 42c8e0fb2f44734f175941859952b3c909e20304 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?= Date: Tue, 5 Nov 2019 14:44:00 +0100 Subject: [PATCH 048/648] v7.7.1 --- lerna.json | 2 +- packages/babel-preset-env-standalone/package.json | 6 +++--- packages/babel-preset-env/package.json | 4 ++-- packages/babel-runtime-corejs2/package.json | 2 +- packages/babel-runtime-corejs3/package.json | 2 +- packages/babel-runtime/package.json | 2 +- packages/babel-standalone/package.json | 2 +- packages/babel-types/package.json | 2 +- 8 files changed, 11 insertions(+), 11 deletions(-) diff --git a/lerna.json b/lerna.json index 33ce123064ca..7abfa608d2a3 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "7.7.0", + "version": "7.7.1", "changelog": { "repo": "babel/babel", "cacheDir": ".changelog", diff --git a/packages/babel-preset-env-standalone/package.json b/packages/babel-preset-env-standalone/package.json index 42e20fb08b71..feb9d499c0ae 100644 --- a/packages/babel-preset-env-standalone/package.json +++ b/packages/babel-preset-env-standalone/package.json @@ -1,6 +1,6 @@ { "name": "@babel/preset-env-standalone", - "version": "7.7.0", + "version": "7.7.1", "description": "Standalone build of babel-prest-env for use in non-Node.js environments.", "main": "babel-preset-env.js", "files": [ @@ -16,8 +16,8 @@ "@babel/plugin-proposal-json-strings": "^7.0.0", "@babel/plugin-transform-named-capturing-groups-regex": "^7.7.0", "@babel/plugin-transform-new-target": "^7.4.4", - "@babel/preset-env": "^7.7.0", - "@babel/standalone": "^7.7.0" + "@babel/preset-env": "^7.7.1", + "@babel/standalone": "^7.7.1" }, "keywords": [ "babel", diff --git a/packages/babel-preset-env/package.json b/packages/babel-preset-env/package.json index a8182900bf5c..7648965e88be 100644 --- a/packages/babel-preset-env/package.json +++ b/packages/babel-preset-env/package.json @@ -1,6 +1,6 @@ { "name": "@babel/preset-env", - "version": "7.7.0", + "version": "7.7.1", "description": "A Babel preset for each environment.", "author": "Henry Zhu ", "homepage": "https://babeljs.io/", @@ -59,7 +59,7 @@ "@babel/plugin-transform-template-literals": "^7.4.4", "@babel/plugin-transform-typeof-symbol": "^7.2.0", "@babel/plugin-transform-unicode-regex": "^7.7.0", - "@babel/types": "^7.7.0", + "@babel/types": "^7.7.1", "browserslist": "^4.6.0", "core-js-compat": "^3.1.1", "invariant": "^2.2.2", diff --git a/packages/babel-runtime-corejs2/package.json b/packages/babel-runtime-corejs2/package.json index b8d0bc49be4c..501e5f0ea62c 100644 --- a/packages/babel-runtime-corejs2/package.json +++ b/packages/babel-runtime-corejs2/package.json @@ -1,6 +1,6 @@ { "name": "@babel/runtime-corejs2", - "version": "7.7.0", + "version": "7.7.1", "description": "babel's modular runtime helpers with core-js@2 polyfilling", "license": "MIT", "publishConfig": { diff --git a/packages/babel-runtime-corejs3/package.json b/packages/babel-runtime-corejs3/package.json index 0948273e927f..ea5650549784 100644 --- a/packages/babel-runtime-corejs3/package.json +++ b/packages/babel-runtime-corejs3/package.json @@ -1,6 +1,6 @@ { "name": "@babel/runtime-corejs3", - "version": "7.7.0", + "version": "7.7.1", "description": "babel's modular runtime helpers with core-js@3 polyfilling", "license": "MIT", "publishConfig": { diff --git a/packages/babel-runtime/package.json b/packages/babel-runtime/package.json index df8449b3858c..6e7e3faf9e98 100644 --- a/packages/babel-runtime/package.json +++ b/packages/babel-runtime/package.json @@ -1,6 +1,6 @@ { "name": "@babel/runtime", - "version": "7.7.0", + "version": "7.7.1", "description": "babel's modular runtime helpers", "license": "MIT", "publishConfig": { diff --git a/packages/babel-standalone/package.json b/packages/babel-standalone/package.json index 4aaa2d7aa0f5..30290bb81ad7 100644 --- a/packages/babel-standalone/package.json +++ b/packages/babel-standalone/package.json @@ -1,6 +1,6 @@ { "name": "@babel/standalone", - "version": "7.7.0", + "version": "7.7.1", "description": "Standalone build of Babel for use in non-Node.js environments.", "main": "babel.js", "files": [ diff --git a/packages/babel-types/package.json b/packages/babel-types/package.json index 07cff7f4ac60..fbf76658006d 100644 --- a/packages/babel-types/package.json +++ b/packages/babel-types/package.json @@ -1,6 +1,6 @@ { "name": "@babel/types", - "version": "7.7.0", + "version": "7.7.1", "description": "Babel Types is a Lodash-esque utility library for AST nodes", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", From d3db02da308d088d030d73995f202465418f5295 Mon Sep 17 00:00:00 2001 From: Babel Bot Date: Tue, 5 Nov 2019 13:50:36 +0000 Subject: [PATCH 049/648] Add v7.7.1 to CHANGELOG.md [skip ci] --- CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f0aeed650d2e..d5da577f4fd1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,13 @@ See [Babylon's CHANGELOG](packages/babylon/CHANGELOG.md) for the Babylon pre-7.0 +## v7.7.1 (2019-11-05) + +#### :bug: Bug Fix +* `babel-types` + * [#10650](https://github.com/babel/babel/pull/10650) Revert "throw a TypeError if identifier validation fails (#10621)" ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) +* `babel-preset-env` + * [#10649](https://github.com/babel/babel/pull/10649) Fix(babel-preset-env): check api.caller is a function to avoid to thr… ([@love2me](https://github.com/love2me)) ## v7.7.0 (2019-11-05) From f544753bb8c9c7a470d98e897b089fd31b83d1f6 Mon Sep 17 00:00:00 2001 From: njlr Date: Tue, 5 Nov 2019 14:40:57 +0000 Subject: [PATCH 050/648] code style: consistent spacing (#10643) [ci-skip] Makes spacing consistent --- packages/babel-preset-typescript/src/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/babel-preset-typescript/src/index.js b/packages/babel-preset-typescript/src/index.js index f7dc5eefae00..f3159543f66d 100644 --- a/packages/babel-preset-typescript/src/index.js +++ b/packages/babel-preset-typescript/src/index.js @@ -17,6 +17,7 @@ export default declare( if (typeof allExtensions !== "boolean") { throw new Error(".allExtensions must be a boolean, or undefined"); } + if (typeof isTSX !== "boolean") { throw new Error(".isTSX must be a boolean, or undefined"); } From 0f949990c33cc3c2b3dc24632f7639be166756b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hu=C3=A1ng=20J=C3=B9nli=C3=A0ng?= Date: Tue, 5 Nov 2019 12:28:16 -0500 Subject: [PATCH 051/648] fix: add inList setter for compatibility with babel-minify (#10656) --- packages/babel-traverse/src/path/index.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/babel-traverse/src/path/index.js b/packages/babel-traverse/src/path/index.js index e73cbde9d1ee..79ef05092857 100644 --- a/packages/babel-traverse/src/path/index.js +++ b/packages/babel-traverse/src/path/index.js @@ -161,6 +161,13 @@ export default class NodePath { return !!this.listKey; } + set inList(inList) { + if (!inList) { + this.listKey = null; + } + // ignore inList = true as it should depend on `listKey` + } + get parentKey() { return this.listKey || this.key; } From 2640e5a27cfeea21c8eff5539306fd577dcfec67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hu=C3=A1ng=20J=C3=B9nli=C3=A0ng?= Date: Tue, 5 Nov 2019 14:52:57 -0500 Subject: [PATCH 052/648] fix: remove accessibility of constructor (#10658) --- packages/babel-plugin-transform-typescript/src/index.js | 1 + .../test/fixtures/class/methods/input.ts | 1 + .../test/fixtures/class/methods/output.js | 2 ++ 3 files changed, 4 insertions(+) diff --git a/packages/babel-plugin-transform-typescript/src/index.js b/packages/babel-plugin-transform-typescript/src/index.js index ed7d927fe595..97b23b454503 100644 --- a/packages/babel-plugin-transform-typescript/src/index.js +++ b/packages/babel-plugin-transform-typescript/src/index.js @@ -93,6 +93,7 @@ export default declare( // Rest handled by Function visitor }, constructor(path, classPath) { + if (path.node.accessibility) path.node.accessibility = null; // Collects parameter properties so that we can add an assignment // for each of them in the constructor body // diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/class/methods/input.ts b/packages/babel-plugin-transform-typescript/test/fixtures/class/methods/input.ts index 35f255f2b23e..58026a1bdaa7 100644 --- a/packages/babel-plugin-transform-typescript/test/fixtures/class/methods/input.ts +++ b/packages/babel-plugin-transform-typescript/test/fixtures/class/methods/input.ts @@ -1,4 +1,5 @@ class C { m(): void; public m(x?: number, ...y: number[]): void {} + public constructor() {} } diff --git a/packages/babel-plugin-transform-typescript/test/fixtures/class/methods/output.js b/packages/babel-plugin-transform-typescript/test/fixtures/class/methods/output.js index cb6e585efbb4..b5436ecfaec6 100644 --- a/packages/babel-plugin-transform-typescript/test/fixtures/class/methods/output.js +++ b/packages/babel-plugin-transform-typescript/test/fixtures/class/methods/output.js @@ -1,4 +1,6 @@ class C { m(x, ...y) {} + constructor() {} + } From 2cd5ad0c8026ecaf55335eb152fb13ab650fd78f Mon Sep 17 00:00:00 2001 From: Leonid Shevtsov Date: Wed, 6 Nov 2019 10:13:08 +0200 Subject: [PATCH 053/648] fix typo: identifer -> identifier (#10647) --- packages/babel-generator/test/index.js | 2 +- packages/babel-parser/src/parser/expression.js | 2 +- packages/babel-types/src/definitions/core.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/babel-generator/test/index.js b/packages/babel-generator/test/index.js index 826610d2b85d..e247686e2488 100644 --- a/packages/babel-generator/test/index.js +++ b/packages/babel-generator/test/index.js @@ -197,7 +197,7 @@ describe("generation", function() { const id2 = fn.body.body[0].expression; id2.name += "2"; - id2.loc.identiferName = "bar"; + id2.loc.identifierName = "bar"; const generated = generate( ast, diff --git a/packages/babel-parser/src/parser/expression.js b/packages/babel-parser/src/parser/expression.js index 291351594925..89088db4d98b 100644 --- a/packages/babel-parser/src/parser/expression.js +++ b/packages/babel-parser/src/parser/expression.js @@ -384,7 +384,7 @@ export default class ExpressionParser extends LValParser { * so for ?? operator we need to check in this case the right expression to have parenthesis * second case a && b ?? c * here a && b => This is considered as a logical expression in the ast tree - * c => identifer + * c => identifier * so now here for ?? operator we need to check the left expression to have parenthesis * if the parenthesis is missing we raise an error and throw it */ diff --git a/packages/babel-types/src/definitions/core.js b/packages/babel-types/src/definitions/core.js index 09c41c9119a9..973c3bfa67c8 100644 --- a/packages/babel-types/src/definitions/core.js +++ b/packages/babel-types/src/definitions/core.js @@ -407,7 +407,7 @@ defineType("Identifier", { name: { validate: chain(function(node, key, val) { if (!isValidIdentifier(val)) { - // throw new TypeError(`"${val}" is not a valid identifer name`); + // throw new TypeError(`"${val}" is not a valid identifier name`); } }, assertValueType("string")), }, From 3ab035bab6ec027e8f6407165541235c6a7615e7 Mon Sep 17 00:00:00 2001 From: Maksim Ryzhikov Date: Wed, 6 Nov 2019 15:34:09 +0300 Subject: [PATCH 054/648] fix: Use the recommended property to specify repository URL (#10665) [ci-skip] Use recommended by npm property to specify repository URL https://docs.npmjs.com/files/package.json#repository Otherwise, it breaks some tools which relay on this convention for example "nlf" package https://github.com/iandotkelly/nlf/blob/master/lib/nlf.js#L284-L285 --- .../babel-helper-create-regexp-features-plugin/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/babel-helper-create-regexp-features-plugin/package.json b/packages/babel-helper-create-regexp-features-plugin/package.json index 71abede86fb5..7e93bf17a147 100644 --- a/packages/babel-helper-create-regexp-features-plugin/package.json +++ b/packages/babel-helper-create-regexp-features-plugin/package.json @@ -6,7 +6,7 @@ "description": "Compile ESNext Regular Expressions to ES5", "repository": { "type": "git", - "repository": "https://github.com/babel/babel", + "url": "https://github.com/babel/babel", "directory": "packages/babel-helper-create-regexp-features-plugin" }, "main": "lib/index.js", From bdb4318f47ec42ca4e325b5163e2e8ad57de4849 Mon Sep 17 00:00:00 2001 From: Vojtech Miksu Date: Wed, 6 Nov 2019 12:30:32 -0800 Subject: [PATCH 055/648] chore: update convert-source-map dep (#10667) --- packages/babel-core/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/babel-core/package.json b/packages/babel-core/package.json index d07ab536efce..1100ef39c93d 100644 --- a/packages/babel-core/package.json +++ b/packages/babel-core/package.json @@ -40,7 +40,7 @@ "@babel/template": "^7.7.0", "@babel/traverse": "^7.7.0", "@babel/types": "^7.7.0", - "convert-source-map": "^1.1.0", + "convert-source-map": "^1.7.0", "debug": "^4.1.0", "json5": "^2.1.0", "lodash": "^4.17.13", From 9082e68d6f70472ee39f881574c3f01ed97d0958 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?= Date: Thu, 7 Nov 2019 02:18:36 +0300 Subject: [PATCH 056/648] Parse arrows with params annotations in conditional expressions (#10669) --- packages/babel-parser/src/plugins/flow.js | 1 + .../input.js | 2 + .../output.json | 220 +++++++++++++++ .../input.js | 3 + .../output.json | 250 ++++++++++++++++++ 5 files changed, 476 insertions(+) create mode 100644 packages/babel-parser/test/fixtures/flow/regression/arrow-in-ternary-with-param-type-and-return-type-like/input.js create mode 100644 packages/babel-parser/test/fixtures/flow/regression/arrow-in-ternary-with-param-type-and-return-type-like/output.json create mode 100644 packages/babel-parser/test/fixtures/flow/regression/arrow-in-ternary-with-param-type-and-return-type/input.js create mode 100644 packages/babel-parser/test/fixtures/flow/regression/arrow-in-ternary-with-param-type-and-return-type/output.json diff --git a/packages/babel-parser/src/plugins/flow.js b/packages/babel-parser/src/plugins/flow.js index 5e7187455da2..ab5f646b6efb 100644 --- a/packages/babel-parser/src/plugins/flow.js +++ b/packages/babel-parser/src/plugins/flow.js @@ -2061,6 +2061,7 @@ export default (superClass: Class): Class => return node.operator === "="; case "ParenthesizedExpression": + case "TypeCastExpression": return this.isAssignable(node.expression); case "MemberExpression": diff --git a/packages/babel-parser/test/fixtures/flow/regression/arrow-in-ternary-with-param-type-and-return-type-like/input.js b/packages/babel-parser/test/fixtures/flow/regression/arrow-in-ternary-with-param-type-and-return-type-like/input.js new file mode 100644 index 000000000000..1f0c3e33482c --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/regression/arrow-in-ternary-with-param-type-and-return-type-like/input.js @@ -0,0 +1,2 @@ +test + ? (x: T): U => y diff --git a/packages/babel-parser/test/fixtures/flow/regression/arrow-in-ternary-with-param-type-and-return-type-like/output.json b/packages/babel-parser/test/fixtures/flow/regression/arrow-in-ternary-with-param-type-and-return-type-like/output.json new file mode 100644 index 000000000000..3c80e21673a6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/regression/arrow-in-ternary-with-param-type-and-return-type-like/output.json @@ -0,0 +1,220 @@ +{ + "type": "File", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "expression": { + "type": "ConditionalExpression", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "test": { + "type": "Identifier", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + }, + "identifierName": "test" + }, + "name": "test" + }, + "consequent": { + "type": "TypeCastExpression", + "start": 10, + "end": 14, + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 9 + } + }, + "expression": { + "type": "Identifier", + "start": 10, + "end": 11, + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 6 + }, + "identifierName": "x" + }, + "name": "x" + }, + "typeAnnotation": { + "type": "TypeAnnotation", + "start": 11, + "end": 14, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 9 + } + }, + "typeAnnotation": { + "type": "GenericTypeAnnotation", + "start": 13, + "end": 14, + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 9 + } + }, + "typeParameters": null, + "id": { + "type": "Identifier", + "start": 13, + "end": 14, + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 9 + }, + "identifierName": "T" + }, + "name": "T" + } + } + }, + "extra": { + "parenthesized": true, + "parenStart": 9 + } + }, + "alternate": { + "type": "ArrowFunctionExpression", + "start": 17, + "end": 23, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 17, + "end": 18, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 13 + }, + "identifierName": "U" + }, + "name": "U" + } + ], + "body": { + "type": "Identifier", + "start": 22, + "end": 23, + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 18 + }, + "identifierName": "y" + }, + "name": "y" + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/regression/arrow-in-ternary-with-param-type-and-return-type/input.js b/packages/babel-parser/test/fixtures/flow/regression/arrow-in-ternary-with-param-type-and-return-type/input.js new file mode 100644 index 000000000000..a36f5ca0c5d8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/regression/arrow-in-ternary-with-param-type-and-return-type/input.js @@ -0,0 +1,3 @@ +test + ? (x: T): U => y + : z \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/regression/arrow-in-ternary-with-param-type-and-return-type/output.json b/packages/babel-parser/test/fixtures/flow/regression/arrow-in-ternary-with-param-type-and-return-type/output.json new file mode 100644 index 000000000000..6be59ef645aa --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/regression/arrow-in-ternary-with-param-type-and-return-type/output.json @@ -0,0 +1,250 @@ +{ + "type": "File", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 5 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 5 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 5 + } + }, + "expression": { + "type": "ConditionalExpression", + "start": 0, + "end": 29, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 5 + } + }, + "test": { + "type": "Identifier", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + }, + "identifierName": "test" + }, + "name": "test" + }, + "consequent": { + "type": "ArrowFunctionExpression", + "start": 9, + "end": 23, + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "predicate": null, + "returnType": { + "type": "TypeAnnotation", + "start": 15, + "end": 18, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 13 + } + }, + "typeAnnotation": { + "type": "GenericTypeAnnotation", + "start": 17, + "end": 18, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 13 + } + }, + "typeParameters": null, + "id": { + "type": "Identifier", + "start": 17, + "end": 18, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 13 + }, + "identifierName": "U" + }, + "name": "U" + } + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 10, + "end": 14, + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 9 + }, + "identifierName": "x" + }, + "name": "x", + "typeAnnotation": { + "type": "TypeAnnotation", + "start": 11, + "end": 14, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 9 + } + }, + "typeAnnotation": { + "type": "GenericTypeAnnotation", + "start": 13, + "end": 14, + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 9 + } + }, + "typeParameters": null, + "id": { + "type": "Identifier", + "start": 13, + "end": 14, + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 9 + }, + "identifierName": "T" + }, + "name": "T" + } + } + } + } + ], + "body": { + "type": "Identifier", + "start": 22, + "end": 23, + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 18 + }, + "identifierName": "y" + }, + "name": "y" + } + }, + "alternate": { + "type": "Identifier", + "start": 28, + "end": 29, + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 5 + }, + "identifierName": "z" + }, + "name": "z" + } + } + } + ], + "directives": [] + } +} \ No newline at end of file From 35f4d1276310bac6fede4a6f86a5c76f951e179e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?= Date: Thu, 7 Nov 2019 02:20:52 +0300 Subject: [PATCH 057/648] v7.7.2 --- lerna.json | 2 +- packages/babel-core/package.json | 10 +++++----- packages/babel-generator/package.json | 6 +++--- .../package.json | 4 ++-- packages/babel-parser/package.json | 2 +- .../babel-plugin-transform-typescript/package.json | 4 ++-- packages/babel-preset-env-standalone/package.json | 4 ++-- packages/babel-preset-typescript/package.json | 6 +++--- packages/babel-runtime-corejs2/package.json | 2 +- packages/babel-runtime-corejs3/package.json | 2 +- packages/babel-runtime/package.json | 2 +- packages/babel-standalone/package.json | 8 ++++---- packages/babel-traverse/package.json | 8 ++++---- packages/babel-types/package.json | 6 +++--- 14 files changed, 33 insertions(+), 33 deletions(-) diff --git a/lerna.json b/lerna.json index 7abfa608d2a3..d348baa77c41 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "7.7.1", + "version": "7.7.2", "changelog": { "repo": "babel/babel", "cacheDir": ".changelog", diff --git a/packages/babel-core/package.json b/packages/babel-core/package.json index 1100ef39c93d..7b64334e7030 100644 --- a/packages/babel-core/package.json +++ b/packages/babel-core/package.json @@ -1,6 +1,6 @@ { "name": "@babel/core", - "version": "7.7.0", + "version": "7.7.2", "description": "Babel compiler core.", "main": "lib/index.js", "author": "Sebastian McKenzie ", @@ -34,12 +34,12 @@ }, "dependencies": { "@babel/code-frame": "^7.5.5", - "@babel/generator": "^7.7.0", + "@babel/generator": "^7.7.2", "@babel/helpers": "^7.7.0", - "@babel/parser": "^7.7.0", + "@babel/parser": "^7.7.2", "@babel/template": "^7.7.0", - "@babel/traverse": "^7.7.0", - "@babel/types": "^7.7.0", + "@babel/traverse": "^7.7.2", + "@babel/types": "^7.7.2", "convert-source-map": "^1.7.0", "debug": "^4.1.0", "json5": "^2.1.0", diff --git a/packages/babel-generator/package.json b/packages/babel-generator/package.json index a51ad5d38e7c..9d4a96b51756 100644 --- a/packages/babel-generator/package.json +++ b/packages/babel-generator/package.json @@ -1,6 +1,6 @@ { "name": "@babel/generator", - "version": "7.7.0", + "version": "7.7.2", "description": "Turns an AST into code.", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", @@ -14,13 +14,13 @@ "lib" ], "dependencies": { - "@babel/types": "^7.7.0", + "@babel/types": "^7.7.2", "jsesc": "^2.5.1", "lodash": "^4.17.13", "source-map": "^0.5.0" }, "devDependencies": { "@babel/helper-fixtures": "^7.6.3", - "@babel/parser": "^7.7.0" + "@babel/parser": "^7.7.2" } } diff --git a/packages/babel-helper-create-regexp-features-plugin/package.json b/packages/babel-helper-create-regexp-features-plugin/package.json index 7e93bf17a147..c0e278155fce 100644 --- a/packages/babel-helper-create-regexp-features-plugin/package.json +++ b/packages/babel-helper-create-regexp-features-plugin/package.json @@ -1,6 +1,6 @@ { "name": "@babel/helper-create-regexp-features-plugin", - "version": "7.7.0", + "version": "7.7.2", "author": "The Babel Team (https://babeljs.io/team)", "license": "MIT", "description": "Compile ESNext Regular Expressions to ES5", @@ -25,7 +25,7 @@ "@babel/core": "^7.0.0" }, "devDependencies": { - "@babel/core": "^7.7.0", + "@babel/core": "^7.7.2", "@babel/helper-plugin-test-runner": "^7.0.0" } } diff --git a/packages/babel-parser/package.json b/packages/babel-parser/package.json index 0226cc56e6bd..b9b393d95960 100644 --- a/packages/babel-parser/package.json +++ b/packages/babel-parser/package.json @@ -1,6 +1,6 @@ { "name": "@babel/parser", - "version": "7.7.0", + "version": "7.7.2", "description": "A JavaScript parser", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", diff --git a/packages/babel-plugin-transform-typescript/package.json b/packages/babel-plugin-transform-typescript/package.json index 2c96f987306f..abe6f25e2b07 100644 --- a/packages/babel-plugin-transform-typescript/package.json +++ b/packages/babel-plugin-transform-typescript/package.json @@ -1,6 +1,6 @@ { "name": "@babel/plugin-transform-typescript", - "version": "7.7.0", + "version": "7.7.2", "description": "Transform TypeScript into ES.next", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-typescript", "license": "MIT", @@ -21,7 +21,7 @@ "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.7.0", + "@babel/core": "^7.7.2", "@babel/helper-plugin-test-runner": "^7.0.0" } } diff --git a/packages/babel-preset-env-standalone/package.json b/packages/babel-preset-env-standalone/package.json index feb9d499c0ae..63afb4df4bdf 100644 --- a/packages/babel-preset-env-standalone/package.json +++ b/packages/babel-preset-env-standalone/package.json @@ -1,6 +1,6 @@ { "name": "@babel/preset-env-standalone", - "version": "7.7.1", + "version": "7.7.2", "description": "Standalone build of babel-prest-env for use in non-Node.js environments.", "main": "babel-preset-env.js", "files": [ @@ -17,7 +17,7 @@ "@babel/plugin-transform-named-capturing-groups-regex": "^7.7.0", "@babel/plugin-transform-new-target": "^7.4.4", "@babel/preset-env": "^7.7.1", - "@babel/standalone": "^7.7.1" + "@babel/standalone": "^7.7.2" }, "keywords": [ "babel", diff --git a/packages/babel-preset-typescript/package.json b/packages/babel-preset-typescript/package.json index ce3bb85142c5..fa98c56cd283 100644 --- a/packages/babel-preset-typescript/package.json +++ b/packages/babel-preset-typescript/package.json @@ -1,6 +1,6 @@ { "name": "@babel/preset-typescript", - "version": "7.7.0", + "version": "7.7.2", "description": "Babel preset for TypeScript.", "repository": "https://github.com/babel/babel/tree/master/packages/babel-preset-typescript", "license": "MIT", @@ -14,13 +14,13 @@ ], "dependencies": { "@babel/helper-plugin-utils": "^7.0.0", - "@babel/plugin-transform-typescript": "^7.7.0" + "@babel/plugin-transform-typescript": "^7.7.2" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "devDependencies": { - "@babel/core": "^7.7.0", + "@babel/core": "^7.7.2", "@babel/helper-plugin-test-runner": "^7.0.0" } } diff --git a/packages/babel-runtime-corejs2/package.json b/packages/babel-runtime-corejs2/package.json index 501e5f0ea62c..d5bc51194622 100644 --- a/packages/babel-runtime-corejs2/package.json +++ b/packages/babel-runtime-corejs2/package.json @@ -1,6 +1,6 @@ { "name": "@babel/runtime-corejs2", - "version": "7.7.1", + "version": "7.7.2", "description": "babel's modular runtime helpers with core-js@2 polyfilling", "license": "MIT", "publishConfig": { diff --git a/packages/babel-runtime-corejs3/package.json b/packages/babel-runtime-corejs3/package.json index ea5650549784..1aff3a832aa7 100644 --- a/packages/babel-runtime-corejs3/package.json +++ b/packages/babel-runtime-corejs3/package.json @@ -1,6 +1,6 @@ { "name": "@babel/runtime-corejs3", - "version": "7.7.1", + "version": "7.7.2", "description": "babel's modular runtime helpers with core-js@3 polyfilling", "license": "MIT", "publishConfig": { diff --git a/packages/babel-runtime/package.json b/packages/babel-runtime/package.json index 6e7e3faf9e98..d0dc352d9599 100644 --- a/packages/babel-runtime/package.json +++ b/packages/babel-runtime/package.json @@ -1,6 +1,6 @@ { "name": "@babel/runtime", - "version": "7.7.1", + "version": "7.7.2", "description": "babel's modular runtime helpers", "license": "MIT", "publishConfig": { diff --git a/packages/babel-standalone/package.json b/packages/babel-standalone/package.json index 30290bb81ad7..a906babfca67 100644 --- a/packages/babel-standalone/package.json +++ b/packages/babel-standalone/package.json @@ -1,6 +1,6 @@ { "name": "@babel/standalone", - "version": "7.7.1", + "version": "7.7.2", "description": "Standalone build of Babel for use in non-Node.js environments.", "main": "babel.js", "files": [ @@ -12,7 +12,7 @@ "prepublishOnly": "cd ../.. && make prepublish-build-standalone" }, "devDependencies": { - "@babel/core": "^7.7.0", + "@babel/core": "^7.7.2", "@babel/helper-plugin-utils": "^7.0.0", "@babel/plugin-external-helpers": "^7.2.0", "@babel/plugin-proposal-async-generator-functions": "^7.7.0", @@ -96,11 +96,11 @@ "@babel/plugin-transform-strict-mode": "^7.2.0", "@babel/plugin-transform-template-literals": "^7.4.4", "@babel/plugin-transform-typeof-symbol": "^7.2.0", - "@babel/plugin-transform-typescript": "^7.7.0", + "@babel/plugin-transform-typescript": "^7.7.2", "@babel/plugin-transform-unicode-regex": "^7.7.0", "@babel/preset-flow": "^7.0.0", "@babel/preset-react": "^7.7.0", - "@babel/preset-typescript": "^7.7.0" + "@babel/preset-typescript": "^7.7.2" }, "keywords": [ "babel", diff --git a/packages/babel-traverse/package.json b/packages/babel-traverse/package.json index 2665f5bc77b7..ee21b6e83e09 100644 --- a/packages/babel-traverse/package.json +++ b/packages/babel-traverse/package.json @@ -1,6 +1,6 @@ { "name": "@babel/traverse", - "version": "7.7.0", + "version": "7.7.2", "description": "The Babel Traverse module maintains the overall tree state, and is responsible for replacing, removing, and adding nodes", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", @@ -12,11 +12,11 @@ "main": "lib/index.js", "dependencies": { "@babel/code-frame": "^7.5.5", - "@babel/generator": "^7.7.0", + "@babel/generator": "^7.7.2", "@babel/helper-function-name": "^7.7.0", "@babel/helper-split-export-declaration": "^7.7.0", - "@babel/parser": "^7.7.0", - "@babel/types": "^7.7.0", + "@babel/parser": "^7.7.2", + "@babel/types": "^7.7.2", "debug": "^4.1.0", "globals": "^11.1.0", "lodash": "^4.17.13" diff --git a/packages/babel-types/package.json b/packages/babel-types/package.json index fbf76658006d..04946bc67d68 100644 --- a/packages/babel-types/package.json +++ b/packages/babel-types/package.json @@ -1,6 +1,6 @@ { "name": "@babel/types", - "version": "7.7.1", + "version": "7.7.2", "description": "Babel Types is a Lodash-esque utility library for AST nodes", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", @@ -17,7 +17,7 @@ "to-fast-properties": "^2.0.0" }, "devDependencies": { - "@babel/generator": "^7.7.0", - "@babel/parser": "^7.7.0" + "@babel/generator": "^7.7.2", + "@babel/parser": "^7.7.2" } } From c2bace4b73ae65771941efcf9c2eb33ad8c3463f Mon Sep 17 00:00:00 2001 From: Babel Bot Date: Wed, 6 Nov 2019 23:28:38 +0000 Subject: [PATCH 058/648] Add v7.7.2 to CHANGELOG.md [skip ci] --- CHANGELOG.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d5da577f4fd1..a3db1b7afbee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,15 @@ See [Babylon's CHANGELOG](packages/babylon/CHANGELOG.md) for the Babylon pre-7.0 +## v7.7.2 (2019-11-07) + +#### :bug: Bug Fix +* `babel-parser` + * [#10669](https://github.com/babel/babel/pull/10669) Parse arrows with params annotations in conditional expressions ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) +* `babel-plugin-transform-typescript` + * [#10658](https://github.com/babel/babel/pull/10658) fix: remove accessibility of constructor ([@JLHwung](https://github.com/JLHwung)) +* `babel-traverse` + * [#10656](https://github.com/babel/babel/pull/10656) fix: add inList setter for compatibility with babel-minify ([@JLHwung](https://github.com/JLHwung)) ## v7.7.1 (2019-11-05) #### :bug: Bug Fix From 0287c0f02f8844adbfd7d84a97a1a8a94c17fa1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?= Date: Fri, 8 Nov 2019 23:23:04 +0300 Subject: [PATCH 059/648] Don't recover from "adjacent jsx elements" parser error (#10682) --- .../babel-parser/src/plugins/jsx/index.js | 10 +- .../jsx/errors/adjacent-tags/options.json | 3 + .../jsx/errors/adjacent-tags/output.json | 189 ------------------ 3 files changed, 5 insertions(+), 197 deletions(-) create mode 100644 packages/babel-parser/test/fixtures/jsx/errors/adjacent-tags/options.json delete mode 100644 packages/babel-parser/test/fixtures/jsx/errors/adjacent-tags/output.json diff --git a/packages/babel-parser/src/plugins/jsx/index.js b/packages/babel-parser/src/plugins/jsx/index.js index 523702f0dd84..2aba709267f2 100644 --- a/packages/babel-parser/src/plugins/jsx/index.js +++ b/packages/babel-parser/src/plugins/jsx/index.js @@ -484,18 +484,12 @@ export default (superClass: Class): Class => node.closingElement = closingElement; } node.children = children; - while (this.isRelational("<")) { - // In case we encounter an lt token here it will always be the start of - // jsx as the lt sign is not allowed in places that expect an expression - this.finishToken(tt.jsxTagStart); - - this.raise( + if (this.isRelational("<")) { + throw this.raise( this.state.start, "Adjacent JSX elements must be wrapped in an enclosing tag. " + "Did you want a JSX fragment <>...?", ); - - this.jsxParseElement(); } return isFragment(openingElement) diff --git a/packages/babel-parser/test/fixtures/jsx/errors/adjacent-tags/options.json b/packages/babel-parser/test/fixtures/jsx/errors/adjacent-tags/options.json new file mode 100644 index 000000000000..9835a882e99c --- /dev/null +++ b/packages/babel-parser/test/fixtures/jsx/errors/adjacent-tags/options.json @@ -0,0 +1,3 @@ +{ + "throws": "Adjacent JSX elements must be wrapped in an enclosing tag. Did you want a JSX fragment <>...? (1:22)" +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/jsx/errors/adjacent-tags/output.json b/packages/babel-parser/test/fixtures/jsx/errors/adjacent-tags/output.json deleted file mode 100644 index b657e0982552..000000000000 --- a/packages/babel-parser/test/fixtures/jsx/errors/adjacent-tags/output.json +++ /dev/null @@ -1,189 +0,0 @@ -{ - "type": "File", - "start": 0, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 37 - } - }, - "errors": [ - "SyntaxError: Adjacent JSX elements must be wrapped in an enclosing tag. Did you want a JSX fragment <>...? (1:22)" - ], - "program": { - "type": "Program", - "start": 0, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 37 - } - }, - "sourceType": "script", - "interpreter": null, - "body": [ - { - "type": "VariableDeclaration", - "start": 0, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 37 - } - }, - "declarations": [ - { - "type": "VariableDeclarator", - "start": 4, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 36 - } - }, - "id": { - "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "x" - }, - "name": "x" - }, - "init": { - "type": "JSXElement", - "start": 8, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 36 - } - }, - "openingElement": { - "type": "JSXOpeningElement", - "start": 8, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "name": { - "type": "JSXIdentifier", - "start": 9, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "name": "div" - }, - "attributes": [], - "selfClosing": false - }, - "closingElement": { - "type": "JSXClosingElement", - "start": 16, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "name": { - "type": "JSXIdentifier", - "start": 18, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "name": "div" - } - }, - "children": [ - { - "type": "JSXText", - "start": 13, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "extra": { - "rawValue": "one", - "raw": "one" - }, - "value": "one" - } - ] - } - } - ], - "kind": "var" - } - ], - "directives": [] - } -} \ No newline at end of file From e315d65a7a8cedbe0476b4a2872890e93a1289ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?= Date: Fri, 8 Nov 2019 23:45:00 +0300 Subject: [PATCH 060/648] v7.7.3 --- lerna.json | 2 +- packages/babel-parser/package.json | 2 +- packages/babel-preset-env-standalone/package.json | 4 ++-- packages/babel-standalone/package.json | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lerna.json b/lerna.json index d348baa77c41..aaabc787806d 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "7.7.2", + "version": "7.7.3", "changelog": { "repo": "babel/babel", "cacheDir": ".changelog", diff --git a/packages/babel-parser/package.json b/packages/babel-parser/package.json index b9b393d95960..ebf2db424378 100644 --- a/packages/babel-parser/package.json +++ b/packages/babel-parser/package.json @@ -1,6 +1,6 @@ { "name": "@babel/parser", - "version": "7.7.2", + "version": "7.7.3", "description": "A JavaScript parser", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", diff --git a/packages/babel-preset-env-standalone/package.json b/packages/babel-preset-env-standalone/package.json index 63afb4df4bdf..c749a6caae8f 100644 --- a/packages/babel-preset-env-standalone/package.json +++ b/packages/babel-preset-env-standalone/package.json @@ -1,6 +1,6 @@ { "name": "@babel/preset-env-standalone", - "version": "7.7.2", + "version": "7.7.3", "description": "Standalone build of babel-prest-env for use in non-Node.js environments.", "main": "babel-preset-env.js", "files": [ @@ -17,7 +17,7 @@ "@babel/plugin-transform-named-capturing-groups-regex": "^7.7.0", "@babel/plugin-transform-new-target": "^7.4.4", "@babel/preset-env": "^7.7.1", - "@babel/standalone": "^7.7.2" + "@babel/standalone": "^7.7.3" }, "keywords": [ "babel", diff --git a/packages/babel-standalone/package.json b/packages/babel-standalone/package.json index a906babfca67..3f7831157508 100644 --- a/packages/babel-standalone/package.json +++ b/packages/babel-standalone/package.json @@ -1,6 +1,6 @@ { "name": "@babel/standalone", - "version": "7.7.2", + "version": "7.7.3", "description": "Standalone build of Babel for use in non-Node.js environments.", "main": "babel.js", "files": [ From 8c2ed89aaa21fe5fd3718114d93100adb25dc7fa Mon Sep 17 00:00:00 2001 From: Babel Bot Date: Fri, 8 Nov 2019 20:52:12 +0000 Subject: [PATCH 061/648] Add v7.7.3 to CHANGELOG.md [skip ci] --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a3db1b7afbee..ef3a4efcb9a6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,11 @@ See [Babylon's CHANGELOG](packages/babylon/CHANGELOG.md) for the Babylon pre-7.0 +## v7.7.3 (2019-11-08) + +#### :bug: Bug Fix +* `babel-parser` + * [#10682](https://github.com/babel/babel/pull/10682) Don't recover from "adjacent jsx elements" parser error ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo)) ## v7.7.2 (2019-11-07) #### :bug: Bug Fix From 70c0ed512a5fb2e8f461c7d14e493a3ce131e686 Mon Sep 17 00:00:00 2001 From: chrishinrichs Date: Fri, 8 Nov 2019 21:31:46 -0600 Subject: [PATCH 062/648] Fix: Don't call Object.keys on non-objects (babel#10482) (#10683) --- packages/babel-helpers/src/helpers.js | 6 +++--- .../test/fixtures/object-spread/assignment/output.js | 2 +- .../test/fixtures/object-spread/expression/output.js | 2 +- .../fixtures/object-spread/variable-declaration/output.js | 2 +- .../test/fixtures/corejs2/entry-shippedProposals/output.js | 2 +- .../test/fixtures/corejs2/usage-shippedProposals/output.js | 2 +- .../test/fixtures/preset-options/shippedProposals/output.js | 2 +- 7 files changed, 9 insertions(+), 9 deletions(-) diff --git a/packages/babel-helpers/src/helpers.js b/packages/babel-helpers/src/helpers.js index fadce7421815..d235cf328569 100644 --- a/packages/babel-helpers/src/helpers.js +++ b/packages/babel-helpers/src/helpers.js @@ -397,7 +397,7 @@ helpers.objectSpread = helper("7.0.0-beta.0")` export default function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = (arguments[i] != null) ? arguments[i] : {}; - var ownKeys = Object.keys(source); + var ownKeys = Object.keys(Object(source)); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; @@ -434,13 +434,13 @@ helpers.objectSpread2 = helper("7.5.0")` for (var i = 1; i < arguments.length; i++) { var source = (arguments[i] != null) ? arguments[i] : {}; if (i % 2) { - ownKeys(source, true).forEach(function (key) { + ownKeys(Object(source), true).forEach(function (key) { defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { - ownKeys(source).forEach(function (key) { + ownKeys(Object(source)).forEach(function (key) { Object.defineProperty( target, key, diff --git a/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-spread/assignment/output.js b/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-spread/assignment/output.js index bca55509f8df..a1f2970a3264 100644 --- a/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-spread/assignment/output.js +++ b/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-spread/assignment/output.js @@ -1,6 +1,6 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } +function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } diff --git a/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-spread/expression/output.js b/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-spread/expression/output.js index ba0e5ad1c8e3..a172df60bd16 100644 --- a/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-spread/expression/output.js +++ b/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-spread/expression/output.js @@ -1,6 +1,6 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } +function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } diff --git a/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-spread/variable-declaration/output.js b/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-spread/variable-declaration/output.js index 1370408b8354..9fabf3047b3d 100644 --- a/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-spread/variable-declaration/output.js +++ b/packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-spread/variable-declaration/output.js @@ -1,6 +1,6 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } +function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } diff --git a/packages/babel-preset-env/test/fixtures/corejs2/entry-shippedProposals/output.js b/packages/babel-preset-env/test/fixtures/corejs2/entry-shippedProposals/output.js index 11efbf4cdb8d..54c32b60fc2c 100644 --- a/packages/babel-preset-env/test/fixtures/corejs2/entry-shippedProposals/output.js +++ b/packages/babel-preset-env/test/fixtures/corejs2/entry-shippedProposals/output.js @@ -298,7 +298,7 @@ require("regenerator-runtime/runtime"); function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } +function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } diff --git a/packages/babel-preset-env/test/fixtures/corejs2/usage-shippedProposals/output.js b/packages/babel-preset-env/test/fixtures/corejs2/usage-shippedProposals/output.js index 02988151dce8..53afb8206c83 100644 --- a/packages/babel-preset-env/test/fixtures/corejs2/usage-shippedProposals/output.js +++ b/packages/babel-preset-env/test/fixtures/corejs2/usage-shippedProposals/output.js @@ -30,7 +30,7 @@ require("core-js/modules/es6.object.to-string"); function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } +function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } diff --git a/packages/babel-preset-env/test/fixtures/preset-options/shippedProposals/output.js b/packages/babel-preset-env/test/fixtures/preset-options/shippedProposals/output.js index 358a6a1f78bb..36fd231345ab 100644 --- a/packages/babel-preset-env/test/fixtures/preset-options/shippedProposals/output.js +++ b/packages/babel-preset-env/test/fixtures/preset-options/shippedProposals/output.js @@ -1,6 +1,6 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } +function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } From 2b082601a7fa00c3e7c505da16fe5dfe009c3860 Mon Sep 17 00:00:00 2001 From: Kenza Houmani Date: Mon, 11 Nov 2019 09:36:17 +0000 Subject: [PATCH 063/648] Fix parentheses on replaceWithMultiple for JSX (#10598) * Closes #9851 Fix parentheses on replaceWithMultiple for JSX * Rename test * Use generate(ast) directly --- packages/babel-traverse/src/path/modification.js | 4 +++- packages/babel-traverse/test/replacement.js | 16 ++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/packages/babel-traverse/src/path/modification.js b/packages/babel-traverse/src/path/modification.js index 6039a94c6090..1f6d2a0b32db 100644 --- a/packages/babel-traverse/src/path/modification.js +++ b/packages/babel-traverse/src/path/modification.js @@ -115,7 +115,9 @@ export function insertAfter(nodes) { }), ); } else if ( - (this.isNodeType("Expression") && !this.isJSXElement()) || + (this.isNodeType("Expression") && + !this.isJSXElement() && + !parentPath.isJSXElement()) || (parentPath.isForStatement() && this.key === "init") ) { if (this.node) { diff --git a/packages/babel-traverse/test/replacement.js b/packages/babel-traverse/test/replacement.js index 3454937fe506..6d54972611f2 100644 --- a/packages/babel-traverse/test/replacement.js +++ b/packages/babel-traverse/test/replacement.js @@ -1,5 +1,6 @@ import traverse from "../lib"; import { parse } from "@babel/parser"; +import generate from "@babel/generator"; import * as t from "@babel/types"; describe("path/replacement", function() { @@ -97,4 +98,19 @@ describe("path/replacement", function() { ); }); }); + describe("replaceWithMultiple", () => { + it("does not add extra parentheses for a JSXElement with a JSXElement parent", () => { + const ast = parse(`

`, { + plugins: ["jsx"], + }); + traverse(ast, { + JSXElement: path => { + if (path.node.openingElement.name.name === "span") { + path.replaceWithMultiple(path.node.children.filter(t.isJSXElement)); + } + }, + }); + expect(generate(ast).code).toBe("

;"); + }); + }); }); From 8e5f2dc929cb860b9090e6cb71df148fbe2b791b Mon Sep 17 00:00:00 2001 From: Mohammad Ahmadi Date: Mon, 11 Nov 2019 13:09:36 +0330 Subject: [PATCH 064/648] corrected the grammar of an option description (#10691) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * grammar correction of an option description (missed in #10589) * changed description to be consistent with others Co-Authored-By: Huáng Jùnliàng * ran prettier --- packages/babel-cli/src/babel/options.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/babel-cli/src/babel/options.js b/packages/babel-cli/src/babel/options.js index 04a648c1fd5a..169c61ffa51a 100644 --- a/packages/babel-cli/src/babel/options.js +++ b/packages/babel-cli/src/babel/options.js @@ -73,7 +73,10 @@ commander.option( "Do not include superfluous whitespace characters and line terminators.", booleanify, ); -commander.option("--minified", "save as much bytes when printing [true|false]"); +commander.option( + "--minified [true|false]", + "Save as many bytes when printing.", +); commander.option( "--auxiliary-comment-before [string]", "Print a comment before any injected non-user code.", From b2767c7d8ad4b74e244b6162660b48d13fcfaae5 Mon Sep 17 00:00:00 2001 From: Benjamin Blackwood Date: Tue, 12 Nov 2019 00:08:18 +1100 Subject: [PATCH 065/648] Add funding field to package.json (#10687) [ci-skip] --- packages/babel-core/package.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/babel-core/package.json b/packages/babel-core/package.json index 7b64334e7030..4da69a87d404 100644 --- a/packages/babel-core/package.json +++ b/packages/babel-core/package.json @@ -28,6 +28,10 @@ "engines": { "node": ">=6.9.0" }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/babel" + }, "browser": { "./lib/config/files/index.js": "./lib/config/files/index-browser.js", "./lib/transform-file.js": "./lib/transform-file-browser.js" From 4cb5e0a01317f36e779c1d7ab53840416bce5d03 Mon Sep 17 00:00:00 2001 From: Sakibul Mowla Date: Mon, 11 Nov 2019 21:38:13 +0000 Subject: [PATCH 066/648] Allow TypeScript type assertions in array destructuring (#10592) * Add test * Add fix * Fix test, destructure with as assertion * Add angle-bracket assertion case * Use isBinding to make typeCastToParameter decision --- .../src/plugins/typescript/index.js | 17 +- .../cast/destructure-and-assign/input.ts | 2 + .../cast/destructure-and-assign/output.json | 269 ++++++++++++++++++ 3 files changed, 283 insertions(+), 5 deletions(-) create mode 100644 packages/babel-parser/test/fixtures/typescript/cast/destructure-and-assign/input.ts create mode 100644 packages/babel-parser/test/fixtures/typescript/cast/destructure-and-assign/output.json diff --git a/packages/babel-parser/src/plugins/typescript/index.js b/packages/babel-parser/src/plugins/typescript/index.js index 9fabb50cd0a2..2e7472e216d2 100644 --- a/packages/babel-parser/src/plugins/typescript/index.js +++ b/packages/babel-parser/src/plugins/typescript/index.js @@ -2483,7 +2483,10 @@ export default (superClass: Class): Class => } } - toAssignableList(exprList: N.Expression[]): $ReadOnlyArray { + toAssignableList( + exprList: N.Expression[], + isBinding: ?boolean, + ): $ReadOnlyArray { for (let i = 0; i < exprList.length; i++) { const expr = exprList[i]; if (!expr) continue; @@ -2493,10 +2496,14 @@ export default (superClass: Class): Class => break; case "TSAsExpression": case "TSTypeAssertion": - this.raise( - expr.start, - "Unexpected type cast in parameter position.", - ); + if (!isBinding) { + exprList[i] = this.typeCastToParameter(expr); + } else { + this.raise( + expr.start, + "Unexpected type cast in parameter position.", + ); + } break; } } diff --git a/packages/babel-parser/test/fixtures/typescript/cast/destructure-and-assign/input.ts b/packages/babel-parser/test/fixtures/typescript/cast/destructure-and-assign/input.ts new file mode 100644 index 000000000000..ece9096fb9f6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/cast/destructure-and-assign/input.ts @@ -0,0 +1,2 @@ +[a as number] = [42]; +[a] = [42]; diff --git a/packages/babel-parser/test/fixtures/typescript/cast/destructure-and-assign/output.json b/packages/babel-parser/test/fixtures/typescript/cast/destructure-and-assign/output.json new file mode 100644 index 000000000000..d621a6cb84c1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/cast/destructure-and-assign/output.json @@ -0,0 +1,269 @@ +{ + "type": "File", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 0, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "operator": "=", + "left": { + "type": "ArrayPattern", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "elements": [ + { + "type": "Identifier", + "start": 1, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "a" + }, + "name": "a", + "typeAnnotation": { + "type": "TSNumberKeyword", + "start": 6, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 12 + } + } + } + } + ] + }, + "right": { + "type": "ArrayExpression", + "start": 16, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "elements": [ + { + "type": "NumericLiteral", + "start": 17, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + ] + } + } + }, + { + "type": "ExpressionStatement", + "start": 22, + "end": 41, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 22, + "end": 40, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "operator": "=", + "left": { + "type": "ArrayPattern", + "start": 22, + "end": 33, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "elements": [ + { + "type": "Identifier", + "start": 31, + "end": 30, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 8 + }, + "identifierName": "a" + }, + "name": "a", + "typeAnnotation": { + "type": "TSNumberKeyword", + "start": 24, + "end": 30, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 8 + } + } + } + } + ] + }, + "right": { + "type": "ArrayExpression", + "start": 36, + "end": 40, + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "elements": [ + { + "type": "NumericLiteral", + "start": 37, + "end": 39, + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 17 + } + }, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + ] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file From d413a3078c1b7a46be106bebf67816c5f9550fc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hu=C3=A1ng=20J=C3=B9nli=C3=A0ng?= Date: Mon, 11 Nov 2019 17:36:10 -0500 Subject: [PATCH 067/648] Add `asserts this [is type]` parsing support (#10677) --- .../src/plugins/typescript/index.js | 64 ++- packages/babel-parser/src/types.js | 1 + .../asserts-this-with-predicate/input.ts | 4 + .../asserts-this-with-predicate/options.json | 5 + .../asserts-this-with-predicate/output.json | 397 ++++++++++++++++++ .../assert-predicate/asserts-this/input.ts | 3 + .../assert-predicate/asserts-this/output.json | 187 +++++++++ .../asserts-var-with-predicate/input.ts | 3 + .../asserts-var-with-predicate/output.json | 267 ++++++++++++ .../input.ts | 0 .../output.json | 0 .../invalid-escaped-asserts-keyword/input.ts | 1 + .../output.json | 170 ++++++++ .../babel-types/src/definitions/typescript.js | 5 +- 14 files changed, 1087 insertions(+), 20 deletions(-) create mode 100644 packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-this-with-predicate/input.ts create mode 100644 packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-this-with-predicate/options.json create mode 100644 packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-this-with-predicate/output.json create mode 100644 packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-this/input.ts create mode 100644 packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-this/output.json create mode 100644 packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-var-with-predicate/input.ts create mode 100644 packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-var-with-predicate/output.json rename packages/babel-parser/test/fixtures/typescript/assert-predicate/{asserts-with-predicate => declare-asserts-var-with-predicate}/input.ts (100%) rename packages/babel-parser/test/fixtures/typescript/assert-predicate/{asserts-with-predicate => declare-asserts-var-with-predicate}/output.json (100%) create mode 100644 packages/babel-parser/test/fixtures/typescript/assert-predicate/invalid-escaped-asserts-keyword/input.ts create mode 100644 packages/babel-parser/test/fixtures/typescript/assert-predicate/invalid-escaped-asserts-keyword/output.json diff --git a/packages/babel-parser/src/plugins/typescript/index.js b/packages/babel-parser/src/plugins/typescript/index.js index 2e7472e216d2..4cf196b9a704 100644 --- a/packages/babel-parser/src/plugins/typescript/index.js +++ b/packages/babel-parser/src/plugins/typescript/index.js @@ -680,6 +680,15 @@ export default (superClass: Class): Class => return this.finishNode(node, "TSLiteralType"); } + tsParseThisTypeOrThisTypePredicate(): N.TsThisType | N.TsTypePredicate { + const thisKeyword = this.tsParseThisTypeNode(); + if (this.isContextual("is") && !this.hasPrecedingLineBreak()) { + return this.tsParseThisTypePredicate(thisKeyword); + } else { + return thisKeyword; + } + } + tsParseNonArrayType(): N.TsType { switch (this.state.type) { case tt.name: @@ -715,14 +724,8 @@ export default (superClass: Class): Class => return this.finishNode(node, "TSLiteralType"); } break; - case tt._this: { - const thisKeyword = this.tsParseThisTypeNode(); - if (this.isContextual("is") && !this.hasPrecedingLineBreak()) { - return this.tsParseThisTypePredicate(thisKeyword); - } else { - return thisKeyword; - } - } + case tt._this: + return this.tsParseThisTypeOrThisTypePredicate(); case tt._typeof: return this.tsParseTypeQuery(); case tt._import: @@ -937,6 +940,24 @@ export default (superClass: Class): Class => this.tsParseTypePredicateAsserts.bind(this), ); + if (asserts && this.match(tt._this)) { + // When asserts is false, thisKeyword is handled by tsParseNonArrayType + // : asserts this is type + let thisTypePredicate = this.tsParseThisTypeOrThisTypePredicate(); + // if it turns out to be a `TSThisType`, wrap it with `TSTypePredicate` + // : asserts this + if (thisTypePredicate.type === "TSThisType") { + const node: N.TsTypePredicate = this.startNodeAtNode(t); + node.parameterName = (thisTypePredicate: N.TsThisType); + node.asserts = true; + thisTypePredicate = this.finishNode(node, "TSTypePredicate"); + } else { + (thisTypePredicate: N.TsTypePredicate).asserts = true; + } + t.typeAnnotation = thisTypePredicate; + return this.finishNode(t, "TSTypeAnnotation"); + } + const typePredicateVariable = this.tsIsIdentifier() && this.tsTryParse(this.tsParseTypePredicatePrefix.bind(this)); @@ -947,15 +968,15 @@ export default (superClass: Class): Class => return this.tsParseTypeAnnotation(/* eatColon */ false, t); } + const node: N.TsTypePredicate = this.startNodeAtNode(t); // : asserts foo - const node = this.startNodeAtNode(t); node.parameterName = this.parseIdentifier(); node.asserts = asserts; t.typeAnnotation = this.finishNode(node, "TSTypePredicate"); return this.finishNode(t, "TSTypeAnnotation"); } - // : foo is type + // : asserts foo is type const type = this.tsParseTypeAnnotation(/* eatColon */ false); const node = this.startNodeAtNode(t); node.parameterName = typePredicateVariable; @@ -989,18 +1010,25 @@ export default (superClass: Class): Class => } tsParseTypePredicateAsserts(): boolean { - if (!this.tsIsIdentifier()) { - return false; - } - - const id = this.parseIdentifier(); if ( - id.name !== "asserts" || - this.hasPrecedingLineBreak() || - !this.tsIsIdentifier() + !this.match(tt.name) || + this.state.value !== "asserts" || + this.hasPrecedingLineBreak() ) { return false; } + const containsEsc = this.state.containsEsc; + this.next(); + if (!this.match(tt.name) && !this.match(tt._this)) { + return false; + } + + if (containsEsc) { + this.raise( + this.state.lastTokStart, + "Escape sequence in keyword asserts", + ); + } return true; } diff --git a/packages/babel-parser/src/types.js b/packages/babel-parser/src/types.js index 8392a58db0f2..82815b1443d6 100644 --- a/packages/babel-parser/src/types.js +++ b/packages/babel-parser/src/types.js @@ -1227,6 +1227,7 @@ export type TsTypePredicate = TsTypeBase & { type: "TSTypePredicate", parameterName: Identifier | TsThisType, typeAnnotation: TsTypeAnnotation, + asserts?: boolean, }; // `typeof` operator diff --git a/packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-this-with-predicate/input.ts b/packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-this-with-predicate/input.ts new file mode 100644 index 000000000000..cc1a550f07bb --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-this-with-predicate/input.ts @@ -0,0 +1,4 @@ +class Foo { + isBar(): asserts this is Foo {} + isBaz = (): asserts this is Foo => {} +} diff --git a/packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-this-with-predicate/options.json b/packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-this-with-predicate/options.json new file mode 100644 index 000000000000..efb11900ba6e --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-this-with-predicate/options.json @@ -0,0 +1,5 @@ +{ + "plugins": [ + "typescript", "classProperties" + ] +} diff --git a/packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-this-with-predicate/output.json b/packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-this-with-predicate/output.json new file mode 100644 index 000000000000..bed7e168b396 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-this-with-predicate/output.json @@ -0,0 +1,397 @@ +{ + "type": "File", + "start": 0, + "end": 87, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 87, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 87, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + }, + "identifierName": "Foo" + }, + "name": "Foo" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 10, + "end": 87, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "ClassMethod", + "start": 14, + "end": 45, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 33 + } + }, + "static": false, + "key": { + "type": "Identifier", + "start": 14, + "end": 19, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 7 + }, + "identifierName": "isBar" + }, + "name": "isBar" + }, + "computed": false, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "returnType": { + "type": "TSTypeAnnotation", + "start": 21, + "end": 42, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 30 + } + }, + "typeAnnotation": { + "type": "TSTypePredicate", + "start": 31, + "end": 42, + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 30 + } + }, + "parameterName": { + "type": "TSThisType", + "start": 31, + "end": 35, + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 23 + } + } + }, + "typeAnnotation": { + "type": "TSTypeAnnotation", + "start": 39, + "end": 42, + "loc": { + "start": { + "line": 2, + "column": 27 + }, + "end": { + "line": 2, + "column": 30 + } + }, + "typeAnnotation": { + "type": "TSTypeReference", + "start": 39, + "end": 42, + "loc": { + "start": { + "line": 2, + "column": 27 + }, + "end": { + "line": 2, + "column": 30 + } + }, + "typeName": { + "type": "Identifier", + "start": 39, + "end": 42, + "loc": { + "start": { + "line": 2, + "column": 27 + }, + "end": { + "line": 2, + "column": 30 + }, + "identifierName": "Foo" + }, + "name": "Foo" + } + } + }, + "asserts": true + } + }, + "body": { + "type": "BlockStatement", + "start": 43, + "end": 45, + "loc": { + "start": { + "line": 2, + "column": 31 + }, + "end": { + "line": 2, + "column": 33 + } + }, + "body": [], + "directives": [] + } + }, + { + "type": "ClassProperty", + "start": 48, + "end": 85, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 39 + } + }, + "static": false, + "key": { + "type": "Identifier", + "start": 48, + "end": 53, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 7 + }, + "identifierName": "isBaz" + }, + "name": "isBaz" + }, + "computed": false, + "value": { + "type": "ArrowFunctionExpression", + "start": 56, + "end": 85, + "loc": { + "start": { + "line": 3, + "column": 10 + }, + "end": { + "line": 3, + "column": 39 + } + }, + "returnType": { + "type": "TSTypeAnnotation", + "start": 58, + "end": 79, + "loc": { + "start": { + "line": 3, + "column": 12 + }, + "end": { + "line": 3, + "column": 33 + } + }, + "typeAnnotation": { + "type": "TSTypePredicate", + "start": 68, + "end": 79, + "loc": { + "start": { + "line": 3, + "column": 22 + }, + "end": { + "line": 3, + "column": 33 + } + }, + "parameterName": { + "type": "TSThisType", + "start": 68, + "end": 72, + "loc": { + "start": { + "line": 3, + "column": 22 + }, + "end": { + "line": 3, + "column": 26 + } + } + }, + "typeAnnotation": { + "type": "TSTypeAnnotation", + "start": 76, + "end": 79, + "loc": { + "start": { + "line": 3, + "column": 30 + }, + "end": { + "line": 3, + "column": 33 + } + }, + "typeAnnotation": { + "type": "TSTypeReference", + "start": 76, + "end": 79, + "loc": { + "start": { + "line": 3, + "column": 30 + }, + "end": { + "line": 3, + "column": 33 + } + }, + "typeName": { + "type": "Identifier", + "start": 76, + "end": 79, + "loc": { + "start": { + "line": 3, + "column": 30 + }, + "end": { + "line": 3, + "column": 33 + }, + "identifierName": "Foo" + }, + "name": "Foo" + } + } + }, + "asserts": true + } + }, + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 83, + "end": 85, + "loc": { + "start": { + "line": 3, + "column": 37 + }, + "end": { + "line": 3, + "column": 39 + } + }, + "body": [], + "directives": [] + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-this/input.ts b/packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-this/input.ts new file mode 100644 index 000000000000..839483541d5b --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-this/input.ts @@ -0,0 +1,3 @@ +class C { + m(): asserts this {}; +} diff --git a/packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-this/output.json b/packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-this/output.json new file mode 100644 index 000000000000..e9d5458c1c89 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-this/output.json @@ -0,0 +1,187 @@ +{ + "type": "File", + "start": 0, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "C" + }, + "name": "C" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ClassMethod", + "start": 12, + "end": 32, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "static": false, + "key": { + "type": "Identifier", + "start": 12, + "end": 13, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 3 + }, + "identifierName": "m" + }, + "name": "m" + }, + "computed": false, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "returnType": { + "type": "TSTypeAnnotation", + "start": 15, + "end": 29, + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "typeAnnotation": { + "type": "TSTypePredicate", + "start": 15, + "end": 29, + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "parameterName": { + "type": "TSThisType", + "start": 25, + "end": 29, + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + "asserts": true + } + }, + "body": { + "type": "BlockStatement", + "start": 30, + "end": 32, + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-var-with-predicate/input.ts b/packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-var-with-predicate/input.ts new file mode 100644 index 000000000000..2b580e64e906 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-var-with-predicate/input.ts @@ -0,0 +1,3 @@ +class C { + assertIsString(value: unknown): asserts value is string {} +} diff --git a/packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-var-with-predicate/output.json b/packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-var-with-predicate/output.json new file mode 100644 index 000000000000..f63a5e0581c3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-var-with-predicate/output.json @@ -0,0 +1,267 @@ +{ + "type": "File", + "start": 0, + "end": 72, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 72, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 72, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "C" + }, + "name": "C" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 72, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ClassMethod", + "start": 12, + "end": 70, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 60 + } + }, + "static": false, + "key": { + "type": "Identifier", + "start": 12, + "end": 26, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 16 + }, + "identifierName": "assertIsString" + }, + "name": "assertIsString" + }, + "computed": false, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 27, + "end": 41, + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 31 + }, + "identifierName": "value" + }, + "name": "value", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "start": 32, + "end": 41, + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 31 + } + }, + "typeAnnotation": { + "type": "TSUnknownKeyword", + "start": 34, + "end": 41, + "loc": { + "start": { + "line": 2, + "column": 24 + }, + "end": { + "line": 2, + "column": 31 + } + } + } + } + } + ], + "returnType": { + "type": "TSTypeAnnotation", + "start": 42, + "end": 67, + "loc": { + "start": { + "line": 2, + "column": 32 + }, + "end": { + "line": 2, + "column": 57 + } + }, + "typeAnnotation": { + "type": "TSTypePredicate", + "start": 42, + "end": 67, + "loc": { + "start": { + "line": 2, + "column": 32 + }, + "end": { + "line": 2, + "column": 57 + } + }, + "parameterName": { + "type": "Identifier", + "start": 52, + "end": 57, + "loc": { + "start": { + "line": 2, + "column": 42 + }, + "end": { + "line": 2, + "column": 47 + }, + "identifierName": "value" + }, + "name": "value" + }, + "typeAnnotation": { + "type": "TSTypeAnnotation", + "start": 61, + "end": 67, + "loc": { + "start": { + "line": 2, + "column": 51 + }, + "end": { + "line": 2, + "column": 57 + } + }, + "typeAnnotation": { + "type": "TSStringKeyword", + "start": 61, + "end": 67, + "loc": { + "start": { + "line": 2, + "column": 51 + }, + "end": { + "line": 2, + "column": 57 + } + } + } + }, + "asserts": true + } + }, + "body": { + "type": "BlockStatement", + "start": 68, + "end": 70, + "loc": { + "start": { + "line": 2, + "column": 58 + }, + "end": { + "line": 2, + "column": 60 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-with-predicate/input.ts b/packages/babel-parser/test/fixtures/typescript/assert-predicate/declare-asserts-var-with-predicate/input.ts similarity index 100% rename from packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-with-predicate/input.ts rename to packages/babel-parser/test/fixtures/typescript/assert-predicate/declare-asserts-var-with-predicate/input.ts diff --git a/packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-with-predicate/output.json b/packages/babel-parser/test/fixtures/typescript/assert-predicate/declare-asserts-var-with-predicate/output.json similarity index 100% rename from packages/babel-parser/test/fixtures/typescript/assert-predicate/asserts-with-predicate/output.json rename to packages/babel-parser/test/fixtures/typescript/assert-predicate/declare-asserts-var-with-predicate/output.json diff --git a/packages/babel-parser/test/fixtures/typescript/assert-predicate/invalid-escaped-asserts-keyword/input.ts b/packages/babel-parser/test/fixtures/typescript/assert-predicate/invalid-escaped-asserts-keyword/input.ts new file mode 100644 index 000000000000..a89b5ad6c9fa --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/assert-predicate/invalid-escaped-asserts-keyword/input.ts @@ -0,0 +1 @@ +declare function assertIsString(value: unknown): \u{61}sserts value; diff --git a/packages/babel-parser/test/fixtures/typescript/assert-predicate/invalid-escaped-asserts-keyword/output.json b/packages/babel-parser/test/fixtures/typescript/assert-predicate/invalid-escaped-asserts-keyword/output.json new file mode 100644 index 000000000000..90484c4b93a3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/assert-predicate/invalid-escaped-asserts-keyword/output.json @@ -0,0 +1,170 @@ +{ + "type": "File", + "start": 0, + "end": 68, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 68 + } + }, + "errors": [ + "SyntaxError: Escape sequence in keyword asserts (1:49)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 68, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 68 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "TSDeclareFunction", + "start": 0, + "end": 68, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 68 + } + }, + "id": { + "type": "Identifier", + "start": 17, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 31 + }, + "identifierName": "assertIsString" + }, + "name": "assertIsString" + }, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 32, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 46 + }, + "identifierName": "value" + }, + "name": "value", + "typeAnnotation": { + "type": "TSTypeAnnotation", + "start": 37, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "typeAnnotation": { + "type": "TSUnknownKeyword", + "start": 39, + "end": 46, + "loc": { + "start": { + "line": 1, + "column": 39 + }, + "end": { + "line": 1, + "column": 46 + } + } + } + } + } + ], + "returnType": { + "type": "TSTypeAnnotation", + "start": 47, + "end": 67, + "loc": { + "start": { + "line": 1, + "column": 47 + }, + "end": { + "line": 1, + "column": 67 + } + }, + "typeAnnotation": { + "type": "TSTypePredicate", + "start": 47, + "end": 67, + "loc": { + "start": { + "line": 1, + "column": 47 + }, + "end": { + "line": 1, + "column": 67 + } + }, + "parameterName": { + "type": "Identifier", + "start": 62, + "end": 67, + "loc": { + "start": { + "line": 1, + "column": 62 + }, + "end": { + "line": 1, + "column": 67 + }, + "identifierName": "value" + }, + "name": "value" + }, + "asserts": true + } + }, + "declare": true + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-types/src/definitions/typescript.js b/packages/babel-types/src/definitions/typescript.js index bba8a5b73c8e..608ea8ab2207 100644 --- a/packages/babel-types/src/definitions/typescript.js +++ b/packages/babel-types/src/definitions/typescript.js @@ -175,11 +175,12 @@ defineType("TSTypeReference", { defineType("TSTypePredicate", { aliases: ["TSType"], - visitor: ["parameterName", "typeAnnotation", "asserts"], + visitor: ["parameterName", "typeAnnotation"], + builder: ["parameterName", "typeAnnotation", "asserts"], fields: { parameterName: validateType(["Identifier", "TSThisType"]), typeAnnotation: validateOptionalType("TSTypeAnnotation"), - asserts: validate(bool), + asserts: validateOptional(bool), }, }); From d9fd07929aeafb16b51d361011808442fd7cb29f Mon Sep 17 00:00:00 2001 From: 4geru koichi uchinishi Date: Wed, 13 Nov 2019 01:08:35 +0900 Subject: [PATCH 068/648] chore: add missing new line to fixture (#10697) --- .../test/fixtures/top-level-await/unsupported/input.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/babel-preset-env/test/fixtures/top-level-await/unsupported/input.mjs b/packages/babel-preset-env/test/fixtures/top-level-await/unsupported/input.mjs index d8ddd6c0ad0b..0a5e432fc91c 100644 --- a/packages/babel-preset-env/test/fixtures/top-level-await/unsupported/input.mjs +++ b/packages/babel-preset-env/test/fixtures/top-level-await/unsupported/input.mjs @@ -1 +1 @@ -await 0; \ No newline at end of file +await 0; From ecad667dda7d8bbc8594df0a36d0a68f3eacb21b Mon Sep 17 00:00:00 2001 From: Shriram Balaji Date: Tue, 12 Nov 2019 21:58:40 +0530 Subject: [PATCH 069/648] Fix optional method chaining in derived classes (#10694) --- .../src/index.js | 2 ++ .../general/super-method-call-loose/input.js | 12 ++++++++++++ .../super-method-call-loose/options.json | 3 +++ .../general/super-method-call-loose/output.js | 15 +++++++++++++++ .../fixtures/general/super-method-call/input.js | 12 ++++++++++++ .../general/super-method-call/output.js | 17 +++++++++++++++++ 6 files changed, 61 insertions(+) create mode 100644 packages/babel-plugin-proposal-optional-chaining/test/fixtures/general/super-method-call-loose/input.js create mode 100644 packages/babel-plugin-proposal-optional-chaining/test/fixtures/general/super-method-call-loose/options.json create mode 100644 packages/babel-plugin-proposal-optional-chaining/test/fixtures/general/super-method-call-loose/output.js create mode 100644 packages/babel-plugin-proposal-optional-chaining/test/fixtures/general/super-method-call/input.js create mode 100644 packages/babel-plugin-proposal-optional-chaining/test/fixtures/general/super-method-call/output.js diff --git a/packages/babel-plugin-proposal-optional-chaining/src/index.js b/packages/babel-plugin-proposal-optional-chaining/src/index.js index c3e324041520..918a59ade508 100644 --- a/packages/babel-plugin-proposal-optional-chaining/src/index.js +++ b/packages/babel-plugin-proposal-optional-chaining/src/index.js @@ -82,6 +82,8 @@ export default declare((api, options) => { let context = scope.maybeGenerateMemoised(object); if (context) { chain.object = t.assignmentExpression("=", context, object); + } else if (t.isSuper(object)) { + context = t.thisExpression(); } else { context = object; } diff --git a/packages/babel-plugin-proposal-optional-chaining/test/fixtures/general/super-method-call-loose/input.js b/packages/babel-plugin-proposal-optional-chaining/test/fixtures/general/super-method-call-loose/input.js new file mode 100644 index 000000000000..445c06ab259e --- /dev/null +++ b/packages/babel-plugin-proposal-optional-chaining/test/fixtures/general/super-method-call-loose/input.js @@ -0,0 +1,12 @@ +"use strict"; +class Base { + method() { + return 'Hello!'; + } +} + +class Derived extends Base { + method() { + return super.method?.() + } +} diff --git a/packages/babel-plugin-proposal-optional-chaining/test/fixtures/general/super-method-call-loose/options.json b/packages/babel-plugin-proposal-optional-chaining/test/fixtures/general/super-method-call-loose/options.json new file mode 100644 index 000000000000..39ea3f99c7ff --- /dev/null +++ b/packages/babel-plugin-proposal-optional-chaining/test/fixtures/general/super-method-call-loose/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["proposal-optional-chaining", { "loose": true }]] +} diff --git a/packages/babel-plugin-proposal-optional-chaining/test/fixtures/general/super-method-call-loose/output.js b/packages/babel-plugin-proposal-optional-chaining/test/fixtures/general/super-method-call-loose/output.js new file mode 100644 index 000000000000..6fd3890a61aa --- /dev/null +++ b/packages/babel-plugin-proposal-optional-chaining/test/fixtures/general/super-method-call-loose/output.js @@ -0,0 +1,15 @@ +"use strict"; + +class Base { + method() { + return 'Hello!'; + } + +} + +class Derived extends Base { + method() { + return super.method == null ? void 0 : super.method(); + } + +} diff --git a/packages/babel-plugin-proposal-optional-chaining/test/fixtures/general/super-method-call/input.js b/packages/babel-plugin-proposal-optional-chaining/test/fixtures/general/super-method-call/input.js new file mode 100644 index 000000000000..445c06ab259e --- /dev/null +++ b/packages/babel-plugin-proposal-optional-chaining/test/fixtures/general/super-method-call/input.js @@ -0,0 +1,12 @@ +"use strict"; +class Base { + method() { + return 'Hello!'; + } +} + +class Derived extends Base { + method() { + return super.method?.() + } +} diff --git a/packages/babel-plugin-proposal-optional-chaining/test/fixtures/general/super-method-call/output.js b/packages/babel-plugin-proposal-optional-chaining/test/fixtures/general/super-method-call/output.js new file mode 100644 index 000000000000..891da0508e27 --- /dev/null +++ b/packages/babel-plugin-proposal-optional-chaining/test/fixtures/general/super-method-call/output.js @@ -0,0 +1,17 @@ +"use strict"; + +class Base { + method() { + return 'Hello!'; + } + +} + +class Derived extends Base { + method() { + var _super$method; + + return (_super$method = super.method) === null || _super$method === void 0 ? void 0 : _super$method.call(this); + } + +} From f71338baf93ad483cf5c48be4f1573ceac8f88ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?= Date: Tue, 12 Nov 2019 23:55:36 +0100 Subject: [PATCH 070/648] E2E test Babel with itself before publishing (#10569) * Add e2e test using Babel itself * Make checks run again --- .circleci/config.yml | 54 ++++++++++++---- Makefile | 14 ++++- scripts/integration-tests/e2e-babel.sh | 29 +++++++++ scripts/integration-tests/publish-local.sh | 33 ++++++++++ scripts/integration-tests/utils/cleanup.sh | 30 +++++++++ scripts/integration-tests/utils/git.sh | 29 +++++++++ .../integration-tests/utils/local-registry.sh | 34 +++++++++++ .../integration-tests/verdaccio-config.yml | 61 +++++++++++++++++++ 8 files changed, 272 insertions(+), 12 deletions(-) create mode 100755 scripts/integration-tests/e2e-babel.sh create mode 100755 scripts/integration-tests/publish-local.sh create mode 100755 scripts/integration-tests/utils/cleanup.sh create mode 100755 scripts/integration-tests/utils/git.sh create mode 100755 scripts/integration-tests/utils/local-registry.sh create mode 100755 scripts/integration-tests/verdaccio-config.yml diff --git a/.circleci/config.yml b/.circleci/config.yml index 691613f6de4b..400c61909baa 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,4 +1,5 @@ -version: 2 +version: 2.1 + aliases: - &restore-node-modules-cache keys: @@ -39,15 +40,19 @@ aliases: - &artifact_test262_xunit path: ~/test-results -jobs: - test: - working_directory: ~/babel +executors: + node-executor: docker: - image: circleci/node:13 + working_directory: ~/babel + +jobs: + test: + executor: node-executor steps: - checkout - - restore-cache: *restore-yarn-cache - - restore-cache: *restore-node-modules-cache + - restore_cache: *restore-yarn-cache + - restore_cache: *restore-node-modules-cache - run: yarn --version - run: make test-ci-coverage # Builds babel-standalone with the regular Babel config @@ -63,14 +68,13 @@ jobs: - store_artifacts: *artifact_env_min - save_cache: *save-node-modules-cache - save_cache: *save-yarn-cache + test262: - working_directory: ~/babel - docker: - - image: circleci/node:12 + executor: node-executor steps: - checkout - - restore-cache: *restore-yarn-cache - - restore-cache: *restore-node-modules-cache + - restore_cache: *restore-yarn-cache + - restore_cache: *restore-node-modules-cache - run: name: Build Babel command: BABEL_ENV=test make bootstrap @@ -107,11 +111,32 @@ jobs: cat ~/test262.tap | $(npm bin)/tap-mocha-reporter spec || true <<: *test262_workdir + publish-verdaccio: + executor: node-executor + steps: + - checkout + - run: yarn install + - run: ./scripts/integration-tests/publish-local.sh + - persist_to_workspace: + root: /tmp/verdaccio-workspace + paths: + - storage + - htpasswd + + e2e-babel: + executor: node-executor + steps: + - checkout + - attach_workspace: + at: /tmp/verdaccio-workspace + - run: ./scripts/integration-tests/e2e-babel.sh + workflows: version: 2 test: jobs: - test + master: jobs: - test262: @@ -119,3 +144,10 @@ workflows: branches: only: - master + + e2e: + jobs: + - publish-verdaccio + - e2e-babel: + requires: + - publish-verdaccio diff --git a/Makefile b/Makefile index 2c077a3fbd87..cfef047f6140 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,8 @@ FLOW_COMMIT = 09669846b7a7ca5a6c23c12d56bb3bebdafd67e9 TEST262_COMMIT = 8688c4ab79059c3097098605e69f1ee5eda6c409 +FORCE_PUBLISH = "@babel/runtime,@babel/runtime-corejs2,@babel/runtime-corejs3,@babel/standalone,@babel/preset-env-standalone" + # Fix color output until TravisCI fixes https://github.com/travis-ci/travis-ci/issues/7967 export FORCE_COLOR = true @@ -189,7 +191,7 @@ prepublish: new-version: git pull --rebase - yarn lerna version --force-publish="@babel/runtime,@babel/runtime-corejs2,@babel/runtime-corejs3,@babel/standalone,@babel/preset-env-standalone" + yarn lerna version --force-publish=$(FORCE_PUBLISH) # NOTE: Run make new-version first publish: prepublish @@ -207,6 +209,16 @@ endif rm -f .npmrc $(MAKE) clean +publish-test: +ifneq ("$(I_AM_USING_VERDACCIO)", "I_AM_SURE") + echo "You probably don't know what you are doing" + exit 1 +endif + $(MAKE) prepublish-build + yarn lerna version patch --force-publish=$(FORCE_PUBLISH) --no-push --yes --tag-version-prefix="version-e2e-test-" + yarn lerna publish from-git --registry http://localhost:4873 --yes --tag-version-prefix="version-e2e-test-" + $(MAKE) clean + bootstrap-only: lerna-bootstrap yarn-install: clean-all diff --git a/scripts/integration-tests/e2e-babel.sh b/scripts/integration-tests/e2e-babel.sh new file mode 100755 index 000000000000..d295a9416c55 --- /dev/null +++ b/scripts/integration-tests/e2e-babel.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +#==============================================================================# +# SETUP # +#==============================================================================# + +# Start in scripts/integration-tests/ even if run from root directory +cd "$(dirname "$0")" + +source utils/local-registry.sh +source utils/cleanup.sh + +# Echo every command being executed +set -x + +# Go to the root of the monorepo +cd ../.. + +#==============================================================================# +# TEST # +#==============================================================================# + +startLocalRegistry "$PWD"/scripts/integration-tests/verdaccio-config.yml +yarn upgrade --scope @babel + +# Test +make test-ci + +cleanup diff --git a/scripts/integration-tests/publish-local.sh b/scripts/integration-tests/publish-local.sh new file mode 100755 index 000000000000..d16f123512a5 --- /dev/null +++ b/scripts/integration-tests/publish-local.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +#==============================================================================# +# SETUP # +#==============================================================================# + +# Start in scripts/integration-tests/ even if run from root directory +cd "$(dirname "$0")" + +source utils/local-registry.sh +source utils/git.sh +source utils/cleanup.sh + +# Echo every command being executed +set -x + +# Go to the root of the monorepo +cd ../.. + +initializeE2Egit + +#==============================================================================# +# PUBLISH # +#==============================================================================# + +make bootstrap-only + +startLocalRegistry "$PWD"/scripts/integration-tests/verdaccio-config.yml +loginLocalRegistry + +I_AM_USING_VERDACCIO=I_AM_SURE make publish-test + +cleanup diff --git a/scripts/integration-tests/utils/cleanup.sh b/scripts/integration-tests/utils/cleanup.sh new file mode 100755 index 000000000000..0a578b79fdc7 --- /dev/null +++ b/scripts/integration-tests/utils/cleanup.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +function cleanup { + echo "Cleaning up." + stopLocalRegistry + + if [ -n "$GIT_E2E_SETUP" ]; then + cleanupE2Egit + fi +} + +# Error messages are redirected to stderr +function handle_error { + echo "$(basename $0): ERROR! An error was encountered executing line $1." 1>&2; + cleanup + echo "Exiting with error." 1>&2; + exit 1 +} + +function handle_exit { + cleanup + echo "Exiting without error." 1>&2; + exit +} + +# Exit the script with a helpful error message when any error is encountered +trap 'set +x; handle_error $LINENO $BASH_COMMAND' ERR + +# Cleanup before exit on any termination signal +trap 'set +x; handle_exit' SIGQUIT SIGTERM SIGINT SIGKILL SIGHUP diff --git a/scripts/integration-tests/utils/git.sh b/scripts/integration-tests/utils/git.sh new file mode 100755 index 000000000000..2cce5ee99077 --- /dev/null +++ b/scripts/integration-tests/utils/git.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +original_git_branch=`git rev-parse --abbrev-ref HEAD` +tmp_branch_name="integration-tests-$(date +'%F-%H-%M-%N')" +original_user_name=`git config user.name` +original_user_email=`git config user.email` + +export GIT_E2E_SETUP="true" + +function initializeE2Egit { + git checkout -b $tmp_branch_name + + # This is needed by lerna, which commits when publishing + git config user.name "Babel E2E Test" + git config user.email "babel-e2e@example.com" +} + +function cleanupE2Egit { + # Delete release tags + git tag -d $(git tag -l "version-e2e-test-*") + + # Checkout the previous branch + git checkout -f $original_git_branch + git branch -D $tmp_branch_name + + # Restore git user + git config user.name "$original_user_name" + git config user.email "$original_user_email" +} diff --git a/scripts/integration-tests/utils/local-registry.sh b/scripts/integration-tests/utils/local-registry.sh new file mode 100755 index 000000000000..e0212d2529b3 --- /dev/null +++ b/scripts/integration-tests/utils/local-registry.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +# Copied from https://github.com/facebook/create-react-app/blob/053f9774d3f592c17741d2a86de66a7ca58f90c0/tasks/local-registry.sh + +custom_registry_url=http://localhost:4873 +original_npm_registry_url=`npm get registry` +original_yarn_registry_url=`yarn config get registry` +default_verdaccio_package=verdaccio@~4.3.3 + +function startLocalRegistry { + # Start local registry + tmp_registry_log=`mktemp` + echo "Registry output file: $tmp_registry_log" + (cd && nohup npx ${VERDACCIO_PACKAGE:-$default_verdaccio_package} -c $1 &>$tmp_registry_log &) + + # Wait for Verdaccio to boot + grep -q "http address" <(tail -f $tmp_registry_log) + + # Set registry to local registry + npm set registry "$custom_registry_url" + yarn config set registry "$custom_registry_url" +} + +function loginLocalRegistry { + # Login so we can publish packages + (cd && npx npm-auth-to-token@1.0.0 -u user -p password -e user@example.com -r "$custom_registry_url") +} + +function stopLocalRegistry { + # Restore the original NPM and Yarn registry URLs and stop Verdaccio + fuser -k 4873/tcp + npm set registry "$original_npm_registry_url" + yarn config set registry "$original_yarn_registry_url" +} diff --git a/scripts/integration-tests/verdaccio-config.yml b/scripts/integration-tests/verdaccio-config.yml new file mode 100755 index 000000000000..69d210aa3933 --- /dev/null +++ b/scripts/integration-tests/verdaccio-config.yml @@ -0,0 +1,61 @@ +# +# This is the default config file. It allows all users to do anything, +# so don't use it on production systems. +# +# Look here for more config file examples: +# https://github.com/verdaccio/verdaccio/tree/master/conf +# + +# path to a directory with all packages +storage: /tmp/verdaccio-workspace/storage + +auth: + htpasswd: + file: /tmp/verdaccio-workspace/htpasswd + # Maximum amount of users allowed to register, defaults to "+inf". + # You can set this to -1 to disable registration. + # max_users: 1000 + +# a list of other known repositories we can talk to +uplinks: + npmjs: + url: https://registry.npmjs.org/ + +packages: + '@*/*': + # scoped packages + access: $all + publish: $all + unpublish: $all + proxy: npmjs + + '**': + # allow all users (including non-authenticated users) to read and + # publish all packages + # + # you can specify usernames/groupnames (depending on your auth plugin) + # and three keywords: "$all", "$anonymous", "$authenticated" + access: $all + publish: $all + unpublish: $all + + # if package is not available locally, proxy requests to 'npmjs' registry + proxy: npmjs + +# You can specify HTTP/1.1 server keep alive timeout in seconds for incoming connections. +# A value of 0 makes the http server behave similarly to Node.js versions prior to 8.0.0, which did not have a keep-alive timeout. +# WORKAROUND: Through given configuration you can workaround following issue https://github.com/verdaccio/verdaccio/issues/301. Set to 0 in case 60 is not enough. +server: + keepAliveTimeout: 60 + +middlewares: + audit: + enabled: true + +# log settings +logs: + - { type: stdout, format: pretty, level: http } + #- {type: file, path: verdaccio.log, level: info} +#experiments: +# # support for npm token command +# token: false From ce070ce42261fa3d537fe5a87a54f26635656c3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hu=C3=A1ng=20J=C3=B9nli=C3=A0ng?= Date: Tue, 12 Nov 2019 18:05:38 -0500 Subject: [PATCH 071/648] bump @babel/* dev dependencies (#10648) * bump @babel/* dev dependencies * chore: align version to @babel/runtime * chore: bump to 7.7.1 * chore: bump to 7.7.2 --- babel.config.js | 5 +- package.json | 16 +- yarn.lock | 619 ++++++++++++++++++++++++------------------------ 3 files changed, 322 insertions(+), 318 deletions(-) diff --git a/babel.config.js b/babel.config.js index fe0f90d0bad8..c7f53eaff39a 100644 --- a/babel.config.js +++ b/babel.config.js @@ -123,7 +123,10 @@ module.exports = function(api) { ], plugins: [ includeRuntime - ? ["@babel/transform-runtime", { version: "7.4.4" }] + ? [ + "@babel/transform-runtime", + { version: require("@babel/runtime/package").version }, + ] : null, ].filter(Boolean), }, diff --git a/package.json b/package.json index a420748f1135..a601cabc9e8c 100644 --- a/package.json +++ b/package.json @@ -9,20 +9,20 @@ "test": "make test" }, "devDependencies": { - "@babel/cli": "^7.6.0", - "@babel/core": "^7.6.0", + "@babel/cli": "^7.7.0", + "@babel/core": "^7.7.2", "@babel/eslint-plugin-development": "^1.0.1", - "@babel/plugin-proposal-class-properties": "^7.5.5", + "@babel/plugin-proposal-class-properties": "^7.7.0", "@babel/plugin-proposal-export-namespace-from": "^7.5.2", "@babel/plugin-proposal-nullish-coalescing-operator": "^7.4.4", "@babel/plugin-proposal-numeric-separator": "^7.2.0", "@babel/plugin-proposal-optional-chaining": "^7.6.0", - "@babel/plugin-transform-modules-commonjs": "^7.6.0", - "@babel/plugin-transform-runtime": "^7.6.0", - "@babel/preset-env": "^7.6.0", + "@babel/plugin-transform-modules-commonjs": "^7.7.0", + "@babel/plugin-transform-runtime": "^7.6.2", + "@babel/preset-env": "^7.7.1", "@babel/preset-flow": "^7.0.0", - "@babel/register": "^7.6.0", - "@babel/runtime": "^7.6.0", + "@babel/register": "^7.7.0", + "@babel/runtime": "^7.7.2", "babel-eslint": "^11.0.0-beta.0", "babel-jest": "^24.9.0", "babel-loader": "^8.0.6", diff --git a/yarn.lock b/yarn.lock index 17d850dc2850..95eb973a33d3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,18 +2,17 @@ # yarn lockfile v1 -"@babel/cli@^7.6.0": - version "7.6.0" - resolved "https://registry.yarnpkg.com/@babel/cli/-/cli-7.6.0.tgz#1470a04394eaf37862989ea4912adf440fa6ff8d" - integrity sha512-1CTDyGUjQqW3Mz4gfKZ04KGOckyyaNmKneAMlABPS+ZyuxWv3FrVEVz7Ag08kNIztVx8VaJ8YgvYLSNlMKAT5Q== +"@babel/cli@^7.7.0": + version "7.7.0" + resolved "https://registry.yarnpkg.com/@babel/cli/-/cli-7.7.0.tgz#8d10c9acb2acb362d7614a9493e1791c69100d89" + integrity sha512-jECEqAq6Ngf3pOhLSg7od9WKyrIacyh1oNNYtRXNn+ummSHCTXBamGywOAtiae34Vk7zKuQNnLvo2BKTMCoV4A== dependencies: commander "^2.8.1" convert-source-map "^1.1.0" fs-readdir-recursive "^1.1.0" glob "^7.0.0" lodash "^4.17.13" - mkdirp "^0.5.1" - output-file-sync "^2.0.0" + make-dir "^2.1.0" slash "^2.0.0" source-map "^0.5.0" optionalDependencies: @@ -26,19 +25,19 @@ dependencies: "@babel/highlight" "^7.0.0" -"@babel/core@^7.1.0", "@babel/core@^7.6.0": - version "7.6.0" - resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.6.0.tgz#9b00f73554edd67bebc86df8303ef678be3d7b48" - integrity sha512-FuRhDRtsd6IptKpHXAa+4WPZYY2ZzgowkbLBecEDDSje1X/apG7jQM33or3NdOmjXBKWGOg4JmSiRfUfuTtHXw== +"@babel/core@^7.1.0", "@babel/core@^7.7.2": + version "7.7.2" + resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.7.2.tgz#ea5b99693bcfc058116f42fa1dd54da412b29d91" + integrity sha512-eeD7VEZKfhK1KUXGiyPFettgF3m513f8FoBSWiQ1xTvl1RAopLs42Wp9+Ze911I6H0N9lNqJMDgoZT7gHsipeQ== dependencies: "@babel/code-frame" "^7.5.5" - "@babel/generator" "^7.6.0" - "@babel/helpers" "^7.6.0" - "@babel/parser" "^7.6.0" - "@babel/template" "^7.6.0" - "@babel/traverse" "^7.6.0" - "@babel/types" "^7.6.0" - convert-source-map "^1.1.0" + "@babel/generator" "^7.7.2" + "@babel/helpers" "^7.7.0" + "@babel/parser" "^7.7.2" + "@babel/template" "^7.7.0" + "@babel/traverse" "^7.7.2" + "@babel/types" "^7.7.2" + convert-source-map "^1.7.0" debug "^4.1.0" json5 "^2.1.0" lodash "^4.17.13" @@ -51,23 +50,22 @@ resolved "https://registry.yarnpkg.com/@babel/eslint-plugin-development/-/eslint-plugin-development-1.0.1.tgz#1f5206ae95795db09b65e7dbc2b158d66497a44c" integrity sha512-ioEhN8HgKr4Yx8ef+XryNpKN4FimSFceb0qVVxvoUzpFn3xyq17MlY5AquEqtXObE7Nu7WKq7QL9INzjCrugyw== -"@babel/generator@^7.4.0", "@babel/generator@^7.6.0": - version "7.6.0" - resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.6.0.tgz#e2c21efbfd3293ad819a2359b448f002bfdfda56" - integrity sha512-Ms8Mo7YBdMMn1BYuNtKuP/z0TgEIhbcyB8HVR6PPNYp4P61lMsABiS4A3VG1qznjXVCf3r+fVHhm4efTYVsySA== +"@babel/generator@^7.4.0", "@babel/generator@^7.7.2": + version "7.7.2" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.7.2.tgz#2f4852d04131a5e17ea4f6645488b5da66ebf3af" + integrity sha512-WthSArvAjYLz4TcbKOi88me+KmDJdKSlfwwN8CnUYn9jBkzhq0ZEPuBfkAWIvjJ3AdEV1Cf/+eSQTnp3IDJKlQ== dependencies: - "@babel/types" "^7.6.0" + "@babel/types" "^7.7.2" jsesc "^2.5.1" lodash "^4.17.13" 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== +"@babel/helper-annotate-as-pure@^7.0.0", "@babel/helper-annotate-as-pure@^7.7.0": + version "7.7.0" + resolved "https://registry.yarnpkg.com/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.7.0.tgz#efc54032d43891fe267679e63f6860aa7dbf4a5e" + integrity sha512-k50CQxMlYTYo+GGyUGFwpxKVtxVJi9yh61sXZji3zYHccK9RYliZGSTOgci85T+r+0VFN2nWbGM04PIqwfrpMg== dependencies: - "@babel/types" "^7.0.0" + "@babel/types" "^7.7.0" "@babel/helper-builder-binary-assignment-operator-visitor@^7.1.0": version "7.1.0" @@ -86,25 +84,33 @@ "@babel/traverse" "^7.4.4" "@babel/types" "^7.4.4" -"@babel/helper-create-class-features-plugin@^7.5.5": - version "7.6.0" - resolved "https://registry.yarnpkg.com/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.6.0.tgz#769711acca889be371e9bc2eb68641d55218021f" - integrity sha512-O1QWBko4fzGju6VoVvrZg0RROCVifcLxiApnGP3OWfWzvxRZFCoBD81K5ur5e3bVY2Vf/5rIJm8cqPKn8HUJng== +"@babel/helper-create-class-features-plugin@^7.7.0": + version "7.7.0" + resolved "https://registry.yarnpkg.com/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.7.0.tgz#bcdc223abbfdd386f94196ae2544987f8df775e8" + integrity sha512-MZiB5qvTWoyiFOgootmRSDV1udjIqJW/8lmxgzKq6oDqxdmHUjeP2ZUOmgHdYjmUVNABqRrHjYAYRvj8Eox/UA== dependencies: - "@babel/helper-function-name" "^7.1.0" - "@babel/helper-member-expression-to-functions" "^7.5.5" - "@babel/helper-optimise-call-expression" "^7.0.0" + "@babel/helper-function-name" "^7.7.0" + "@babel/helper-member-expression-to-functions" "^7.7.0" + "@babel/helper-optimise-call-expression" "^7.7.0" "@babel/helper-plugin-utils" "^7.0.0" - "@babel/helper-replace-supers" "^7.5.5" - "@babel/helper-split-export-declaration" "^7.4.4" + "@babel/helper-replace-supers" "^7.7.0" + "@babel/helper-split-export-declaration" "^7.7.0" -"@babel/helper-define-map@^7.5.5": - version "7.5.5" - resolved "https://registry.yarnpkg.com/@babel/helper-define-map/-/helper-define-map-7.5.5.tgz#3dec32c2046f37e09b28c93eb0b103fd2a25d369" - integrity sha512-fTfxx7i0B5NJqvUOBBGREnrqbTxRh7zinBANpZXAVDlsZxYdclDp467G1sQ8VZYMnAURY3RpBUAgOYT9GfzHBg== +"@babel/helper-create-regexp-features-plugin@^7.7.0": + version "7.7.0" + resolved "https://registry.yarnpkg.com/@babel/helper-create-regexp-features-plugin/-/helper-create-regexp-features-plugin-7.7.0.tgz#2e8badfe201cfafb5d930f46cf1e0b6f1cdcab23" + integrity sha512-ZhagAAVGD3L6MPM9/zZi7RRteonfBFLVUz3kjsnYsMAtr9hOJCKI9BAKIMpqn3NyWicPieoX779UL+7/3BEAOA== + dependencies: + "@babel/helper-regex" "^7.4.4" + regexpu-core "^4.6.0" + +"@babel/helper-define-map@^7.7.0": + version "7.7.0" + resolved "https://registry.yarnpkg.com/@babel/helper-define-map/-/helper-define-map-7.7.0.tgz#60b0e9fd60def9de5054c38afde8c8ee409c7529" + integrity sha512-kPKWPb0dMpZi+ov1hJiwse9dWweZsz3V9rP4KdytnX1E7z3cTNmFGglwklzFPuqIcHLIY3bgKSs4vkwXXdflQA== dependencies: - "@babel/helper-function-name" "^7.1.0" - "@babel/types" "^7.5.5" + "@babel/helper-function-name" "^7.7.0" + "@babel/types" "^7.7.0" lodash "^4.17.13" "@babel/helper-explode-assignable-expression@^7.1.0": @@ -115,61 +121,61 @@ "@babel/traverse" "^7.1.0" "@babel/types" "^7.0.0" -"@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== +"@babel/helper-function-name@^7.7.0": + version "7.7.0" + resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.7.0.tgz#44a5ad151cfff8ed2599c91682dda2ec2c8430a3" + integrity sha512-tDsJgMUAP00Ugv8O2aGEua5I2apkaQO7lBGUq1ocwN3G23JE5Dcq0uh3GvFTChPa4b40AWiAsLvCZOA2rdnQ7Q== dependencies: - "@babel/helper-get-function-arity" "^7.0.0" - "@babel/template" "^7.1.0" - "@babel/types" "^7.0.0" + "@babel/helper-get-function-arity" "^7.7.0" + "@babel/template" "^7.7.0" + "@babel/types" "^7.7.0" -"@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== +"@babel/helper-get-function-arity@^7.0.0", "@babel/helper-get-function-arity@^7.7.0": + version "7.7.0" + resolved "https://registry.yarnpkg.com/@babel/helper-get-function-arity/-/helper-get-function-arity-7.7.0.tgz#c604886bc97287a1d1398092bc666bc3d7d7aa2d" + integrity sha512-tLdojOTz4vWcEnHWHCuPN5P85JLZWbm5Fx5ZsMEMPhF3Uoe3O7awrbM2nQ04bDOUToH/2tH/ezKEOR8zEYzqyw== dependencies: - "@babel/types" "^7.0.0" + "@babel/types" "^7.7.0" -"@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== +"@babel/helper-hoist-variables@^7.4.4", "@babel/helper-hoist-variables@^7.7.0": + version "7.7.0" + resolved "https://registry.yarnpkg.com/@babel/helper-hoist-variables/-/helper-hoist-variables-7.7.0.tgz#b4552e4cfe5577d7de7b183e193e84e4ec538c81" + integrity sha512-LUe/92NqsDAkJjjCEWkNe+/PcpnisvnqdlRe19FahVapa4jndeuJ+FBiTX1rcAKWKcJGE+C3Q3tuEuxkSmCEiQ== dependencies: - "@babel/types" "^7.4.4" + "@babel/types" "^7.7.0" -"@babel/helper-member-expression-to-functions@^7.5.5": - version "7.5.5" - resolved "https://registry.yarnpkg.com/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.5.5.tgz#1fb5b8ec4453a93c439ee9fe3aeea4a84b76b590" - integrity sha512-5qZ3D1uMclSNqYcXqiHoA0meVdv+xUEex9em2fqMnrk/scphGlGgg66zjMrPJESPwrFJ6sbfFQYUSa0Mz7FabA== +"@babel/helper-member-expression-to-functions@^7.7.0": + version "7.7.0" + resolved "https://registry.yarnpkg.com/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.7.0.tgz#472b93003a57071f95a541ea6c2b098398bcad8a" + integrity sha512-QaCZLO2RtBcmvO/ekOLp8p7R5X2JriKRizeDpm5ChATAFWrrYDcDxPuCIBXKyBjY+i1vYSdcUTMIb8psfxHDPA== dependencies: - "@babel/types" "^7.5.5" + "@babel/types" "^7.7.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== +"@babel/helper-module-imports@^7.0.0", "@babel/helper-module-imports@^7.7.0": + version "7.7.0" + resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.7.0.tgz#99c095889466e5f7b6d66d98dffc58baaf42654d" + integrity sha512-Dv3hLKIC1jyfTkClvyEkYP2OlkzNvWs5+Q8WgPbxM5LMeorons7iPP91JM+DU7tRbhqA1ZeooPaMFvQrn23RHw== dependencies: - "@babel/types" "^7.0.0" + "@babel/types" "^7.7.0" -"@babel/helper-module-transforms@^7.1.0", "@babel/helper-module-transforms@^7.4.4": - version "7.5.5" - resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.5.5.tgz#f84ff8a09038dcbca1fd4355661a500937165b4a" - integrity sha512-jBeCvETKuJqeiaCdyaheF40aXnnU1+wkSiUs/IQg3tB85up1LyL8x77ClY8qJpuRJUcXQo+ZtdNESmZl4j56Pw== +"@babel/helper-module-transforms@^7.1.0", "@babel/helper-module-transforms@^7.7.0": + version "7.7.0" + resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.7.0.tgz#154a69f0c5b8fd4d39e49750ff7ac4faa3f36786" + integrity sha512-rXEefBuheUYQyX4WjV19tuknrJFwyKw0HgzRwbkyTbB+Dshlq7eqkWbyjzToLrMZk/5wKVKdWFluiAsVkHXvuQ== dependencies: - "@babel/helper-module-imports" "^7.0.0" - "@babel/helper-simple-access" "^7.1.0" - "@babel/helper-split-export-declaration" "^7.4.4" - "@babel/template" "^7.4.4" - "@babel/types" "^7.5.5" + "@babel/helper-module-imports" "^7.7.0" + "@babel/helper-simple-access" "^7.7.0" + "@babel/helper-split-export-declaration" "^7.7.0" + "@babel/template" "^7.7.0" + "@babel/types" "^7.7.0" lodash "^4.17.13" -"@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== +"@babel/helper-optimise-call-expression@^7.7.0": + version "7.7.0" + resolved "https://registry.yarnpkg.com/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.7.0.tgz#4f66a216116a66164135dc618c5d8b7a959f9365" + integrity sha512-48TeqmbazjNU/65niiiJIJRc5JozB8acui1OS7bSd6PgxfuovWsvjfWSzlgx+gPFdVveNzUdpdIg5l56Pl5jqg== dependencies: - "@babel/types" "^7.0.0" + "@babel/types" "^7.7.0" "@babel/helper-plugin-utils@^7.0.0": version "7.0.0" @@ -183,60 +189,60 @@ dependencies: lodash "^4.17.13" -"@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.5.5": - version "7.5.5" - resolved "https://registry.yarnpkg.com/@babel/helper-replace-supers/-/helper-replace-supers-7.5.5.tgz#f84ce43df031222d2bad068d2626cb5799c34bc2" - integrity sha512-XvRFWrNnlsow2u7jXDuH4jDDctkxbS7gXssrP4q2nUD606ukXHRvydj346wmNg+zAgpFx4MWf4+usfC93bElJg== - dependencies: - "@babel/helper-member-expression-to-functions" "^7.5.5" - "@babel/helper-optimise-call-expression" "^7.0.0" - "@babel/traverse" "^7.5.5" - "@babel/types" "^7.5.5" - -"@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.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.4.4" - -"@babel/helper-wrap-function@^7.1.0": - 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.2.0" - -"@babel/helpers@^7.6.0": - version "7.6.0" - resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.6.0.tgz#21961d16c6a3c3ab597325c34c465c0887d31c6e" - integrity sha512-W9kao7OBleOjfXtFGgArGRX6eCP0UEcA2ZWEWNkJdRZnHhW4eEbeswbG3EwaRsnQUAEGWYgMq1HsIXuNNNy2eQ== - dependencies: - "@babel/template" "^7.6.0" - "@babel/traverse" "^7.6.0" - "@babel/types" "^7.6.0" +"@babel/helper-remap-async-to-generator@^7.7.0": + version "7.7.0" + resolved "https://registry.yarnpkg.com/@babel/helper-remap-async-to-generator/-/helper-remap-async-to-generator-7.7.0.tgz#4d69ec653e8bff5bce62f5d33fc1508f223c75a7" + integrity sha512-pHx7RN8X0UNHPB/fnuDnRXVZ316ZigkO8y8D835JlZ2SSdFKb6yH9MIYRU4fy/KPe5sPHDFOPvf8QLdbAGGiyw== + dependencies: + "@babel/helper-annotate-as-pure" "^7.7.0" + "@babel/helper-wrap-function" "^7.7.0" + "@babel/template" "^7.7.0" + "@babel/traverse" "^7.7.0" + "@babel/types" "^7.7.0" + +"@babel/helper-replace-supers@^7.5.5", "@babel/helper-replace-supers@^7.7.0": + version "7.7.0" + resolved "https://registry.yarnpkg.com/@babel/helper-replace-supers/-/helper-replace-supers-7.7.0.tgz#d5365c8667fe7cbd13b8ddddceb9bd7f2b387512" + integrity sha512-5ALYEul5V8xNdxEeWvRsBzLMxQksT7MaStpxjJf9KsnLxpAKBtfw5NeMKZJSYDa0lKdOcy0g+JT/f5mPSulUgg== + dependencies: + "@babel/helper-member-expression-to-functions" "^7.7.0" + "@babel/helper-optimise-call-expression" "^7.7.0" + "@babel/traverse" "^7.7.0" + "@babel/types" "^7.7.0" + +"@babel/helper-simple-access@^7.7.0": + version "7.7.0" + resolved "https://registry.yarnpkg.com/@babel/helper-simple-access/-/helper-simple-access-7.7.0.tgz#97a8b6c52105d76031b86237dc1852b44837243d" + integrity sha512-AJ7IZD7Eem3zZRuj5JtzFAptBw7pMlS3y8Qv09vaBWoFsle0d1kAn5Wq6Q9MyBXITPOKnxwkZKoAm4bopmv26g== + dependencies: + "@babel/template" "^7.7.0" + "@babel/types" "^7.7.0" + +"@babel/helper-split-export-declaration@^7.7.0": + version "7.7.0" + resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.7.0.tgz#1365e74ea6c614deeb56ebffabd71006a0eb2300" + integrity sha512-HgYSI8rH08neWlAH3CcdkFg9qX9YsZysZI5GD8LjhQib/mM0jGOZOVkoUiiV2Hu978fRtjtsGsW6w0pKHUWtqA== + dependencies: + "@babel/types" "^7.7.0" + +"@babel/helper-wrap-function@^7.7.0": + version "7.7.0" + resolved "https://registry.yarnpkg.com/@babel/helper-wrap-function/-/helper-wrap-function-7.7.0.tgz#15af3d3e98f8417a60554acbb6c14e75e0b33b74" + integrity sha512-sd4QjeMgQqzshSjecZjOp8uKfUtnpmCyQhKQrVJBBgeHAB/0FPi33h3AbVlVp07qQtMD4QgYSzaMI7VwncNK/w== + dependencies: + "@babel/helper-function-name" "^7.7.0" + "@babel/template" "^7.7.0" + "@babel/traverse" "^7.7.0" + "@babel/types" "^7.7.0" + +"@babel/helpers@^7.7.0": + version "7.7.0" + resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.7.0.tgz#359bb5ac3b4726f7c1fde0ec75f64b3f4275d60b" + integrity sha512-VnNwL4YOhbejHb7x/b5F39Zdg5vIQpUUNzJwx0ww1EcVRt41bbGRZWhAURrfY32T5zTT3qwNOQFWpn+P0i0a2g== + dependencies: + "@babel/template" "^7.7.0" + "@babel/traverse" "^7.7.0" + "@babel/types" "^7.7.0" "@babel/highlight@^7.0.0": version "7.5.0" @@ -247,32 +253,32 @@ esutils "^2.0.2" js-tokens "^4.0.0" -"@babel/parser@^7.0.0", "@babel/parser@^7.1.0", "@babel/parser@^7.4.3", "@babel/parser@^7.6.0": - version "7.6.0" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.6.0.tgz#3e05d0647432a8326cb28d0de03895ae5a57f39b" - integrity sha512-+o2q111WEx4srBs7L9eJmcwi655eD8sXniLqMB93TBK9GrNzGrxDWSjiqz2hLU0Ha8MTXFIP0yd9fNdP+m43ZQ== +"@babel/parser@^7.0.0", "@babel/parser@^7.1.0", "@babel/parser@^7.4.3", "@babel/parser@^7.7.0", "@babel/parser@^7.7.2": + version "7.7.2" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.7.2.tgz#ea8334dc77416bfd9473eb470fd00d8245b3943b" + integrity sha512-DDaR5e0g4ZTb9aP7cpSZLkACEBdoLGwJDWgHtBhrGX7Q1RjhdoMOfexICj5cqTAtpowjGQWfcvfnQG7G2kAB5w== -"@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== +"@babel/plugin-proposal-async-generator-functions@^7.7.0": + version "7.7.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-async-generator-functions/-/plugin-proposal-async-generator-functions-7.7.0.tgz#83ef2d6044496b4c15d8b4904e2219e6dccc6971" + integrity sha512-ot/EZVvf3mXtZq0Pd0+tSOfGWMizqmOohXmNZg6LNFjHOV+wOPv7BvVYh8oPR8LhpIP3ye8nNooKL50YRWxpYA== dependencies: "@babel/helper-plugin-utils" "^7.0.0" - "@babel/helper-remap-async-to-generator" "^7.1.0" + "@babel/helper-remap-async-to-generator" "^7.7.0" "@babel/plugin-syntax-async-generators" "^7.2.0" -"@babel/plugin-proposal-class-properties@^7.5.5": - version "7.5.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-class-properties/-/plugin-proposal-class-properties-7.5.5.tgz#a974cfae1e37c3110e71f3c6a2e48b8e71958cd4" - integrity sha512-AF79FsnWFxjlaosgdi421vmYG6/jg79bVD0dpD44QdgobzHKuLZ6S3vl8la9qIeSwGi8i1fS0O1mfuDAAdo1/A== +"@babel/plugin-proposal-class-properties@^7.7.0": + version "7.7.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-class-properties/-/plugin-proposal-class-properties-7.7.0.tgz#ac54e728ecf81d90e8f4d2a9c05a890457107917" + integrity sha512-tufDcFA1Vj+eWvwHN+jvMN6QsV5o+vUlytNKrbMiCeDL0F2j92RURzUsUMWE5EJkLyWxjdUslCsMQa9FWth16A== dependencies: - "@babel/helper-create-class-features-plugin" "^7.5.5" + "@babel/helper-create-class-features-plugin" "^7.7.0" "@babel/helper-plugin-utils" "^7.0.0" -"@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== +"@babel/plugin-proposal-dynamic-import@^7.7.0": + version "7.7.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-dynamic-import/-/plugin-proposal-dynamic-import-7.7.0.tgz#dc02a8bad8d653fb59daf085516fa416edd2aa7f" + integrity sha512-7poL3Xi+QFPC7sGAzEIbXUyYzGJwbc2+gSD0AkiC5k52kH2cqHdqxm5hNFfLW3cRSTcx9bN0Fl7/6zWcLLnKAQ== dependencies: "@babel/helper-plugin-utils" "^7.0.0" "@babel/plugin-syntax-dynamic-import" "^7.2.0" @@ -309,10 +315,10 @@ "@babel/helper-plugin-utils" "^7.0.0" "@babel/plugin-syntax-numeric-separator" "^7.2.0" -"@babel/plugin-proposal-object-rest-spread@^7.5.5": - version "7.5.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.5.5.tgz#61939744f71ba76a3ae46b5eea18a54c16d22e58" - integrity sha512-F2DxJJSQ7f64FyTVl5cw/9MWn6naXGdk3Q3UhDbFEEHv+EilCPoeRD3Zh/Utx1CJz4uyKlQ4uH+bJPbEhMV7Zw== +"@babel/plugin-proposal-object-rest-spread@^7.6.2": + version "7.6.2" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.6.2.tgz#8ffccc8f3a6545e9f78988b6bf4fe881b88e8096" + integrity sha512-LDBXlmADCsMZV1Y9OQwMc0MyGZ8Ta/zlD9N67BfQT8uYwkRswiu2hU6nJKrjrt/58aH/vqfQlR/9yId/7A2gWw== dependencies: "@babel/helper-plugin-utils" "^7.0.0" "@babel/plugin-syntax-object-rest-spread" "^7.2.0" @@ -333,14 +339,13 @@ "@babel/helper-plugin-utils" "^7.0.0" "@babel/plugin-syntax-optional-chaining" "^7.2.0" -"@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== +"@babel/plugin-proposal-unicode-property-regex@^7.7.0": + version "7.7.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-unicode-property-regex/-/plugin-proposal-unicode-property-regex-7.7.0.tgz#549fe1717a1bd0a2a7e63163841cb37e78179d5d" + integrity sha512-mk34H+hp7kRBWJOOAR0ZMGCydgKMD4iN9TpDRp3IIcbunltxEY89XSimc6WbtSLCDrwcdy/EEw7h5CFCzxTchw== dependencies: + "@babel/helper-create-regexp-features-plugin" "^7.7.0" "@babel/helper-plugin-utils" "^7.0.0" - "@babel/helper-regex" "^7.4.4" - regexpu-core "^4.5.4" "@babel/plugin-syntax-async-generators@^7.2.0": version "7.2.0" @@ -412,6 +417,13 @@ dependencies: "@babel/helper-plugin-utils" "^7.0.0" +"@babel/plugin-syntax-top-level-await@^7.7.0": + version "7.7.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-top-level-await/-/plugin-syntax-top-level-await-7.7.0.tgz#f5699549f50bbe8d12b1843a4e82f0a37bb65f4d" + integrity sha512-hi8FUNiFIY1fnUI2n1ViB1DR0R4QeK4iHcTlW6aJkrPoTdb8Rf1EMQ6GT3f67DDkYyWgew9DFoOZ6gOoEsdzTA== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + "@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" @@ -419,14 +431,14 @@ dependencies: "@babel/helper-plugin-utils" "^7.0.0" -"@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== +"@babel/plugin-transform-async-to-generator@^7.7.0": + version "7.7.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-async-to-generator/-/plugin-transform-async-to-generator-7.7.0.tgz#e2b84f11952cf5913fe3438b7d2585042772f492" + integrity sha512-vLI2EFLVvRBL3d8roAMqtVY0Bm9C1QzLkdS57hiKrjUBSqsQYrBsMCeOg/0KK7B0eK9V71J5mWcha9yyoI2tZw== dependencies: - "@babel/helper-module-imports" "^7.0.0" + "@babel/helper-module-imports" "^7.7.0" "@babel/helper-plugin-utils" "^7.0.0" - "@babel/helper-remap-async-to-generator" "^7.1.0" + "@babel/helper-remap-async-to-generator" "^7.7.0" "@babel/plugin-transform-block-scoped-functions@^7.2.0": version "7.2.0" @@ -435,26 +447,26 @@ dependencies: "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-transform-block-scoping@^7.6.0": - version "7.6.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.6.0.tgz#c49e21228c4bbd4068a35667e6d951c75439b1dc" - integrity sha512-tIt4E23+kw6TgL/edACZwP1OUKrjOTyMrFMLoT5IOFrfMRabCgekjqFd5o6PaAMildBu46oFkekIdMuGkkPEpA== +"@babel/plugin-transform-block-scoping@^7.6.3": + version "7.6.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.6.3.tgz#6e854e51fbbaa84351b15d4ddafe342f3a5d542a" + integrity sha512-7hvrg75dubcO3ZI2rjYTzUrEuh1E9IyDEhhB6qfcooxhDA33xx2MasuLVgdxzcP6R/lipAC6n9ub9maNW6RKdw== dependencies: "@babel/helper-plugin-utils" "^7.0.0" lodash "^4.17.13" -"@babel/plugin-transform-classes@^7.5.5": - version "7.5.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-classes/-/plugin-transform-classes-7.5.5.tgz#d094299d9bd680a14a2a0edae38305ad60fb4de9" - integrity sha512-U2htCNK/6e9K7jGyJ++1p5XRU+LJjrwtoiVn9SzRlDT2KubcZ11OOwy3s24TjHxPgxNwonCYP7U2K51uVYCMDg== +"@babel/plugin-transform-classes@^7.7.0": + version "7.7.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-classes/-/plugin-transform-classes-7.7.0.tgz#b411ecc1b8822d24b81e5d184f24149136eddd4a" + integrity sha512-/b3cKIZwGeUesZheU9jNYcwrEA7f/Bo4IdPmvp7oHgvks2majB5BoT5byAql44fiNQYOPzhk2w8DbgfuafkMoA== dependencies: - "@babel/helper-annotate-as-pure" "^7.0.0" - "@babel/helper-define-map" "^7.5.5" - "@babel/helper-function-name" "^7.1.0" - "@babel/helper-optimise-call-expression" "^7.0.0" + "@babel/helper-annotate-as-pure" "^7.7.0" + "@babel/helper-define-map" "^7.7.0" + "@babel/helper-function-name" "^7.7.0" + "@babel/helper-optimise-call-expression" "^7.7.0" "@babel/helper-plugin-utils" "^7.0.0" - "@babel/helper-replace-supers" "^7.5.5" - "@babel/helper-split-export-declaration" "^7.4.4" + "@babel/helper-replace-supers" "^7.7.0" + "@babel/helper-split-export-declaration" "^7.7.0" globals "^11.1.0" "@babel/plugin-transform-computed-properties@^7.2.0": @@ -471,14 +483,13 @@ dependencies: "@babel/helper-plugin-utils" "^7.0.0" -"@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== +"@babel/plugin-transform-dotall-regex@^7.7.0": + version "7.7.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-dotall-regex/-/plugin-transform-dotall-regex-7.7.0.tgz#c5c9ecacab3a5e0c11db6981610f0c32fd698b3b" + integrity sha512-3QQlF7hSBnSuM1hQ0pS3pmAbWLax/uGNCbPBND9y+oJ4Y776jsyujG2k0Sn2Aj2a0QwVOiOFL5QVPA7spjvzSA== dependencies: + "@babel/helper-create-regexp-features-plugin" "^7.7.0" "@babel/helper-plugin-utils" "^7.0.0" - "@babel/helper-regex" "^7.4.4" - regexpu-core "^4.5.4" "@babel/plugin-transform-duplicate-keys@^7.5.0": version "7.5.0" @@ -510,12 +521,12 @@ dependencies: "@babel/helper-plugin-utils" "^7.0.0" -"@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== +"@babel/plugin-transform-function-name@^7.7.0": + version "7.7.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-function-name/-/plugin-transform-function-name-7.7.0.tgz#0fa786f1eef52e3b7d4fc02e54b2129de8a04c2a" + integrity sha512-P5HKu0d9+CzZxP5jcrWdpe7ZlFDe24bmqP6a6X8BHEBl/eizAsY8K6LX8LASZL0Jxdjm5eEfzp+FIrxCm/p8bA== dependencies: - "@babel/helper-function-name" "^7.1.0" + "@babel/helper-function-name" "^7.7.0" "@babel/helper-plugin-utils" "^7.0.0" "@babel/plugin-transform-literals@^7.2.0": @@ -541,39 +552,39 @@ "@babel/helper-plugin-utils" "^7.0.0" babel-plugin-dynamic-import-node "^2.3.0" -"@babel/plugin-transform-modules-commonjs@^7.6.0": - version "7.6.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.6.0.tgz#39dfe957de4420445f1fcf88b68a2e4aa4515486" - integrity sha512-Ma93Ix95PNSEngqomy5LSBMAQvYKVe3dy+JlVJSHEXZR5ASL9lQBedMiCyVtmTLraIDVRE3ZjTZvmXXD2Ozw3g== +"@babel/plugin-transform-modules-commonjs@^7.7.0": + version "7.7.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.7.0.tgz#3e5ffb4fd8c947feede69cbe24c9554ab4113fe3" + integrity sha512-KEMyWNNWnjOom8vR/1+d+Ocz/mILZG/eyHHO06OuBQ2aNhxT62fr4y6fGOplRx+CxCSp3IFwesL8WdINfY/3kg== dependencies: - "@babel/helper-module-transforms" "^7.4.4" + "@babel/helper-module-transforms" "^7.7.0" "@babel/helper-plugin-utils" "^7.0.0" - "@babel/helper-simple-access" "^7.1.0" + "@babel/helper-simple-access" "^7.7.0" babel-plugin-dynamic-import-node "^2.3.0" -"@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== +"@babel/plugin-transform-modules-systemjs@^7.7.0": + version "7.7.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.7.0.tgz#9baf471213af9761c1617bb12fd278e629041417" + integrity sha512-ZAuFgYjJzDNv77AjXRqzQGlQl4HdUM6j296ee4fwKVZfhDR9LAGxfvXjBkb06gNETPnN0sLqRm9Gxg4wZH6dXg== dependencies: - "@babel/helper-hoist-variables" "^7.4.4" + "@babel/helper-hoist-variables" "^7.7.0" "@babel/helper-plugin-utils" "^7.0.0" babel-plugin-dynamic-import-node "^2.3.0" -"@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== +"@babel/plugin-transform-modules-umd@^7.7.0": + version "7.7.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-umd/-/plugin-transform-modules-umd-7.7.0.tgz#d62c7da16670908e1d8c68ca0b5d4c0097b69966" + integrity sha512-u7eBA03zmUswQ9LQ7Qw0/ieC1pcAkbp5OQatbWUzY1PaBccvuJXUkYzoN1g7cqp7dbTu6Dp9bXyalBvD04AANA== dependencies: - "@babel/helper-module-transforms" "^7.1.0" + "@babel/helper-module-transforms" "^7.7.0" "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-transform-named-capturing-groups-regex@^7.6.0": - version "7.6.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-named-capturing-groups-regex/-/plugin-transform-named-capturing-groups-regex-7.6.0.tgz#1e6e663097813bb4f53d42df0750cf28ad3bb3f1" - integrity sha512-jem7uytlmrRl3iCAuQyw8BpB4c4LWvSpvIeXKpMb+7j84lkx4m4mYr5ErAcmN5KM7B6BqrAvRGjBIbbzqCczew== +"@babel/plugin-transform-named-capturing-groups-regex@^7.7.0": + version "7.7.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-named-capturing-groups-regex/-/plugin-transform-named-capturing-groups-regex-7.7.0.tgz#358e6fd869b9a4d8f5cbc79e4ed4fc340e60dcaf" + integrity sha512-+SicSJoKouPctL+j1pqktRVCgy+xAch1hWWTMy13j0IflnyNjaoskj+DwRQFimHbLqO3sq2oN2CXMvXq3Bgapg== dependencies: - regexp-tree "^0.1.13" + "@babel/helper-create-regexp-features-plugin" "^7.7.0" "@babel/plugin-transform-new-target@^7.4.4": version "7.4.4" @@ -606,10 +617,10 @@ dependencies: "@babel/helper-plugin-utils" "^7.0.0" -"@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== +"@babel/plugin-transform-regenerator@^7.7.0": + version "7.7.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-regenerator/-/plugin-transform-regenerator-7.7.0.tgz#f1b20b535e7716b622c99e989259d7dd942dd9cc" + integrity sha512-AXmvnC+0wuj/cFkkS/HFHIojxH3ffSXE+ttulrqWjZZRaUOonfJc60e1wSNT4rV8tIunvu/R3wCp71/tLAa9xg== dependencies: regenerator-transform "^0.14.0" @@ -620,10 +631,10 @@ dependencies: "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-transform-runtime@^7.6.0": - version "7.6.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-runtime/-/plugin-transform-runtime-7.6.0.tgz#85a3cce402b28586138e368fce20ab3019b9713e" - integrity sha512-Da8tMf7uClzwUm/pnJ1S93m/aRXmoYNDD7TkHua8xBDdaAs54uZpTWvEt6NGwmoVMb9mZbntfTqmG2oSzN/7Vg== +"@babel/plugin-transform-runtime@^7.6.2": + version "7.6.2" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-runtime/-/plugin-transform-runtime-7.6.2.tgz#2669f67c1fae0ae8d8bf696e4263ad52cb98b6f8" + integrity sha512-cqULw/QB4yl73cS5Y0TZlQSjDvNkzDbu0FurTZyHlJpWE5T3PCMdnyV+xXoH1opr1ldyHODe3QAX3OMAii5NxA== dependencies: "@babel/helper-module-imports" "^7.0.0" "@babel/helper-plugin-utils" "^7.0.0" @@ -637,10 +648,10 @@ dependencies: "@babel/helper-plugin-utils" "^7.0.0" -"@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== +"@babel/plugin-transform-spread@^7.6.2": + version "7.6.2" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-spread/-/plugin-transform-spread-7.6.2.tgz#fc77cf798b24b10c46e1b51b1b88c2bf661bb8dd" + integrity sha512-DpSvPFryKdK1x+EDJYCy28nmAaIMdxmhot62jAXF/o99iA33Zj2Lmcp3vDmz+MUh0LNYVPvfj5iC3feb3/+PFg== dependencies: "@babel/helper-plugin-utils" "^7.0.0" @@ -667,65 +678,65 @@ dependencies: "@babel/helper-plugin-utils" "^7.0.0" -"@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== +"@babel/plugin-transform-unicode-regex@^7.7.0": + version "7.7.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-unicode-regex/-/plugin-transform-unicode-regex-7.7.0.tgz#743d9bcc44080e3cc7d49259a066efa30f9187a3" + integrity sha512-RrThb0gdrNwFAqEAAx9OWgtx6ICK69x7i9tCnMdVrxQwSDp/Abu9DXFU5Hh16VP33Rmxh04+NGW28NsIkFvFKA== dependencies: + "@babel/helper-create-regexp-features-plugin" "^7.7.0" "@babel/helper-plugin-utils" "^7.0.0" - "@babel/helper-regex" "^7.4.4" - regexpu-core "^4.5.4" -"@babel/preset-env@^7.6.0": - version "7.6.0" - resolved "https://registry.yarnpkg.com/@babel/preset-env/-/preset-env-7.6.0.tgz#aae4141c506100bb2bfaa4ac2a5c12b395619e50" - integrity sha512-1efzxFv/TcPsNXlRhMzRnkBFMeIqBBgzwmZwlFDw5Ubj0AGLeufxugirwZmkkX/ayi3owsSqoQ4fw8LkfK9SYg== +"@babel/preset-env@^7.7.1": + version "7.7.1" + resolved "https://registry.yarnpkg.com/@babel/preset-env/-/preset-env-7.7.1.tgz#04a2ff53552c5885cf1083e291c8dd5490f744bb" + integrity sha512-/93SWhi3PxcVTDpSqC+Dp4YxUu3qZ4m7I76k0w73wYfn7bGVuRIO4QUz95aJksbS+AD1/mT1Ie7rbkT0wSplaA== dependencies: - "@babel/helper-module-imports" "^7.0.0" + "@babel/helper-module-imports" "^7.7.0" "@babel/helper-plugin-utils" "^7.0.0" - "@babel/plugin-proposal-async-generator-functions" "^7.2.0" - "@babel/plugin-proposal-dynamic-import" "^7.5.0" + "@babel/plugin-proposal-async-generator-functions" "^7.7.0" + "@babel/plugin-proposal-dynamic-import" "^7.7.0" "@babel/plugin-proposal-json-strings" "^7.2.0" - "@babel/plugin-proposal-object-rest-spread" "^7.5.5" + "@babel/plugin-proposal-object-rest-spread" "^7.6.2" "@babel/plugin-proposal-optional-catch-binding" "^7.2.0" - "@babel/plugin-proposal-unicode-property-regex" "^7.4.4" + "@babel/plugin-proposal-unicode-property-regex" "^7.7.0" "@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-syntax-top-level-await" "^7.7.0" "@babel/plugin-transform-arrow-functions" "^7.2.0" - "@babel/plugin-transform-async-to-generator" "^7.5.0" + "@babel/plugin-transform-async-to-generator" "^7.7.0" "@babel/plugin-transform-block-scoped-functions" "^7.2.0" - "@babel/plugin-transform-block-scoping" "^7.6.0" - "@babel/plugin-transform-classes" "^7.5.5" + "@babel/plugin-transform-block-scoping" "^7.6.3" + "@babel/plugin-transform-classes" "^7.7.0" "@babel/plugin-transform-computed-properties" "^7.2.0" "@babel/plugin-transform-destructuring" "^7.6.0" - "@babel/plugin-transform-dotall-regex" "^7.4.4" + "@babel/plugin-transform-dotall-regex" "^7.7.0" "@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-function-name" "^7.7.0" "@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.6.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.6.0" + "@babel/plugin-transform-modules-commonjs" "^7.7.0" + "@babel/plugin-transform-modules-systemjs" "^7.7.0" + "@babel/plugin-transform-modules-umd" "^7.7.0" + "@babel/plugin-transform-named-capturing-groups-regex" "^7.7.0" "@babel/plugin-transform-new-target" "^7.4.4" "@babel/plugin-transform-object-super" "^7.5.5" "@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-regenerator" "^7.7.0" "@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-spread" "^7.6.2" "@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.6.0" + "@babel/plugin-transform-unicode-regex" "^7.7.0" + "@babel/types" "^7.7.1" browserslist "^4.6.0" core-js-compat "^3.1.1" invariant "^2.2.2" @@ -740,52 +751,52 @@ "@babel/helper-plugin-utils" "^7.0.0" "@babel/plugin-transform-flow-strip-types" "^7.0.0" -"@babel/register@^7.6.0": - version "7.6.0" - resolved "https://registry.yarnpkg.com/@babel/register/-/register-7.6.0.tgz#76b6f466714680f4becafd45beeb2a7b87431abf" - integrity sha512-78BomdN8el+x/nkup9KwtjJXuptW5oXMFmP11WoM2VJBjxrKv4grC3qjpLL8RGGUYUGsm57xnjYFM2uom+jWUQ== +"@babel/register@^7.7.0": + version "7.7.0" + resolved "https://registry.yarnpkg.com/@babel/register/-/register-7.7.0.tgz#4e23ecf840296ef79c605baaa5c89e1a2426314b" + integrity sha512-HV3GJzTvSoyOMWGYn2TAh6uL6g+gqKTgEZ99Q3+X9UURT1VPT/WcU46R61XftIc5rXytcOHZ4Z0doDlsjPomIg== dependencies: find-cache-dir "^2.0.0" lodash "^4.17.13" - mkdirp "^0.5.1" + make-dir "^2.1.0" pirates "^4.0.0" - source-map-support "^0.5.9" + source-map-support "^0.5.16" -"@babel/runtime@^7.6.0": - version "7.6.0" - resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.6.0.tgz#4fc1d642a9fd0299754e8b5de62c631cf5568205" - integrity sha512-89eSBLJsxNxOERC0Op4vd+0Bqm6wRMqMbFtV3i0/fbaWw/mJ8Q3eBvgX0G4SyrOOLCtbu98HspF8o09MRT+KzQ== +"@babel/runtime@^7.7.2": + version "7.7.2" + resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.7.2.tgz#111a78002a5c25fc8e3361bedc9529c696b85a6a" + integrity sha512-JONRbXbTXc9WQE2mAZd1p0Z3DZ/6vaQIkgYMSTP3KjRCyd7rCZCcfhCyX+YjwcKxcZ82UrxbRD358bpExNgrjw== dependencies: regenerator-runtime "^0.13.2" -"@babel/template@^7.1.0", "@babel/template@^7.4.0", "@babel/template@^7.4.4", "@babel/template@^7.6.0": - version "7.6.0" - resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.6.0.tgz#7f0159c7f5012230dad64cca42ec9bdb5c9536e6" - integrity sha512-5AEH2EXD8euCk446b7edmgFdub/qfH1SN6Nii3+fyXP807QRx9Q73A2N5hNwRRslC2H9sNzaFhsPubkS4L8oNQ== +"@babel/template@^7.4.0", "@babel/template@^7.7.0": + version "7.7.0" + resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.7.0.tgz#4fadc1b8e734d97f56de39c77de76f2562e597d0" + integrity sha512-OKcwSYOW1mhWbnTBgQY5lvg1Fxg+VyfQGjcBduZFljfc044J5iDlnDSfhQ867O17XHiSCxYHUxHg2b7ryitbUQ== dependencies: "@babel/code-frame" "^7.0.0" - "@babel/parser" "^7.6.0" - "@babel/types" "^7.6.0" + "@babel/parser" "^7.7.0" + "@babel/types" "^7.7.0" -"@babel/traverse@^7.0.0", "@babel/traverse@^7.1.0", "@babel/traverse@^7.4.3", "@babel/traverse@^7.4.4", "@babel/traverse@^7.5.5", "@babel/traverse@^7.6.0": - version "7.6.0" - resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.6.0.tgz#389391d510f79be7ce2ddd6717be66d3fed4b516" - integrity sha512-93t52SaOBgml/xY74lsmt7xOR4ufYvhb5c5qiM6lu4J/dWGMAfAh6eKw4PjLes6DI6nQgearoxnFJk60YchpvQ== +"@babel/traverse@^7.0.0", "@babel/traverse@^7.1.0", "@babel/traverse@^7.4.3", "@babel/traverse@^7.4.4", "@babel/traverse@^7.7.0", "@babel/traverse@^7.7.2": + version "7.7.2" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.7.2.tgz#ef0a65e07a2f3c550967366b3d9b62a2dcbeae09" + integrity sha512-TM01cXib2+rgIZrGJOLaHV/iZUAxf4A0dt5auY6KNZ+cm6aschuJGqKJM3ROTt3raPUdIDk9siAufIFEleRwtw== dependencies: "@babel/code-frame" "^7.5.5" - "@babel/generator" "^7.6.0" - "@babel/helper-function-name" "^7.1.0" - "@babel/helper-split-export-declaration" "^7.4.4" - "@babel/parser" "^7.6.0" - "@babel/types" "^7.6.0" + "@babel/generator" "^7.7.2" + "@babel/helper-function-name" "^7.7.0" + "@babel/helper-split-export-declaration" "^7.7.0" + "@babel/parser" "^7.7.2" + "@babel/types" "^7.7.2" debug "^4.1.0" globals "^11.1.0" lodash "^4.17.13" -"@babel/types@^7.0.0", "@babel/types@^7.2.0", "@babel/types@^7.3.0", "@babel/types@^7.4.0", "@babel/types@^7.4.4", "@babel/types@^7.5.5", "@babel/types@^7.6.0": - version "7.6.1" - resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.6.1.tgz#53abf3308add3ac2a2884d539151c57c4b3ac648" - integrity sha512-X7gdiuaCmA0uRjCmRtYJNAVCc/q+5xSgsfKJHqMN4iNLILX39677fJE1O40arPMh0TTtS9ItH67yre6c7k6t0g== +"@babel/types@^7.0.0", "@babel/types@^7.3.0", "@babel/types@^7.4.0", "@babel/types@^7.4.4", "@babel/types@^7.7.0", "@babel/types@^7.7.1", "@babel/types@^7.7.2": + version "7.7.2" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.7.2.tgz#550b82e5571dcd174af576e23f0adba7ffc683f7" + integrity sha512-YTf6PXoh3+eZgRCBzzP25Bugd2ngmpQVrk7kXX0i5N9BO7TFBtIgZYs7WtxtOGs8e6A4ZI7ECkbBCEHeXocvOA== dependencies: esutils "^2.0.2" lodash "^4.17.13" @@ -3505,10 +3516,10 @@ conventional-recommended-bump@^5.0.0: meow "^4.0.0" q "^1.5.1" -convert-source-map@^1.1.0, convert-source-map@^1.4.0, convert-source-map@^1.5.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== +convert-source-map@^1.1.0, convert-source-map@^1.4.0, convert-source-map@^1.5.0, convert-source-map@^1.7.0: + version "1.7.0" + resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.7.0.tgz#17a2cb882d7f77d3490585e2ce6c524424a3a442" + integrity sha512-4FJkXzKXEDB1snCFZlLP4gpC3JILicCpGbzG9f9G7tGqGCzETQ2hWPrcinA9oU4wtf2biUaEH5065UnMeR33oA== dependencies: safe-buffer "~5.1.1" @@ -6782,9 +6793,9 @@ json5@^1.0.1: minimist "^1.2.0" 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== + version "2.1.1" + resolved "https://registry.yarnpkg.com/json5/-/json5-2.1.1.tgz#81b6cb04e9ba496f1c7005d07b4368a2638f90b6" + integrity sha512-l+3HXD0GEI3huGq1njuqtzYK8OYJyXMkOLtQ53pjWh89tvWS2h6l+1zMkYWqlb57+SiQodKZyvMEFb2X+KrFhQ== dependencies: minimist "^1.2.0" @@ -9175,17 +9186,12 @@ regex-not@^1.0.0, regex-not@^1.0.2: extend-shallow "^3.0.2" safe-regex "^1.1.0" -regexp-tree@^0.1.13: - version "0.1.13" - resolved "https://registry.yarnpkg.com/regexp-tree/-/regexp-tree-0.1.13.tgz#5b19ab9377edc68bc3679256840bb29afc158d7f" - integrity sha512-hwdV/GQY5F8ReLZWO+W1SRoN5YfpOKY6852+tBFcma72DKBIcHjPRIlIvQN35bCOljuAfP2G2iB0FC/w236mUw== - 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: +regexpu-core@^4.6.0: version "4.6.0" resolved "https://registry.yarnpkg.com/regexpu-core/-/regexpu-core-4.6.0.tgz#2037c18b327cfce8a6fea2a4ec441f2432afb8b6" integrity sha512-YlVaefl8P5BnFYOITTNzDvan1ulLOiXJzCNZxduTIosN17b87h3bvG9yHMoHaRuo88H4mQ06Aodj5VtYGGGiTg== @@ -9754,10 +9760,10 @@ source-map-resolve@^0.5.0: source-map-url "^0.4.0" urix "^0.1.0" -source-map-support@^0.5.6, source-map-support@^0.5.9: - version "0.5.13" - resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.13.tgz#31b24a9c2e73c2de85066c0feb7d44767ed52932" - integrity sha512-SHSKFHadjVA5oR4PPqhtAVdcBWwRYVd6g6cAXnIbRiIwc2EhPrTuKUBdSLvlEKyIP3GCf89fltvcZiP9MMFA1w== +source-map-support@^0.5.16, source-map-support@^0.5.6: + version "0.5.16" + resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.16.tgz#0ae069e7fe3ba7538c64c98515e35339eac5a042" + integrity sha512-efyLRJDr68D9hBBNIPWFjhpFzURh+KJykQwvMyW5UiZzYwoF6l4YMMDIJJEyFWxWCqfyxLzz6tSfUFR+kXXsVQ== dependencies: buffer-from "^1.0.0" source-map "^0.6.0" @@ -10441,11 +10447,6 @@ trim-off-newlines@^1.0.0: resolved "https://registry.yarnpkg.com/trim-off-newlines/-/trim-off-newlines-1.0.1.tgz#9f9ba9d9efa8764c387698bcbfeb2c848f11adb3" integrity sha1-n5up2e+odkw4dpi8v+sshI8RrbM= -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.10.0" resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.10.0.tgz#c3c19f95973fb0a62973fb09d90d961ee43e5c8a" From 7633f094793e2bffc82f1c4f4036fdbf30418700 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hu=C3=A1ng=20J=C3=B9nli=C3=A0ng?= Date: Tue, 12 Nov 2019 18:25:24 -0500 Subject: [PATCH 072/648] =?UTF-8?q?Babel=20should=20not=20silently=20remov?= =?UTF-8?q?e=20unknown=20options=20after=20command=E2=80=A6=20(#10698)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: add test case * chore: bump commander to 4.0.1 * fix: let commander.js throw on unknown options after args --- packages/babel-cli/package.json | 2 +- packages/babel-cli/src/babel/options.js | 4 ++++ .../error incorrect options after args/in-files/script.js | 1 + .../babel/error incorrect options after args/options.json | 4 ++++ .../babel/error incorrect options after args/stderr.txt | 1 + .../error incorrect options before args/in-files/script.js | 1 + .../babel/error incorrect options before args/options.json | 4 ++++ .../babel/error incorrect options before args/stderr.txt | 1 + 8 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 packages/babel-cli/test/fixtures/babel/error incorrect options after args/in-files/script.js create mode 100644 packages/babel-cli/test/fixtures/babel/error incorrect options after args/options.json create mode 100644 packages/babel-cli/test/fixtures/babel/error incorrect options after args/stderr.txt create mode 100644 packages/babel-cli/test/fixtures/babel/error incorrect options before args/in-files/script.js create mode 100644 packages/babel-cli/test/fixtures/babel/error incorrect options before args/options.json create mode 100644 packages/babel-cli/test/fixtures/babel/error incorrect options before args/stderr.txt diff --git a/packages/babel-cli/package.json b/packages/babel-cli/package.json index 0328b7596c27..c5b1e90485d6 100644 --- a/packages/babel-cli/package.json +++ b/packages/babel-cli/package.json @@ -19,7 +19,7 @@ "compiler" ], "dependencies": { - "commander": "^2.8.1", + "commander": "^4.0.1", "convert-source-map": "^1.1.0", "fs-readdir-recursive": "^1.1.0", "glob": "^7.0.0", diff --git a/packages/babel-cli/src/babel/options.js b/packages/babel-cli/src/babel/options.js index 169c61ffa51a..1543d02f4bb4 100644 --- a/packages/babel-cli/src/babel/options.js +++ b/packages/babel-cli/src/babel/options.js @@ -163,6 +163,10 @@ commander.option( commander.version(pkg.version + " (@babel/core " + version + ")"); commander.usage("[options] "); +// register an empty action handler so that commander.js can throw on +// unknown options _after_ args +// see https://github.com/tj/commander.js/issues/561#issuecomment-522209408 +commander.action(() => {}); export type CmdOptions = { babelOptions: Object, diff --git a/packages/babel-cli/test/fixtures/babel/error incorrect options after args/in-files/script.js b/packages/babel-cli/test/fixtures/babel/error incorrect options after args/in-files/script.js new file mode 100644 index 000000000000..4bc9539528d4 --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/error incorrect options after args/in-files/script.js @@ -0,0 +1 @@ +arr.map(x => x * MULTIPLIER); diff --git a/packages/babel-cli/test/fixtures/babel/error incorrect options after args/options.json b/packages/babel-cli/test/fixtures/babel/error incorrect options after args/options.json new file mode 100644 index 000000000000..dde64755da06 --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/error incorrect options after args/options.json @@ -0,0 +1,4 @@ +{ + "args": ["script.js", "--spruce-maps"], + "stderrContains": true +} diff --git a/packages/babel-cli/test/fixtures/babel/error incorrect options after args/stderr.txt b/packages/babel-cli/test/fixtures/babel/error incorrect options after args/stderr.txt new file mode 100644 index 000000000000..294d5ccaeaed --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/error incorrect options after args/stderr.txt @@ -0,0 +1 @@ +error: unknown option '--spruce-maps' diff --git a/packages/babel-cli/test/fixtures/babel/error incorrect options before args/in-files/script.js b/packages/babel-cli/test/fixtures/babel/error incorrect options before args/in-files/script.js new file mode 100644 index 000000000000..4bc9539528d4 --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/error incorrect options before args/in-files/script.js @@ -0,0 +1 @@ +arr.map(x => x * MULTIPLIER); diff --git a/packages/babel-cli/test/fixtures/babel/error incorrect options before args/options.json b/packages/babel-cli/test/fixtures/babel/error incorrect options before args/options.json new file mode 100644 index 000000000000..0d7953971726 --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/error incorrect options before args/options.json @@ -0,0 +1,4 @@ +{ + "args": ["--spruce-maps", "script.js"], + "stderrContains": true +} diff --git a/packages/babel-cli/test/fixtures/babel/error incorrect options before args/stderr.txt b/packages/babel-cli/test/fixtures/babel/error incorrect options before args/stderr.txt new file mode 100644 index 000000000000..294d5ccaeaed --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel/error incorrect options before args/stderr.txt @@ -0,0 +1 @@ +error: unknown option '--spruce-maps' From 67ea7f4b4da9726d66982258a64c001481b7cda5 Mon Sep 17 00:00:00 2001 From: Jaideep Bhoosreddy Date: Wed, 13 Nov 2019 11:31:29 -0500 Subject: [PATCH 073/648] Implement PR workflow for running test262 on babel PRs (#10579) * Implement PR workflow with test262 * revisions --- .circleci/config.yml | 42 ++++++++++++++++++++++++++++++++++++++---- 1 file changed, 38 insertions(+), 4 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 400c61909baa..0d1c725d3243 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -40,6 +40,9 @@ aliases: - &artifact_test262_xunit path: ~/test-results + - &artifact_test262_diff_tap + path: ~/diff.tap + executors: node-executor: docker: @@ -73,6 +76,14 @@ jobs: executor: node-executor steps: - checkout + - run: + name: Sync with latest master branch (only on PRs) + command: | + if [ -n "$CIRCLE_PULL_REQUEST" ] + then + git fetch origin refs/pull/$CIRCLE_PR_NUMBER/merge + git checkout -qf FETCH_HEAD + fi - restore_cache: *restore-yarn-cache - restore_cache: *restore-node-modules-cache - run: @@ -100,16 +111,34 @@ jobs: yarn link $(./jq -j ".name" $package) done node lib/download-node + - run: + name: Download master branch Test262 artifact + command: node lib/download-master-artifact ~/master.tap + <<: *test262_workdir - run: name: Run Test262 command: node lib/run-tests I_AM_SURE | tee ~/test262.tap <<: *test262_workdir - store_artifacts: *artifact_test262_tap - run: - name: Output test262 results + name: Output Test262 results command: | cat ~/test262.tap | $(npm bin)/tap-mocha-reporter spec || true <<: *test262_workdir + - run: + name: Compare previous master branch & current job results + command: | + mkdir -p ~/test-results/test262 + node lib/compare-results ~/master.tap ~/test262.tap | tee ~/diff.tap + <<: *test262_workdir + - store_artifacts: *artifact_test262_diff_tap + - run: + name: Output comparision results and report to CircleCI + command: | + mkdir -p ~/test-results/test262 + cat ~/diff.tap | $(npm bin)/tap-merge | $(npm bin)/tap-mocha-reporter xunit | tee ~/test-results/test262/results.xml + <<: *test262_workdir + - store_test_results: *artifact_test262_xunit publish-verdaccio: executor: node-executor @@ -136,15 +165,20 @@ workflows: test: jobs: - test - - master: + test262-master: jobs: - test262: filters: branches: only: - master - + test262: + jobs: + - approve-test262-run: + type: approval + - test262: + requires: + - approve-test262-run e2e: jobs: - publish-verdaccio From 1d1101eb7c8d89a2179b098f6dd131b4b479020a Mon Sep 17 00:00:00 2001 From: ZYSzys Date: Thu, 14 Nov 2019 00:39:19 +0800 Subject: [PATCH 074/648] Add missing flow type to babel-cli for consistency (#10692) --- packages/babel-cli/src/babel/dir.js | 6 +++--- packages/babel-cli/src/babel/file.js | 2 +- packages/babel-cli/src/babel/options.js | 5 ++++- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/packages/babel-cli/src/babel/dir.js b/packages/babel-cli/src/babel/dir.js index c6790d5acea7..234eb7c8f60b 100644 --- a/packages/babel-cli/src/babel/dir.js +++ b/packages/babel-cli/src/babel/dir.js @@ -145,7 +145,7 @@ export default async function({ if (cliOptions.watch) { const chokidar = util.requireChokidar(); - filenames.forEach(function(filenameOrDir) { + filenames.forEach(function(filenameOrDir: string): void { const watcher = chokidar.watch(filenameOrDir, { persistent: true, ignoreInitial: true, @@ -155,8 +155,8 @@ export default async function({ }, }); - ["add", "change"].forEach(function(type) { - watcher.on(type, function(filename) { + ["add", "change"].forEach(function(type: string): void { + watcher.on(type, function(filename: string): void { handleFile( filename, filename === filenameOrDir diff --git a/packages/babel-cli/src/babel/file.js b/packages/babel-cli/src/babel/file.js index 23b0307cc884..1ad5d6b84772 100644 --- a/packages/babel-cli/src/babel/file.js +++ b/packages/babel-cli/src/babel/file.js @@ -223,7 +223,7 @@ export default async function({ pollInterval: 10, }, }) - .on("all", function(type: string, filename: string) { + .on("all", function(type: string, filename: string): void { if (!util.isCompilableExtension(filename, cliOptions.extensions)) { return; } diff --git a/packages/babel-cli/src/babel/options.js b/packages/babel-cli/src/babel/options.js index 1543d02f4bb4..fa09d6b64ed3 100644 --- a/packages/babel-cli/src/babel/options.js +++ b/packages/babel-cli/src/babel/options.js @@ -320,7 +320,10 @@ function booleanify(val: any): boolean | any { return val; } -function collect(value, previousValue): Array { +function collect( + value: string | any, + previousValue: Array, +): Array { // If the user passed the option with no value, like "babel file.js --presets", do nothing. if (typeof value !== "string") return previousValue; From 433b6ba3a41c6715bd3638b243502d51304555a2 Mon Sep 17 00:00:00 2001 From: Jaideep Bhoosreddy Date: Wed, 13 Nov 2019 15:42:44 -0500 Subject: [PATCH 075/648] Ignore PR job on master branch (#10702) --- .circleci/config.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 0d1c725d3243..f654bb91c696 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -176,9 +176,17 @@ workflows: jobs: - approve-test262-run: type: approval + filters: + branches: + ignore: + - master - test262: requires: - approve-test262-run + filters: + branches: + ignore: + - master e2e: jobs: - publish-verdaccio From e1839e5ec9c10ffadac51aa58fbc1e6753c6b27f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hu=C3=A1ng=20J=C3=B9nli=C3=A0ng?= Date: Wed, 13 Nov 2019 16:47:56 -0500 Subject: [PATCH 076/648] Circumvent typeof transform for umd build template (#10701) * add test case * fix: circumvent typeof transform * chore: update test fixtures --- .../output.js | 2 +- .../src/index.js | 8 ++++--- .../loose/export-default-10/output.js | 2 +- .../loose/export-default-11/output.js | 2 +- .../fixtures/loose/export-default-2/output.js | 2 +- .../fixtures/loose/export-default-3/output.js | 2 +- .../fixtures/loose/export-default-4/output.js | 2 +- .../fixtures/loose/export-default-5/output.js | 2 +- .../fixtures/loose/export-default-6/output.js | 2 +- .../fixtures/loose/export-default-7/output.js | 2 +- .../fixtures/loose/export-default-8/output.js | 2 +- .../fixtures/loose/export-default-9/output.js | 2 +- .../fixtures/loose/export-default/output.js | 2 +- .../fixtures/loose/export-from-2/output.js | 2 +- .../fixtures/loose/export-from-3/output.js | 2 +- .../fixtures/loose/export-from-4/output.js | 2 +- .../fixtures/loose/export-from-5/output.js | 2 +- .../fixtures/loose/export-from-6/output.js | 2 +- .../test/fixtures/loose/export-from/output.js | 2 +- .../fixtures/loose/export-named-2/output.js | 2 +- .../fixtures/loose/export-named-3/output.js | 2 +- .../fixtures/loose/export-named-4/output.js | 2 +- .../fixtures/loose/export-named-5/output.js | 2 +- .../fixtures/loose/export-named/output.js | 2 +- .../fixtures/loose/exports-variable/output.js | 2 +- .../loose/get-module-name-option/output.js | 2 +- .../loose/hoist-function-exports/output.js | 2 +- .../fixtures/loose/imports-default/output.js | 2 +- .../output.js | 2 +- .../imports-exact-globals-false/output.js | 2 +- .../output.js | 2 +- .../imports-exact-globals-true/output.js | 2 +- .../fixtures/loose/imports-glob/output.js | 2 +- .../fixtures/loose/imports-mixing/output.js | 2 +- .../fixtures/loose/imports-named/output.js | 2 +- .../test/fixtures/loose/imports/output.js | 2 +- .../output.js | 2 +- .../output.js | 2 +- .../output.js | 2 +- .../test/fixtures/loose/module-id/output.js | 2 +- .../output.js | 2 +- .../test/fixtures/loose/module-name/output.js | 2 +- .../loose/non-default-imports/output.js | 2 +- .../loose/override-export-name/output.js | 2 +- .../loose/override-import-name/output.js | 2 +- .../test/fixtures/loose/overview/output.js | 2 +- .../test/fixtures/loose/remap/output.js | 2 +- .../test/fixtures/regression/4192/output.js | 2 +- .../fixtures/umd/export-default-10/output.js | 2 +- .../fixtures/umd/export-default-11/output.js | 2 +- .../fixtures/umd/export-default-2/output.js | 2 +- .../fixtures/umd/export-default-3/output.js | 2 +- .../fixtures/umd/export-default-4/output.js | 2 +- .../fixtures/umd/export-default-5/output.js | 2 +- .../fixtures/umd/export-default-6/output.js | 2 +- .../fixtures/umd/export-default-7/output.js | 2 +- .../fixtures/umd/export-default-8/output.js | 2 +- .../fixtures/umd/export-default-9/output.js | 2 +- .../fixtures/umd/export-default/output.js | 2 +- .../test/fixtures/umd/export-from-2/output.js | 2 +- .../test/fixtures/umd/export-from-3/output.js | 2 +- .../test/fixtures/umd/export-from-4/output.js | 2 +- .../test/fixtures/umd/export-from-5/output.js | 2 +- .../test/fixtures/umd/export-from-6/output.js | 2 +- .../test/fixtures/umd/export-from/output.js | 2 +- .../fixtures/umd/export-named-2/output.js | 2 +- .../fixtures/umd/export-named-3/output.js | 2 +- .../fixtures/umd/export-named-4/output.js | 2 +- .../fixtures/umd/export-named-5/output.js | 2 +- .../test/fixtures/umd/export-named/output.js | 2 +- .../fixtures/umd/exports-variable/output.js | 2 +- .../umd/get-module-name-option/output.js | 2 +- .../umd/hoist-function-exports/output.js | 2 +- .../fixtures/umd/imports-default/output.js | 2 +- .../output.js | 2 +- .../umd/imports-exact-globals-false/output.js | 2 +- .../output.js | 2 +- .../umd/imports-exact-globals-true/output.js | 2 +- .../test/fixtures/umd/imports-glob/output.js | 2 +- .../fixtures/umd/imports-mixing/output.js | 2 +- .../test/fixtures/umd/imports-named/output.js | 2 +- .../test/fixtures/umd/imports/output.js | 2 +- .../output.js | 2 +- .../output.js | 2 +- .../output.js | 2 +- .../test/fixtures/umd/module-id/output.js | 2 +- .../output.js | 2 +- .../test/fixtures/umd/module-name/output.js | 2 +- .../umd/non-default-imports/output.js | 2 +- .../umd/override-export-name/output.js | 2 +- .../umd/override-import-name/output.js | 2 +- .../test/fixtures/umd/overview/output.js | 2 +- .../test/fixtures/umd/remap/output.js | 2 +- .../dynamic-import/modules-umd/output.js | 4 +--- .../fixtures/modules/modules-umd/output.js | 4 +--- .../plugins-integration/issue-10662/input.mjs | 2 ++ .../issue-10662/options.json | 14 +++++++++++++ .../plugins-integration/issue-10662/output.js | 21 +++++++++++++++++++ 98 files changed, 136 insertions(+), 101 deletions(-) create mode 100644 packages/babel-preset-env/test/fixtures/plugins-integration/issue-10662/input.mjs create mode 100644 packages/babel-preset-env/test/fixtures/plugins-integration/issue-10662/options.json create mode 100644 packages/babel-preset-env/test/fixtures/plugins-integration/issue-10662/output.js diff --git a/packages/babel-plugin-transform-function-name/test/fixtures/function-name/export-default-arrow-renaming-module-umd/output.js b/packages/babel-plugin-transform-function-name/test/fixtures/function-name/export-default-arrow-renaming-module-umd/output.js index aca80143342e..cd8510701baf 100644 --- a/packages/babel-plugin-transform-function-name/test/fixtures/function-name/export-default-arrow-renaming-module-umd/output.js +++ b/packages/babel-plugin-transform-function-name/test/fixtures/function-name/export-default-arrow-renaming-module-umd/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/src/index.js b/packages/babel-plugin-transform-modules-umd/src/index.js index 037c70f2b45b..87ab37eff91d 100644 --- a/packages/babel-plugin-transform-modules-umd/src/index.js +++ b/packages/babel-plugin-transform-modules-umd/src/index.js @@ -14,7 +14,9 @@ import { types as t, template } from "@babel/core"; const buildPrerequisiteAssignment = template(` GLOBAL_REFERENCE = GLOBAL_REFERENCE || {} `); - +// Note: we avoid comparing typeof results with "object" or "symbol" otherwise +// they will be processed by `transform-typeof-symbol`, which in return could +// cause typeof helper used before declaration const buildWrapper = template(` (function (global, factory) { if (typeof define === "function" && define.amd) { @@ -28,8 +30,8 @@ const buildWrapper = template(` GLOBAL_TO_ASSIGN; } })( - typeof globalThis === "object" ? globalThis - : typeof self === "object" ? self + typeof globalThis !== "undefined" ? globalThis + : typeof self !== "undefined" ? self : this, function(IMPORT_NAMES) { }) diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-10/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-10/output.js index 32501cb4319b..16cf5dab5b0e 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-10/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-10/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-11/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-11/output.js index 0633fe90d0a0..43f6f4120ba2 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-11/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-11/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-2/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-2/output.js index 34e8e2fa3d82..1eb753f05ea7 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-2/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-2/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-3/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-3/output.js index aa3b89c8d714..8b28dd6ec87b 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-3/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-3/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-4/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-4/output.js index 7e144092f4e7..d1aa080c8110 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-4/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-4/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-5/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-5/output.js index 6766df086135..50d6e6ae7234 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-5/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-5/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-6/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-6/output.js index 4fd6be58e8d3..2e9a39834a8f 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-6/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-6/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-7/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-7/output.js index fa009a30d6df..99ed0428f6f9 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-7/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-7/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-8/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-8/output.js index f221e56a8ccd..50619c0ab739 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-8/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-8/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-9/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-9/output.js index f840c25e6f78..78580db2a617 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-9/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default-9/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default/output.js index 5b666da90d2f..005e2f9b8237 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-default/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-from-2/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-from-2/output.js index 14961ba262e8..75e19b01ab38 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-from-2/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-from-2/output.js @@ -10,7 +10,7 @@ factory(mod.exports, global.foo); global.input = mod.exports; } -})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports, _foo) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _foo) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-from-3/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-from-3/output.js index fb7da87c3f20..d6c735f4b8c8 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-from-3/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-from-3/output.js @@ -10,7 +10,7 @@ factory(mod.exports, global.foo); global.input = mod.exports; } -})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports, _foo) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _foo) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-from-4/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-from-4/output.js index dc7a24f5f4c5..13cd6c56cf1a 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-from-4/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-from-4/output.js @@ -10,7 +10,7 @@ factory(mod.exports, global.foo); global.input = mod.exports; } -})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports, _foo) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _foo) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-from-5/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-from-5/output.js index 2e900d34ed1a..db35ffb83d9e 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-from-5/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-from-5/output.js @@ -10,7 +10,7 @@ factory(mod.exports, global.foo); global.input = mod.exports; } -})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports, _foo) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _foo) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-from-6/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-from-6/output.js index feaf9c4c81a1..8405ded47ad5 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-from-6/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-from-6/output.js @@ -10,7 +10,7 @@ factory(mod.exports, global.foo); global.input = mod.exports; } -})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports, _foo) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _foo) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-from/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-from/output.js index c9634daa1bc9..f200b057fbbf 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-from/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-from/output.js @@ -10,7 +10,7 @@ factory(mod.exports, global.foo); global.input = mod.exports; } -})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports, _foo) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _foo) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-named-2/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-named-2/output.js index f840c25e6f78..78580db2a617 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-named-2/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-named-2/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-named-3/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-named-3/output.js index d8434b638462..4e96e316480b 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-named-3/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-named-3/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-named-4/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-named-4/output.js index 9f6a74975f35..e19d1a5d1fc3 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-named-4/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-named-4/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-named-5/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-named-5/output.js index 60d36f6a310e..c9353e2a5bd1 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-named-5/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-named-5/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-named/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-named/output.js index e12b16c662f8..23ff6af10e6e 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-named/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/export-named/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/exports-variable/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/exports-variable/output.js index 34f0969295f0..d4aeec297660 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/exports-variable/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/exports-variable/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/get-module-name-option/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/get-module-name-option/output.js index 9ef9726b81db..bbfb355912b8 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/get-module-name-option/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/get-module-name-option/output.js @@ -10,6 +10,6 @@ factory(); global.myCustomModuleName = mod.exports; } -})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function () { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function () { "use strict"; }); diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/hoist-function-exports/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/hoist-function-exports/output.js index 3894e1d6357b..640ce3bb776c 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/hoist-function-exports/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/hoist-function-exports/output.js @@ -10,7 +10,7 @@ factory(mod.exports, global.evens); global.input = mod.exports; } -})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports, _evens) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _evens) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-default/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-default/output.js index 733966a5af62..71c3133b263f 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-default/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-default/output.js @@ -10,7 +10,7 @@ factory(global.foo); global.input = mod.exports; } -})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_foo) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_foo) { "use strict"; _foo = babelHelpers.interopRequireDefault(_foo); diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-exact-globals-false-with-overrides/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-exact-globals-false-with-overrides/output.js index 9d38e1ce05a6..c751e3aee868 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-exact-globals-false-with-overrides/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-exact-globals-false-with-overrides/output.js @@ -10,7 +10,7 @@ factory(global.fooBAR, global.fooBAR, global.fizzBuzz); global.input = mod.exports; } -})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_fooBar, _fooBar2, _fizzbuzz) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_fooBar, _fooBar2, _fizzbuzz) { "use strict"; _fooBar = babelHelpers.interopRequireDefault(_fooBar); diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-exact-globals-false/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-exact-globals-false/output.js index 18307048ec1b..5229781b738a 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-exact-globals-false/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-exact-globals-false/output.js @@ -10,7 +10,7 @@ factory(global.fooBar, global.fooBar, global.fizzbuzz); global.input = mod.exports; } -})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_fooBar, _fooBar2, _fizzbuzz) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_fooBar, _fooBar2, _fizzbuzz) { "use strict"; _fooBar = babelHelpers.interopRequireDefault(_fooBar); diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-exact-globals-true-with-overrides/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-exact-globals-true-with-overrides/output.js index 05b85cc76366..54211b04b3c0 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-exact-globals-true-with-overrides/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-exact-globals-true-with-overrides/output.js @@ -10,7 +10,7 @@ factory(global.fooBAR, global.mylib.fooBar, global.fizz.buzz); global.input = mod.exports; } -})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_fooBar, _fooBar2, _fizzbuzz) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_fooBar, _fooBar2, _fizzbuzz) { "use strict"; _fooBar = babelHelpers.interopRequireDefault(_fooBar); diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-exact-globals-true/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-exact-globals-true/output.js index baea395d1471..bf4c741e6ce0 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-exact-globals-true/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-exact-globals-true/output.js @@ -10,7 +10,7 @@ factory(global.fooBar, global.mylibFooBar, global.fizzbuzz); global.input = mod.exports; } -})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_fooBar, _fooBar2, _fizzbuzz) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_fooBar, _fooBar2, _fizzbuzz) { "use strict"; _fooBar = babelHelpers.interopRequireDefault(_fooBar); diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-glob/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-glob/output.js index 2820bf461f2a..be83fe78d33c 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-glob/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-glob/output.js @@ -10,7 +10,7 @@ factory(global.foo); global.input = mod.exports; } -})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (foo) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (foo) { "use strict"; foo = babelHelpers.interopRequireWildcard(foo); diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-mixing/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-mixing/output.js index 37b9f152bef7..17bf5e1fac30 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-mixing/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-mixing/output.js @@ -10,7 +10,7 @@ factory(global.foo); global.input = mod.exports; } -})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_foo) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_foo) { "use strict"; _foo = babelHelpers.interopRequireWildcard(_foo); diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-named/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-named/output.js index f8fb2a0217cb..d6e7457a2618 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-named/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports-named/output.js @@ -10,7 +10,7 @@ factory(global.foo); global.input = mod.exports; } -})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_foo) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_foo) { "use strict"; _foo.bar; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports/output.js index 0e773a28c17e..5d36f0f1abf6 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/imports/output.js @@ -10,6 +10,6 @@ factory(global.foo, global.fooBar, global.fooBar); global.input = mod.exports; } -})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_foo, _fooBar, _fooBar2) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_foo, _fooBar, _fooBar2) { "use strict"; }); diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-id-with-overridden-global-in-namespace/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-id-with-overridden-global-in-namespace/output.js index 5c79efde0967..06cb04062449 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-id-with-overridden-global-in-namespace/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-id-with-overridden-global-in-namespace/output.js @@ -11,7 +11,7 @@ global.foo = global.foo || {}; global.foo.bar = mod.exports; } -})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-id-with-overridden-global-in-very-nested-namespace/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-id-with-overridden-global-in-very-nested-namespace/output.js index 55ebfb1b8c30..da053338dc3b 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-id-with-overridden-global-in-very-nested-namespace/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-id-with-overridden-global-in-very-nested-namespace/output.js @@ -13,7 +13,7 @@ global.foo.bar.baz = global.foo.bar.baz || {}; global.foo.bar.baz.qux = mod.exports; } -})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-id-with-overridden-global/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-id-with-overridden-global/output.js index 0085a705c53a..55f97d820fda 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-id-with-overridden-global/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-id-with-overridden-global/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.baz = mod.exports; } -})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-id/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-id/output.js index 7dc12234cdb4..2d9c9cd817c0 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-id/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-id/output.js @@ -10,7 +10,7 @@ factory(); global.MyLib = mod.exports; } -})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function () { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function () { "use strict"; foobar(); diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-name-with-overridden-global/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-name-with-overridden-global/output.js index db9e9b200d7c..45d0bcb7c75b 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-name-with-overridden-global/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-name-with-overridden-global/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.looseModuleNameWithOverriddenGlobalInput = mod.exports; } -})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-name/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-name/output.js index 01c2ce86f9d3..ec9d725704c7 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-name/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/module-name/output.js @@ -10,7 +10,7 @@ factory(); global.looseModuleNameInput = mod.exports; } -})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function () { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function () { "use strict"; foobar(); diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/non-default-imports/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/non-default-imports/output.js index 10c4c15c9b6a..81afa0c2b734 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/non-default-imports/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/non-default-imports/output.js @@ -10,6 +10,6 @@ factory(global.render); global.input = mod.exports; } -})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_render) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_render) { "use strict"; }); diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/override-export-name/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/override-export-name/output.js index 5b666da90d2f..005e2f9b8237 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/override-export-name/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/override-export-name/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/override-import-name/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/override-import-name/output.js index c6850dc1ab1a..9a60cc93eeff 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/override-import-name/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/override-import-name/output.js @@ -10,6 +10,6 @@ factory(global.Promise); global.input = mod.exports; } -})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_es6Promise) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_es6Promise) { "use strict"; }); diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/overview/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/overview/output.js index 0ec5e6cb6d88..92177358c8c4 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/overview/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/overview/output.js @@ -10,7 +10,7 @@ factory(mod.exports, global.foo, global.fooBar, global.fooBar); global.input = mod.exports; } -})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports, foo2, _fooBar, _fooBar2) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, foo2, _fooBar, _fooBar2) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/remap/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/remap/output.js index a8503bc29b96..03b4c1258a54 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/remap/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/loose/remap/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; _exports.__esModule = true; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/regression/4192/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/regression/4192/output.js index f0c22802cb37..78689e28938e 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/regression/4192/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/regression/4192/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-10/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-10/output.js index 49e75d5bc965..96660c937784 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-10/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-10/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-11/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-11/output.js index 5447cc116b68..670be0b97f02 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-11/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-11/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-2/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-2/output.js index 04d3f90de328..ec688671cff5 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-2/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-2/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-3/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-3/output.js index 6579e72a0bdd..b982d97d90da 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-3/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-3/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-4/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-4/output.js index 5478384d3bde..e5dafcbe9c01 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-4/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-4/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-5/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-5/output.js index ae92ef86e76d..b57a16c2680f 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-5/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-5/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-6/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-6/output.js index 38bb552b8f92..b244eea085de 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-6/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-6/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-7/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-7/output.js index b5b988ee2090..7a36751246c2 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-7/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-7/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-8/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-8/output.js index a9d3a15498cd..260883e265f2 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-8/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-8/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-9/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-9/output.js index e0c54835f5f6..20b42c4faae2 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-9/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default-9/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default/output.js index 3650a0e70afd..127234bed6d4 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-default/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-from-2/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-from-2/output.js index 24f7b0cac307..3580d4361beb 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-from-2/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-from-2/output.js @@ -10,7 +10,7 @@ factory(mod.exports, global.foo); global.input = mod.exports; } -})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports, _foo) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _foo) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-from-3/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-from-3/output.js index 5d59222a6acc..033dc64eadbe 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-from-3/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-from-3/output.js @@ -10,7 +10,7 @@ factory(mod.exports, global.foo); global.input = mod.exports; } -})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports, _foo) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _foo) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-from-4/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-from-4/output.js index a71a3dc3afa1..1a2577046f54 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-from-4/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-from-4/output.js @@ -10,7 +10,7 @@ factory(mod.exports, global.foo); global.input = mod.exports; } -})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports, _foo) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _foo) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-from-5/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-from-5/output.js index c5806681062b..fd5bfbed33af 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-from-5/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-from-5/output.js @@ -10,7 +10,7 @@ factory(mod.exports, global.foo); global.input = mod.exports; } -})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports, _foo) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _foo) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-from-6/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-from-6/output.js index 69ed1878b92c..46e4a2b27dd2 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-from-6/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-from-6/output.js @@ -10,7 +10,7 @@ factory(mod.exports, global.foo); global.input = mod.exports; } -})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports, _foo) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _foo) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-from/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-from/output.js index 3f4e37cb955c..cda318717a4c 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-from/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-from/output.js @@ -10,7 +10,7 @@ factory(mod.exports, global.foo); global.input = mod.exports; } -})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports, _foo) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _foo) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-named-2/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-named-2/output.js index e0c54835f5f6..20b42c4faae2 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-named-2/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-named-2/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-named-3/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-named-3/output.js index 0174dbf05c23..9b45a5008053 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-named-3/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-named-3/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-named-4/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-named-4/output.js index b39c6551907e..096434af4d2e 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-named-4/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-named-4/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-named-5/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-named-5/output.js index ea7c9ea47720..6966fb097e00 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-named-5/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-named-5/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-named/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-named/output.js index ba76f746df69..1062cc37298a 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-named/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/export-named/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/exports-variable/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/exports-variable/output.js index 116ca5633a54..9ad3023932a7 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/exports-variable/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/exports-variable/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/get-module-name-option/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/get-module-name-option/output.js index 9ef9726b81db..bbfb355912b8 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/get-module-name-option/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/get-module-name-option/output.js @@ -10,6 +10,6 @@ factory(); global.myCustomModuleName = mod.exports; } -})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function () { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function () { "use strict"; }); diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/hoist-function-exports/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/hoist-function-exports/output.js index 6b33b55fddfb..f6448a39188b 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/hoist-function-exports/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/hoist-function-exports/output.js @@ -10,7 +10,7 @@ factory(mod.exports, global.evens); global.input = mod.exports; } -})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports, _evens) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _evens) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-default/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-default/output.js index 733966a5af62..71c3133b263f 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-default/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-default/output.js @@ -10,7 +10,7 @@ factory(global.foo); global.input = mod.exports; } -})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_foo) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_foo) { "use strict"; _foo = babelHelpers.interopRequireDefault(_foo); diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-exact-globals-false-with-overrides/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-exact-globals-false-with-overrides/output.js index 9d38e1ce05a6..c751e3aee868 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-exact-globals-false-with-overrides/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-exact-globals-false-with-overrides/output.js @@ -10,7 +10,7 @@ factory(global.fooBAR, global.fooBAR, global.fizzBuzz); global.input = mod.exports; } -})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_fooBar, _fooBar2, _fizzbuzz) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_fooBar, _fooBar2, _fizzbuzz) { "use strict"; _fooBar = babelHelpers.interopRequireDefault(_fooBar); diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-exact-globals-false/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-exact-globals-false/output.js index 18307048ec1b..5229781b738a 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-exact-globals-false/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-exact-globals-false/output.js @@ -10,7 +10,7 @@ factory(global.fooBar, global.fooBar, global.fizzbuzz); global.input = mod.exports; } -})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_fooBar, _fooBar2, _fizzbuzz) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_fooBar, _fooBar2, _fizzbuzz) { "use strict"; _fooBar = babelHelpers.interopRequireDefault(_fooBar); diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-exact-globals-true-with-overrides/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-exact-globals-true-with-overrides/output.js index 05b85cc76366..54211b04b3c0 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-exact-globals-true-with-overrides/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-exact-globals-true-with-overrides/output.js @@ -10,7 +10,7 @@ factory(global.fooBAR, global.mylib.fooBar, global.fizz.buzz); global.input = mod.exports; } -})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_fooBar, _fooBar2, _fizzbuzz) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_fooBar, _fooBar2, _fizzbuzz) { "use strict"; _fooBar = babelHelpers.interopRequireDefault(_fooBar); diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-exact-globals-true/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-exact-globals-true/output.js index baea395d1471..bf4c741e6ce0 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-exact-globals-true/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-exact-globals-true/output.js @@ -10,7 +10,7 @@ factory(global.fooBar, global.mylibFooBar, global.fizzbuzz); global.input = mod.exports; } -})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_fooBar, _fooBar2, _fizzbuzz) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_fooBar, _fooBar2, _fizzbuzz) { "use strict"; _fooBar = babelHelpers.interopRequireDefault(_fooBar); diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-glob/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-glob/output.js index 2820bf461f2a..be83fe78d33c 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-glob/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-glob/output.js @@ -10,7 +10,7 @@ factory(global.foo); global.input = mod.exports; } -})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (foo) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (foo) { "use strict"; foo = babelHelpers.interopRequireWildcard(foo); diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-mixing/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-mixing/output.js index 37b9f152bef7..17bf5e1fac30 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-mixing/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-mixing/output.js @@ -10,7 +10,7 @@ factory(global.foo); global.input = mod.exports; } -})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_foo) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_foo) { "use strict"; _foo = babelHelpers.interopRequireWildcard(_foo); diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-named/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-named/output.js index f8fb2a0217cb..d6e7457a2618 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-named/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports-named/output.js @@ -10,7 +10,7 @@ factory(global.foo); global.input = mod.exports; } -})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_foo) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_foo) { "use strict"; _foo.bar; diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports/output.js index 0e773a28c17e..5d36f0f1abf6 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/imports/output.js @@ -10,6 +10,6 @@ factory(global.foo, global.fooBar, global.fooBar); global.input = mod.exports; } -})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_foo, _fooBar, _fooBar2) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_foo, _fooBar, _fooBar2) { "use strict"; }); diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-id-with-overridden-global-in-namespace/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-id-with-overridden-global-in-namespace/output.js index b45744b06497..db961cbcdf89 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-id-with-overridden-global-in-namespace/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-id-with-overridden-global-in-namespace/output.js @@ -11,7 +11,7 @@ global.foo = global.foo || {}; global.foo.bar = mod.exports; } -})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-id-with-overridden-global-in-very-nested-namespace/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-id-with-overridden-global-in-very-nested-namespace/output.js index 0b358a9b2079..c3bd11fb105c 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-id-with-overridden-global-in-very-nested-namespace/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-id-with-overridden-global-in-very-nested-namespace/output.js @@ -13,7 +13,7 @@ global.foo.bar.baz = global.foo.bar.baz || {}; global.foo.bar.baz.qux = mod.exports; } -})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-id-with-overridden-global/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-id-with-overridden-global/output.js index 3a3fb1a0cb30..dd85a01acf7d 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-id-with-overridden-global/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-id-with-overridden-global/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.baz = mod.exports; } -})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-id/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-id/output.js index 7dc12234cdb4..2d9c9cd817c0 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-id/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-id/output.js @@ -10,7 +10,7 @@ factory(); global.MyLib = mod.exports; } -})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function () { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function () { "use strict"; foobar(); diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-name-with-overridden-global/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-name-with-overridden-global/output.js index 1d76a5b0d621..e6186c39d886 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-name-with-overridden-global/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-name-with-overridden-global/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.umdModuleNameWithOverriddenGlobalInput = mod.exports; } -})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-name/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-name/output.js index 07c787a92f28..e85460f205bb 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-name/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/module-name/output.js @@ -10,7 +10,7 @@ factory(); global.umdModuleNameInput = mod.exports; } -})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function () { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function () { "use strict"; foobar(); diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/non-default-imports/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/non-default-imports/output.js index 10c4c15c9b6a..81afa0c2b734 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/non-default-imports/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/non-default-imports/output.js @@ -10,6 +10,6 @@ factory(global.render); global.input = mod.exports; } -})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_render) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_render) { "use strict"; }); diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/override-export-name/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/override-export-name/output.js index 3650a0e70afd..127234bed6d4 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/override-export-name/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/override-export-name/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/override-import-name/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/override-import-name/output.js index c6850dc1ab1a..9a60cc93eeff 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/override-import-name/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/override-import-name/output.js @@ -10,6 +10,6 @@ factory(global.Promise); global.input = mod.exports; } -})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_es6Promise) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_es6Promise) { "use strict"; }); diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/overview/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/overview/output.js index 4d7a91b32231..294904dbbd39 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/overview/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/overview/output.js @@ -10,7 +10,7 @@ factory(mod.exports, global.foo, global.fooBar, global.fooBar); global.input = mod.exports; } -})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports, foo2, _fooBar, _fooBar2) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, foo2, _fooBar, _fooBar2) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/remap/output.js b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/remap/output.js index c374f3aa7925..33c36e34dc22 100644 --- a/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/remap/output.js +++ b/packages/babel-plugin-transform-modules-umd/test/fixtures/umd/remap/output.js @@ -10,7 +10,7 @@ factory(mod.exports); global.input = mod.exports; } -})(typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : this, function (_exports) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; Object.defineProperty(_exports, "__esModule", { diff --git a/packages/babel-preset-env/test/fixtures/dynamic-import/modules-umd/output.js b/packages/babel-preset-env/test/fixtures/dynamic-import/modules-umd/output.js index 8e25ad450629..f4b267b43c0b 100644 --- a/packages/babel-preset-env/test/fixtures/dynamic-import/modules-umd/output.js +++ b/packages/babel-preset-env/test/fixtures/dynamic-import/modules-umd/output.js @@ -1,5 +1,3 @@ -function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } - (function (global, factory) { if (typeof define === "function" && define.amd) { define([], factory); @@ -12,7 +10,7 @@ function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterat factory(); global.input = mod.exports; } -})((typeof globalThis === "undefined" ? "undefined" : _typeof(globalThis)) === "object" ? globalThis : (typeof self === "undefined" ? "undefined" : _typeof(self)) === "object" ? self : this, function () { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function () { "use strict"; import("foo"); // warns diff --git a/packages/babel-preset-env/test/fixtures/modules/modules-umd/output.js b/packages/babel-preset-env/test/fixtures/modules/modules-umd/output.js index 5f1d193f306f..f4afd867e11a 100644 --- a/packages/babel-preset-env/test/fixtures/modules/modules-umd/output.js +++ b/packages/babel-preset-env/test/fixtures/modules/modules-umd/output.js @@ -1,5 +1,3 @@ -function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } - (function (global, factory) { if (typeof define === "function" && define.amd) { define(["a"], factory); @@ -12,7 +10,7 @@ function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterat factory(global.a); global.input = mod.exports; } -})((typeof globalThis === "undefined" ? "undefined" : _typeof(globalThis)) === "object" ? globalThis : (typeof self === "undefined" ? "undefined" : _typeof(self)) === "object" ? self : this, function (_a) { +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_a) { "use strict"; _a = _interopRequireDefault(_a); diff --git a/packages/babel-preset-env/test/fixtures/plugins-integration/issue-10662/input.mjs b/packages/babel-preset-env/test/fixtures/plugins-integration/issue-10662/input.mjs new file mode 100644 index 000000000000..99f2bc766393 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/plugins-integration/issue-10662/input.mjs @@ -0,0 +1,2 @@ +var globalThis = {}; +typeof globalThis; diff --git a/packages/babel-preset-env/test/fixtures/plugins-integration/issue-10662/options.json b/packages/babel-preset-env/test/fixtures/plugins-integration/issue-10662/options.json new file mode 100644 index 000000000000..00fdf1fb5d98 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/plugins-integration/issue-10662/options.json @@ -0,0 +1,14 @@ +{ + "presets": [ + [ + "env", + { + "modules": "umd", + "targets": [ + "Safari 8", + "IE 11" + ] + } + ] + ] +} diff --git a/packages/babel-preset-env/test/fixtures/plugins-integration/issue-10662/output.js b/packages/babel-preset-env/test/fixtures/plugins-integration/issue-10662/output.js new file mode 100644 index 000000000000..e13f6d324d73 --- /dev/null +++ b/packages/babel-preset-env/test/fixtures/plugins-integration/issue-10662/output.js @@ -0,0 +1,21 @@ +(function (global, factory) { + if (typeof define === "function" && define.amd) { + define([], factory); + } else if (typeof exports !== "undefined") { + factory(); + } else { + var mod = { + exports: {} + }; + factory(); + global.input = mod.exports; + } +})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function () { + "use strict"; + + function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + + var globalThis = {}; + + _typeof(globalThis); +}); From 15b0283650581c100da7fc6571df58c1ceee425b Mon Sep 17 00:00:00 2001 From: Kai Cataldo Date: Wed, 13 Nov 2019 19:40:27 -0500 Subject: [PATCH 077/648] --- 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 078/648] 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 079/648] 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 080/648] 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 081/648] 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 082/648] 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 083/648] 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 084/648] 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 085/648] 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 086/648] 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 087/648] 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 088/648] 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 089/648] 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 090/648] 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 091/648] 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 092/648] 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 093/648] 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 094/648] 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 095/648] 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 096/648] 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 097/648] 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 098/648] 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 099/648] 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 100/648] 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 101/648] 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 102/648] 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 103/648] 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 104/648] 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 105/648] 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 106/648] 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 107/648] 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 108/648] 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 109/648] 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 110/648] 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 111/648] 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 112/648] 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 113/648] 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 114/648] 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 115/648] 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 116/648] 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 117/648] 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 118/648] 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 119/648] 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 120/648] 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 121/648] 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 122/648] 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 123/648] 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 124/648] 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 125/648] 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 126/648] 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 127/648] 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 128/648] 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 129/648] 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 130/648] 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 131/648] 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 132/648] 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 133/648] 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 134/648] 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 135/648] 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 136/648] 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 137/648] 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 138/648] 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 139/648] 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 140/648] 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 141/648] 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 142/648] 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 143/648] 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 144/648] 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 145/648] 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 146/648] 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 147/648] 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 148/648] 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 149/648] 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 150/648] 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 151/648] 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 152/648] 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 153/648] 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 154/648] 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 155/648] 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 156/648] 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 157/648] 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 158/648] 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 159/648] 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 160/648] 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 161/648] 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 162/648] 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 163/648] 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 164/648] 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 165/648] 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 166/648] 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 167/648] 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 168/648] 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 169/648] 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 170/648] 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 171/648] 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 172/648] 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 173/648] 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 174/648] 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 175/648] 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 176/648] 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 177/648] 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 178/648] 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 179/648] 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 180/648] 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 181/648] 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 182/648] 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 183/648] 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 184/648] 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 185/648] 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 186/648] 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 187/648] 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 188/648] 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 189/648] 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 190/648] 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 191/648] 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 192/648] 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 193/648] 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 194/648] 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 195/648] 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 196/648] 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 197/648] 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 198/648] 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 199/648] 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 200/648] 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 201/648] 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 202/648] 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 203/648] 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 204/648] 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 205/648] 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 206/648] 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 207/648] 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 208/648] 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 209/648] 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 210/648] 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 211/648] 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 212/648] 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 213/648] 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 214/648] 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 215/648] 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 216/648] 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 217/648] 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 218/648] 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 219/648] 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 220/648] 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 221/648] 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 222/648] 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 223/648] 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 224/648] 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 225/648] 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 226/648] 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 227/648] 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 228/648] 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 229/648] 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 230/648] 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 231/648] 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 232/648] 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 233/648] 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 234/648] 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 235/648] 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 236/648] 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 237/648] 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 238/648] 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 239/648] 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 240/648] 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 241/648] 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 242/648] 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 243/648] 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 244/648] 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 245/648] 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 246/648] 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 247/648] 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 248/648] 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 249/648] 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 250/648] 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 251/648] 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 252/648] 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 253/648] 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 254/648] 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 255/648] 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 256/648] 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 257/648] 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 258/648] 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 259/648] 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 260/648] 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 261/648] 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 262/648] 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 263/648] 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 264/648] 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 265/648] 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 266/648] 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 267/648] 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 268/648] 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 269/648] 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 270/648] 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 271/648] 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 272/648] 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 273/648] 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 274/648] 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 275/648] 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 276/648] 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 277/648] 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 278/648] 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 279/648] 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 280/648] 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 281/648] 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 282/648] 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 283/648] 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 284/648] 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 285/648] 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 286/648] 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 287/648] 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 288/648] 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 289/648] 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 290/648] 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 291/648] 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 292/648] 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 293/648] 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 294/648] 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 295/648] 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 296/648] 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 297/648] 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 298/648] 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 299/648] 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 300/648] 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 301/648] 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 302/648] 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 303/648] 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 304/648] 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 305/648] 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 306/648] 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 307/648] 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 308/648] 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 309/648] 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 310/648] 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 311/648] 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 312/648] 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 313/648] 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 314/648] 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 315/648] 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 316/648] 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 317/648] 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 318/648] 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 319/648] 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 320/648] 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 321/648] 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 322/648] 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 323/648] 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 324/648] 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 325/648] 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 326/648] 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 327/648] 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 328/648] 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 329/648] 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 330/648] 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 331/648] 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 332/648] 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 333/648] 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 334/648] 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 335/648] 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 336/648] 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 337/648] 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 338/648] 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 339/648] 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 340/648] 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 341/648] 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 342/648] 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 343/648] 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 344/648] 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 345/648] 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 346/648] 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 347/648] 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 348/648] 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 349/648] 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 350/648] 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 351/648] 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 352/648] 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 353/648] 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 354/648] 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 355/648] 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 356/648] 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 357/648] 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 358/648] 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 359/648] 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 360/648] 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 361/648] 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 362/648] 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 363/648] 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 364/648] 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 365/648] 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 366/648] 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 367/648] 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 368/648] 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 369/648] 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 370/648] 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 371/648] 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 372/648] 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 373/648] 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 374/648] 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 375/648] 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 376/648] 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 377/648] 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 378/648] 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 379/648] 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 380/648] 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 381/648] 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 382/648] 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 383/648] 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 384/648] 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 385/648] 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 386/648] 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 387/648] 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 388/648] 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 389/648] 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 390/648] 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 391/648] 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 392/648] 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 393/648] 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 394/648] 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 395/648] 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 396/648] 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 397/648] 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 398/648] 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 399/648] 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 400/648] =?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 401/648] 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 402/648] 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 403/648] [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 404/648] 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 405/648] 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 406/648] 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 407/648] 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 408/648] 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 409/648] 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 410/648] 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 411/648] 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 412/648] 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 413/648] 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 414/648] 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 415/648] 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 416/648] 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 417/648] 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 418/648] 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 419/648] 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 420/648] 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 421/648] [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 422/648] 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 423/648] 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 424/648] 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 425/648] 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 426/648] 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 427/648] 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 428/648] 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 429/648] 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 430/648] 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 431/648] 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 432/648] 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 433/648] 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 434/648] 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 435/648] 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 436/648] 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 437/648] 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 438/648] 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 439/648] 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 440/648] 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 441/648] 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 442/648] 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 443/648] 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 444/648] 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 445/648] 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 446/648] 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 447/648] 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 448/648] 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 449/648] 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 450/648] =?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 451/648] 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 452/648] 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 453/648] 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 454/648] 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 455/648] 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 456/648] 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 457/648] 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 458/648] 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 459/648] 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 460/648] 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 461/648] 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 462/648] 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 463/648] 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 464/648] 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 465/648] 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 466/648] 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 467/648] 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 468/648] 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 469/648] 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 470/648] 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 471/648] 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 472/648] 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 473/648] 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 474/648] 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 475/648] 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 476/648] 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 477/648] 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 478/648] 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 479/648] 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 480/648] 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 481/648] 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 482/648] 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 483/648] 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 484/648] 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 485/648] 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 486/648] 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 487/648] 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 488/648] 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 489/648] 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 490/648] 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 491/648] 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 492/648] 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 493/648] 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 494/648] 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 495/648] 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 496/648] 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 497/648] 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 498/648] 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 499/648] 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 500/648] 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 501/648] 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 502/648] 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 503/648] 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 504/648] 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 505/648] 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 506/648] 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 507/648] 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 508/648] 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 509/648] 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 510/648] 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 511/648] 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 512/648] 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 513/648] 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 514/648] 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 515/648] 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 516/648] 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 517/648] 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 518/648] 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 519/648] =?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 520/648] 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 521/648] 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 522/648] 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 523/648] 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 524/648] 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 525/648] 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 526/648] 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 527/648] 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 528/648] 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 529/648] 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 530/648] 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 531/648] 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 532/648] 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 533/648] 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 534/648] 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 535/648] 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 536/648] 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 537/648] 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 538/648] 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 539/648] 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 540/648] 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 541/648] 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 542/648] 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 543/648] 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 544/648] 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 545/648] 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 546/648] 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 547/648] 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 548/648] 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 549/648] 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 550/648] 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 551/648] 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 552/648] 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 553/648] 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 554/648] 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 555/648] 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 556/648] 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 557/648] 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 558/648] 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 559/648] 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 560/648] 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 561/648] 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 562/648] 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 563/648] 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 564/648] 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 565/648] 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 566/648] 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 567/648] 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 568/648] 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 569/648] 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 570/648] 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 571/648] 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 572/648] 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 573/648] 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 574/648] 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 575/648] 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 576/648] 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 577/648] 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 578/648] 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 579/648] 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 580/648] 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 581/648] 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 582/648] 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 583/648] 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 584/648] 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 585/648] `--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 586/648] 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 587/648] 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 588/648] 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 589/648] 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 590/648] 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 591/648] 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 592/648] 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 593/648] 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 594/648] 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 595/648] 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 596/648] 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 597/648] 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 598/648] 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 599/648] 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 600/648] 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 601/648] 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 602/648] 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 603/648] 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 604/648] 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 605/648] 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 606/648] 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 607/648] 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 608/648] 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 609/648] 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 610/648] 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 611/648] 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 612/648] 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 613/648] 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 614/648] 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 615/648] 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 616/648] 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 617/648] 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 618/648] 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 619/648] 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 620/648] 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 621/648] 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 622/648] 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 623/648] 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 624/648] 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 625/648] 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 626/648] 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 627/648] 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 628/648] 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 629/648] 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 630/648] 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 631/648] 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 632/648] 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 633/648] 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 634/648] 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 635/648] 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 636/648] 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 637/648] 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 638/648] 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 639/648] 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 640/648] 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 641/648] 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 642/648] 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 643/648] 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 644/648] 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 645/648] 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" From 927b89bec845136420e1640b584c4f9c8edd92c8 Mon Sep 17 00:00:00 2001 From: Raja Sekar Date: Thu, 14 Nov 2019 21:46:40 +0100 Subject: [PATCH 646/648] removed yarn lock from eslint packages (#10711) --- eslint/babel-eslint-parser/yarn.lock | 3711 ----------------- .../babel-eslint-plugin-development/yarn.lock | 857 ---- eslint/babel-eslint-plugin/yarn.lock | 977 ----- 3 files changed, 5545 deletions(-) delete mode 100644 eslint/babel-eslint-parser/yarn.lock delete mode 100644 eslint/babel-eslint-plugin-development/yarn.lock delete mode 100644 eslint/babel-eslint-plugin/yarn.lock diff --git a/eslint/babel-eslint-parser/yarn.lock b/eslint/babel-eslint-parser/yarn.lock deleted file mode 100644 index aab080f5cb3f..000000000000 --- a/eslint/babel-eslint-parser/yarn.lock +++ /dev/null @@ -1,3711 +0,0 @@ -# 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/core@^7.2.0": - 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.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.11" - resolve "^1.3.2" - semver "^5.4.1" - source-map "^0.5.0" - -"@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.5.0" - jsesc "^2.5.1" - lodash "^4.17.11" - 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.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.3.0" - esutils "^2.0.0" - -"@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.4.4" - "@babel/traverse" "^7.4.4" - "@babel/types" "^7.4.4" - -"@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/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" - 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.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.1.0" - "@babel/types" "^7.0.0" - -"@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.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.4.4" - -"@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", "@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.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" - 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", "@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.11" - -"@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", "@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.4.4" - "@babel/types" "^7.4.4" - -"@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.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.4.4" - -"@babel/helper-wrap-function@^7.1.0": - 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.2.0" - -"@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: - "@babel/template" "^7.4.4" - "@babel/traverse" "^7.5.0" - "@babel/types" "^7.5.0" - -"@babel/highlight@^7.0.0": - 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.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.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.2.0" - -"@babel/plugin-proposal-class-properties@^7.1.0": - 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-create-class-features-plugin" "^7.5.0" - "@babel/helper-plugin-utils" "^7.0.0" - -"@babel/plugin-proposal-decorators@^7.1.2": - 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/plugin-syntax-decorators" "^7.2.0" - -"@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-dynamic-import" "^7.2.0" - -"@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-json-strings" "^7.2.0" - -"@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-nullish-coalescing-operator" "^7.2.0" - -"@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-object-rest-spread" "^7.2.0" - -"@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-catch-binding" "^7.2.0" - -"@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-optional-chaining" "^7.2.0" - -"@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/plugin-syntax-pipeline-operator" "^7.5.0" - -"@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-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.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", "@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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.11" - -"@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.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.4.4" - "@babel/helper-split-export-declaration" "^7.4.4" - globals "^11.1.0" - -"@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.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.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.4.4" - regexpu-core "^4.5.4" - -"@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.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.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.2.0" - -"@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.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.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-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-plugin-utils" "^7.0.0" - -"@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.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.4.4" - "@babel/helper-plugin-utils" "^7.0.0" - babel-plugin-dynamic-import-node "^2.3.0" - -"@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-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.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.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.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.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.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.2.0" - -"@babel/plugin-transform-react-jsx-source@^7.0.0": - 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.2.0" - -"@babel/plugin-transform-react-jsx@^7.0.0": - 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.3.0" - "@babel/helper-plugin-utils" "^7.0.0" - "@babel/plugin-syntax-jsx" "^7.2.0" - -"@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.14.0" - -"@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-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-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.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.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.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.4.4" - regexpu-core "^4.5.4" - -"@babel/preset-env@^7.1.5": - 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.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.5.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.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.4.4" - "@babel/types" "^7.4.4" - -"@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.5.0" - "@babel/helper-function-name" "^7.1.0" - "@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.11" - -"@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.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@^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@^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.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-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, 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" - resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911" - integrity sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg== - 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" - 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-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: - 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" - 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@^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" - "@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" - -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" - 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" - integrity sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA== - dependencies: - 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" - integrity sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w== - 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.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.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.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" - 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-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 "^2.0.0" - -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.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.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" - has-ansi "^2.0.0" - 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, 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" - 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== - -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@^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-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" - -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.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.14.1, commander@^2.9.0: - 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.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" - 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" - 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, 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.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.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" - semver "^5.5.0" - shebang-command "^1.2.0" - which "^1.2.9" - -date-fns@^1.27.2: - 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.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.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.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" - -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@^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.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= - -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: - once "^1.4.0" - -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@^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.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.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 "^2.0.0" - -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.17.11" - -eslint-plugin-import@^2.14.0: - 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.9" - doctrine "1.5.0" - 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.11.0" - -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: - prettier-linter-helpers "^1.0.0" - -eslint-scope@3.7.1: - version "3.7.1" - 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.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.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.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" - 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.10.0" - chalk "^2.1.0" - cross-spawn "^6.0.5" - 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 "^6.0.0" - esquery "^1.0.1" - esutils "^2.0.2" - file-entry-cache "^5.0.1" - functional-red-black-tree "^1.0.1" - glob-parent "^3.1.0" - globals "^11.7.0" - ignore "^4.0.6" - import-fresh "^3.0.0" - imurmurhash "^0.1.4" - 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.11" - minimatch "^3.0.4" - mkdirp "^0.5.1" - natural-compare "^1.4.0" - optionator "^0.8.2" - progress "^2.0.0" - regexpp "^2.0.1" - semver "^5.5.1" - strip-ansi "^4.0.0" - strip-json-comments "^2.0.1" - table "^5.2.3" - text-table "^0.2.0" - -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 "^6.0.7" - 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.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" - 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" - -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" - 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" - 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.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" - tmp "^0.0.33" - -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" - 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@^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@^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" - -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@^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 "^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" - 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" - integrity sha1-M8RLQpqysvBkYpnF+fcY83b/jVQ= - -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: - locate-path "^3.0.0" - -find-up@^2.0.0, find-up@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/find-up/-/find-up-2.1.0.tgz#45d1b7e506c717ddd482775a2b77920a3c0c57a7" - integrity sha1-RdG35QbHF93UgndaK3eSCjwMV6c= - dependencies: - locate-path "^2.0.0" - -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: - flatted "^2.0.0" - rimraf "2.6.3" - write "1.0.3" - -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: - 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.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-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-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" - inherits "2" - minimatch "^3.0.4" - once "^1.3.0" - path-is-absolute "^1.0.0" - -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: - 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.2.0" - resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.0.tgz#8d8fdc73977cb04104721cb53666c1ca64cd328b" - integrity sha512-jpSvDPV4Cq/bgtpndIWbI5hmYxhQGHPC4d4cqBPb4DLniCfhJokdXhwhaDuLBGLQdvvRum/UiX6ECVIPvDXqdg== - -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@^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" - 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" - integrity sha1-GLKB2lhbHFxR3vJMkw7SmgvmsXc= - 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" - 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, 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.1.1" - -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.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.3.1" - resolved "https://registry.yarnpkg.com/husky/-/husky-1.3.1.tgz#26823e399300388ca2afff11cfa8a86b0033fae0" - integrity sha512-86U6sVVVf4b5NYSZ0yvv88dRgBSSXXmHaiq5pP4KDj5JVzdwKgBjEtUPOm8hcoytezFwbU+7gotXNhpHdystlg== - dependencies: - cosmiconfig "^5.0.7" - execa "^1.0.0" - find-up "^3.0.0" - get-stdin "^6.0.0" - is-ci "^2.0.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.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" - 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.4" - resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" - integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== - -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.2.0" - chalk "^2.4.2" - cli-cursor "^2.1.0" - cli-width "^2.0.0" - external-editor "^3.0.3" - figures "^2.0.0" - lodash "^4.17.12" - mute-stream "0.0.7" - run-async "^2.2.0" - rxjs "^6.4.0" - string-width "^2.1.0" - strip-ansi "^5.1.0" - through "^2.3.6" - -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-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-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 "^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" - 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" - integrity sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg== - 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" - 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.0, is-extglob@^2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2" - 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.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-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" - 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" - 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.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.6.0" - -js-levenshtein@^1.1.3: - 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.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== - dependencies: - argparse "^1.0.7" - esprima "^4.0.0" - -jsesc@^2.5.1: - 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" - 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" - 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" - 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" - 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.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" - cosmiconfig "^5.0.2" - debug "^3.1.0" - dedent "^0.7.0" - execa "^0.9.0" - find-parent-dir "^0.3.0" - is-glob "^4.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" - 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" - 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.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" - elegant-spinner "^1.0.1" - figures "^1.7.0" - indent-string "^3.0.0" - log-symbols "^1.0.2" - log-update "^2.3.0" - strip-ansi "^3.0.1" - -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 "^2.4.1" - cli-cursor "^2.1.0" - date-fns "^1.27.2" - figures "^2.0.0" - -listr@^0.14.1: - 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" - 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.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" - 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" - integrity sha1-K1aLJl7slExtnA3pw9u7ygNUzY4= - dependencies: - 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" - integrity sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A== - dependencies: - p-locate "^3.0.0" - path-exists "^3.0.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@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-symbols@^1.0.2: - version "1.0.2" - 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 "^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.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" - 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" - integrity sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ== - -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" - resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284" - integrity sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ= - -mixin-deep@^1.2.0: - 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" - -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@^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: - ansi-colors "3.2.3" - browser-stdout "1.3.1" - debug "3.2.6" - diff "3.5.0" - escape-string-regexp "1.0.5" - 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" - 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: - 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 "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" - 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" - 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-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.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" - 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" - 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" - integrity sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0= - -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.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@^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-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: - execa "^1.0.0" - lcid "^2.0.0" - mem "^4.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= - -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.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.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.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" - -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-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.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.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= - -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 "^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" - -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.18.2" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.18.2.tgz#6823e7c5900017b4bd3acf46fe9ac4b4d7bda9ea" - integrity sha512-OeHeMc0JhFE9idD4ZdtNibzY0+TPHSpSSb9h8FqtP+YnoZZ1sl8Vc9b1sasjfymH3SonAF4QcA2+mzHPhMvIiw== - -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" - -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.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" - -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" - 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" - integrity sha1-ljYlN48+HE1IyFhytabsfV0JMjc= - dependencies: - normalize-package-data "^2.3.2" - parse-json "^4.0.0" - pify "^3.0.0" - -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" - -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.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" - -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== - -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 "^8.0.2" - regjsgen "^0.5.0" - regjsparser "^0.6.0" - unicode-match-property-ecmascript "^1.0.4" - unicode-match-property-value-ecmascript "^1.1.0" - -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.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= - -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= - -require-main-filename@^1.0.1: - version "1.0.1" - 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.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: - 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" - -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.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.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.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" - -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" - 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", 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== - -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== - -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" - 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" - 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" - 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@^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" - 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" - 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" - 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" - integrity sha512-MjqsvNwyz1s0k81Goz/9vRBe9SZdB09Bdw+/zYyO+3CuPk6fouTaxscHkgtE8jKvf01kVfl8riHzERQ/kefaSA== - 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" - 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@^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-expression-parse "^3.0.0" - spdx-license-ids "^3.0.0" - -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@^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" - -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" - 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" - -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@^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.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 "^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: - 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@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 "^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@^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.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 "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" - -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" - 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" - integrity sha1-yy4SAwZ+DI3h9hQJS5/kVwTqYAM= - -tslib@^1.9.0: - 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" - -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.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.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.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 "^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" - -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.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 "^3.0.0" - spdx-expression-parse "^3.0.0" - -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@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" diff --git a/eslint/babel-eslint-plugin-development/yarn.lock b/eslint/babel-eslint-plugin-development/yarn.lock deleted file mode 100644 index 1124540b3f7b..000000000000 --- a/eslint/babel-eslint-plugin-development/yarn.lock +++ /dev/null @@ -1,857 +0,0 @@ -# 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.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" - -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" diff --git a/eslint/babel-eslint-plugin/yarn.lock b/eslint/babel-eslint-plugin/yarn.lock deleted file mode 100644 index 7845d4d1c04c..000000000000 --- a/eslint/babel-eslint-plugin/yarn.lock +++ /dev/null @@ -1,977 +0,0 @@ -# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. -# 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" - 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.10" - resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911" - 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@^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" "^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@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" - 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.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" - 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.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" - 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-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@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" - -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.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" - 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.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" - 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.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" - 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.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: - 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, globals@^11.1.0: - version "11.4.0" - resolved "https://registry.yarnpkg.com/globals/-/globals-11.4.0.tgz#b85c793349561c16076a3c13549238a27945f1bc" - -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" - -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" - resolved "https://registry.yarnpkg.com/has-ansi/-/has-ansi-2.0.0.tgz#34f5049ce1ecdf2b0649af3ef24e45ed35416d91" - dependencies: - ansi-regex "^2.0.0" - -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" - -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.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" - -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" - -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" - -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.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, 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" - 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.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: - 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@^5.2.0: - version "5.2.0" - resolved "https://registry.yarnpkg.com/mocha/-/mocha-5.2.0.tgz#6d8ae508f59167f940f2b5b3c4a612ae50c90ae6" - 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" - -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" - -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" - -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" - -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@5.4.0: - version "5.4.0" - resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.4.0.tgz#1c6b337402c2137605efe19f10fec390f6faab54" - dependencies: - 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" - -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@^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" - -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 17dfdab7d20e4f222d91237efcb1a60c031a7018 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hu=C3=A1ng=20J=C3=B9nli=C3=A0ng?= Date: Thu, 14 Nov 2019 16:00:46 -0500 Subject: [PATCH 647/648] chore: ignore engines for eslint packages (#10713) --- Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index cfef047f6140..b552967d9f0a 100644 --- a/Makefile +++ b/Makefile @@ -225,7 +225,8 @@ yarn-install: clean-all yarn --ignore-engines lerna-bootstrap: yarn-install - yarn lerna bootstrap +# todo: remove `-- -- --ignore-engines` in Babel 8 + yarn lerna bootstrap -- -- --ignore-engines bootstrap: bootstrap-only $(MAKE) build From b4c42601d1943256ecfc20ab6a6306ee786e2e14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?= Date: Thu, 14 Nov 2019 22:05:26 +0100 Subject: [PATCH 648/648] Fix linting in ESLint packages (#10712) * Lint eslint/* * Run "make fix-js" * Fix remaining problems * Remove linting from subpackages * Remove husky * Add back eslint dep --- .eslintignore | 4 + Makefile | 2 +- eslint/babel-eslint-config-internal/index.js | 14 +- eslint/babel-eslint-parser/.prettierignore | 1 - eslint/babel-eslint-parser/.prettierrc | 3 - eslint/babel-eslint-parser/package.json | 22 +-- .../.eslintrc.json | 20 -- .../.prettierrc | 11 -- .../package.json | 7 +- .../src/rules/no-deprecated-clone.js | 2 - .../src/rules/no-undefined-identifier.js | 2 +- .../src/rules/plugin-name.js | 2 +- .../src/utils/is-from-babel-types.js | 2 +- eslint/babel-eslint-plugin/index.js | 62 +++--- .../rules/array-bracket-spacing.js | 79 ++++---- .../babel-eslint-plugin/rules/arrow-parens.js | 49 ++--- eslint/babel-eslint-plugin/rules/camelcase.js | 105 ++++++---- .../rules/flow-object-type.js | 53 ++--- .../rules/func-params-comma-dangle.js | 51 ++--- .../rules/generator-star-spacing.js | 73 +++---- eslint/babel-eslint-plugin/rules/new-cap.js | 12 +- .../rules/no-await-in-loop.js | 41 ++-- .../rules/no-invalid-this.js | 34 ++-- .../rules/no-unused-expressions.js | 27 +-- .../rules/object-curly-spacing.js | 38 ++-- .../rules/object-shorthand.js | 49 ++--- eslint/babel-eslint-plugin/rules/quotes.js | 27 ++- eslint/babel-eslint-plugin/rules/semi.js | 182 +++++++++--------- .../babel-eslint-plugin/rules/valid-typeof.js | 15 +- .../tests/rules/new-cap.js | 2 - .../tests/rules/object-curly-spacing.js | 2 - 31 files changed, 498 insertions(+), 495 deletions(-) delete mode 100644 eslint/babel-eslint-parser/.prettierignore delete mode 100644 eslint/babel-eslint-parser/.prettierrc delete mode 100644 eslint/babel-eslint-plugin-development/.eslintrc.json delete mode 100644 eslint/babel-eslint-plugin-development/.prettierrc diff --git a/.eslintignore b/.eslintignore index 092fbbb802cd..ab694692690c 100644 --- a/.eslintignore +++ b/.eslintignore @@ -24,3 +24,7 @@ packages/babel-preset-env-standalone/babel-preset-env.min.js packages/babel-standalone/babel.js packages/babel-standalone/babel.min.js packages/babel-parser/test/expressions + +eslint/*/node_modules +eslint/*/test +eslint/*/tests diff --git a/Makefile b/Makefile index b552967d9f0a..b2b2d3c4e7b9 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,7 @@ FORCE_PUBLISH = "@babel/runtime,@babel/runtime-corejs2,@babel/runtime-corejs3,@b # Fix color output until TravisCI fixes https://github.com/travis-ci/travis-ci/issues/7967 export FORCE_COLOR = true -SOURCES = packages codemods +SOURCES = packages codemods eslint .PHONY: build build-dist watch lint fix clean test-clean test-only test test-ci publish bootstrap diff --git a/eslint/babel-eslint-config-internal/index.js b/eslint/babel-eslint-config-internal/index.js index 82d4013ef665..4d8e8da89bff 100644 --- a/eslint/babel-eslint-config-internal/index.js +++ b/eslint/babel-eslint-config-internal/index.js @@ -4,12 +4,12 @@ module.exports = { plugins: ["flowtype"], parserOptions: { ecmaVersion: 2017, - sourceType: "module" + sourceType: "module", }, rules: { - "camelcase": "off", + camelcase: "off", "consistent-return": "off", - "curly": ["error", "multi-line"], + curly: ["error", "multi-line"], "linebreak-style": ["error", "unix"], "max-len": ["error", 110, 2], "new-cap": "off", @@ -31,18 +31,18 @@ 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", }, globals: { // Flow Iterator: true, - $Keys: true + $Keys: true, }, env: { node: true, es6: true, - browser: true - } + browser: true, + }, }; diff --git a/eslint/babel-eslint-parser/.prettierignore b/eslint/babel-eslint-parser/.prettierignore deleted file mode 100644 index a6c57f5fb2ff..000000000000 --- a/eslint/babel-eslint-parser/.prettierignore +++ /dev/null @@ -1 +0,0 @@ -*.json diff --git a/eslint/babel-eslint-parser/.prettierrc b/eslint/babel-eslint-parser/.prettierrc deleted file mode 100644 index 88a0e9a2990e..000000000000 --- a/eslint/babel-eslint-parser/.prettierrc +++ /dev/null @@ -1,3 +0,0 @@ -{ - "trailingComma": "es5" - } \ No newline at end of file diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 3a5d1d282b74..a92949e7e0a6 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -13,11 +13,7 @@ }, "homepage": "https://github.com/babel/babel-eslint", "scripts": { - "test": "npm run lint && npm run test-only", - "test-only": "cd test && mocha specs && cd -", - "lint": "eslint .", - "lint-fix": "npm run lint -- --fix", - "precommit": "lint-staged", + "test": "cd test && mocha specs && cd -", "preversion": "npm test", "changelog": "git log `git describe --tags --abbrev=0`..HEAD --pretty=format:' * %s (%an)' | grep -v 'Merge pull request'" }, @@ -52,23 +48,9 @@ "@babel/preset-env": "^7.1.5", "@babel/preset-flow": "^7.0.0", "@babel/preset-react": "^7.0.0", - "babel-eslint": "^10.0.2", "dedent": "^0.7.0", "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": "^3.1.0", "espree": "^6.0.0", - "husky": "^1.0.0-rc.13", - "lint-staged": "^7.2.2", - "mocha": "^6.1.4", - "prettier": "^1.4.4" - }, - "lint-staged": { - "*.js": [ - "eslint --format=codeframe --fix", - "git add" - ] + "mocha": "^6.1.4" } } diff --git a/eslint/babel-eslint-plugin-development/.eslintrc.json b/eslint/babel-eslint-plugin-development/.eslintrc.json deleted file mode 100644 index 0b09e73c3d1f..000000000000 --- a/eslint/babel-eslint-plugin-development/.eslintrc.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "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/.prettierrc b/eslint/babel-eslint-plugin-development/.prettierrc deleted file mode 100644 index bf2972ae07a3..000000000000 --- a/eslint/babel-eslint-plugin-development/.prettierrc +++ /dev/null @@ -1,11 +0,0 @@ -{ - "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/package.json b/eslint/babel-eslint-plugin-development/package.json index 9a8810acea83..9a65d7b6cf8a 100644 --- a/eslint/babel-eslint-plugin-development/package.json +++ b/eslint/babel-eslint-plugin-development/package.json @@ -14,14 +14,11 @@ }, "main": "src/index.js", "scripts": { - "test": "mocha tests --recursive", - "lint": "eslint src tests" + "test": "mocha tests --recursive" }, "devDependencies": { "eslint": "^5.9.0", - "eslint-plugin-prettier": "^3.0.0", - "mocha": "^5.2.0", - "prettier": "^1.15.2" + "mocha": "^5.2.0" }, "engines": { "node": ">=8.0.0" 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 08bfef8c9be5..e6e72f1b9b06 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 @@ -1,5 +1,3 @@ -// @flow - "use strict"; const getReferenceOrigin = require("../utils/get-reference-origin"); 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 index c1b4b8a99382..7a433b160c75 100644 --- a/eslint/babel-eslint-plugin-development/src/rules/no-undefined-identifier.js +++ b/eslint/babel-eslint-plugin-development/src/rules/no-undefined-identifier.js @@ -32,7 +32,7 @@ module.exports = { ) { context.report( node, - "Use path.scope.buildUndefinedNode() to create an undefined identifier directly.", + "Use path.scope.buildUndefinedNode() to create an undefined identifier directly." ); } }, diff --git a/eslint/babel-eslint-plugin-development/src/rules/plugin-name.js b/eslint/babel-eslint-plugin-development/src/rules/plugin-name.js index 58a4bc9f6337..11dd02808a31 100644 --- a/eslint/babel-eslint-plugin-development/src/rules/plugin-name.js +++ b/eslint/babel-eslint-plugin-development/src/rules/plugin-name.js @@ -44,7 +44,7 @@ module.exports = { if (!returnValue.properties.some(p => p.key.name === "name")) { context.report( returnValue, - "This Babel plugin doesn't have a 'name' property.", + "This Babel plugin doesn't have a 'name' property." ); } } 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 36ab618817d6..304561621732 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 @@ -6,7 +6,7 @@ const isBabelPluginFactory = require("./is-babel-plugin-factory"); // is a reference to a @babel/types export. module.exports = function isFromBabelTypes( origin /*: ReferenceOrigin */, - scope /*: Scope */, + scope /*: Scope */ ) { if (origin.kind === "import" && origin.source === "@babel/types") { // imported from @babel/types diff --git a/eslint/babel-eslint-plugin/index.js b/eslint/babel-eslint-plugin/index.js index 6cd30daefb0b..eda05b28c808 100644 --- a/eslint/babel-eslint-plugin/index.js +++ b/eslint/babel-eslint-plugin/index.js @@ -1,38 +1,38 @@ -'use strict'; +"use strict"; module.exports = { rules: { - 'array-bracket-spacing': require('./rules/array-bracket-spacing'), - 'arrow-parens': require('./rules/arrow-parens'), - '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'), - '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'), - 'object-curly-spacing': require('./rules/object-curly-spacing'), - 'object-shorthand': require('./rules/object-shorthand'), - 'quotes': require('./rules/quotes'), - 'semi': require('./rules/semi'), - 'valid-typeof': require('./rules/valid-typeof'), + "array-bracket-spacing": require("./rules/array-bracket-spacing"), + "arrow-parens": require("./rules/arrow-parens"), + "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"), + 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"), + "object-curly-spacing": require("./rules/object-curly-spacing"), + "object-shorthand": require("./rules/object-shorthand"), + quotes: require("./rules/quotes"), + semi: require("./rules/semi"), + "valid-typeof": require("./rules/valid-typeof"), }, rulesConfig: { - 'array-bracket-spacing': 0, - 'arrow-parens': 0, - 'camelcase': 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, - 'valid-typeof': 0, + "array-bracket-spacing": 0, + "arrow-parens": 0, + camelcase: 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, + "valid-typeof": 0, }, }; diff --git a/eslint/babel-eslint-plugin/rules/array-bracket-spacing.js b/eslint/babel-eslint-plugin/rules/array-bracket-spacing.js index 0a9ba375216b..e7eafff0d265 100644 --- a/eslint/babel-eslint-plugin/rules/array-bracket-spacing.js +++ b/eslint/babel-eslint-plugin/rules/array-bracket-spacing.js @@ -1,43 +1,46 @@ "use strict"; -var isWarnedForDeprecation = false; +let isWarnedForDeprecation = false; module.exports = { - meta: { - deprecated: true, - schema: [ - { - "enum": ["always", "never"] - }, - { - "type": "object", - "properties": { - "singleValue": { - "type": "boolean" - }, - "objectsInArrays": { - "type": "boolean" - }, - "arraysInArrays": { - "type": "boolean" - } - }, - "additionalProperties": false - } - ] - }, - create: function() { - return { - Program: function() { - if (isWarnedForDeprecation || /\=-(f|-format)=/.test(process.argv.join('='))) { - return; - } + meta: { + deprecated: true, + schema: [ + { + enum: ["always", "never"], + }, + { + type: "object", + properties: { + singleValue: { + type: "boolean", + }, + objectsInArrays: { + type: "boolean", + }, + arraysInArrays: { + 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/array-bracket-spacing rule is deprecated. Please ' + - 'use the built in array-bracket-spacing rule instead.'); - /* eslint-enable no-console */ - isWarnedForDeprecation = true; - } - }; - } + console.log( + "The babel/array-bracket-spacing rule is deprecated. Please " + + "use the built in array-bracket-spacing rule instead." + ); + isWarnedForDeprecation = true; + }, + }; + }, }; diff --git a/eslint/babel-eslint-plugin/rules/arrow-parens.js b/eslint/babel-eslint-plugin/rules/arrow-parens.js index 13d9c8ffe01b..848045ff7bcb 100644 --- a/eslint/babel-eslint-plugin/rules/arrow-parens.js +++ b/eslint/babel-eslint-plugin/rules/arrow-parens.js @@ -1,28 +1,31 @@ "use strict"; -var isWarnedForDeprecation = false; +let isWarnedForDeprecation = false; module.exports = { - meta: { - deprecated: true, - schema: [ - { - "enum": ["always", "as-needed"] - } - ] - }, - create: function() { - return { - Program: function() { - if (isWarnedForDeprecation || /\=-(f|-format)=/.test(process.argv.join('='))) { - return; - } + 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; - } - }; - } + console.log( + "The babel/arrow-parens rule is deprecated. Please " + + "use the built in arrow-parens rule instead." + ); + isWarnedForDeprecation = true; + }, + }; + }, }; diff --git a/eslint/babel-eslint-plugin/rules/camelcase.js b/eslint/babel-eslint-plugin/rules/camelcase.js index 65e8164cd77b..6528b4a7f423 100644 --- a/eslint/babel-eslint-plugin/rules/camelcase.js +++ b/eslint/babel-eslint-plugin/rules/camelcase.js @@ -15,7 +15,7 @@ module.exports = { description: "enforce camelcase naming convention", category: "Stylistic Issues", recommended: false, - url: "https://eslint.org/docs/rules/camelcase" + url: "https://eslint.org/docs/rules/camelcase", }, schema: [ @@ -23,23 +23,22 @@ module.exports = { type: "object", properties: { ignoreDestructuring: { - type: "boolean" + type: "boolean", }, properties: { - enum: ["always", "never"] - } + enum: ["always", "never"], + }, }, - additionalProperties: false - } + additionalProperties: false, + }, ], messages: { - notCamelCase: "Identifier '{{name}}' is not in camel case." - } + notCamelCase: "Identifier '{{name}}' is not in camel case.", + }, }, create(context) { - //-------------------------------------------------------------------------- // Helpers //-------------------------------------------------------------------------- @@ -66,7 +65,6 @@ module.exports = { * @private */ function isUnderscored(name) { - // if there's an underscore, it might be A_CONSTANT, which is okay return name.indexOf("_") > -1 && name !== name.toUpperCase(); } @@ -100,7 +98,11 @@ module.exports = { function report(node) { if (reported.indexOf(node.parent) < 0) { reported.push(node.parent); - context.report({ node, messageId: "notCamelCase", data: { name: node.name } }); + context.report({ + node, + messageId: "notCamelCase", + data: { name: node.name }, + }); } } @@ -113,30 +115,39 @@ module.exports = { } 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; + 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)) { + 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)) { + } else if ( + effectiveParent.type === "AssignmentExpression" && + isUnderscored(name) && + (!isMemberExpression(effectiveParent.right.type) || + (isMemberExpression(effectiveParent.left.type) && + effectiveParent.left.property.name === node.name)) + ) { report(node); } @@ -145,50 +156,76 @@ module.exports = { * 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; + } 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); + 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)) { + if ( + valueIsUnderscored && + !(assignmentKeyEqualsValue && ignoreDestructuring) + ) { report(node); } } // "never" check properties or always ignore destructuring - if (properties === "never" || (ignoreDestructuring && isInsideObjectPattern(node))) { + 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)) { + 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) { - + } 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)) { + 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)) { + } else if ( + isUnderscored(name) && + !ALLOWED_PARENT_TYPES.has(effectiveParent.type) + ) { report(node); } - } - + }, }; - - } + }, }; diff --git a/eslint/babel-eslint-plugin/rules/flow-object-type.js b/eslint/babel-eslint-plugin/rules/flow-object-type.js index 73cd3ed17a47..4e45f8328b03 100644 --- a/eslint/babel-eslint-plugin/rules/flow-object-type.js +++ b/eslint/babel-eslint-plugin/rules/flow-object-type.js @@ -1,29 +1,34 @@ "use strict"; -var isWarnedForDeprecation = false; +let isWarnedForDeprecation = false; module.exports = { - meta: { - deprecated: true, - schema: [ - { - "enum": ["semicolon", "comma"], - } - ] - }, - create: function() { - return { - Program: function() { - if (isWarnedForDeprecation || /\=-(f|-format)=/.test(process.argv.join('='))) { - return; - } + 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; - } - }; - } + console.log( + "The babel/flow-object-type rule is deprecated. Please " + + "use the flowtype/object-type-delimiter rule instead.\n" + + // eslint-disable-next-line + "Check out https://github.com/gajus/eslint-plugin-flowtype#eslint-plugin-flowtype-rules-object-type-delimiter" + ); + + isWarnedForDeprecation = true; + }, + }; + }, }; 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 0290d81323d4..40bd08b3bbd3 100644 --- a/eslint/babel-eslint-plugin/rules/func-params-comma-dangle.js +++ b/eslint/babel-eslint-plugin/rules/func-params-comma-dangle.js @@ -1,28 +1,31 @@ -'use strict'; +"use strict"; -var isWarnedForDeprecation = false; +let isWarnedForDeprecation = false; 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; - } + 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; - } - }; - } + console.log( + "The babel/func-params-comma-dangle rule is deprecated. Please " + + "use the built in comma-dangle rule instead." + ); + isWarnedForDeprecation = true; + }, + }; + }, }; diff --git a/eslint/babel-eslint-plugin/rules/generator-star-spacing.js b/eslint/babel-eslint-plugin/rules/generator-star-spacing.js index 64186ffe680f..6befc25d04ea 100644 --- a/eslint/babel-eslint-plugin/rules/generator-star-spacing.js +++ b/eslint/babel-eslint-plugin/rules/generator-star-spacing.js @@ -1,40 +1,43 @@ "use strict"; -var isWarnedForDeprecation = false; +let isWarnedForDeprecation = false; module.exports = { - meta: { - deprecated: true, - schema: [ - { - "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; - } + meta: { + deprecated: true, + schema: [ + { + 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; - } - }; - } + console.log( + "The babel/generator-star-spacing rule is deprecated. Please " + + "use the built in generator-star-spacing rule instead." + ); + isWarnedForDeprecation = true; + }, + }; + }, }; diff --git a/eslint/babel-eslint-plugin/rules/new-cap.js b/eslint/babel-eslint-plugin/rules/new-cap.js index 37ee633bf2d9..3e09bb25df4b 100644 --- a/eslint/babel-eslint-plugin/rules/new-cap.js +++ b/eslint/babel-eslint-plugin/rules/new-cap.js @@ -1,8 +1,8 @@ "use strict"; -const ruleComposer = require('eslint-rule-composer'); -const eslint = require('eslint'); -const newCapRule = new eslint.Linter().getRules().get('new-cap'); +const ruleComposer = require("eslint-rule-composer"); +const eslint = require("eslint"); +const newCapRule = new eslint.Linter().getRules().get("new-cap"); /** * Returns whether a node is under a decorator or not. @@ -10,10 +10,10 @@ const newCapRule = new eslint.Linter().getRules().get('new-cap'); * @returns {Boolean} Returns true if the node is under a decorator. */ function isDecorator(node) { - return node.parent.type === "Decorator"; + return node.parent.type === "Decorator"; } module.exports = ruleComposer.filterReports( - newCapRule, - (problem, metadata) => !isDecorator(problem.node) + newCapRule, + problem => !isDecorator(problem.node) ); 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 8ef295f36fd3..a46a19da8876 100644 --- a/eslint/babel-eslint-plugin/rules/no-await-in-loop.js +++ b/eslint/babel-eslint-plugin/rules/no-await-in-loop.js @@ -1,24 +1,27 @@ "use strict"; -var isWarnedForDeprecation = false; +let isWarnedForDeprecation = false; module.exports = { - meta: { - deprecated: true, - schema: [] - }, - create: function() { - return { - Program: function() { - if (isWarnedForDeprecation || /\=-(f|-format)=/.test(process.argv.join('='))) { - return; - } + meta: { + deprecated: true, + schema: [], + }, + create: function() { + return { + Program: function() { + if ( + isWarnedForDeprecation || + /=-(f|-format)=/.test(process.argv.join("=")) + ) { + return; + } - /* 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; - } - }; - } + console.log( + "The babel/no-await-in-loop rule is deprecated. Please " + + "use the built in no-await-in-loop rule instead." + ); + isWarnedForDeprecation = true; + }, + }; + }, }; diff --git a/eslint/babel-eslint-plugin/rules/no-invalid-this.js b/eslint/babel-eslint-plugin/rules/no-invalid-this.js index 994499eaadaa..101ec655a6d8 100644 --- a/eslint/babel-eslint-plugin/rules/no-invalid-this.js +++ b/eslint/babel-eslint-plugin/rules/no-invalid-this.js @@ -1,25 +1,21 @@ "use strict"; -const ruleComposer = require('eslint-rule-composer'); -const eslint = require('eslint'); -const noInvalidThisRule = new eslint.Linter().getRules().get('no-invalid-this'); +const ruleComposer = require("eslint-rule-composer"); +const eslint = require("eslint"); +const noInvalidThisRule = new eslint.Linter().getRules().get("no-invalid-this"); -module.exports = ruleComposer.filterReports( - noInvalidThisRule, - (problem, metadata) => { - let inClassProperty = false; - let node = problem.node; +module.exports = ruleComposer.filterReports(noInvalidThisRule, problem => { + let inClassProperty = false; + let node = problem.node; - while (node) { - if (node.type === "ClassProperty" || - node.type === "ClassPrivateProperty") { - inClassProperty = true; - return; - } + while (node) { + if (node.type === "ClassProperty" || node.type === "ClassPrivateProperty") { + inClassProperty = true; + return; + } - node = node.parent; - } + node = node.parent; + } - return !inClassProperty; - } -); + return !inClassProperty; +}); diff --git a/eslint/babel-eslint-plugin/rules/no-unused-expressions.js b/eslint/babel-eslint-plugin/rules/no-unused-expressions.js index eb1955ab0bb8..81c779d3c78e 100644 --- a/eslint/babel-eslint-plugin/rules/no-unused-expressions.js +++ b/eslint/babel-eslint-plugin/rules/no-unused-expressions.js @@ -1,8 +1,8 @@ "use strict"; -const ruleComposer = require('eslint-rule-composer'); -const eslint = require('eslint'); -const rule = new eslint.Linter().getRules().get('no-unused-expressions'); +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 @@ -11,9 +11,11 @@ const rule = new eslint.Linter().getRules().get('no-unused-expressions'); */ function isFinalStatementInBlockStatement(node) { const parent = node.parent; - return /^(?:If|Expression)Statement$/.test(node.type) && - parent.type === 'BlockStatement' && - parent.body[parent.body.length - 1] === node; + return ( + /^(?:If|Expression)Statement$/.test(node.type) && + parent.type === "BlockStatement" && + parent.body[parent.body.length - 1] === node + ); } /** @@ -24,13 +26,13 @@ function isFinalStatementInBlockStatement(node) { function isInDoStatement(node) { if (!node) return false; - if (node.type === 'DoExpression') return true; + if (node.type === "DoExpression") return true; // this is an `else if` if ( - node.type === 'IfStatement' && + node.type === "IfStatement" && node.parent && - node.parent.type === 'IfStatement' + node.parent.type === "IfStatement" ) { return isInDoStatement(node.parent); } @@ -50,14 +52,13 @@ function isInDoStatement(node) { function isOptionalCallExpression(node) { return ( !!node && - node.type === 'ExpressionStatement' && - node.expression.type === 'OptionalCallExpression' + node.type === "ExpressionStatement" && + node.expression.type === "OptionalCallExpression" ); } module.exports = ruleComposer.filterReports( rule, - (problem, metadata) => + problem => !isInDoStatement(problem.node) && !isOptionalCallExpression(problem.node) ); - diff --git a/eslint/babel-eslint-plugin/rules/object-curly-spacing.js b/eslint/babel-eslint-plugin/rules/object-curly-spacing.js index 19953bf04ffe..d3ec19620158 100644 --- a/eslint/babel-eslint-plugin/rules/object-curly-spacing.js +++ b/eslint/babel-eslint-plugin/rules/object-curly-spacing.js @@ -1,25 +1,27 @@ "use strict"; -const ruleComposer = require('eslint-rule-composer'); -const eslint = require('eslint'); -const objectCurlySpacingRule = new eslint.Linter().getRules().get('object-curly-spacing'); +const ruleComposer = require("eslint-rule-composer"); +const eslint = require("eslint"); +const objectCurlySpacingRule = new eslint.Linter() + .getRules() + .get("object-curly-spacing"); module.exports = ruleComposer.filterReports( - objectCurlySpacingRule, - (problem, metadata) => { - const node = problem.node; + objectCurlySpacingRule, + (problem, metadata) => { + const node = problem.node; - // Allow `exportNamespaceFrom` and `exportDefaultFrom` syntax: - // export * as x from '...'; - // export x from '...'; - if ( - node.type === 'ExportNamedDeclaration' && - node.specifiers.length > 0 && - metadata.sourceCode.getTokenBefore(node.specifiers[0]).value === "export" - ) { - return false; - } - - return true; + // Allow `exportNamespaceFrom` and `exportDefaultFrom` syntax: + // export * as x from '...'; + // export x from '...'; + if ( + node.type === "ExportNamedDeclaration" && + node.specifiers.length > 0 && + metadata.sourceCode.getTokenBefore(node.specifiers[0]).value === "export" + ) { + return false; } + + return true; + } ); diff --git a/eslint/babel-eslint-plugin/rules/object-shorthand.js b/eslint/babel-eslint-plugin/rules/object-shorthand.js index 73ce1365ba40..21f41e639e79 100644 --- a/eslint/babel-eslint-plugin/rules/object-shorthand.js +++ b/eslint/babel-eslint-plugin/rules/object-shorthand.js @@ -1,28 +1,31 @@ "use strict"; -var isWarnedForDeprecation = false; +let isWarnedForDeprecation = false; 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; - } + 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; - } - }; - } + console.log( + "The babel/object-shorthand rule is deprecated. Please " + + "use the built in object-shorthand rule instead." + ); + isWarnedForDeprecation = true; + }, + }; + }, }; diff --git a/eslint/babel-eslint-plugin/rules/quotes.js b/eslint/babel-eslint-plugin/rules/quotes.js index 41cd7da5a325..a4bb46df453f 100644 --- a/eslint/babel-eslint-plugin/rules/quotes.js +++ b/eslint/babel-eslint-plugin/rules/quotes.js @@ -1,18 +1,15 @@ -'use strict'; +"use strict"; -const ruleComposer = require('eslint-rule-composer'); -const eslint = require('eslint'); -const quotesRule = new eslint.Linter().getRules().get('quotes'); +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; +module.exports = ruleComposer.filterReports(quotesRule, problem => { + // 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/rules/semi.js b/eslint/babel-eslint-plugin/rules/semi.js index 2d2fcc4ed292..8888bf4cacc8 100644 --- a/eslint/babel-eslint-plugin/rules/semi.js +++ b/eslint/babel-eslint-plugin/rules/semi.js @@ -1,115 +1,123 @@ "use strict"; -const ruleComposer = require('eslint-rule-composer'); -const eslint = require('eslint'); -const semiRule = new eslint.Linter().getRules().get('semi'); +const ruleComposer = require("eslint-rule-composer"); +const eslint = require("eslint"); +const semiRule = new eslint.Linter().getRules().get("semi"); const OPT_OUT_PATTERN = /^[-[(/+`]/; // One of [(/+-` const isSemicolon = token => token.type === "Punctuator" && token.value === ";"; const isUnnecessarySemicolon = (context, lastToken) => { - if (!isSemicolon(lastToken)) { - return false; - } + if (!isSemicolon(lastToken)) { + return false; + } - const nextToken = context.getSourceCode().getTokenAfter(lastToken); + const nextToken = context.getSourceCode().getTokenAfter(lastToken); - if (!nextToken) { - return true; - } + 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 === ";"); + 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; -} + return (lastTokenLine !== nextTokenLine && !isOptOutToken) || isDivider; +}; const isOneLinerBlock = (context, node) => { - const nextToken = context.getSourceCode().getTokenAfter(node); + const nextToken = context.getSourceCode().getTokenAfter(node); - if (!nextToken || nextToken.value !== "}") { - return false; - } + if (!nextToken || nextToken.value !== "}") { + return false; + } - const parent = node.parent; + const parent = node.parent; - return parent && parent.type === "BlockStatement" && - parent.loc.start.line === parent.loc.end.line; + return ( + parent && + parent.type === "BlockStatement" && + parent.loc.start.line === parent.loc.end.line + ); }; const report = (context, node, missing) => { - const lastToken = context.getSourceCode().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 - }); + const lastToken = context.getSourceCode().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, + }); }; const semiRuleWithClassProperty = ruleComposer.joinReports([ - semiRule, - context => ({ - ClassProperty(node) { - const options = context.options[1]; - const exceptOneLine = options && options.omitLastInOneLineBlock === true; - - const sourceCode = context.getSourceCode(); - const lastToken = sourceCode.getLastToken(node); - - if (context.options[0] === "never") { - if (isUnnecessarySemicolon(context, lastToken)) { - report(context, node, true); - } - } else { - if (!isSemicolon(lastToken)) { - if (!exceptOneLine || !isOneLinerBlock(context, node)) { - report(context, node); - } - } else { - if (exceptOneLine && isOneLinerBlock(context, node)) { - report(context, node, true); - } - } - } - }, - }), + semiRule, + context => ({ + ClassProperty(node) { + const options = context.options[1]; + const exceptOneLine = options && options.omitLastInOneLineBlock === true; + + const sourceCode = context.getSourceCode(); + const lastToken = sourceCode.getLastToken(node); + + if (context.options[0] === "never") { + if (isUnnecessarySemicolon(context, lastToken)) { + report(context, node, true); + } + } else { + if (!isSemicolon(lastToken)) { + if (!exceptOneLine || !isOneLinerBlock(context, node)) { + report(context, node); + } + } else { + if (exceptOneLine && isOneLinerBlock(context, node)) { + 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; - } - - return true; + semiRuleWithClassProperty, + problem => { + const node = problem.node; + + // Handle async iterator: + // for await (let something of {}) + if ( + node.type === "VariableDeclaration" && + node.parent.type === "ForAwaitStatement" + ) { + return false; } + + return true; + } ); diff --git a/eslint/babel-eslint-plugin/rules/valid-typeof.js b/eslint/babel-eslint-plugin/rules/valid-typeof.js index df5110be052a..aa8321ec98f9 100644 --- a/eslint/babel-eslint-plugin/rules/valid-typeof.js +++ b/eslint/babel-eslint-plugin/rules/valid-typeof.js @@ -1,12 +1,9 @@ "use strict"; -const ruleComposer = require('eslint-rule-composer'); -const eslint = require('eslint'); -const validTypeOf = new eslint.Linter().getRules().get('valid-typeof'); +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'; - } -) +module.exports = ruleComposer.filterReports(validTypeOf, problem => { + return problem.node.value !== "bigint"; +}); diff --git a/eslint/babel-eslint-plugin/tests/rules/new-cap.js b/eslint/babel-eslint-plugin/tests/rules/new-cap.js index d03adde0713a..c37f2e9f06a9 100644 --- a/eslint/babel-eslint-plugin/tests/rules/new-cap.js +++ b/eslint/babel-eslint-plugin/tests/rules/new-cap.js @@ -1,5 +1,3 @@ -/* eslint-disable */ - /** * @fileoverview Tests for new-cap rule. * @author Nicholas C. Zakas 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 8771785ff51e..a982ba5d3954 100644 --- a/eslint/babel-eslint-plugin/tests/rules/object-curly-spacing.js +++ b/eslint/babel-eslint-plugin/tests/rules/object-curly-spacing.js @@ -1,5 +1,3 @@ -/* eslint-disable */ - /** * @fileoverview Disallows or enforces spaces inside of object literals. * @author Jamund Ferguson