diff --git a/.eslintrc.yml b/.eslintrc.yml index 5279c7ef0b7d..ae99a744e13a 100644 --- a/.eslintrc.yml +++ b/.eslintrc.yml @@ -14,7 +14,6 @@ settings: import/internal-regex: ^linguist-languages/ rules: prettier-internal-rules/require-json-extensions: error - prettier-internal-rules/better-parent-property-check-in-needs-parens: error curly: error dot-notation: error eqeqeq: @@ -100,3 +99,14 @@ overrides: - error - patterns: - ".." + - files: src/language-js/needs-parens.js + rules: + prettier-internal-rules/better-parent-property-check-in-needs-parens: error + - files: src/**/*.js + rules: + prettier-internal-rules/prefer-fast-path-each: error + - files: + - src/language-js/**/*.js + - src/language-css/**/*.js + rules: + prettier-internal-rules/directly-loc-start-end: error diff --git a/.github/workflows/dev-package-test.yml b/.github/workflows/dev-package-test.yml index 7898c2979322..12576bc08cfd 100644 --- a/.github/workflows/dev-package-test.yml +++ b/.github/workflows/dev-package-test.yml @@ -30,7 +30,7 @@ jobs: runs-on: ${{ matrix.os }} steps: - name: Checkout - uses: actions/checkout@v2.3.3 + uses: actions/checkout@v2.3.4 - name: Setup Node.js uses: actions/setup-node@v2.1.2 diff --git a/.github/workflows/dev-test.yml b/.github/workflows/dev-test.yml index 717c58c3a745..2436742074f9 100644 --- a/.github/workflows/dev-test.yml +++ b/.github/workflows/dev-test.yml @@ -5,6 +5,7 @@ on: branches: - master - patch-release + - next pull_request: jobs: @@ -28,6 +29,8 @@ jobs: ENABLE_CODE_COVERAGE: true FULL_TEST: true CHECK_TEST_PARSERS: true + - os: "ubuntu-latest" + node: "15" exclude: - os: "macos-latest" node: "12" @@ -41,7 +44,7 @@ jobs: runs-on: ${{ matrix.os }} steps: - name: Checkout - uses: actions/checkout@v2.3.3 + uses: actions/checkout@v2.3.4 - name: Setup Node.js uses: actions/setup-node@v2.1.2 diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index d47ab9ecb194..bfbb606ef546 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -5,6 +5,7 @@ on: branches: - master - patch-release + - next pull_request: jobs: @@ -13,7 +14,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v2.3.3 + uses: actions/checkout@v2.3.4 - name: Setup Node.js uses: actions/setup-node@v2.1.2 diff --git a/.github/workflows/prod-test.yml b/.github/workflows/prod-test.yml index 64e02c1725a9..bd3be0d02275 100644 --- a/.github/workflows/prod-test.yml +++ b/.github/workflows/prod-test.yml @@ -5,6 +5,7 @@ on: branches: - master - patch-release + - next pull_request: jobs: @@ -13,7 +14,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v2.3.3 + uses: actions/checkout@v2.3.4 - name: Setup Node.js uses: actions/setup-node@v2.1.2 @@ -57,7 +58,7 @@ jobs: needs: [build] steps: - name: Checkout - uses: actions/checkout@v2.3.3 + uses: actions/checkout@v2.3.4 - name: Setup Node.js uses: actions/setup-node@v2.1.2 @@ -91,6 +92,8 @@ jobs: - os: "ubuntu-latest" node: "14" FULL_TEST: true + - os: "ubuntu-latest" + node: "15" exclude: - os: "macos-latest" node: "12" @@ -103,7 +106,7 @@ jobs: needs: [build] steps: - name: Checkout - uses: actions/checkout@v2.3.3 + uses: actions/checkout@v2.3.4 - name: Setup Node.js uses: actions/setup-node@v2.1.2 diff --git a/changelog_unreleased/api/pr-8983.md b/changelog_unreleased/api/pr-8983.md index 8d45781238f7..4282ea7a04d2 100644 --- a/changelog_unreleased/api/pr-8983.md +++ b/changelog_unreleased/api/pr-8983.md @@ -1,6 +1,6 @@ -#### ESM standalone bundles ([#8983](https://github.com/prettier/prettier/pull/8983) by [@Monchi](https://github.com/Monchi), [@fisker](https://github.com/fisker)) +#### [HIGHLIGHT]ESM standalone bundles ([#8983](https://github.com/prettier/prettier/pull/8983) by [@Monchi](https://github.com/Monchi), [@fisker](https://github.com/fisker)) -Now standalone is also bundled as ESM. It works directly on browser. +Prettier now also comes as ES modules, which can be directly used in modern browsers: ```js import prettier from "https://unpkg.com/prettier/esm/standalone.mjs"; diff --git a/changelog_unreleased/cli/pr-9298.md b/changelog_unreleased/cli/pr-9298.md index e3eb6e9a55db..d402fa7d563b 100644 --- a/changelog_unreleased/cli/pr-9298.md +++ b/changelog_unreleased/cli/pr-9298.md @@ -1,4 +1,4 @@ -#### Fix error on dir or file that name is a number (#9298 by @fisker) +#### Fix: error on directories and files with numeric names (#9298 by @fisker) ```console diff --git a/changelog_unreleased/css/pr-9209.md b/changelog_unreleased/css/pr-9209.md index 89da8951bc04..2a3f7f2442fa 100644 --- a/changelog_unreleased/css/pr-9209.md +++ b/changelog_unreleased/css/pr-9209.md @@ -1,4 +1,4 @@ -#### Improve custom properties format (#9209 by @fisker) +#### Improve formatting for custom properties (#9209 by @fisker) Thanks to [`PostCSS 8.0`](https://github.com/postcss/postcss/releases/tag/8.0.0), we can handle these edge cases on custom properties. diff --git a/changelog_unreleased/flow/pr-9432.md b/changelog_unreleased/flow/pr-9432.md index 63ac02f42f74..a677ea5044ae 100644 --- a/changelog_unreleased/flow/pr-9432.md +++ b/changelog_unreleased/flow/pr-9432.md @@ -1,4 +1,4 @@ -#### Flow Enums with unknown members (#9432 by @gkz) +#### Enums with unknown members (#9432 by @gkz) Previously, was not supported. Now, the following is formatted: diff --git a/changelog_unreleased/flow/pr-9457.md b/changelog_unreleased/flow/pr-9457.md index 285ee4423fd3..7899e4fa5323 100644 --- a/changelog_unreleased/flow/pr-9457.md +++ b/changelog_unreleased/flow/pr-9457.md @@ -1,6 +1,4 @@ -#### Flow `this` annotations (#9457 by @dsainati1, #9489 by @fisker) - -Add support for `this` parameter annotations in Flow. +#### `this` parameter annotations (#9457 by @dsainati1, #9489 by @fisker) ```jsx diff --git a/changelog_unreleased/flow/pr-9523.md b/changelog_unreleased/flow/pr-9523.md new file mode 100644 index 000000000000..da75c9926d1f --- /dev/null +++ b/changelog_unreleased/flow/pr-9523.md @@ -0,0 +1,18 @@ +#### Support `BigIntLiteralTypeAnnotation` and `BigIntTypeAnnotation` (#9523 by @fisker) + +Add support for `BigIntLiteralTypeAnnotation` and `BigIntTypeAnnotation` in Flow. + + +```jsx +// Input +const foo: bigint = 1n; +const bar: baz<1n> = 1n; + +// Prettier stable +Error: unknown type: "BigIntTypeAnnotation" + at ... + +// Prettier master +const foo: bigint = 1n; +const bar: baz<1n> = 1n; +``` diff --git a/changelog_unreleased/flow/pr-9543.md b/changelog_unreleased/flow/pr-9543.md new file mode 100644 index 000000000000..bc6582b498fa --- /dev/null +++ b/changelog_unreleased/flow/pr-9543.md @@ -0,0 +1,25 @@ +#### Treat more simple types as non-breaking in generic type annotations (#9543 by @fisker) + + +```jsx +// Input +const foo1: Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo = a +const foo2: Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo<"STRING"> = a; +const foo3: Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo<0> = a; + +// Prettier master +const foo1: Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo< + symbol +> = a; +const foo2: Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo< + "STRING" +> = a; +const foo3: Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo< + 0 +> = a; + +// Prettier stable (typescript and flow parser) +const foo1: Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo = a +const foo2: Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo<"STRING"> = a; +const foo3: Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo<0> = a; +``` diff --git a/changelog_unreleased/flow/pr-9553.md b/changelog_unreleased/flow/pr-9553.md new file mode 100644 index 000000000000..a041ea4fb7f9 --- /dev/null +++ b/changelog_unreleased/flow/pr-9553.md @@ -0,0 +1,22 @@ +#### Fix missing parentheses around `prettier-ignore`d type assertions (#9553 by @fisker) + + +```jsx +// Input +transform( + // prettier-ignore + (pointTransformer: (Point => Point)) +); + +// Prettier stable +transform( + // prettier-ignore + pointTransformer: (Point => Point) +); + +// Prettier master +transform( + // prettier-ignore + (pointTransformer: (Point => Point)) +); +``` diff --git a/changelog_unreleased/flow/pr-9563.md b/changelog_unreleased/flow/pr-9563.md new file mode 100644 index 000000000000..8260bb391b9f --- /dev/null +++ b/changelog_unreleased/flow/pr-9563.md @@ -0,0 +1,22 @@ +#### Improve comment types detection (#9563 by @fisker) + + +```jsx +// Input +foo/*::*/(baz); +class Foo { + bar( data: Array) {} +} + +// Prettier master +foo/*:: */(baz); +class Foo { + bar(data: Array/*:: */) {} +} + +// Prettier stable +foo/*:: */(baz); +class Foo { + bar(data: Array) {} +} +``` diff --git a/changelog_unreleased/javascript/pr-9000.md b/changelog_unreleased/javascript/pr-9000.md index 6f7ec68d3532..283afdd1e9d9 100644 --- a/changelog_unreleased/javascript/pr-9000.md +++ b/changelog_unreleased/javascript/pr-9000.md @@ -1,5 +1,9 @@ -#### Add `espree` parser (#9000 by @fisker) +#### [HIGHLIGHT]Add `espree` and `meriyah` parser (#9000, #9514 by @fisker) -A new value for the `parser` option has been added: [`espree`](https://github.com/eslint/espree) - which is the [`ESLint`](https://github.com/eslint/eslint) default parser. +Two new values for the `parser` option has been added: -Note that `espree` only works for [ECMAScript Finished Proposals](https://github.com/tc39/proposals/blob/master/finished-proposals.md), and is stricter than the `babel` parser. +- [`espree`](https://github.com/eslint/espree) - which is the default parser used by [`ESLint`](https://github.com/eslint/eslint). + + Note that `espree` only works for [Finished ECMAScript Proposals](https://github.com/tc39/proposals/blob/master/finished-proposals.md), and is stricter than the `babel` parser. + +- [`meriyah`](https://github.com/meriyah/meriyah) - A [fast](https://meriyah.github.io/meriyah/performance/) JavaScript parser, successor of [cherow](https://github.com/cherow/cherow). diff --git a/changelog_unreleased/javascript/pr-9278.md b/changelog_unreleased/javascript/pr-9278.md index 0efc1a6be42d..ede3ac621d71 100644 --- a/changelog_unreleased/javascript/pr-9278.md +++ b/changelog_unreleased/javascript/pr-9278.md @@ -1,4 +1,4 @@ -#### Fix comments inside template (#9278 by @fisker) +#### Fix comments inside template literals with embedded syntax (#9278 by @fisker) ```js diff --git a/changelog_unreleased/javascript/pr-9341.md b/changelog_unreleased/javascript/pr-9341.md index e7a38b91cdba..aeb46aeff2d1 100644 --- a/changelog_unreleased/javascript/pr-9341.md +++ b/changelog_unreleased/javascript/pr-9341.md @@ -1,6 +1,6 @@ -#### Improve formatting for `AssignmentExpression` with `ClassExpression` that has a long super class (#9341 by @sosukesuzuki) +#### Improve formatting for assignments of classes with long superclass names (#9341 by @sosukesuzuki) -This improves the formatting for [Google Closure Library Namespace](https://developers.google.com/closure/library/docs/introduction#names). +This improves the formatting for [Google Closure Library namespaces](https://developers.google.com/closure/library/docs/introduction#names). ```js diff --git a/changelog_unreleased/javascript/pr-9345.md b/changelog_unreleased/javascript/pr-9345.md index d579dc6a762c..57ac2fa5fb17 100644 --- a/changelog_unreleased/javascript/pr-9345.md +++ b/changelog_unreleased/javascript/pr-9345.md @@ -1,4 +1,4 @@ -#### Fix placing leading comments for a body of while statement (#9345 by @sosukesuzuki) +#### Fix placement of leading comments for bodies of `while` statements (#9345 by @sosukesuzuki) ```js diff --git a/changelog_unreleased/javascript/pr-9408.md b/changelog_unreleased/javascript/pr-9408.md index b496ce45f6a5..0444bb337109 100644 --- a/changelog_unreleased/javascript/pr-9408.md +++ b/changelog_unreleased/javascript/pr-9408.md @@ -1,4 +1,4 @@ -#### Update to `@babel/parser` 7.12 (#9408, #9476 by @sosukesuzuki) +#### Update to `@babel/parser` 7.12 (#9408, #9476, #9597 by @sosukesuzuki) Updated the JavaScript parser to [`@babel/parser` 7.12](https://babeljs.io/blog/2020/10/15/7.12.0). This fixes several bugs and supports some new syntax. @@ -7,15 +7,11 @@ Updated the JavaScript parser to [`@babel/parser` 7.12](https://babeljs.io/blog/ [The "module attributes" proposal supported on 2.1](https://prettier.io/blog/2020/08/24/2.1.0.html#support-es-module-attributes-and-json-modules-8436httpsgithubcomprettierprettierpull8436-by-fiskerhttpsgithubcomfisker) has been significantly changed and also renamed to "import assertions". ```js -import json from "./foo.json" assert { type: "json" }; +import foo from "./foo.json" assert { type: "json" }; ``` ##### Support imports and exports with string names - - -Due to a [bug in `@babel/parser`](https://github.com/babel/babel/issues/12209), Prettier can only use exports, but that will be fixed. - ```js let happy = "happy"; export { happy as "😃" }; diff --git a/changelog_unreleased/javascript/pr-9431.md b/changelog_unreleased/javascript/pr-9431.md index b3233bf01c14..0056c7ce604e 100644 --- a/changelog_unreleased/javascript/pr-9431.md +++ b/changelog_unreleased/javascript/pr-9431.md @@ -1,4 +1,4 @@ -#### Keep html and markdown invalid template literals as it is (#9431 by @fisker) +#### Keep HTML and Markdown invalid template literals as is (#9431 by @fisker) ```js diff --git a/changelog_unreleased/javascript/pr-9435.md b/changelog_unreleased/javascript/pr-9435.md index b54aeeaa37cb..d856535a8773 100644 --- a/changelog_unreleased/javascript/pr-9435.md +++ b/changelog_unreleased/javascript/pr-9435.md @@ -1,4 +1,4 @@ -#### Fix `import {a as a}` and `export {a as a}` format (#9435 by @fisker) +#### Fix formatting for `import {a as a}` and `export {a as a}` (#9435 by @fisker) ```js diff --git a/changelog_unreleased/markdown/pr-8786.md b/changelog_unreleased/markdown/pr-8786.md index 0523b5124cbb..77af10af845c 100644 --- a/changelog_unreleased/markdown/pr-8786.md +++ b/changelog_unreleased/markdown/pr-8786.md @@ -1,4 +1,4 @@ -#### Fix missing blank lines in fenced code block without end mark ([#8786](https://github.com/prettier/prettier/pull/8786) by [@fisker](https://github.com/fisker)) +#### Fix missing blank lines in fenced code blocks lacking the closing fence ([#8786](https://github.com/prettier/prettier/pull/8786) by [@fisker](https://github.com/fisker)) ```markdown diff --git a/changelog_unreleased/markdown/pr-9275.md b/changelog_unreleased/markdown/pr-9275.md index bd110518659a..7f5664d1048e 100644 --- a/changelog_unreleased/markdown/pr-9275.md +++ b/changelog_unreleased/markdown/pr-9275.md @@ -1,4 +1,4 @@ -#### Add support for [[wiki-style]] links in markdown (#9275 by @iamrecursion) +#### Add support for `[[wiki-style]]` links (#9275 by @iamrecursion) 1. Support for `[[wiki-style]]` links ensures that they do not get broken by the prettier formatting by being wrapped over multiple lines. diff --git a/changelog_unreleased/mdx/pr-9267.md b/changelog_unreleased/mdx/pr-9267.md index 4997d105f3c4..ee5743c2710b 100644 --- a/changelog_unreleased/mdx/pr-9267.md +++ b/changelog_unreleased/mdx/pr-9267.md @@ -1,4 +1,4 @@ -#### Fix JSX format (#9267 by @fisker) +#### Fix extra empty lines in JSX (#9267 by @fisker) ```markdown diff --git a/changelog_unreleased/typescript/pr-9318.md b/changelog_unreleased/typescript/pr-9318.md index 93d621294b16..3de4c132252f 100644 --- a/changelog_unreleased/typescript/pr-9318.md +++ b/changelog_unreleased/typescript/pr-9318.md @@ -1,4 +1,4 @@ -#### Preserve a last separator for ignored object and interface types (#9318 by @sosukesuzuki) +#### Preserve the last separator in ignored object types and interfaces (#9318 by @sosukesuzuki) ```ts diff --git a/changelog_unreleased/typescript/pr-9473.md b/changelog_unreleased/typescript/pr-9473.md index e81744bf9374..ed18101ee85b 100644 --- a/changelog_unreleased/typescript/pr-9473.md +++ b/changelog_unreleased/typescript/pr-9473.md @@ -1,4 +1,4 @@ -#### Support TypeScript 4.1 via Babel (#9473 by @sosukesuzuki) +#### [HIGHLIGHT]Support TypeScript 4.1 via Babel (#9473 by @sosukesuzuki) `--parser=babel-ts` is required. diff --git a/changelog_unreleased/typescript/pr-9484.md b/changelog_unreleased/typescript/pr-9484.md index 1c468a631bcc..7b2634ce716a 100644 --- a/changelog_unreleased/typescript/pr-9484.md +++ b/changelog_unreleased/typescript/pr-9484.md @@ -1,4 +1,4 @@ -#### Add parens to object value that it's an assignment (#9484 by @fisker) +#### Add parens around assignments in object literal properties (#9484 by @fisker) ```ts diff --git a/changelog_unreleased/typescript/pr-9521.md b/changelog_unreleased/typescript/pr-9521.md new file mode 100644 index 000000000000..9d63819f9daf --- /dev/null +++ b/changelog_unreleased/typescript/pr-9521.md @@ -0,0 +1,25 @@ +#### Fix inconsistencies in formatting of types between `typescript` and `flow` (#9521 by @fisker) + + +```ts +// Input +const name: SomeGeneric< + Pick +> = null; + +// Prettier master (--parser=typescript) +const name: SomeGeneric> = null; + +// Prettier master (--parser=flow) +const name: SomeGeneric< + Pick +> = null; + +// Prettier stable (typescript and flow parser) +const name: SomeGeneric< + Pick +> = null; +``` diff --git a/changelog_unreleased/vue/pr-9225.md b/changelog_unreleased/vue/pr-9225.md index bd909dc28c31..480739ec9061 100644 --- a/changelog_unreleased/vue/pr-9225.md +++ b/changelog_unreleased/vue/pr-9225.md @@ -1,4 +1,4 @@ -#### Fix inconsistent `v-for` format (#9225 by @zweimach) +#### Fix inconsistent formatting for `v-for` (#9225 by @zweimach) ```vue diff --git a/cspell.json b/cspell.json index b1b6ce5f9fe6..3bc57e55953e 100644 --- a/cspell.json +++ b/cspell.json @@ -51,6 +51,7 @@ "camelcase", "camelified", "chedeau", + "cherow", "chrzosel", "Clemmons", "cliify", @@ -212,6 +213,7 @@ "mdast", "Memberish", "memoized", + "meriyah", "Michał", "Microsyntax", "Mikael", @@ -222,6 +224,7 @@ "mixins", "mjml", "mkdir", + "mobx", "Moeller", "Monteiro", "Morrell", @@ -394,6 +397,7 @@ "Vue's", "Wadler", "Wadler's", + "webcompat", "webstorm", "Weixin", "whitespaces", diff --git a/docs/browser.md b/docs/browser.md index 1766b6a4441f..96d81c1a682c 100644 --- a/docs/browser.md +++ b/docs/browser.md @@ -3,13 +3,18 @@ id: browser title: Browser --- -Run Prettier in the browser with the `standalone.js` UMD bundle shipped in the NPM package (starting in version 1.13). The UMD bundle only formats the code and has no support for config files, ignore files, CLI usage, or automatic loading of plugins. +Run Prettier in the browser using its **standalone** version. This version only formats the code and has no support for config files, ignore files, CLI usage, or automatic loading of plugins. + +The standalone version comes as: + +- ES modules: `esm/standalone.mjs`, starting in version 2.2 +- UMD: `standalone.js`, starting in version 1.13 The [`browser` field](https://github.com/defunctzombie/package-browser-field-spec) in Prettier’s `package.json` points to `standalone.js`. That’s why you can just `import` or `require` the `prettier` module to access Prettier’s API, and your code can stay compatible with both Node and the browser as long as webpack or another bundler that supports the `browser` field is used. This is especially convenient for [plugins](plugins.md). ### `prettier.format(code, options)` -Unlike the `format` function from the [main API](api.md#prettierformatsource--options), this function does not load plugins automatically, so a `plugins` property is required if you want to load plugins. Additionally, the parsers included in the Prettier package won’t be loaded automatically, so you need to load them before using them. +Unlike the `format` function from the [main API](api.md#prettierformatsource--options), this function does not load plugins automatically, so a `plugins` property is required if you want to load plugins. Additionally, the parsers included in the Prettier package won’t be loaded automatically, so you need to load them as plugins before using them. See [Usage](#usage) below for examples. diff --git a/jest.config.js b/jest.config.js index 3bcdcfec4e08..2ac2c033e417 100644 --- a/jest.config.js +++ b/jest.config.js @@ -63,7 +63,7 @@ module.exports = { "prettier-local": "/tests_config/require_prettier.js", "prettier-standalone": "/tests_config/require_standalone.js", }, - modulePathIgnorePatterns: ["/dist"], + modulePathIgnorePatterns: ["/dist", "/website/static/lib"], testEnvironment: "node", transform, watchPlugins: [ diff --git a/package.json b/package.json index 1eea3d51d733..565cbb34a9d5 100644 --- a/package.json +++ b/package.json @@ -20,15 +20,15 @@ "bin" ], "dependencies": { - "@angular/compiler": "10.2.0", + "@angular/compiler": "10.2.2", "@babel/code-frame": "7.10.4", - "@babel/parser": "7.12.3", - "@glimmer/syntax": "0.62.3", + "@babel/parser": "7.12.5", + "@glimmer/syntax": "0.62.4", "@iarna/toml": "2.2.5", "@typescript-eslint/typescript-estree": "3.10.1", "angular-estree-parser": "2.2.1", "angular-html-parser": "1.7.1", - "camelcase": "6.1.0", + "camelcase": "6.2.0", "chalk": "4.1.0", "ci-info": "watson/ci-info#f43f6a1cefff47fb361c88cf4b943fdbcaafe540", "cjk-regex": "2.0.0", @@ -43,10 +43,10 @@ "fast-glob": "3.2.4", "fast-json-stable-stringify": "2.1.0", "find-parent-dir": "0.3.0", - "flow-parser": "0.136.0", + "flow-parser": "0.137.0", "get-stdin": "8.0.0", "globby": "11.0.1", - "graphql": "15.3.0", + "graphql": "15.4.0", "html-element-attributes": "2.3.0", "html-styles": "1.0.0", "html-tag-names": "1.1.5", @@ -59,6 +59,7 @@ "linguist-languages": "7.11.1", "lodash": "4.17.20", "mem": "8.0.0", + "meriyah": "3.1.2", "minimatch": "3.0.4", "minimist": "1.2.5", "n-readlines": "1.0.0", @@ -78,7 +79,7 @@ "resolve": "1.18.1", "semver": "7.3.2", "string-width": "4.2.0", - "typescript": "4.0.3", + "typescript": "4.0.5", "unicode-regex": "3.0.0", "unified": "9.2.0", "vnopts": "1.0.2", @@ -87,33 +88,33 @@ "devDependencies": { "@babel/core": "7.12.3", "@babel/preset-env": "7.12.1", - "@babel/types": "7.12.1", - "@glimmer/reference": "0.62.3", + "@babel/types": "7.12.6", + "@glimmer/reference": "0.62.4", "@rollup/plugin-alias": "3.1.1", "@rollup/plugin-babel": "5.2.1", - "@rollup/plugin-commonjs": "15.1.0", + "@rollup/plugin-commonjs": "16.0.0", "@rollup/plugin-json": "4.1.0", - "@rollup/plugin-node-resolve": "9.0.0", - "@rollup/plugin-replace": "2.3.3", + "@rollup/plugin-node-resolve": "10.0.0", + "@rollup/plugin-replace": "2.3.4", "@types/estree": "0.0.45", "@types/node": "14.14.0", "@typescript-eslint/types": "3.10.1", - "babel-jest": "26.6.1", + "babel-jest": "26.6.3", "babel-loader": "8.1.0", "benchmark": "2.1.4", "builtin-modules": "3.1.0", "cross-env": "7.0.2", - "cspell": "4.1.2", - "eslint": "7.12.0", - "eslint-config-prettier": "6.14.0", + "cspell": "4.1.3", + "eslint": "7.13.0", + "eslint-config-prettier": "6.15.0", "eslint-formatter-friendly": "7.0.0", "eslint-plugin-import": "2.22.1", "eslint-plugin-jest": "24.1.0", "eslint-plugin-prettier-internal-rules": "file:scripts/tools/eslint-plugin-prettier-internal-rules", "eslint-plugin-react": "7.21.5", "eslint-plugin-unicorn": "23.0.0", - "execa": "4.0.3", - "jest": "26.6.1", + "execa": "4.1.0", + "jest": "26.6.3", "jest-snapshot-serializer-ansi": "1.0.0", "jest-snapshot-serializer-raw": "1.1.0", "jest-watch-typeahead": "0.6.1", @@ -121,7 +122,7 @@ "path-browserify": "1.0.1", "prettier": "2.1.2", "rimraf": "3.0.2", - "rollup": "2.32.1", + "rollup": "2.33.1", "rollup-plugin-node-globals": "1.4.0", "rollup-plugin-terser": "7.0.2", "shelljs": "0.8.4", diff --git a/scripts/build/config.js b/scripts/build/config.js index 64b2d0211c8d..16e38f50335b 100644 --- a/scripts/build/config.js +++ b/scripts/build/config.js @@ -44,6 +44,9 @@ const parsers = [ { input: "src/language-js/parser-espree.js", }, + { + input: "src/language-js/parser-meriyah.js", + }, { input: "src/language-js/parser-angular.js", }, diff --git a/scripts/tools/eslint-plugin-prettier-internal-rules/directly-loc-start-end.js b/scripts/tools/eslint-plugin-prettier-internal-rules/directly-loc-start-end.js new file mode 100644 index 000000000000..1e2618637923 --- /dev/null +++ b/scripts/tools/eslint-plugin-prettier-internal-rules/directly-loc-start-end.js @@ -0,0 +1,38 @@ +"use strict"; + +const selector = [ + "MemberExpression", + "[computed=false]", + '[property.type="Identifier"]', + ':matches([property.name="locStart"], [property.name="locEnd"])', +].join(""); + +const MESSAGE_ID = "directly-loc-start-end"; + +module.exports = { + meta: { + type: "suggestion", + docs: { + url: + "https://github.com/prettier/prettier/blob/master/scripts/eslint-plugin-prettier-internal-rules/directly-loc-start-end.js", + }, + messages: { + [MESSAGE_ID]: + "Please import `{{function}}` function and use it directly.", + }, + fixable: "code", + }, + create(context) { + return { + [selector](node) { + context.report({ + node, + messageId: MESSAGE_ID, + data: { function: node.property.name }, + fix: (fixer) => + fixer.replaceTextRange([node.range[0], node.property.range[0]], ""), + }); + }, + }; + }, +}; diff --git a/scripts/tools/eslint-plugin-prettier-internal-rules/index.js b/scripts/tools/eslint-plugin-prettier-internal-rules/index.js index da954fddfc80..9436ff11bd7d 100644 --- a/scripts/tools/eslint-plugin-prettier-internal-rules/index.js +++ b/scripts/tools/eslint-plugin-prettier-internal-rules/index.js @@ -2,7 +2,9 @@ module.exports = { rules: { - "require-json-extensions": require("./require-json-extensions"), "better-parent-property-check-in-needs-parens": require("./better-parent-property-check-in-needs-parens"), + "directly-loc-start-end": require("./directly-loc-start-end"), + "prefer-fast-path-each": require("./prefer-fast-path-each"), + "require-json-extensions": require("./require-json-extensions"), }, }; diff --git a/scripts/tools/eslint-plugin-prettier-internal-rules/package.json b/scripts/tools/eslint-plugin-prettier-internal-rules/package.json index 43c4312a4549..6815d796672d 100644 --- a/scripts/tools/eslint-plugin-prettier-internal-rules/package.json +++ b/scripts/tools/eslint-plugin-prettier-internal-rules/package.json @@ -1,6 +1,6 @@ { "name": "eslint-plugin-prettier-internal-rules", - "version": "1.0.0", + "version": "1.0.3", "description": "Prettier internal eslint rules", "private": true, "author": "fisker", diff --git a/scripts/tools/eslint-plugin-prettier-internal-rules/prefer-fast-path-each.js b/scripts/tools/eslint-plugin-prettier-internal-rules/prefer-fast-path-each.js new file mode 100644 index 000000000000..f4d6ad97d63a --- /dev/null +++ b/scripts/tools/eslint-plugin-prettier-internal-rules/prefer-fast-path-each.js @@ -0,0 +1,42 @@ +"use strict"; + +const selector = [ + "ExpressionStatement", + ">", + "CallExpression.expression", + "[optional=false]", + ">", + "MemberExpression.callee", + "[computed=false]", + "[optional=false]", + ">", + "Identifier.property", + '[name="map"]', +].join(""); + +const messageId = "prefer-fast-path-each"; + +module.exports = { + meta: { + type: "suggestion", + docs: { + url: + "https://github.com/prettier/prettier/blob/master/scripts/eslint-plugin-prettier-internal-rules/require-json-extensions.js", + }, + messages: { + [messageId]: "Prefer `FastPath#each()` over `FastPath#map()`.", + }, + fixable: "code", + }, + create(context) { + return { + [selector](node) { + context.report({ + node, + messageId, + fix: (fixer) => fixer.replaceText(node, "each"), + }); + }, + }; + }, +}; diff --git a/src/common/fast-path.js b/src/common/fast-path.js index 61b5883d660b..2b14c7ff2073 100644 --- a/src/common/fast-path.js +++ b/src/common/fast-path.js @@ -93,9 +93,7 @@ class FastPath { for (let i = 0; i < value.length; ++i) { if (i in value) { stack.push(i, value[i]); - // If the callback needs to know the value of i, call - // path.getName(), assuming path is the parameter name. - callback(this); + callback(this, i); stack.length -= 2; } } diff --git a/src/common/util.js b/src/common/util.js index 55b33450feb3..b362b1649dba 100644 --- a/src/common/util.js +++ b/src/common/util.js @@ -3,7 +3,7 @@ const stringWidth = require("string-width"); const escapeStringRegexp = require("escape-string-regexp"); const getLast = require("../utils/get-last"); -const support = require("../main/support"); +const { getSupportInfo } = require("../main/support"); const notAsciiRegex = /[^\x20-\x7F]/; @@ -613,24 +613,6 @@ function addTrailingComment(node, comment) { addCommentHelper(node, comment); } -// Not using -/* istanbul ignore next */ -function isWithinParentArrayProperty(path, propertyName) { - const node = path.getValue(); - const parent = path.getParentNode(); - - if (parent == null) { - return false; - } - - if (!Array.isArray(parent[propertyName])) { - return false; - } - - const key = path.getName(); - return parent[propertyName][key] === node; -} - function replaceEndOfLineWith(text, replacement) { const parts = []; for (const part of text.split("\n")) { @@ -642,20 +624,18 @@ function replaceEndOfLineWith(text, replacement) { return parts; } -function getParserName(lang, options) { - const supportInfo = support.getSupportInfo({ plugins: options.plugins }); - const language = supportInfo.languages.find( - (language) => - language.name.toLowerCase() === lang || - (language.aliases && language.aliases.includes(lang)) || - (language.extensions && - language.extensions.some((ext) => ext === `.${lang}`)) - ); - if (language) { - return language.parsers[0]; - } - - return null; +function inferParserByLanguage(language, options) { + const { languages } = getSupportInfo({ plugins: options.plugins }); + const matched = + languages.find(({ name }) => name.toLowerCase() === language) || + languages.find( + ({ aliases }) => Array.isArray(aliases) && aliases.includes(language) + ) || + languages.find( + ({ extensions }) => + Array.isArray(extensions) && extensions.includes(`.${language}`) + ); + return matched && matched.parsers[0]; } function isFrontMatterNode(node) { @@ -674,11 +654,11 @@ function getShebang(text) { } module.exports = { + inferParserByLanguage, replaceEndOfLineWith, getStringWidth, getMaxContinuousCount, getMinNotPresentContinuousCount, - getParserName, getPenultimate, getLast, getNextNonSpaceNonCommentCharacterIndexWithStartIndex, @@ -710,7 +690,6 @@ module.exports = { addLeadingComment, addDanglingComment, addTrailingComment, - isWithinParentArrayProperty, isFrontMatterNode, getShebang, }; diff --git a/src/language-css/clean.js b/src/language-css/clean.js index 340ae8929a5e..a288aa440ab5 100644 --- a/src/language-css/clean.js +++ b/src/language-css/clean.js @@ -3,19 +3,17 @@ const { isFrontMatterNode } = require("../common/util"); const getLast = require("../utils/get-last"); -function clean(ast, newObj, parent) { - [ - "raw", // front-matter - "raws", - "sourceIndex", - "source", - "before", - "after", - "trailingComma", - ].forEach((name) => { - delete newObj[name]; - }); +const ignoredProperties = new Set([ + "raw", // front-matter + "raws", + "sourceIndex", + "source", + "before", + "after", + "trailingComma", +]); +function clean(ast, newObj, parent) { if (isFrontMatterNode(ast) && ast.lang === "yaml") { delete newObj.value; } @@ -173,6 +171,8 @@ function clean(ast, newObj, parent) { } } +clean.ignoredProperties = ignoredProperties; + function cleanCSSStrings(value) { return value.replace(/'/g, '"').replace(/\\([^\dA-Fa-f])/g, "$1"); } diff --git a/src/language-css/loc.js b/src/language-css/loc.js index 4fa19f40c6ab..3562df36b82f 100644 --- a/src/language-css/loc.js +++ b/src/language-css/loc.js @@ -216,7 +216,17 @@ function replaceQuotesInInlineComments(text) { return text; } +function locStart(node) { + return node.source.startOffset; +} + +function locEnd(node) { + return node.source.endOffset; +} + module.exports = { + locStart, + locEnd, calculateLoc, replaceQuotesInInlineComments, }; diff --git a/src/language-css/parser-postcss.js b/src/language-css/parser-postcss.js index fe852aa1535a..39d88fab9bd8 100644 --- a/src/language-css/parser-postcss.js +++ b/src/language-css/parser-postcss.js @@ -10,6 +10,7 @@ const { isSCSSVariable, stringifyNode, } = require("./utils"); +const { locStart, locEnd } = require("./loc"); const { calculateLoc, replaceQuotesInInlineComments } = require("./loc"); const getHighestAncestor = (node) => { @@ -663,6 +664,10 @@ function parseWithParser(parse, text, options) { calculateLoc(result, text); if (frontMatter) { + frontMatter.source = { + startOffset: 0, + endOffset: frontMatter.raw.length, + }; result.nodes.unshift(frontMatter); } @@ -693,19 +698,8 @@ function parseScss(text, parsers, options) { const postCssParser = { astFormat: "postcss", hasPragma, - locStart(node) { - if (node.source) { - return node.source.startOffset; - } - /* istanbul ignore next */ - return null; - }, - locEnd(node) { - if (node.source) { - return node.source.endOffset; - } - return null; - }, + locStart, + locEnd, }; // Export as a plugin so we can reuse the same bundle for UMD loading diff --git a/src/language-css/printer-postcss.js b/src/language-css/printer-postcss.js index 79c09530c771..1f10689e9b13 100644 --- a/src/language-css/printer-postcss.js +++ b/src/language-css/printer-postcss.js @@ -72,6 +72,7 @@ const { lastLineHasInlineComment, isAtWordPlaceholderNode, } = require("./utils"); +const { locStart, locEnd } = require("./loc"); function shouldPrintComma(options) { return options.trailingComma === "es5" || options.trailingComma === "all"; @@ -104,10 +105,8 @@ function genericPrint(path, options, print) { } case "css-comment": { const isInlineComment = node.inline || node.raws.inline; - const text = options.originalText.slice( - options.locStart(node), - options.locEnd(node) - ); + + const text = options.originalText.slice(locStart(node), locEnd(node)); return isInlineComment ? text.trimEnd() : text; } @@ -190,7 +189,7 @@ function genericPrint(path, options, print) { ]) : isTemplatePropNode(node) && !parentNode.raws.semicolon && - options.originalText[options.locEnd(node) - 1] !== ";" + options.originalText[locEnd(node) - 1] !== ";" ? "" : options.__isHTMLStyleAttribute && isLastNode(path, node) ? ifBreak(";", "") @@ -202,7 +201,7 @@ function genericPrint(path, options, print) { const isTemplatePlaceholderNodeWithoutSemiColon = isTemplatePlaceholderNode(node) && !parentNode.raws.semicolon && - options.originalText[options.locEnd(node) - 1] !== ";"; + options.originalText[locEnd(node) - 1] !== ";"; if (options.parser === "less") { if (node.mixin) { @@ -500,7 +499,7 @@ function genericPrint(path, options, print) { // originalText has to be used for Less, see replaceQuotesInInlineComments in loc.js const parentNode = path.getParentNode(); if (parentNode.raws && parentNode.raws.selector) { - const start = options.locStart(parentNode); + const start = locStart(parentNode); const end = start + parentNode.raws.selector.length; return options.originalText.slice(start, end).trim(); } @@ -513,8 +512,8 @@ function genericPrint(path, options, print) { grandParent.type === "value-func" && grandParent.value === "selector" ) { - const start = options.locStart(parentNode.open) + 1; - const end = options.locEnd(parentNode.close) - 1; + const start = locStart(parentNode.open) + 1; + const end = locEnd(parentNode.close) - 1; const selector = options.originalText.slice(start, end).trim(); return lastLineHasInlineComment(selector) @@ -530,10 +529,7 @@ function genericPrint(path, options, print) { return path.call(print, "group"); } case "value-comment": { - return options.originalText.slice( - options.locStart(node), - options.locEnd(node) - ); + return options.originalText.slice(locStart(node), locEnd(node)); } case "value-comma_group": { const parentNode = path.getParentNode(); @@ -805,7 +801,7 @@ function genericPrint(path, options, print) { if ( isAtWordPlaceholderNode(iNode) && isAtWordPlaceholderNode(iNextNode) && - options.locEnd(iNode) === options.locStart(iNextNode) + locEnd(iNode) === locStart(iNextNode) ) { continue; } @@ -987,8 +983,7 @@ function genericPrint(path, options, print) { function printNodeSequence(path, options, print) { const node = path.getValue(); const parts = []; - let i = 0; - path.map((pathChild) => { + path.each((pathChild, i) => { const prevNode = node.nodes[i - 1]; if ( prevNode && @@ -997,10 +992,7 @@ function printNodeSequence(path, options, print) { ) { const childNode = pathChild.getValue(); parts.push( - options.originalText.slice( - options.locStart(childNode), - options.locEnd(childNode) - ) + options.originalText.slice(locStart(childNode), locEnd(childNode)) ); } else { parts.push(pathChild.call(print)); @@ -1009,11 +1001,9 @@ function printNodeSequence(path, options, print) { if (i !== node.nodes.length - 1) { if ( (node.nodes[i + 1].type === "css-comment" && - !hasNewline( - options.originalText, - options.locStart(node.nodes[i + 1]), - { backwards: true } - ) && + !hasNewline(options.originalText, locStart(node.nodes[i + 1]), { + backwards: true, + }) && !isFrontMatterNode(node.nodes[i])) || (node.nodes[i + 1].type === "css-atrule" && node.nodes[i + 1].name === "else" && @@ -1023,18 +1013,13 @@ function printNodeSequence(path, options, print) { } else { parts.push(options.__isHTMLStyleAttribute ? line : hardline); if ( - isNextLineEmpty( - options.originalText, - pathChild.getValue(), - options.locEnd - ) && + isNextLineEmpty(options.originalText, pathChild.getValue(), locEnd) && !isFrontMatterNode(node.nodes[i]) ) { parts.push(hardline); } } } - i++; }, "nodes"); return concat(parts); diff --git a/src/language-graphql/printer-graphql.js b/src/language-graphql/printer-graphql.js index 5320a063a55b..2b6b2a0487e2 100644 --- a/src/language-graphql/printer-graphql.js +++ b/src/language-graphql/printer-graphql.js @@ -26,7 +26,7 @@ function genericPrint(path, options, print) { switch (n.kind) { case "Document": { const parts = []; - path.map((pathChild, index) => { + path.each((pathChild, index) => { parts.push(concat([pathChild.call(print)])); if (index !== n.definitions.length - 1) { parts.push(hardline); @@ -677,10 +677,8 @@ function printInterfaces(path, options, print) { return parts; } -function clean(node, newNode /*, parent*/) { - delete newNode.loc; - delete newNode.comments; -} +function clean(/*node, newNode , parent*/) {} +clean.ignoredProperties = new Set(["loc", "comments"]); module.exports = { print: genericPrint, diff --git a/src/language-handlebars/clean.js b/src/language-handlebars/clean.js index 9abcac2d200d..db7b843ff52d 100644 --- a/src/language-handlebars/clean.js +++ b/src/language-handlebars/clean.js @@ -1,9 +1,6 @@ "use strict"; -module.exports = function (ast, newNode) { - delete newNode.loc; - delete newNode.selfClosing; - +function clean(ast, newNode /*, parent*/) { // (Glimmer/HTML) ignore TextNode whitespace if (ast.type === "TextNode") { const trimmed = ast.chars.trim(); @@ -12,4 +9,7 @@ module.exports = function (ast, newNode) { } newNode.chars = trimmed; } -}; +} +clean.ignoredProperties = new Set(["loc", "selfClosing"]); + +module.exports = clean; diff --git a/src/language-handlebars/utils.js b/src/language-handlebars/utils.js index 8f67e9ccbb49..c7b20c3d469d 100644 --- a/src/language-handlebars/utils.js +++ b/src/language-handlebars/utils.js @@ -18,8 +18,7 @@ const voidTags = new Set(htmlVoidElements); function isVoid(node) { return ( (isGlimmerComponent(node) && - (node.children === 0 || - node.children.every((n) => isWhitespaceNode(n)))) || + node.children.every((n) => isWhitespaceNode(n))) || voidTags.has(node.tag) ); } diff --git a/src/language-html/clean.js b/src/language-html/clean.js index ee0c9bc05eea..4c9089cc96b7 100644 --- a/src/language-html/clean.js +++ b/src/language-html/clean.js @@ -2,13 +2,15 @@ const { isFrontMatterNode } = require("../common/util"); -module.exports = function (ast, newNode) { - delete newNode.sourceSpan; - delete newNode.startSourceSpan; - delete newNode.endSourceSpan; - delete newNode.nameSpan; - delete newNode.valueSpan; +const ignoredProperties = new Set([ + "sourceSpan", + "startSourceSpan", + "endSourceSpan", + "nameSpan", + "valueSpan", +]); +function clean(ast, newNode) { if (ast.type === "text" || ast.type === "comment") { return null; } @@ -25,4 +27,8 @@ module.exports = function (ast, newNode) { if (ast.type === "docType") { delete newNode.value; } -}; +} + +clean.ignoredProperties = ignoredProperties; + +module.exports = clean; diff --git a/src/language-html/parser-html.js b/src/language-html/parser-html.js index 39b99d0716cb..994e0f555111 100644 --- a/src/language-html/parser-html.js +++ b/src/language-html/parser-html.js @@ -7,7 +7,7 @@ const { } = require("angular-html-parser/lib/compiler/src/parse_util"); const { parse: parseFrontMatter } = require("../utils/front-matter"); const createError = require("../common/parser-create-error"); -const { getParserName } = require("../common/util"); +const { inferParserByLanguage } = require("../common/util"); const { HTML_ELEMENT_ATTRIBUTES, HTML_TAGS, @@ -73,7 +73,10 @@ function ngHtmlParser( } const langAttr = node.attrs.find((attr) => attr.name === "lang"); const langValue = langAttr && langAttr.value; - return langValue == null || getParserName(langValue, options) === "html"; + return ( + langValue == null || + inferParserByLanguage(langValue, options) === "html" + ); }; if (rootNodes.some(shouldParseAsHTML)) { let secondParseResult; diff --git a/src/language-html/utils.js b/src/language-html/utils.js index e79715793c02..544fe06f693f 100644 --- a/src/language-html/utils.js +++ b/src/language-html/utils.js @@ -2,7 +2,7 @@ const htmlTagNames = require("html-tag-names"); const htmlElementAttributes = require("html-element-attributes"); -const { getParserName, isFrontMatterNode } = require("../common/util"); +const { inferParserByLanguage, isFrontMatterNode } = require("../common/util"); const { CSS_DISPLAY_TAGS, CSS_DISPLAY_DEFAULT, @@ -427,7 +427,8 @@ function inferScriptParser(node, options) { if (options && isVueNonHtmlBlock(node, options)) { return ( _inferScriptParser(node) || - (!("src" in node.attrMap) && getParserName(node.attrMap.lang, options)) + (!("src" in node.attrMap) && + inferParserByLanguage(node.attrMap.lang, options)) ); } } diff --git a/src/language-js/clean.js b/src/language-js/clean.js index 4f5bfbf20ede..45d300feb265 100644 --- a/src/language-js/clean.js +++ b/src/language-js/clean.js @@ -1,29 +1,32 @@ "use strict"; -function clean(ast, newObj, parent) { - [ - "range", - "raw", - "comments", - "leadingComments", - "trailingComments", - "innerComments", - "extra", - "start", - "end", - "loc", - "flags", - "errors", - "tokens", - ].forEach((name) => { - delete newObj[name]; - }); +const { isBlockComment } = require("./utils"); + +const ignoredProperties = new Set([ + "range", + "raw", + "comments", + "leadingComments", + "trailingComments", + "innerComments", + "extra", + "start", + "end", + "loc", + "flags", + "errors", + "tokens", +]); +function clean(ast, newObj, parent) { if (ast.type === "Program") { delete newObj.sourceType; } - if (ast.type === "BigIntLiteral") { + if ( + ast.type === "BigIntLiteral" || + ast.type === "BigIntLiteralTypeAnnotation" + ) { if (newObj.value) { newObj.value = newObj.value.toLowerCase(); } @@ -65,6 +68,7 @@ function clean(ast, newObj, parent) { ast.type === "MethodDefinition" || ast.type === "ClassProperty" || ast.type === "ClassMethod" || + ast.type === "FieldDefinition" || ast.type === "TSDeclareMethod" || ast.type === "TSPropertySignature" || ast.type === "ObjectTypeProperty") && @@ -182,7 +186,7 @@ function clean(ast, newObj, parent) { ast.leadingComments && ast.leadingComments.some( (comment) => - comment.type === "CommentBlock" && + isBlockComment(comment) && ["GraphQL", "HTML"].some( (languageName) => comment.value === ` ${languageName} ` ) @@ -210,4 +214,6 @@ function clean(ast, newObj, parent) { } } +clean.ignoredProperties = ignoredProperties; + module.exports = clean; diff --git a/src/language-js/comments.js b/src/language-js/comments.js index 5a96da983fbf..c33bff504871 100644 --- a/src/language-js/comments.js +++ b/src/language-js/comments.js @@ -13,6 +13,7 @@ const { getNextNonSpaceNonCommentCharacterIndex, } = require("../common/util"); const { isBlockComment, getFunctionParameters } = require("./utils"); +const { locStart, locEnd } = require("./loc"); function handleOwnLineComment(comment, text, options, ast, isLastComment) { const { precedingNode, enclosingNode, followingNode } = comment; @@ -22,8 +23,7 @@ function handleOwnLineComment(comment, text, options, ast, isLastComment) { precedingNode, enclosingNode, followingNode, - comment, - options + comment ) || handleMemberExpressionComments(enclosingNode, followingNode, comment) || handleIfStatementComments( @@ -31,16 +31,14 @@ function handleOwnLineComment(comment, text, options, ast, isLastComment) { precedingNode, enclosingNode, followingNode, - comment, - options + comment ) || handleWhileComments( text, precedingNode, enclosingNode, followingNode, - comment, - options + comment ) || handleTryStatementComments( enclosingNode, @@ -62,17 +60,10 @@ function handleOwnLineComment(comment, text, options, ast, isLastComment) { text, enclosingNode, precedingNode, - comment, - options + comment ) || handleAssignmentPatternComments(enclosingNode, comment) || - handleMethodNameComments( - text, - enclosingNode, - precedingNode, - comment, - options - ) || + handleMethodNameComments(text, enclosingNode, precedingNode, comment) || handleLabeledStatementComments(enclosingNode, comment) ); } @@ -86,16 +77,14 @@ function handleEndOfLineComment(comment, text, options, ast, isLastComment) { precedingNode, enclosingNode, followingNode, - comment, - options + comment ) || handleConditionalExpressionComments( enclosingNode, precedingNode, followingNode, comment, - text, - options + text ) || handleImportSpecifierComments(enclosingNode, comment) || handleIfStatementComments( @@ -103,16 +92,14 @@ function handleEndOfLineComment(comment, text, options, ast, isLastComment) { precedingNode, enclosingNode, followingNode, - comment, - options + comment ) || handleWhileComments( text, precedingNode, enclosingNode, followingNode, - comment, - options + comment ) || handleTryStatementComments( enclosingNode, @@ -139,35 +126,21 @@ function handleRemainingComment(comment, text, options, ast, isLastComment) { precedingNode, enclosingNode, followingNode, - comment, - options + comment ) || handleWhileComments( text, precedingNode, enclosingNode, followingNode, - comment, - options + comment ) || handleObjectPropertyAssignment(enclosingNode, precedingNode, comment) || - handleCommentInEmptyParens(text, enclosingNode, comment, options) || - handleMethodNameComments( - text, - enclosingNode, - precedingNode, - comment, - options - ) || + handleCommentInEmptyParens(text, enclosingNode, comment) || + handleMethodNameComments(text, enclosingNode, precedingNode, comment) || handleOnlyComments(enclosingNode, ast, comment, isLastComment) || - handleCommentAfterArrowParams(text, enclosingNode, comment, options) || - handleFunctionNameComments( - text, - enclosingNode, - precedingNode, - comment, - options - ) || + handleCommentAfterArrowParams(text, enclosingNode, comment) || + handleFunctionNameComments(text, enclosingNode, precedingNode, comment) || handleTSMappedTypeComments( text, enclosingNode, @@ -180,8 +153,7 @@ function handleRemainingComment(comment, text, options, ast, isLastComment) { text, enclosingNode, followingNode, - comment, - options + comment ) ) { return true; @@ -237,8 +209,7 @@ function handleIfStatementComments( precedingNode, enclosingNode, followingNode, - comment, - options + comment ) { if ( !enclosingNode || @@ -256,7 +227,7 @@ function handleIfStatementComments( const nextCharacter = getNextNonSpaceNonCommentCharacter( text, comment, - options.locEnd + locEnd ); if (nextCharacter === ")") { addTrailingComment(precedingNode, comment); @@ -306,8 +277,7 @@ function handleWhileComments( precedingNode, enclosingNode, followingNode, - comment, - options + comment ) { if ( !enclosingNode || @@ -325,7 +295,7 @@ function handleWhileComments( const nextCharacter = getNextNonSpaceNonCommentCharacter( text, comment, - options.locEnd + locEnd ); if (nextCharacter === ")") { addTrailingComment(precedingNode, comment); @@ -404,16 +374,11 @@ function handleConditionalExpressionComments( precedingNode, followingNode, comment, - text, - options + text ) { const isSameLineAsPrecedingNode = precedingNode && - !hasNewlineInRange( - text, - options.locEnd(precedingNode), - options.locStart(comment) - ); + !hasNewlineInRange(text, locEnd(precedingNode), locStart(comment)); if ( (!precedingNode || !isSameLineAsPrecedingNode) && @@ -498,13 +463,7 @@ function handleClassComments( return false; } -function handleMethodNameComments( - text, - enclosingNode, - precedingNode, - comment, - options -) { +function handleMethodNameComments(text, enclosingNode, precedingNode, comment) { // This is only needed for estree parsers (flow, typescript) to attach // after a method name: // obj = { fn /*comment*/() {} }; @@ -519,8 +478,7 @@ function handleMethodNameComments( enclosingNode.key === precedingNode && // special Property case: { key: /*comment*/(value) }; // comment should be attached to value instead of key - getNextNonSpaceNonCommentCharacter(text, precedingNode, options.locEnd) !== - ":" + getNextNonSpaceNonCommentCharacter(text, precedingNode, locEnd) !== ":" ) { addTrailingComment(precedingNode, comment); return true; @@ -534,6 +492,7 @@ function handleMethodNameComments( precedingNode.type === "Decorator" && (enclosingNode.type === "ClassMethod" || enclosingNode.type === "ClassProperty" || + enclosingNode.type === "FieldDefinition" || enclosingNode.type === "TSAbstractClassProperty" || enclosingNode.type === "TSAbstractMethodDefinition" || enclosingNode.type === "TSDeclareMethod" || @@ -550,12 +509,9 @@ function handleFunctionNameComments( text, enclosingNode, precedingNode, - comment, - options + comment ) { - if ( - getNextNonSpaceNonCommentCharacter(text, comment, options.locEnd) !== "(" - ) { + if (getNextNonSpaceNonCommentCharacter(text, comment, locEnd) !== "(") { return false; } @@ -574,16 +530,12 @@ function handleFunctionNameComments( return false; } -function handleCommentAfterArrowParams(text, enclosingNode, comment, options) { +function handleCommentAfterArrowParams(text, enclosingNode, comment) { if (!(enclosingNode && enclosingNode.type === "ArrowFunctionExpression")) { return false; } - const index = getNextNonSpaceNonCommentCharacterIndex( - text, - comment, - options.locEnd - ); + const index = getNextNonSpaceNonCommentCharacterIndex(text, comment, locEnd); if (index !== false && text.slice(index, index + 2) === "=>") { addDanglingComment(enclosingNode, comment); return true; @@ -592,10 +544,8 @@ function handleCommentAfterArrowParams(text, enclosingNode, comment, options) { return false; } -function handleCommentInEmptyParens(text, enclosingNode, comment, options) { - if ( - getNextNonSpaceNonCommentCharacter(text, comment, options.locEnd) !== ")" - ) { +function handleCommentInEmptyParens(text, enclosingNode, comment) { + if (getNextNonSpaceNonCommentCharacter(text, comment, locEnd) !== ")") { return false; } @@ -629,8 +579,7 @@ function handleLastFunctionArgComments( precedingNode, enclosingNode, followingNode, - comment, - options + comment ) { // Flow function type definitions if ( @@ -652,7 +601,7 @@ function handleLastFunctionArgComments( precedingNode.type === "AssignmentPattern") && enclosingNode && isRealFunctionLikeNode(enclosingNode) && - getNextNonSpaceNonCommentCharacter(text, comment, options.locEnd) === ")" + getNextNonSpaceNonCommentCharacter(text, comment, locEnd) === ")" ) { addTrailingComment(precedingNode, comment); return true; @@ -669,12 +618,12 @@ function handleLastFunctionArgComments( if (parameters.length !== 0) { return getNextNonSpaceNonCommentCharacterIndexWithStartIndex( text, - options.locEnd(getLast(parameters)) + locEnd(getLast(parameters)) ); } const functionParamLeftParenIndex = getNextNonSpaceNonCommentCharacterIndexWithStartIndex( text, - options.locEnd(enclosingNode.id) + locEnd(enclosingNode.id) ); return ( functionParamLeftParenIndex !== false && @@ -684,7 +633,7 @@ function handleLastFunctionArgComments( ) ); })(); - if (options.locStart(comment) > functionParamRightParenIndex) { + if (locStart(comment) > functionParamRightParenIndex) { addBlockStatementFirstComment(followingNode, comment); return true; } @@ -826,15 +775,14 @@ function handleImportDeclarationComments( text, enclosingNode, precedingNode, - comment, - options + comment ) { if ( precedingNode && precedingNode.type === "ImportSpecifier" && enclosingNode && enclosingNode.type === "ImportDeclaration" && - hasNewline(text, options.locEnd(comment)) + hasNewline(text, locEnd(comment)) ) { addTrailingComment(precedingNode, comment); return true; @@ -884,8 +832,7 @@ function handleTSFunctionTrailingComments( text, enclosingNode, followingNode, - comment, - options + comment ) { if ( !followingNode && @@ -893,7 +840,7 @@ function handleTSFunctionTrailingComments( (enclosingNode.type === "TSMethodSignature" || enclosingNode.type === "TSDeclareFunction" || enclosingNode.type === "TSAbstractMethodDefinition") && - getNextNonSpaceNonCommentCharacter(text, comment, options.locEnd) === ";" + getNextNonSpaceNonCommentCharacter(text, comment, locEnd) === ";" ) { addTrailingComment(enclosingNode, comment); return true; @@ -988,7 +935,8 @@ function getCommentChildNodes(node, options) { if ( (options.parser === "typescript" || options.parser === "flow" || - options.parser === "espree") && + options.parser === "espree" || + options.parser === "meriyah") && node.type === "MethodDefinition" && node.value && node.value.type === "FunctionExpression" && @@ -1017,7 +965,6 @@ module.exports = { handleEndOfLineComment, handleRemainingComment, hasLeadingComment, - isBlockComment, isTypeCastComment, getGapRegex, getCommentChildNodes, diff --git a/src/language-js/embed.js b/src/language-js/embed.js index 1797bf41413b..9daf9b028070 100644 --- a/src/language-js/embed.js +++ b/src/language-js/embed.js @@ -15,7 +15,8 @@ const { }, utils: { mapDoc, replaceNewlinesWithLiterallines }, } = require("../document"); -const { isBlockComment, hasLeadingComment } = require("./comments"); +const { isBlockComment } = require("./utils"); +const { hasLeadingComment } = require("./comments"); function getParser(path) { if ( diff --git a/src/language-js/index.js b/src/language-js/index.js index 00c22e14206a..f6e9c3c0038e 100644 --- a/src/language-js/index.js +++ b/src/language-js/index.js @@ -13,6 +13,7 @@ const languages = [ parsers: [ "babel", "espree", + "meriyah", "babel-flow", "babel-ts", "flow", @@ -45,6 +46,7 @@ const languages = [ "flow", "typescript", "espree", + "meriyah", ], vscodeLanguageIds: ["javascriptreact"], })), @@ -151,6 +153,10 @@ const parsers = { get espree() { return require("./parser-espree").parsers.espree; }, + // JS - meriyah + get meriyah() { + return require("./parser-meriyah").parsers.meriyah; + }, }; module.exports = { diff --git a/src/language-js/loc.js b/src/language-js/loc.js index ad3b380bab7d..139dabc3aa9e 100644 --- a/src/language-js/loc.js +++ b/src/language-js/loc.js @@ -1,5 +1,9 @@ "use strict"; +/** + * @typedef {import("./types/estree").Node} Node + */ + function locStart(node, opts) { const { ignoreDecorators } = opts || {}; @@ -21,6 +25,11 @@ function locEnd(node) { return node.typeAnnotation ? Math.max(end, locEnd(node.typeAnnotation)) : end; } +/** + * @param {Node} startNode + * @param {Node | number} endNodeOrLength + * @returns {number[]} + */ function composeLoc(startNode, endNodeOrLength = startNode) { const start = locStart(startNode); const end = @@ -31,8 +40,37 @@ function composeLoc(startNode, endNodeOrLength = startNode) { return [start, end]; } +/** + * @param {Node} nodeA + * @param {Node} nodeB + * @returns {boolean} + */ +function hasSameLocStart(nodeA, nodeB) { + return locStart(nodeA) === locStart(nodeB); +} + +/** + * @param {Node} nodeA + * @param {Node} nodeB + * @returns {boolean} + */ +function hasSameLocEnd(nodeA, nodeB) { + return locEnd(nodeA) === locEnd(nodeB); +} + +/** + * @param {Node} nodeA + * @param {Node} nodeB + * @returns {boolean} + */ +function hasSameLoc(nodeA, nodeB) { + return hasSameLocStart(nodeA, nodeB) && hasSameLocEnd(nodeA, nodeB); +} + module.exports = { locStart, locEnd, composeLoc, + hasSameLocStart, + hasSameLoc, }; diff --git a/src/language-js/needs-parens.js b/src/language-js/needs-parens.js index 3dbd4171fcd3..a30c38144280 100644 --- a/src/language-js/needs-parens.js +++ b/src/language-js/needs-parens.js @@ -1,8 +1,5 @@ "use strict"; -/** @type {import("assert")} */ -const assert = require("assert"); - const { getFunctionParameters, getLeftSidePathName, @@ -24,13 +21,6 @@ function needsParens(path, options) { const name = path.getName(); const node = path.getNode(); - // If the value of this path is some child of a Node and not a Node - // itself, then it doesn't need parentheses. Only Node objects (in - // fact, only Expression nodes) need parentheses. - if (path.getValue() !== node) { - return false; - } - // to avoid unexpected `}}` in HTML interpolations if ( options.__isInHtmlInterpolation && @@ -73,85 +63,99 @@ function needsParens(path, options) { return false; } - if (parent.type === "ParenthesizedExpression") { - return false; - } - - // Add parens around the extends clause of a class. It is needed for almost - // all expressions. - if ( - name === "superClass" && - (parent.type === "ClassDeclaration" || parent.type === "ClassExpression") && - (node.type === "ArrowFunctionExpression" || - node.type === "AssignmentExpression" || - node.type === "AwaitExpression" || - node.type === "BinaryExpression" || - node.type === "ConditionalExpression" || - node.type === "LogicalExpression" || - node.type === "NewExpression" || - node.type === "ObjectExpression" || - node.type === "ParenthesizedExpression" || - node.type === "SequenceExpression" || - node.type === "TaggedTemplateExpression" || - node.type === "UnaryExpression" || - node.type === "UpdateExpression" || - node.type === "YieldExpression") - ) { - return true; - } - - if (parent.type === "ExportDefaultDeclaration") { - return ( - // `export default function` or `export default class` can't be followed by - // anything after. So an expression like `export default (function(){}).toString()` - // needs to be followed by a parentheses - shouldWrapFunctionForExportDefault(path, options) || - // `export default (foo, bar)` also needs parentheses - node.type === "SequenceExpression" - ); - } - - if (name === "expression" && parent.type === "Decorator") { - let hasCallExpression = false; - let hasMemberExpression = false; - let current = node; - while (current) { - switch (current.type) { - case "MemberExpression": - hasMemberExpression = true; - current = current.object; - break; - case "CallExpression": - if ( - /** @(x().y) */ hasMemberExpression || - /** @(x().y()) */ hasCallExpression - ) { - return true; + switch (parent.type) { + case "ParenthesizedExpression": + return false; + case "ClassDeclaration": + case "ClassExpression": { + // Add parens around the extends clause of a class. It is needed for almost + // all expressions. + if ( + name === "superClass" && + (node.type === "ArrowFunctionExpression" || + node.type === "AssignmentExpression" || + node.type === "AwaitExpression" || + node.type === "BinaryExpression" || + node.type === "ConditionalExpression" || + node.type === "LogicalExpression" || + node.type === "NewExpression" || + node.type === "ObjectExpression" || + node.type === "ParenthesizedExpression" || + node.type === "SequenceExpression" || + node.type === "TaggedTemplateExpression" || + node.type === "UnaryExpression" || + node.type === "UpdateExpression" || + node.type === "YieldExpression") + ) { + return true; + } + break; + } + case "ExportDefaultDeclaration": { + return ( + // `export default function` or `export default class` can't be followed by + // anything after. So an expression like `export default (function(){}).toString()` + // needs to be followed by a parentheses + shouldWrapFunctionForExportDefault(path, options) || + // `export default (foo, bar)` also needs parentheses + node.type === "SequenceExpression" + ); + } + case "Decorator": { + if (name === "expression") { + let hasCallExpression = false; + let hasMemberExpression = false; + let current = node; + while (current) { + switch (current.type) { + case "MemberExpression": + hasMemberExpression = true; + current = current.object; + break; + case "CallExpression": + if ( + /** @(x().y) */ hasMemberExpression || + /** @(x().y()) */ hasCallExpression + ) { + return true; + } + hasCallExpression = true; + current = current.callee; + break; + case "Identifier": + return false; + default: + return true; } - hasCallExpression = true; - current = current.callee; - break; - case "Identifier": - return false; - default: - return true; + } + return true; } + break; + } + case "ExpressionStatement": { + if ( + startsWithNoLookaheadToken( + node, + /* forbidFunctionClassAndDoExpr */ true + ) + ) { + return true; + } + break; + } + case "ArrowFunctionExpression": { + if ( + name === "body" && + node.type !== "SequenceExpression" && // these have parens added anyway + startsWithNoLookaheadToken( + node, + /* forbidFunctionClassAndDoExpr */ false + ) + ) { + return true; + } + break; } - return true; - } - - if ( - (name === "body" && - parent.type === "ArrowFunctionExpression" && - node.type !== "SequenceExpression" && // these have parens added anyway - startsWithNoLookaheadToken( - node, - /* forbidFunctionClassAndDoExpr */ false - )) || - (parent.type === "ExpressionStatement" && - startsWithNoLookaheadToken(node, /* forbidFunctionClassAndDoExpr */ true)) - ) { - return true; } switch (node.type) { @@ -285,7 +289,6 @@ function needsParens(path, options) { } if (name === "right" && parentPrecedence === precedence) { - assert.strictEqual(parent.right, node); return true; } @@ -491,7 +494,8 @@ function needsParens(path, options) { return true; } else if ( name === "key" && - parent.type === "ClassProperty" && + (parent.type === "ClassProperty" || + parent.type === "FieldDefinition") && parent.computed ) { return false; @@ -742,6 +746,7 @@ function isStatement(node) { node.type === "ClassDeclaration" || node.type === "ClassMethod" || node.type === "ClassProperty" || + node.type === "FieldDefinition" || node.type === "ClassPrivateProperty" || node.type === "ContinueStatement" || node.type === "DebuggerStatement" || diff --git a/src/language-js/parser-espree.js b/src/language-js/parser-espree.js index 6b2ea36c78ad..0f637f1d3eb7 100644 --- a/src/language-js/parser-espree.js +++ b/src/language-js/parser-espree.js @@ -35,17 +35,16 @@ function parse(originalText, parsers, options) { } catch (moduleError) { try { ast = parse(text, { ...espreeOptions, sourceType: "script" }); - } catch (scriptError) { + } catch (_) { // throw the error for `module` parsing + const { message, lineNumber, column } = moduleError; /* istanbul ignore next */ - if (typeof moduleError.lineNumber !== "number") { + if (typeof lineNumber !== "number") { throw moduleError; } - throw createError(moduleError.message, { - start: { line: moduleError.lineNumber, column: moduleError.column }, - }); + throw createError(message, { start: { line: lineNumber, column } }); } } diff --git a/src/language-js/parser-meriyah.js b/src/language-js/parser-meriyah.js new file mode 100644 index 000000000000..32f10e58ca6d --- /dev/null +++ b/src/language-js/parser-meriyah.js @@ -0,0 +1,88 @@ +"use strict"; + +const createError = require("../common/parser-create-error"); +const { hasPragma } = require("./pragma"); +const { locStart, locEnd } = require("./loc"); +const postprocess = require("./postprocess"); + +// https://github.com/meriyah/meriyah/blob/4676f60b6c149d7082bde2c9147f9ae2359c8075/src/parser.ts#L185 +const parseOptions = { + // Allow module code + module: true, + // Enable stage 3 support (ESNext) + next: true, + // Enable start and end offsets to each node + ranges: true, + // Enable web compatibility + webcompat: true, + // Enable line/column location information to each node + loc: true, + // Attach raw property to each literal and identifier node + raw: true, + // Enabled directives + directives: true, + // Allow return in the global scope + globalReturn: true, + // Enable implied strict mode + impliedStrict: false, + // Enable non-standard parenthesized expression node + preserveParens: false, + // Enable lexical binding and scope tracking + lexical: false, + // Adds a source attribute in every node’s loc object when the locations option is `true` + // source: '', + // Distinguish Identifier from IdentifierPattern + identifierPattern: false, + // Enable React JSX parsing + jsx: true, + // Allow edge cases that deviate from the spec + specDeviation: true, + // Creates unique key for in ObjectPattern when key value are same + uniqueKeyInPattern: false, +}; + +function parseWithOptions(text, module) { + const { parse } = require("meriyah"); + const comments = []; + const tokens = []; + const ast = parse(text, { + ...parseOptions, + module, + onComment: comments, + onToken: tokens, + }); + ast.comments = comments; + ast.tokens = tokens; + + return ast; +} + +function parse(text, parsers, options) { + let ast; + + try { + ast = parseWithOptions(text /* module */, true); + } catch (moduleError) { + try { + ast = parseWithOptions(text, /* module */ false); + } catch (_) { + // throw the error for `module` parsing + const { message, line, column } = moduleError; + + /* istanbul ignore next */ + if (typeof line !== "number") { + throw moduleError; + } + + throw createError(message, { start: { line, column } }); + } + } + + return postprocess(ast, { ...options, originalText: text }); +} + +module.exports = { + parsers: { + meriyah: { parse, astFormat: "estree", hasPragma, locStart, locEnd }, + }, +}; diff --git a/src/language-js/postprocess.js b/src/language-js/postprocess.js index ca1a55320d61..3efece636707 100644 --- a/src/language-js/postprocess.js +++ b/src/language-js/postprocess.js @@ -21,7 +21,8 @@ function postprocess(ast, options) { if ( options.parser !== "typescript" && options.parser !== "flow" && - options.parser !== "espree" + options.parser !== "espree" && + options.parser !== "meriyah" ) { const startOffsetsOfTypeCastedNodes = new Set(); @@ -40,9 +41,16 @@ function postprocess(ast, options) { ast = visitNode(ast, (node) => { if (node.type === "ParenthesizedExpression") { + const { expression } = node; + + // Align range with `flow` + if (expression.type === "TypeCastExpression") { + expression.range = node.range; + return expression; + } + const start = locStart(node); if (!startOffsetsOfTypeCastedNodes.has(start)) { - const { expression } = node; if (!expression.extra) { expression.extra = {}; } diff --git a/src/language-js/print/call-arguments.js b/src/language-js/print/call-arguments.js index 7c3ec3d9633a..e36d2d694286 100644 --- a/src/language-js/print/call-arguments.js +++ b/src/language-js/print/call-arguments.js @@ -16,6 +16,7 @@ const { isLongCurriedCallExpression, shouldPrintComma, } = require("../utils"); +const { locEnd } = require("../loc"); const { builders: { @@ -99,7 +100,7 @@ function printCallArguments(path, options, print) { if (index === lastArgIndex) { // do nothing - } else if (isNextLineEmpty(options.originalText, arg, options.locEnd)) { + } else if (isNextLineEmpty(options.originalText, arg, locEnd)) { if (index === 0) { hasEmptyLineFollowingFirstArg = true; } diff --git a/src/language-js/print/function-parameters.js b/src/language-js/print/function-parameters.js new file mode 100644 index 000000000000..7a8d696ca6b7 --- /dev/null +++ b/src/language-js/print/function-parameters.js @@ -0,0 +1,197 @@ +"use strict"; + +const { + getNextNonSpaceNonCommentCharacter, + isNextLineEmpty, +} = require("../../common/util"); +const { printDanglingComments } = require("../../main/comments"); +const { + builders: { concat, line, hardline, softline, group, indent, ifBreak }, + utils: { removeLines }, +} = require("../../document"); +const { + getFunctionParameters, + iterateFunctionParametersPath, + isSimpleType, + isTestCall, + isTypeAnnotationAFunction, + isObjectType, + isObjectTypePropertyAFunction, + hasRestParameter, + shouldPrintComma, +} = require("../utils"); +const { locEnd } = require("../loc"); +const { printFunctionTypeParameters } = require("./misc"); + +function printFunctionParameters( + path, + print, + options, + expandArg, + printTypeParams +) { + const functionNode = path.getValue(); + const parameters = getFunctionParameters(functionNode); + const typeParams = printTypeParams + ? printFunctionTypeParameters(path, options, print) + : ""; + + if (parameters.length === 0) { + return concat([ + typeParams, + "(", + printDanglingComments( + path, + options, + /* sameIndent */ true, + (comment) => + getNextNonSpaceNonCommentCharacter( + options.originalText, + comment, + locEnd + ) === ")" + ), + ")", + ]); + } + + const parent = path.getParentNode(); + const isParametersInTestCall = isTestCall(parent); + const shouldHugParameters = shouldHugFunctionParameters(functionNode); + const shouldExpandParameters = + expandArg && !parameters.some((node) => node.comments); + const printed = []; + iterateFunctionParametersPath(path, (parameterPath, index) => { + const isLastParameter = index === parameters.length - 1; + if (isLastParameter && functionNode.rest) { + printed.push("..."); + } + printed.push(parameterPath.call(print)); + if (isLastParameter) { + return; + } + printed.push(","); + if ( + isParametersInTestCall || + shouldHugParameters || + shouldExpandParameters + ) { + printed.push(" "); + } else if ( + isNextLineEmpty(options.originalText, parameters[index], locEnd) + ) { + printed.push(hardline, hardline); + } else { + printed.push(line); + } + }); + + // If the parent is a call with the first/last argument expansion and this is the + // params of the first/last argument, we don't want the arguments to break and instead + // want the whole expression to be on a new line. + // + // Good: Bad: + // verylongcall( verylongcall(( + // (a, b) => { a, + // } b, + // }) ) => { + // }) + if (shouldExpandParameters) { + return group( + concat([ + removeLines(typeParams), + "(", + concat(printed.map(removeLines)), + ")", + ]) + ); + } + + // Single object destructuring should hug + // + // function({ + // a, + // b, + // c + // }) {} + const hasNotParameterDecorator = parameters.every((node) => !node.decorators); + if (shouldHugParameters && hasNotParameterDecorator) { + return concat([typeParams, "(", concat(printed), ")"]); + } + + // don't break in specs, eg; `it("should maintain parens around done even when long", (done) => {})` + if (isParametersInTestCall) { + return concat([typeParams, "(", concat(printed), ")"]); + } + + const isFlowShorthandWithOneArg = + (isObjectTypePropertyAFunction(parent) || + isTypeAnnotationAFunction(parent) || + parent.type === "TypeAlias" || + parent.type === "UnionTypeAnnotation" || + parent.type === "TSUnionType" || + parent.type === "IntersectionTypeAnnotation" || + (parent.type === "FunctionTypeAnnotation" && + parent.returnType === functionNode)) && + parameters.length === 1 && + parameters[0].name === null && + // `type q = (this: string) => void;` + functionNode.this !== parameters[0] && + parameters[0].typeAnnotation && + functionNode.typeParameters === null && + isSimpleType(parameters[0].typeAnnotation) && + !functionNode.rest; + + if (isFlowShorthandWithOneArg) { + if (options.arrowParens === "always") { + return concat(["(", concat(printed), ")"]); + } + return concat(printed); + } + + return concat([ + typeParams, + "(", + indent(concat([softline, concat(printed)])), + ifBreak( + !hasRestParameter(functionNode) && shouldPrintComma(options, "all") + ? "," + : "" + ), + softline, + ")", + ]); +} + +function shouldHugFunctionParameters(node) { + if (!node) { + return false; + } + const parameters = getFunctionParameters(node); + if (parameters.length !== 1) { + return false; + } + const [parameter] = parameters; + return ( + !parameter.comments && + (parameter.type === "ObjectPattern" || + parameter.type === "ArrayPattern" || + (parameter.type === "Identifier" && + parameter.typeAnnotation && + (parameter.typeAnnotation.type === "TypeAnnotation" || + parameter.typeAnnotation.type === "TSTypeAnnotation") && + isObjectType(parameter.typeAnnotation.typeAnnotation)) || + (parameter.type === "FunctionTypeParam" && + isObjectType(parameter.typeAnnotation)) || + (parameter.type === "AssignmentPattern" && + (parameter.left.type === "ObjectPattern" || + parameter.left.type === "ArrayPattern") && + (parameter.right.type === "Identifier" || + (parameter.right.type === "ObjectExpression" && + parameter.right.properties.length === 0) || + (parameter.right.type === "ArrayExpression" && + parameter.right.elements.length === 0)))) + ); +} + +module.exports = { printFunctionParameters, shouldHugFunctionParameters }; diff --git a/src/language-js/print/member-chain.js b/src/language-js/print/member-chain.js index 787223c752ff..9bb2333dda36 100644 --- a/src/language-js/print/member-chain.js +++ b/src/language-js/print/member-chain.js @@ -20,6 +20,7 @@ const { isNumericLiteral, isSimpleCallArgument, } = require("../utils"); +const { locEnd } = require("../loc"); const { builders: { @@ -73,7 +74,7 @@ function printMemberChain(path, options, print) { const nextCharIndex = getNextNonSpaceNonCommentCharacterIndex( originalText, node, - options.locEnd + locEnd ); const nextChar = originalText.charAt(nextCharIndex); @@ -86,7 +87,7 @@ function printMemberChain(path, options, print) { ); } - return isNextLineEmpty(originalText, node, options.locEnd); + return isNextLineEmpty(originalText, node, locEnd); } function rec(path) { diff --git a/src/language-js/print/module.js b/src/language-js/print/module.js index dc0f8ccf506d..1076773416dd 100644 --- a/src/language-js/print/module.js +++ b/src/language-js/print/module.js @@ -94,7 +94,22 @@ function printModuleSpecifiers(path, options, print) { return concat(parts); } +function printImportAssertions(path, options, print) { + const node = path.getNode(); + if (Array.isArray(node.assertions) && node.assertions.length !== 0) { + return concat([ + " assert {", + options.bracketSpacing ? " " : "", + join(", ", path.map(print, "assertions")), + options.bracketSpacing ? " " : "", + "}", + ]); + } + return ""; +} + module.exports = { printModuleSource, printModuleSpecifiers, + printImportAssertions, }; diff --git a/src/language-js/print/ternary.js b/src/language-js/print/ternary.js index 422efaa5ee0b..604ea79de462 100644 --- a/src/language-js/print/ternary.js +++ b/src/language-js/print/ternary.js @@ -1,10 +1,9 @@ "use strict"; const flat = require("lodash/flatten"); - -const { isJSXNode } = require("../utils"); const { hasNewlineInRange } = require("../../common/util"); -const handleComments = require("../comments"); +const { isJSXNode, isBlockComment } = require("../utils"); +const { locStart, locEnd } = require("../loc"); const { builders: { concat, @@ -258,11 +257,11 @@ function printTernaryOperator(path, options, print, operatorOptions) { ]).filter(Boolean); const shouldBreak = comments.some( (comment) => - handleComments.isBlockComment(comment) && + isBlockComment(comment) && hasNewlineInRange( options.originalText, - options.locStart(comment), - options.locEnd(comment) + locStart(comment), + locEnd(comment) ) ); const maybeGroup = (doc) => diff --git a/src/language-js/printer-estree-json.js b/src/language-js/printer-estree-json.js index 71f81ebdcf10..63af2bd254ac 100644 --- a/src/language-js/printer-estree-json.js +++ b/src/language-js/printer-estree-json.js @@ -58,23 +58,28 @@ function genericPrint(path, options, print) { } } -function clean(node, newNode /*, parent*/) { - delete newNode.start; - delete newNode.end; - delete newNode.extra; - delete newNode.loc; - delete newNode.comments; - delete newNode.errors; - delete newNode.range; +const ignoredProperties = new Set([ + "start", + "end", + "extra", + "loc", + "comments", + "errors", + "range", +]); - if (node.type === "Identifier") { +function clean(node, newNode /*, parent*/) { + const { type } = node; + if (type === "Identifier") { return { type: "StringLiteral", value: node.name }; } - if (node.type === "UnaryExpression" && node.operator === "+") { + if (type === "UnaryExpression" && node.operator === "+") { return newNode.argument; } } +clean.ignoredProperties = ignoredProperties; + module.exports = { preprocess, print: genericPrint, diff --git a/src/language-js/printer-estree.js b/src/language-js/printer-estree.js index 2f8af23d20b4..6f3224cc4fae 100644 --- a/src/language-js/printer-estree.js +++ b/src/language-js/printer-estree.js @@ -8,7 +8,6 @@ const assert = require("assert"); // TODO(azz): anything that imports from main shouldn't be in a `language-*` dir. const comments = require("../main/comments"); const { - getNextNonSpaceNonCommentCharacter, hasNewline, hasNewlineInRange, getLast, @@ -19,11 +18,9 @@ const { hasNodeIgnoreComment, getIndentSize, getPreferredQuote, -} = require("../common/util"); -const { isNextLineEmpty, getNextNonSpaceNonCommentCharacterIndex, -} = require("../common/util-shared"); +} = require("../common/util"); const { builders: { concat, @@ -41,7 +38,7 @@ const { lineSuffixBoundary, addAlignmentToDoc, }, - utils: { willBreak, isLineNext, isEmpty, removeLines, normalizeParts }, + utils: { willBreak, isLineNext, isEmpty, normalizeParts }, printer: { printDocToString }, } = require("../document"); const embed = require("./embed"); @@ -57,10 +54,7 @@ const preprocess = require("./preprocess"); const { classChildNeedsASIProtection, classPropMayCauseASIProblems, - getFlowVariance, getFunctionParameters, - iterateFunctionParametersPath, - hasRestParameter, getLeftSidePathName, getParentExportDeclaration, getTypeScriptMappedTypeModifier, @@ -72,7 +66,6 @@ const { hasNewlineBetweenOrAfterDecorators, hasNgSideEffect, hasPrettierIgnore, - hasSameLoc, hasTrailingComment, hasTrailingLineComment, identity, @@ -95,7 +88,7 @@ const { isNumericLiteral, isObjectType, isObjectTypePropertyAFunction, - isSimpleFlowType, + isSimpleType, isSimpleNumber, isSimpleTemplateLiteral, isStringLiteral, @@ -104,7 +97,8 @@ const { isTestCall, isTheOnlyJSXElementInMarkdown, isTSXFile, - isTypeAnnotationAFunction, + isBlockComment, + isLineComment, matchJsxWhitespaceRegex, needsHardlineAfterDanglingComment, rawText, @@ -113,6 +107,7 @@ const { shouldFlatten, startsWithNoLookaheadToken, } = require("./utils"); +const { locStart, locEnd, hasSameLoc } = require("./loc"); const printMemberChain = require("./print/member-chain"); const printCallArguments = require("./print/call-arguments"); @@ -122,8 +117,16 @@ const { printMemberLookup, printBindExpressionCallee, } = require("./print/misc"); -const { printModuleSource, printModuleSpecifiers } = require("./print/module"); +const { + printModuleSource, + printModuleSpecifiers, + printImportAssertions, +} = require("./print/module"); const printTernaryOperator = require("./print/ternary"); +const { + printFunctionParameters, + shouldHugFunctionParameters, +} = require("./print/function-parameters"); const needsQuoteProps = new WeakMap(); @@ -144,6 +147,7 @@ function genericPrint(path, options, printPath, args) { node.type === "ClassMethod" || node.type === "ClassPrivateMethod" || node.type === "ClassProperty" || + node.type === "FieldDefinition" || node.type === "TSAbstractClassProperty" || node.type === "ClassPrivateProperty" || node.type === "MethodDefinition" || @@ -159,8 +163,8 @@ function genericPrint(path, options, printPath, args) { // for printing the decorators. !( parentExportDecl && - options.locStart(parentExportDecl, { ignoreDecorators: true }) > - options.locStart(node.decorators[0]) + locStart(parentExportDecl, { ignoreDecorators: true }) > + locStart(node.decorators[0]) ) ) { const shouldBreak = @@ -191,8 +195,8 @@ function genericPrint(path, options, printPath, args) { node.declaration.decorators.length > 0 && // Only print decorators here if they were written before the export, // otherwise they are printed by the node.declaration - options.locStart(node, { ignoreDecorators: true }) > - options.locStart(node.declaration.decorators[0]) + locStart(node, { ignoreDecorators: true }) > + locStart(node.declaration.decorators[0]) ) { // Export declarations are responsible for printing any decorators // that logically apply to node.declaration. @@ -294,15 +298,11 @@ function printPathNoParens(path, options, print, args) { // Babel 6 if (n.directives) { const directivesCount = n.directives.length; - path.map((childPath, index) => { + path.each((childPath, index) => { parts.push(print(childPath), semi, hardline); if ( (index < directivesCount - 1 || hasContents) && - isNextLineEmpty( - options.originalText, - childPath.getValue(), - options.locEnd - ) + isNextLineEmpty(options.originalText, childPath.getValue(), locEnd) ) { parts.push(hardline); } @@ -460,6 +460,7 @@ function printPathNoParens(path, options, print, args) { parent.type === "AssignmentExpression" || parent.type === "VariableDeclarator" || parent.type === "ClassProperty" || + parent.type === "FieldDefinition" || parent.type === "TSAbstractClassProperty" || parent.type === "ClassPrivateProperty" || parent.type === "ObjectProperty" || @@ -684,7 +685,7 @@ function printPathNoParens(path, options, print, args) { const nextCharacter = getNextNonSpaceNonCommentCharacterIndex( options.originalText, comment, - options.locEnd + locEnd ); return ( nextCharacter !== false && @@ -704,12 +705,12 @@ function printPathNoParens(path, options, print, args) { // We want to always keep these types of nodes on the same line // as the arrow. if ( - !hasLeadingOwnLineComment(options.originalText, n.body, options) && + !hasLeadingOwnLineComment(options.originalText, n.body) && (n.body.type === "ArrayExpression" || n.body.type === "ObjectExpression" || n.body.type === "BlockStatement" || isJSXNode(n.body) || - isTemplateOnItsOwnLine(n.body, options.originalText, options) || + isTemplateOnItsOwnLine(n.body, options.originalText) || n.body.type === "ArrowFunctionExpression" || n.body.type === "DoExpression") ) { @@ -807,7 +808,7 @@ function printPathNoParens(path, options, print, args) { parts.push(path.call(print, "imported")); - if (n.local && !hasSameLoc(n.local, n.imported, options)) { + if (n.local && !hasSameLoc(n.local, n.imported)) { parts.push(" as ", path.call(print, "local")); } @@ -815,7 +816,7 @@ function printPathNoParens(path, options, print, args) { case "ExportSpecifier": { parts.push(path.call(print, "local")); - if (n.exported && !hasSameLoc(n.local, n.exported, options)) { + if (n.exported && !hasSameLoc(n.local, n.exported)) { parts.push(" as ", path.call(print, "exported")); } @@ -847,7 +848,11 @@ function printPathNoParens(path, options, print, args) { parts.push(" as ", path.call(print, "exported")); } - parts.push(printModuleSource(path, options, print), semi); + parts.push( + printModuleSource(path, options, print), + printImportAssertions(path, options, print), + semi + ); return concat(parts); @@ -869,10 +874,7 @@ function printPathNoParens(path, options, print, args) { (n.importKind && n.importKind === "type") || // import {} from 'x' /{\s*}/.test( - options.originalText.slice( - options.locStart(n), - options.locStart(n.source) - ) + options.originalText.slice(locStart(n), locStart(n.source)) ) ) { parts.push(" {}", printModuleSource(path, options, print)); @@ -880,13 +882,7 @@ function printPathNoParens(path, options, print, args) { parts.push(" ", path.call(print, "source")); } - if (Array.isArray(n.assertions) && n.assertions.length !== 0) { - parts.push( - " assert { ", - join(", ", path.map(print, "assertions")), - " }" - ); - } + parts.push(printImportAssertions(path, options, print)); parts.push(semi); @@ -941,11 +937,7 @@ function printPathNoParens(path, options, print, args) { path.each((childPath) => { parts.push(indent(concat([hardline, print(childPath), semi]))); if ( - isNextLineEmpty( - options.originalText, - childPath.getValue(), - options.locEnd - ) + isNextLineEmpty(options.originalText, childPath.getValue(), locEnd) ) { parts.push(hardline); } @@ -985,7 +977,7 @@ function printPathNoParens(path, options, print, args) { (n.callee.name === "require" || n.callee.name === "define")) || // Template literals as single arguments (args.length === 1 && - isTemplateOnItsOwnLine(args[0], options.originalText, options)) || + isTemplateOnItsOwnLine(args[0], options.originalText)) || // Keep test declarations on a single line // e.g. `it('long name', () => {` (!isNew && isTestCall(n, path.getParentNode())) @@ -1012,6 +1004,7 @@ function printPathNoParens(path, options, print, args) { // // Here, we ensure that such comments stay between the Identifier and the Callee. const isIdentifierWithFlowAnnotation = + (options.parser === "babel" || options.parser === "babel-flow") && n.callee && n.callee.type === "Identifier" && hasFlowAnnotationComment(n.callee.trailingComments); @@ -1086,7 +1079,7 @@ function printPathNoParens(path, options, print, args) { const firstProperty = fields .map((field) => n[field][0]) - .sort((a, b) => options.locStart(a) - options.locStart(b))[0]; + .sort((a, b) => locStart(a) - locStart(b))[0]; const parent = path.getParentNode(0); const isFlowInterfaceLikeBody = @@ -1118,8 +1111,8 @@ function printPathNoParens(path, options, print, args) { firstProperty && hasNewlineInRange( options.originalText, - options.locStart(n), - options.locStart(firstProperty) + locStart(n), + locStart(firstProperty) )); const separator = isFlowInterfaceLikeBody @@ -1141,7 +1134,7 @@ function printPathNoParens(path, options, print, args) { propsAndLoc.push({ node, printed: print(childPath), - loc: options.locStart(node), + loc: locStart(node), }); }, field); }); @@ -1160,9 +1153,7 @@ function printPathNoParens(path, options, print, args) { ) { separatorParts.shift(); } - if ( - isNextLineEmpty(options.originalText, prop.node, options.locEnd) - ) { + if (isNextLineEmpty(options.originalText, prop.node, locEnd)) { separatorParts.push(hardline); } return result; @@ -1171,8 +1162,8 @@ function printPathNoParens(path, options, print, args) { if (n.inexact) { let printed; if (hasDanglingComments(n)) { - const hasLineComments = !n.comments.every( - handleComments.isBlockComment + const hasLineComments = !n.comments.every((comment) => + isBlockComment(comment) ); const printedDanglingComments = comments.printDanglingComments( path, @@ -1184,7 +1175,7 @@ function printPathNoParens(path, options, print, args) { hasLineComments || hasNewline( options.originalText, - options.locEnd(n.comments[n.comments.length - 1]) + locEnd(n.comments[n.comments.length - 1]) ) ? hardline : line, @@ -1254,7 +1245,7 @@ function printPathNoParens(path, options, print, args) { path.match( (node) => node.type === "ObjectPattern" && !node.decorators, (node, name, number) => - shouldHugArguments(node) && + shouldHugFunctionParameters(node) && (name === "params" || name === "parameters" || name === "this" || @@ -1266,7 +1257,7 @@ function printPathNoParens(path, options, print, args) { (node, name) => name === "typeAnnotation", (node, name) => name === "typeAnnotation", (node, name, number) => - shouldHugArguments(node) && + shouldHugFunctionParameters(node) && (name === "params" || name === "parameters" || name === "this" || @@ -1639,8 +1630,7 @@ function printPathNoParens(path, options, print, args) { const commentOnOwnLine = (hasTrailingComment(n.consequent) && n.consequent.comments.some( - (comment) => - comment.trailing && !handleComments.isBlockComment(comment) + (comment) => comment.trailing && !isBlockComment(comment) )) || needsHardlineAfterDanglingComment(n); const elseOnSameLine = @@ -1728,10 +1718,9 @@ function printPathNoParens(path, options, print, args) { ]) ); case "ForInStatement": - // Note: esprima can't actually parse "for each (". return group( concat([ - n.each ? "for each (" : "for (", + "for (", path.call(print, "left"), " in ", path.call(print, "right"), @@ -1824,11 +1813,11 @@ function printPathNoParens(path, options, print, args) { n.param.comments && n.param.comments.some( (comment) => - !handleComments.isBlockComment(comment) || + !isBlockComment(comment) || (comment.leading && - hasNewline(options.originalText, options.locEnd(comment))) || + hasNewline(options.originalText, locEnd(comment))) || (comment.trailing && - hasNewline(options.originalText, options.locStart(comment), { + hasNewline(options.originalText, locStart(comment), { backwards: true, })) ); @@ -1872,11 +1861,7 @@ function printPathNoParens(path, options, print, args) { return concat([ casePath.call(print), n.cases.indexOf(caseNode) !== n.cases.length - 1 && - isNextLineEmpty( - options.originalText, - caseNode, - options.locEnd - ) + isNextLineEmpty(options.originalText, caseNode, locEnd) ? hardline : "", ]); @@ -2129,7 +2114,7 @@ function printPathNoParens(path, options, print, args) { case "JSXClosingFragment": { const hasComment = n.comments && n.comments.length; const hasOwnLineComment = - hasComment && !n.comments.every(handleComments.isBlockComment); + hasComment && !n.comments.every((comment) => isBlockComment(comment)); const isOpeningFragment = n.type === "JSXOpeningFragment"; return concat([ isOpeningFragment ? "<" : " isBlockComment(comment)); return concat([ comments.printDanglingComments( @@ -2184,6 +2169,7 @@ function printPathNoParens(path, options, print, args) { "}", ]); case "ClassProperty": + case "FieldDefinition": case "TSAbstractClassProperty": case "ClassPrivateProperty": { if (n.decorators && n.decorators.length !== 0) { @@ -2204,9 +2190,8 @@ function printPathNoParens(path, options, print, args) { if (n.readonly) { parts.push("readonly "); } - const variance = getFlowVariance(n); - if (variance) { - parts.push(variance); + if (n.variance) { + parts.push(path.call(print, "variance")); } parts.push( printPropertyKey(path, options, print), @@ -2390,14 +2375,10 @@ function printPathNoParens(path, options, print, args) { return "*"; case "EmptyTypeAnnotation": return "empty"; - case "AnyTypeAnnotation": - return "any"; case "MixedTypeAnnotation": return "mixed"; case "ArrayTypeAnnotation": return concat([path.call(print, "elementType"), "[]"]); - case "BooleanTypeAnnotation": - return "boolean"; case "BooleanLiteralTypeAnnotation": return "" + n.value; case "DeclareClass": @@ -2560,9 +2541,9 @@ function printPathNoParens(path, options, print, args) { !( ((parent.type === "ObjectTypeProperty" || parent.type === "ObjectTypeInternalSlot") && - !getFlowVariance(parent) && + !parent.variance && !parent.optional && - options.locStart(parent) === options.locStart(n)) || + locStart(parent) === locStart(n)) || parent.type === "ObjectTypeCallProperty" || (parentParentParent && parentParentParent.type === "DeclareFunction") ); @@ -2582,7 +2563,7 @@ function printPathNoParens(path, options, print, args) { parent.type === "TSTypeAnnotation") && parentParent.type === "ArrowFunctionExpression"; - if (isObjectTypePropertyAFunction(parent, options)) { + if (isObjectTypePropertyAFunction(parent)) { isArrowFunctionTypeAnnotation = true; needsColon = true; } @@ -2634,11 +2615,6 @@ function printPathNoParens(path, options, print, args) { path.call(print, "typeAnnotation"), ]); } - case "GenericTypeAnnotation": - return concat([ - path.call(print, "id"), - path.call(print, "typeParameters"), - ]); case "DeclareInterface": case "InterfaceDeclaration": @@ -2778,7 +2754,7 @@ function printPathNoParens(path, options, print, args) { (parent.type === "TypeAlias" || parent.type === "VariableDeclarator" || parent.type === "TSTypeAliasDeclaration") && - hasLeadingOwnLineComment(options.originalText, n, options) + hasLeadingOwnLineComment(options.originalText, n) ); // { @@ -2804,8 +2780,7 @@ function printPathNoParens(path, options, print, args) { } const shouldAddStartLine = - shouldIndent && - !hasLeadingOwnLineComment(options.originalText, n, options); + shouldIndent && !hasLeadingOwnLineComment(options.originalText, n); const code = concat([ ifBreak(concat([shouldAddStartLine ? line : "", "| "])), @@ -2833,15 +2808,11 @@ function printPathNoParens(path, options, print, args) { } case "NullableTypeAnnotation": return concat(["?", path.call(print, "typeAnnotation")]); - case "TSNullKeyword": - case "NullLiteralTypeAnnotation": - return "null"; - case "ThisTypeAnnotation": - return "this"; - case "NumberTypeAnnotation": - return "number"; - case "SymbolTypeAnnotation": - return "symbol"; + case "Variance": { + const { kind } = n; + assert.ok(kind === "plus" || kind === "minus"); + return kind === "plus" ? "+" : "-"; + } case "ObjectTypeCallProperty": if (n.static) { parts.push("static "); @@ -2851,9 +2822,8 @@ function printPathNoParens(path, options, print, args) { return concat(parts); case "ObjectTypeIndexer": { - const variance = getFlowVariance(n); return concat([ - variance || "", + n.variance ? path.call(print, "variance") : "", "[", path.call(print, "id"), n.id ? ": " : "", @@ -2863,8 +2833,6 @@ function printPathNoParens(path, options, print, args) { ]); } case "ObjectTypeProperty": { - const variance = getFlowVariance(n); - let modifier = ""; if (n.proto) { @@ -2876,10 +2844,10 @@ function printPathNoParens(path, options, print, args) { return concat([ modifier, isGetterOrSetter(n) ? n.kind + " " : "", - variance || "", + n.variance ? path.call(print, "variance") : "", printPropertyKey(path, options, print), printOptionalToken(path), - isFunctionNotation(n, options) ? "" : ": ", + isFunctionNotation(n) ? "" : ": ", path.call(print, "value"), ]); } @@ -2893,14 +2861,13 @@ function printPathNoParens(path, options, print, args) { return nodeStr(n, options); case "NumberLiteralTypeAnnotation": assert.strictEqual(typeof n.value, "number"); - + // fall through + case "BigIntLiteralTypeAnnotation": if (n.extra != null) { return printNumber(n.extra.raw); } return printNumber(n.raw); - case "StringTypeAnnotation": - return "string"; case "DeclareTypeAlias": case "TypeAlias": { if (n.type === "DeclareTypeAlias" || n.declare) { @@ -2936,24 +2903,28 @@ function printPathNoParens(path, options, print, args) { case "TypeParameterDeclaration": case "TypeParameterInstantiation": { - const value = path.getValue(); - const commentStart = options.originalText - .slice(0, options.locStart(value)) - .lastIndexOf("/*"); - // As noted in the TypeCastExpression comments above, we're able to use a normal whitespace regex here - // because we know for sure that this is a type definition. - const commentSyntax = - commentStart >= 0 && - options.originalText.slice(commentStart).match(/^\/\*\s*::/); - if (commentSyntax) { - return concat([ - "/*:: ", - printTypeParameters(path, options, print, "params"), - " */", - ]); + const printed = printTypeParameters(path, options, print, "params"); + + if (options.parser === "flow") { + const start = locStart(n); + const end = locEnd(n); + const commentStartIndex = options.originalText.lastIndexOf("/*", start); + const commentEndIndex = options.originalText.indexOf("*/", end); + if (commentStartIndex !== -1 && commentEndIndex !== -1) { + const comment = options.originalText + .slice(commentStartIndex + 2, commentEndIndex) + .trim(); + if ( + comment.startsWith("::") && + !comment.includes("/*") && + !comment.includes("*/") + ) { + return concat(["/*:: ", printed, " */"]); + } + } } - return printTypeParameters(path, options, print, "params"); + return printed; } case "TSTypeParameterDeclaration": @@ -2980,10 +2951,8 @@ function printPathNoParens(path, options, print, args) { return concat(parts); } - const variance = getFlowVariance(n); - - if (variance) { - parts.push(variance); + if (n.variance) { + parts.push(path.call(print, "variance")); } parts.push(path.call(print, "name")); @@ -3018,8 +2987,6 @@ function printPathNoParens(path, options, print, args) { } case "TypeofTypeAnnotation": return concat(["typeof ", path.call(print, "argument")]); - case "VoidTypeAnnotation": - return "void"; case "InferredPredicate": return "%checks"; // Unhandled types below. If encountered, nodes of these types should @@ -3029,12 +2996,15 @@ function printPathNoParens(path, options, print, args) { return concat(["%checks(", path.call(print, "value"), ")"]); case "TSAbstractKeyword": return "abstract"; + case "AnyTypeAnnotation": case "TSAnyKeyword": return "any"; case "TSAsyncKeyword": return "async"; + case "BooleanTypeAnnotation": case "TSBooleanKeyword": return "boolean"; + case "BigIntTypeAnnotation": case "TSBigIntKeyword": return "bigint"; case "TSConstKeyword": @@ -3043,8 +3013,12 @@ function printPathNoParens(path, options, print, args) { return "declare"; case "TSExportKeyword": return "export"; + case "NullLiteralTypeAnnotation": + case "TSNullKeyword": + return "null"; case "TSNeverKeyword": return "never"; + case "NumberTypeAnnotation": case "TSNumberKeyword": return "number"; case "TSObjectKeyword": @@ -3057,16 +3031,19 @@ function printPathNoParens(path, options, print, args) { return "public"; case "TSReadonlyKeyword": return "readonly"; + case "SymbolTypeAnnotation": case "TSSymbolKeyword": return "symbol"; case "TSStaticKeyword": return "static"; + case "StringTypeAnnotation": case "TSStringKeyword": return "string"; case "TSUndefinedKeyword": return "undefined"; case "TSUnknownKeyword": return "unknown"; + case "VoidTypeAnnotation": case "TSVoidKeyword": return "void"; case "TSAsExpression": @@ -3125,9 +3102,10 @@ function printPathNoParens(path, options, print, args) { parts.push(path.call(print, "parameter")); return concat(parts); + case "GenericTypeAnnotation": case "TSTypeReference": return concat([ - path.call(print, "typeName"), + path.call(print, n.type === "TSTypeReference" ? "typeName" : "id"), printTypeParameters(path, options, print, "typeParameters"), ]); case "TSTypeQuery": @@ -3180,6 +3158,7 @@ function printPathNoParens(path, options, print, args) { ]); case "TSNonNullExpression": return concat([path.call(print, "expression"), "!"]); + case "ThisTypeAnnotation": case "TSThisType": return "this"; case "TSImportType": @@ -3234,8 +3213,8 @@ function printPathNoParens(path, options, print, args) { case "TSMappedType": { const shouldBreak = hasNewlineInRange( options.originalText, - options.locStart(n), - options.locEnd(n) + locStart(n), + locEnd(n) ); return group( concat([ @@ -3390,8 +3369,8 @@ function printPathNoParens(path, options, print, args) { parts.push(printTypeScriptModifiers(path, options, print)); const textBetweenNodeAndItsId = options.originalText.slice( - options.locStart(n), - options.locStart(n.id) + locStart(n), + locStart(n.id) ); // Global declaration looks like this: @@ -3425,7 +3404,8 @@ function printPathNoParens(path, options, print, args) { } case "PrivateName": - return concat(["#", path.call(print, "id")]); + // babel use `id`, meriyah use `name` + return concat(["#", path.call(print, n.id ? "id" : "name")]); // TODO: Temporary auto-generated node type. To remove when typescript-estree has proper support for private fields. case "TSPrivateIdentifier": @@ -3454,7 +3434,7 @@ function printPathNoParens(path, options, print, args) { case "InterpreterDirective": parts.push("#!", n.value, hardline); - if (isNextLineEmpty(options.originalText, n, options.locEnd)) { + if (isNextLineEmpty(options.originalText, n, locEnd)) { parts.push(hardline); } @@ -3582,7 +3562,7 @@ function printStatementSequence(path, options, print) { const bodyNode = path.getNode(); const isClass = bodyNode.type === "ClassBody"; - path.map((stmtPath, i) => { + path.each((stmtPath, i) => { const stmt = stmtPath.getValue(); // Just in case the AST has been modified to contain falsy @@ -3622,7 +3602,10 @@ function printStatementSequence(path, options, print) { if (!options.semi && isClass) { if (classPropMayCauseASIProblems(stmtPath)) { parts.push(";"); - } else if (stmt.type === "ClassProperty") { + } else if ( + stmt.type === "ClassProperty" || + stmt.type === "FieldDefinition" + ) { const nextChild = bodyNode.body[i + 1]; if (classChildNeedsASIProtection(nextChild)) { parts.push(";"); @@ -3630,10 +3613,7 @@ function printStatementSequence(path, options, print) { } } - if ( - isNextLineEmpty(text, stmt, options.locEnd) && - !isLastStatement(stmtPath) - ) { + if (isNextLineEmpty(text, stmt, locEnd) && !isLastStatement(stmtPath)) { parts.push(hardline); } @@ -3884,9 +3864,7 @@ function printTypeAnnotation(path, options, print) { const isFunctionDeclarationIdentifier = parentNode.type === "DeclareFunction" && parentNode.id === node; - if ( - isFlowAnnotationComment(options.originalText, node.typeAnnotation, options) - ) { + if (isFlowAnnotationComment(options.originalText, node.typeAnnotation)) { return concat([" /*: ", path.call(print, "typeAnnotation"), " */"]); } @@ -3896,146 +3874,6 @@ function printTypeAnnotation(path, options, print) { ]); } -function printFunctionParameters( - path, - print, - options, - expandArg, - printTypeParams -) { - const functionNode = path.getValue(); - const parameters = getFunctionParameters(functionNode); - const typeParams = printTypeParams - ? printFunctionTypeParameters(path, options, print) - : ""; - - if (parameters.length === 0) { - return concat([ - typeParams, - "(", - comments.printDanglingComments( - path, - options, - /* sameIndent */ true, - (comment) => - getNextNonSpaceNonCommentCharacter( - options.originalText, - comment, - options.locEnd - ) === ")" - ), - ")", - ]); - } - - const parent = path.getParentNode(); - const isParametersInTestCall = isTestCall(parent); - const shouldHugParameters = shouldHugArguments(functionNode); - const shouldExpandParameters = - expandArg && !parameters.some((node) => node.comments); - const printed = []; - iterateFunctionParametersPath(path, (parameterPath, index) => { - const isLastParameter = index === parameters.length - 1; - if (isLastParameter && functionNode.rest) { - printed.push("..."); - } - printed.push(parameterPath.call(print)); - if (isLastParameter) { - return; - } - printed.push(","); - if ( - isParametersInTestCall || - shouldHugParameters || - shouldExpandParameters - ) { - printed.push(" "); - } else if ( - isNextLineEmpty(options.originalText, parameters[index], options.locEnd) - ) { - printed.push(hardline, hardline); - } else { - printed.push(line); - } - }); - - // If the parent is a call with the first/last argument expansion and this is the - // params of the first/last argument, we don't want the arguments to break and instead - // want the whole expression to be on a new line. - // - // Good: Bad: - // verylongcall( verylongcall(( - // (a, b) => { a, - // } b, - // }) ) => { - // }) - if (shouldExpandParameters) { - return group( - concat([ - removeLines(typeParams), - "(", - concat(printed.map(removeLines)), - ")", - ]) - ); - } - - // Single object destructuring should hug - // - // function({ - // a, - // b, - // c - // }) {} - const hasNotParameterDecorator = parameters.every((node) => !node.decorators); - if (shouldHugParameters && hasNotParameterDecorator) { - return concat([typeParams, "(", concat(printed), ")"]); - } - - // don't break in specs, eg; `it("should maintain parens around done even when long", (done) => {})` - if (isParametersInTestCall) { - return concat([typeParams, "(", concat(printed), ")"]); - } - - const isFlowShorthandWithOneArg = - (isObjectTypePropertyAFunction(parent, options) || - isTypeAnnotationAFunction(parent, options) || - parent.type === "TypeAlias" || - parent.type === "UnionTypeAnnotation" || - parent.type === "TSUnionType" || - parent.type === "IntersectionTypeAnnotation" || - (parent.type === "FunctionTypeAnnotation" && - parent.returnType === functionNode)) && - parameters.length === 1 && - parameters[0].name === null && - // `type q = (this: string) => void;` - functionNode.this !== parameters[0] && - parameters[0].typeAnnotation && - functionNode.typeParameters === null && - isSimpleFlowType(parameters[0].typeAnnotation) && - !functionNode.rest; - - if (isFlowShorthandWithOneArg) { - if (options.arrowParens === "always") { - return concat(["(", concat(printed), ")"]); - } - return concat(printed); - } - - return concat([ - typeParams, - "(", - indent(concat([softline, concat(printed)])), - ifBreak( - !hasRestParameter(functionNode) && shouldPrintComma(options, "all") - ? "," - : "" - ), - softline, - ")", - ]); -} - function shouldPrintParamsWithoutParens(path, options) { if (options.arrowParens === "always") { return false; @@ -4105,7 +3943,7 @@ function printReturnType(path, print, options) { if ( n.returnType && - isFlowAnnotationComment(options.originalText, n.returnType, options) + isFlowAnnotationComment(options.originalText, n.returnType) ) { return concat([" /*: ", returnType, " */"]); } @@ -4167,6 +4005,7 @@ function printExportDeclaration(path, options, print) { parts.push(decl.exportKind === "type" ? "type " : ""); parts.push(printModuleSpecifiers(path, options, print)); parts.push(printModuleSource(path, options, print)); + parts.push(printImportAssertions(path, options, print)); parts.push(semi); } @@ -4217,9 +4056,6 @@ function printTypeParameters(path, options, print, paramsKey) { } const grandparent = path.getNode(2); - const greatGrandParent = path.getNode(3); - const greatGreatGrandParent = path.getNode(4); - const isParameterInTestCall = grandparent != null && isTestCall(grandparent); const shouldInline = @@ -4231,28 +4067,14 @@ function printTypeParameters(path, options, print, paramsKey) { shouldHugType(n[paramsKey][0].id)) || (n[paramsKey][0].type === "TSTypeReference" && shouldHugType(n[paramsKey][0].typeName)) || - n[paramsKey][0].type === "NullableTypeAnnotation" || - // See https://github.com/prettier/prettier/pull/6467 for the context. - (greatGreatGrandParent && - greatGreatGrandParent.type === "VariableDeclarator" && - grandparent.type === "TSTypeAnnotation" && - greatGrandParent.type !== "ArrowFunctionExpression" && - n[paramsKey][0].type !== "TSUnionType" && - n[paramsKey][0].type !== "UnionTypeAnnotation" && - n[paramsKey][0].type !== "TSIntersectionType" && - n[paramsKey][0].type !== "IntersectionTypeAnnotation" && - n[paramsKey][0].type !== "TSConditionalType" && - n[paramsKey][0].type !== "TSMappedType" && - n[paramsKey][0].type !== "TSTypeOperator" && - n[paramsKey][0].type !== "TSIndexedAccessType" && - n[paramsKey][0].type !== "TSArrayType"))); + n[paramsKey][0].type === "NullableTypeAnnotation")); function printDanglingCommentsForInline(n) { if (!hasDanglingComments(n)) { return ""; } - const hasOnlyBlockComments = n.comments.every( - handleComments.isBlockComment + const hasOnlyBlockComments = n.comments.every((comment) => + isBlockComment(comment) ); const printed = comments.printDanglingComments( path, @@ -4481,8 +4303,7 @@ function printJSXChildren( const n = path.getValue(); const children = []; - // using `map` instead of `each` because it provides `i` - path.map((childPath, i) => { + path.each((childPath, i) => { const child = childPath.getValue(); if (isLiteral(child)) { const text = rawText(child); @@ -4941,7 +4762,7 @@ function printBinaryishExpressions( (node.operator === "|>" || node.type === "NGPipeExpression" || (node.operator === "|" && options.parser === "__vue_expression")) && - !hasLeadingOwnLineComment(options.originalText, node.right, options); + !hasLeadingOwnLineComment(options.originalText, node.right); const operator = node.type === "NGPipeExpression" ? "|" : node.operator; const rightSuffix = @@ -5005,7 +4826,7 @@ function printBinaryishExpressions( } function printAssignmentRight(leftNode, rightNode, printedRight, options) { - if (hasLeadingOwnLineComment(options.originalText, rightNode, options)) { + if (hasLeadingOwnLineComment(options.originalText, rightNode)) { return indent(concat([line, printedRight])); } @@ -5130,7 +4951,7 @@ function stmtNeedsASIProtection(path, options) { } function shouldHugType(node) { - if (isSimpleFlowType(node) || isObjectType(node)) { + if (isSimpleType(node) || isObjectType(node)) { return true; } @@ -5160,37 +4981,6 @@ function shouldHugType(node) { return false; } -function shouldHugArguments(fun) { - if (!fun) { - return false; - } - const parameters = getFunctionParameters(fun); - if (parameters.length !== 1) { - return false; - } - const param = parameters[0]; - return ( - !param.comments && - (param.type === "ObjectPattern" || - param.type === "ArrayPattern" || - (param.type === "Identifier" && - param.typeAnnotation && - (param.typeAnnotation.type === "TypeAnnotation" || - param.typeAnnotation.type === "TSTypeAnnotation") && - isObjectType(param.typeAnnotation.typeAnnotation)) || - (param.type === "FunctionTypeParam" && - isObjectType(param.typeAnnotation)) || - (param.type === "AssignmentPattern" && - (param.left.type === "ObjectPattern" || - param.left.type === "ArrayPattern") && - (param.right.type === "Identifier" || - (param.right.type === "ObjectExpression" && - param.right.properties.length === 0) || - (param.right.type === "ArrayExpression" && - param.right.elements.length === 0)))) - ); -} - function printArrayItems(path, options, printPath, print) { const printedElements = []; let separatorParts = []; @@ -5202,11 +4992,7 @@ function printArrayItems(path, options, printPath, print) { separatorParts = [",", line]; if ( childPath.getValue() && - isNextLineEmpty( - options.originalText, - childPath.getValue(), - options.locEnd - ) + isNextLineEmpty(options.originalText, childPath.getValue(), locEnd) ) { separatorParts.push(softline); } @@ -5251,9 +5037,7 @@ function printReturnAndThrowArgument(path, options, print) { const lastComment = Array.isArray(node.comments) && node.comments[node.comments.length - 1]; - const isLastCommentLine = - lastComment && - (lastComment.type === "CommentLine" || lastComment.type === "Line"); + const isLastCommentLine = lastComment && isLineComment(lastComment); if (isLastCommentLine) { parts.push(semi); @@ -5316,41 +5100,38 @@ function canAttachComment(node) { function printComment(commentPath, options) { const comment = commentPath.getValue(); - switch (comment.type) { - case "CommentBlock": - case "Block": { - if (isIndentableBlockComment(comment)) { - const printed = printIndentableBlockComment(comment); - // We need to prevent an edge case of a previous trailing comment - // printed as a `lineSuffix` which causes the comments to be - // interleaved. See https://github.com/prettier/prettier/issues/4412 - if ( - comment.trailing && - !hasNewline(options.originalText, options.locStart(comment), { - backwards: true, - }) - ) { - return concat([hardline, printed]); - } - return printed; - } - - const commentEnd = options.locEnd(comment); - const isInsideFlowComment = - options.originalText.slice(commentEnd - 3, commentEnd) === "*-/"; + if (isLineComment(comment)) { + // Supports `//`, `#!`, `` + return options.originalText + .slice(locStart(comment), locEnd(comment)) + .trimEnd(); + } - return "/*" + comment.value + (isInsideFlowComment ? "*-/" : "*/"); + if (isBlockComment(comment)) { + if (isIndentableBlockComment(comment)) { + const printed = printIndentableBlockComment(comment); + // We need to prevent an edge case of a previous trailing comment + // printed as a `lineSuffix` which causes the comments to be + // interleaved. See https://github.com/prettier/prettier/issues/4412 + if ( + comment.trailing && + !hasNewline(options.originalText, locStart(comment), { + backwards: true, + }) + ) { + return concat([hardline, printed]); + } + return printed; } - case "CommentLine": - case "Line": - // Supports `//`, `#!`, `` - return options.originalText - .slice(options.locStart(comment), options.locEnd(comment)) - .trimEnd(); - default: - /* istanbul ignore next */ - throw new Error("Not a comment: " + JSON.stringify(comment)); + + const commentEnd = locEnd(comment); + const isInsideFlowComment = + options.originalText.slice(commentEnd - 3, commentEnd) === "*-/"; + return "/*" + comment.value + (isInsideFlowComment ? "*-/" : "*/"); } + + /* istanbul ignore next */ + throw new Error("Not a comment: " + JSON.stringify(comment)); } function isIndentableBlockComment(comment) { @@ -5389,7 +5170,7 @@ module.exports = { willPrintOwnComments, canAttachComment, printComment, - isBlockComment: handleComments.isBlockComment, + isBlockComment, handleComments: { ownLine: handleComments.handleOwnLineComment, endOfLine: handleComments.handleEndOfLineComment, diff --git a/src/language-js/types/estree.d.ts b/src/language-js/types/estree.d.ts index f017e17e9256..793932d95db3 100644 --- a/src/language-js/types/estree.d.ts +++ b/src/language-js/types/estree.d.ts @@ -14,7 +14,25 @@ type AdditionalFields = { leadingComments?: ReadonlyArray | Comment[]; }; -export type Comment = (ESTree.Comment | Babel.Comment | TSESTree.Comment) & { +type MeriyahComment = { + value: string; + start: number; + end: number; + range: number[]; + type: + | "MultiLine" + | "SingleLine" + | "HashbangComment" + | "HTMLOpen" + | "HTMLClose"; +}; + +export type Comment = ( + | ESTree.Comment + | Babel.Comment + | TSESTree.Comment + | MeriyahComment +) & { printed?: boolean; trailing?: boolean; leading?: boolean; diff --git a/src/language-js/utils.js b/src/language-js/utils.js index b2abb7bf4230..6400b5f2ecf5 100644 --- a/src/language-js/utils.js +++ b/src/language-js/utils.js @@ -9,6 +9,7 @@ const { hasNodeIgnoreComment, skipWhitespace, } = require("../common/util"); +const { locStart, locEnd, hasSameLocStart } = require("./loc"); /** * @typedef {import("./types/estree").Node} Node @@ -55,6 +56,7 @@ function hasFlowShorthandAnnotationComment(node) { node.extra && node.extra.parenthesized && node.trailingComments && + isBlockComment(node.trailingComments[0]) && FLOW_SHORTHAND_ANNOTATION.test(node.trailingComments[0].value) ); } @@ -64,7 +66,11 @@ function hasFlowShorthandAnnotationComment(node) { * @returns {boolean} */ function hasFlowAnnotationComment(comments) { - return comments && FLOW_ANNOTATION.test(comments[0].value); + return ( + comments && + isBlockComment(comments[0]) && + FLOW_ANNOTATION.test(comments[0].value) + ); } /** @@ -152,6 +158,35 @@ function getLeftSidePathName(path, node) { throw new Error("Unexpected node has no left side."); } +/** + * @param {Comment} comment + * @returns {boolean} + */ +function isBlockComment(comment) { + return ( + comment.type === "Block" || + comment.type === "CommentBlock" || + // `meriyah` + comment.type === "MultiLine" + ); +} + +/** + * @param {Comment} comment + * @returns {boolean} + */ +function isLineComment(comment) { + return ( + comment.type === "Line" || + comment.type === "CommentLine" || + // `meriyah` has `SingleLine`, `HashbangComment`, `HTMLOpen`, and `HTMLClose` + comment.type === "SingleLine" || + comment.type === "HashbangComment" || + comment.type === "HTMLOpen" || + comment.type === "HTMLClose" + ); +} + const exportDeclarationTypes = new Set([ "ExportDefaultDeclaration", "ExportDefaultSpecifier", @@ -160,10 +195,6 @@ const exportDeclarationTypes = new Set([ "ExportAllDeclaration", ]); -function isBlockComment(comment) { - return comment.type === "Block" || comment.type === "CommentBlock"; -} - /** * @param {Node} node * @returns {boolean} @@ -340,39 +371,10 @@ function isGetterOrSetter(node) { return node.kind === "get" || node.kind === "set"; } -/** - * @param {Node} nodeA - * @param {Node} nodeB - * @returns {boolean} - */ -function sameLocStart(nodeA, nodeB, { locStart }) { - return locStart(nodeA) === locStart(nodeB); -} - -/** - * @param {Node} nodeA - * @param {Node} nodeB - * @returns {boolean} - */ -function sameLocEnd(nodeA, nodeB, { locEnd }) { - return locEnd(nodeA) === locEnd(nodeB); -} - -/** - * @param {Node} nodeA - * @param {Node} nodeB - * @returns {boolean} - */ -function hasSameLoc(nodeA, nodeB, options) { - return ( - sameLocStart(nodeA, nodeB, options) && sameLocEnd(nodeA, nodeB, options) - ); -} - // TODO: This is a bad hack and we need a better way to distinguish between // arrow functions and otherwise -function isFunctionNotation(node, options) { - return isGetterOrSetter(node) || sameLocStart(node, node.value, options); +function isFunctionNotation(node) { + return isGetterOrSetter(node) || hasSameLocStart(node, node.value); } // Hack to differentiate between the following two which have the same ast @@ -382,25 +384,25 @@ function isFunctionNotation(node, options) { * @param {Node} node * @returns {boolean} */ -function isObjectTypePropertyAFunction(node, options) { +function isObjectTypePropertyAFunction(node) { return ( (node.type === "ObjectTypeProperty" || node.type === "ObjectTypeInternalSlot") && node.value.type === "FunctionTypeAnnotation" && !node.static && - !isFunctionNotation(node, options) + !isFunctionNotation(node) ); } // Hack to differentiate between the following two which have the same ast // declare function f(a): void; // var f: (a) => void; -function isTypeAnnotationAFunction(node, options) { +function isTypeAnnotationAFunction(node) { return ( (node.type === "TypeAnnotation" || node.type === "TSTypeAnnotation") && node.typeAnnotation.type === "FunctionTypeAnnotation" && !node.static && - !sameLocStart(node, node.typeAnnotation, options) + !hasSameLocStart(node, node.typeAnnotation) ); } @@ -430,30 +432,71 @@ function isMemberish(node) { ); } -const flowTypeAnnotations = new Set([ +const simpleTypeAnnotations = new Set([ + // `any` "AnyTypeAnnotation", + "TSAnyKeyword", + // `null` "NullLiteralTypeAnnotation", - "GenericTypeAnnotation", + "TSNullKeyword", + // `this` "ThisTypeAnnotation", + "TSThisType", + // `number` "NumberTypeAnnotation", + "TSNumberKeyword", + // `void` "VoidTypeAnnotation", - "EmptyTypeAnnotation", - "MixedTypeAnnotation", + "TSVoidKeyword", + // `boolean` "BooleanTypeAnnotation", - "BooleanLiteralTypeAnnotation", + "TSBooleanKeyword", + // `bigint` + "BigIntTypeAnnotation", + "TSBigIntKeyword", + // `symbol` + "SymbolTypeAnnotation", + "TSSymbolKeyword", + // `string` "StringTypeAnnotation", + "TSStringKeyword", + // literals + "BooleanLiteralTypeAnnotation", + "StringLiteralTypeAnnotation", + "BigIntLiteralTypeAnnotation", + "NumberLiteralTypeAnnotation", + "TSLiteralType", + // flow only, `empty`, `mixed` + "EmptyTypeAnnotation", + "MixedTypeAnnotation", + // typescript only, `never`, `object`, `undefined`, `unknown` + "TSNeverKeyword", + "TSObjectKeyword", + "TSUndefinedKeyword", + "TSUnknownKeyword", ]); - /** * @param {Node} node * @returns {boolean} */ -function isSimpleFlowType(node) { - return ( - node && - flowTypeAnnotations.has(node.type) && - !(node.type === "GenericTypeAnnotation" && node.typeParameters) - ); +function isSimpleType(node) { + if (!node) { + return false; + } + + if ( + (node.type === "GenericTypeAnnotation" || + node.type === "TSTypeReference") && + !node.typeParameters + ) { + return true; + } + + if (simpleTypeAnnotations.has(node.type)) { + return true; + } + + return false; } const unitTestRe = /^(skip|[fx]?(it|describe|test))$/; @@ -656,30 +699,6 @@ function isSimpleTemplateLiteral(node) { }); } -/** - * @param {ObjectTypeProperty} node - */ -function getFlowVariance(node) { - if (!node.variance) { - return null; - } - - // Babel 7.0 currently uses variance node type, and flow should - // follow suit soon: - // https://github.com/babel/babel/issues/4722 - const variance = node.variance.kind || node.variance; - - switch (variance) { - case "plus": - return "+"; - case "minus": - return "-"; - default: - /* istanbul ignore next */ - return variance; - } -} - /** * @param {FastPath} path * @returns {boolean} @@ -687,7 +706,7 @@ function getFlowVariance(node) { function classPropMayCauseASIProblems(path) { const node = path.getNode(); - if (node.type !== "ClassProperty") { + if (node.type !== "ClassProperty" && node.type !== "FieldDefinition") { return false; } @@ -724,6 +743,7 @@ function classChildNeedsASIProtection(node) { } switch (node.type) { case "ClassProperty": + case "FieldDefinition": case "TSAbstractClassProperty": return node.computed; case "MethodDefinition": // Flow @@ -767,10 +787,9 @@ function hasNewlineBetweenOrAfterDecorators(node, options) { return ( hasNewlineInRange( options.originalText, - options.locStart(node.decorators[0]), - options.locEnd(getLast(node.decorators)) - ) || - hasNewline(options.originalText, options.locEnd(getLast(node.decorators))) + locStart(node.decorators[0]), + locEnd(getLast(node.decorators)) + ) || hasNewline(options.originalText, locEnd(getLast(node.decorators))) ); } @@ -877,9 +896,9 @@ function isLastStatement(path) { * @param {Node} typeAnnotation * @returns {boolean} */ -function isFlowAnnotationComment(text, typeAnnotation, options) { - const start = options.locStart(typeAnnotation); - const end = skipWhitespace(text, options.locEnd(typeAnnotation)); +function isFlowAnnotationComment(text, typeAnnotation) { + const start = locStart(typeAnnotation); + const end = skipWhitespace(text, locEnd(typeAnnotation)); return ( end !== false && text.slice(start, start + 2) === "/*" && @@ -892,7 +911,7 @@ function isFlowAnnotationComment(text, typeAnnotation, options) { * @param {Node} node * @returns {boolean} */ -function hasLeadingOwnLineComment(text, node, options) { +function hasLeadingOwnLineComment(text, node) { if (isJSXNode(node)) { return hasNodeIgnoreComment(node); } @@ -900,7 +919,7 @@ function hasLeadingOwnLineComment(text, node, options) { const res = node.comments && node.comments.some( - (comment) => comment.leading && hasNewline(text, options.locEnd(comment)) + (comment) => comment.leading && hasNewline(text, locEnd(comment)) ); return res; } @@ -909,7 +928,7 @@ function hasLeadingOwnLineComment(text, node, options) { // (the leftmost leaf node) and, if it (or its parents) has any // leadingComments, returns true (so it can be wrapped in parens). function returnArgumentHasLeadingComment(options, argument) { - if (hasLeadingOwnLineComment(options.originalText, argument, options)) { + if (hasLeadingOwnLineComment(options.originalText, argument)) { return true; } @@ -919,7 +938,7 @@ function returnArgumentHasLeadingComment(options, argument) { while ((newLeftMost = getLeftSide(leftMost))) { leftMost = newLeftMost; - if (hasLeadingOwnLineComment(options.originalText, leftMost, options)) { + if (hasLeadingOwnLineComment(options.originalText, leftMost)) { return true; } } @@ -968,7 +987,9 @@ function isStringPropSafeToUnquote(node, options) { )) || (isSimpleNumber(node.key.value) && String(Number(node.key.value)) === node.key.value && - (options.parser === "babel" || options.parser === "espree"))) + (options.parser === "babel" || + options.parser === "espree" || + options.parser === "meriyah"))) ); } @@ -1024,12 +1045,12 @@ function templateLiteralHasNewLines(template) { * @param {string} text * @returns {boolean} */ -function isTemplateOnItsOwnLine(n, text, options) { +function isTemplateOnItsOwnLine(n, text) { return ( ((n.type === "TemplateLiteral" && templateLiteralHasNewLines(n)) || (n.type === "TaggedTemplateExpression" && templateLiteralHasNewLines(n.quasi))) && - !hasNewline(text, options.locStart(n), { backwards: true }) + !hasNewline(text, locStart(n), { backwards: true }) ); } @@ -1430,7 +1451,6 @@ function iterateFunctionParametersPath(path, iteratee) { module.exports = { classChildNeedsASIProtection, classPropMayCauseASIProblems, - getFlowVariance, getFunctionParameters, iterateFunctionParametersPath, hasRestParameter, @@ -1447,12 +1467,12 @@ module.exports = { hasNgSideEffect, hasNode, hasPrettierIgnore, - hasSameLoc, hasTrailingComment, hasTrailingLineComment, identity, isBinaryish, isBlockComment, + isLineComment, isCallOrOptionalCallExpression, isEmptyJSXElement, isExportDeclaration, @@ -1475,7 +1495,7 @@ module.exports = { isNumericLiteral, isObjectType, isObjectTypePropertyAFunction, - isSimpleFlowType, + isSimpleType, isSimpleNumber, isSimpleTemplateLiteral, isStringLiteral, diff --git a/src/language-markdown/clean.js b/src/language-markdown/clean.js new file mode 100644 index 000000000000..869eef9dd751 --- /dev/null +++ b/src/language-markdown/clean.js @@ -0,0 +1,77 @@ +"use strict"; + +const { isFrontMatterNode } = require("../common/util"); +const { startWithPragma } = require("./pragma"); + +const ignoredProperties = new Set([ + "position", + "raw", // front-matter +]); +function clean(ast, newObj, parent) { + // for codeblock + if ( + ast.type === "front-matter" || + ast.type === "code" || + ast.type === "yaml" || + ast.type === "import" || + ast.type === "export" || + ast.type === "jsx" + ) { + delete newObj.value; + } + + if (ast.type === "list") { + delete newObj.isAligned; + } + + if (ast.type === "list" || ast.type === "listItem") { + delete newObj.spread; + delete newObj.loose; + } + + // texts can be splitted or merged + if (ast.type === "text") { + return null; + } + + if (ast.type === "inlineCode") { + newObj.value = ast.value.replace(/[\t\n ]+/g, " "); + } + + if (ast.type === "wikiLink") { + newObj.value = ast.value.trim().replace(/[\t\n]+/g, " "); + } + + if (ast.type === "definition" || ast.type === "linkReference") { + newObj.label = ast.label + .trim() + .replace(/[\t\n ]+/g, " ") + .toLowerCase(); + } + + if ( + (ast.type === "definition" || + ast.type === "link" || + ast.type === "image") && + ast.title + ) { + newObj.title = ast.title.replace(/\\(["')])/g, "$1"); + } + + // for insert pragma + if ( + parent && + parent.type === "root" && + parent.children.length > 0 && + (parent.children[0] === ast || + (isFrontMatterNode(parent.children[0]) && parent.children[1] === ast)) && + ast.type === "html" && + startWithPragma(ast.value) + ) { + return null; + } +} + +clean.ignoredProperties = ignoredProperties; + +module.exports = clean; diff --git a/src/language-markdown/embed.js b/src/language-markdown/embed.js index bc36131f0feb..69cfdbf65fe9 100644 --- a/src/language-markdown/embed.js +++ b/src/language-markdown/embed.js @@ -1,6 +1,9 @@ "use strict"; -const { getParserName, getMaxContinuousCount } = require("../common/util"); +const { + inferParserByLanguage, + getMaxContinuousCount, +} = require("../common/util"); const { builders: { hardline, concat, markAsRoot }, utils: { replaceNewlinesWithLiterallines }, @@ -12,7 +15,7 @@ function embed(path, print, textToDoc, options) { const node = path.getValue(); if (node.type === "code" && node.lang !== null) { - const parser = getParserName(node.lang, options); + const parser = inferParserByLanguage(node.lang, options); if (parser) { const styleUnit = options.__inJsTemplate ? "~" : "`"; const style = styleUnit.repeat( diff --git a/src/language-markdown/printer-markdown.js b/src/language-markdown/printer-markdown.js index c370b67a33e4..ca916505a6e8 100644 --- a/src/language-markdown/printer-markdown.js +++ b/src/language-markdown/printer-markdown.js @@ -25,10 +25,11 @@ const { utils: { normalizeDoc }, printer: { printDocToString }, } = require("../document"); -const { replaceEndOfLineWith, isFrontMatterNode } = require("../common/util"); +const { replaceEndOfLineWith } = require("../common/util"); const embed = require("./embed"); -const pragma = require("./pragma"); +const { insertPragma } = require("./pragma"); const preprocess = require("./preprocess"); +const clean = require("./clean"); const { getFencedCodeBlockValue, hasGitDiffFriendlyOrderedList, @@ -577,19 +578,16 @@ function printLine(path, value, options) { function printTable(path, options, print) { const hardlineWithoutBreakParent = hardline.parts[0]; const node = path.getValue(); - const contents = []; // { [rowIndex: number]: { [columnIndex: number]: string } } - path.map((rowPath) => { - const rowContents = []; - - rowPath.map((cellPath) => { - rowContents.push( - printDocToString(cellPath.call(print), options).formatted - ); - }, "children"); - - contents.push(rowContents); - }, "children"); + // { [rowIndex: number]: { [columnIndex: number]: string } } + const contents = path.map( + (rowPath) => + rowPath.map( + (cellPath) => printDocToString(cellPath.call(print), options).formatted, + "children" + ), + "children" + ); // Get the width of each column const columnMaxWidths = contents.reduce( @@ -762,7 +760,7 @@ function printChildren(path, options, print, events) { let lastChildNode; - path.map((childPath, index) => { + path.each((childPath, index) => { const childNode = childPath.getValue(); const result = processor(childPath, index); @@ -938,74 +936,6 @@ function clamp(value, min, max) { return value < min ? min : value > max ? max : value; } -function clean(ast, newObj, parent) { - delete newObj.position; - delete newObj.raw; // front-matter - - // for codeblock - if ( - ast.type === "front-matter" || - ast.type === "code" || - ast.type === "yaml" || - ast.type === "import" || - ast.type === "export" || - ast.type === "jsx" - ) { - delete newObj.value; - } - - if (ast.type === "list") { - delete newObj.isAligned; - } - - if (ast.type === "list" || ast.type === "listItem") { - delete newObj.spread; - delete newObj.loose; - } - - // texts can be splitted or merged - if (ast.type === "text") { - return null; - } - - if (ast.type === "inlineCode") { - newObj.value = ast.value.replace(/[\t\n ]+/g, " "); - } - - if (ast.type === "wikiLink") { - newObj.value = ast.value.trim().replace(/[\t\n]+/g, " "); - } - - if (ast.type === "definition" || ast.type === "linkReference") { - newObj.label = ast.label - .trim() - .replace(/[\t\n ]+/g, " ") - .toLowerCase(); - } - - if ( - (ast.type === "definition" || - ast.type === "link" || - ast.type === "image") && - ast.title - ) { - newObj.title = ast.title.replace(/\\(["')])/g, "$1"); - } - - // for insert pragma - if ( - parent && - parent.type === "root" && - parent.children.length > 0 && - (parent.children[0] === ast || - (isFrontMatterNode(parent.children[0]) && parent.children[1] === ast)) && - ast.type === "html" && - pragma.startWithPragma(ast.value) - ) { - return null; - } -} - function hasPrettierIgnore(path) { const index = +path.getName(); @@ -1023,5 +953,5 @@ module.exports = { embed, massageAstNode: clean, hasPrettierIgnore, - insertPragma: pragma.insertPragma, + insertPragma, }; diff --git a/src/main/core-options.js b/src/main/core-options.js index 70e8d8d4005d..3f3039bd3e93 100644 --- a/src/main/core-options.js +++ b/src/main/core-options.js @@ -130,6 +130,7 @@ const options = { { value: "babel-ts", since: "2.0.0", description: "TypeScript" }, { value: "typescript", since: "1.4.0", description: "TypeScript" }, { value: "espree", since: "2.2.0", description: "JavaScript" }, + { value: "meriyah", since: "2.2.0", description: "JavaScript" }, { value: "css", since: "1.7.1", description: "CSS" }, { value: "less", since: "1.7.1", description: "Less" }, { value: "scss", since: "1.7.1", description: "SCSS" }, diff --git a/src/main/massage-ast.js b/src/main/massage-ast.js index fbede504a769..f2ce7beb7d71 100644 --- a/src/main/massage-ast.js +++ b/src/main/massage-ast.js @@ -9,15 +9,23 @@ function massageAST(ast, options, parent) { return ast; } + const cleanFunction = options.printer.massageAstNode; + let ignoredProperties; + if (cleanFunction && cleanFunction.ignoredProperties) { + ignoredProperties = cleanFunction.ignoredProperties; + } else { + ignoredProperties = new Set(); + } + const newObj = {}; for (const key of Object.keys(ast)) { - if (typeof ast[key] !== "function") { + if (!ignoredProperties.has(key) && typeof ast[key] !== "function") { newObj[key] = massageAST(ast[key], options, ast); } } - if (options.printer.massageAstNode) { - const result = options.printer.massageAstNode(ast, newObj, parent); + if (cleanFunction) { + const result = cleanFunction(ast, newObj, parent); if (result === null) { return; } diff --git a/src/main/range-util.js b/src/main/range-util.js index c66b1fed62e6..344926dd06ef 100644 --- a/src/main/range-util.js +++ b/src/main/range-util.js @@ -120,6 +120,7 @@ function isSourceElement(opts, node) { case "babel-ts": case "typescript": case "espree": + case "meriyah": return isJsSourceElement(node.type); case "json": return jsonSourceElements.has(node.type); diff --git a/tests/flow-repo/def_site_variance/__snapshots__/jsfmt.spec.js.snap b/tests/flow-repo/def_site_variance/__snapshots__/jsfmt.spec.js.snap index 5257b2abf2ff..bf8fb87403f2 100644 --- a/tests/flow-repo/def_site_variance/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow-repo/def_site_variance/__snapshots__/jsfmt.spec.js.snap @@ -2,7 +2,7 @@ exports[`test.js format 1`] = ` ====================================options===================================== -parsers: ["flow"] +parsers: ["flow", "babel-flow"] printWidth: 80 | printWidth =====================================input====================================== diff --git a/tests/flow-repo/def_site_variance/jsfmt.spec.js b/tests/flow-repo/def_site_variance/jsfmt.spec.js index b9a908981a50..f5bd7f6bdcd0 100644 --- a/tests/flow-repo/def_site_variance/jsfmt.spec.js +++ b/tests/flow-repo/def_site_variance/jsfmt.spec.js @@ -1 +1 @@ -run_spec(__dirname, ["flow"]); +run_spec(__dirname, ["flow", "babel-flow"]); diff --git a/tests/flow/comments/__snapshots__/jsfmt.spec.js.snap b/tests/flow/comments/__snapshots__/jsfmt.spec.js.snap index c1523e352541..77210f6a8be9 100644 --- a/tests/flow/comments/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/comments/__snapshots__/jsfmt.spec.js.snap @@ -293,6 +293,25 @@ const x = (input /*: string */) /*: string */ => {}; ================================================================================ `; +exports[`type_annotations-2.js format 1`] = ` +====================================options===================================== +parsers: ["flow", "babel"] +printWidth: 80 + | printWidth +=====================================input====================================== +foo/*::*/(baz); +class Foo { + bar( data: Array) {} +} +=====================================output===================================== +foo/*:: */(baz); +class Foo { + bar(data: Array) {} +} + +================================================================================ +`; + exports[`union.js format 1`] = ` ====================================options===================================== parsers: ["flow", "babel"] diff --git a/tests/flow/comments/babel-only/__snapshots__/jsfmt.spec.js.snap b/tests/flow/comments/babel-only/__snapshots__/jsfmt.spec.js.snap new file mode 100644 index 000000000000..b76c2cc42ed5 --- /dev/null +++ b/tests/flow/comments/babel-only/__snapshots__/jsfmt.spec.js.snap @@ -0,0 +1,30 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`type_annotations-3.js format 1`] = ` +====================================options===================================== +parsers: ["babel-flow"] +printWidth: 80 + | printWidth +=====================================input====================================== +import type { OneType } from './oneFile.js' +/*:: +import type { HelloType } from './otherFile.js' +*/ + +type PropTypes = {| + TestComponent: React.AbstractComponent, + hello: HelloType, +|}; +=====================================output===================================== +import type { OneType } from "./oneFile.js"; +/*:: +import type { HelloType } from './otherFile.js' +*/ + +type PropTypes = {| + TestComponent: React.AbstractComponent, + hello: HelloType, +|}; + +================================================================================ +`; diff --git a/tests/flow/comments/babel-only/jsfmt.spec.js b/tests/flow/comments/babel-only/jsfmt.spec.js new file mode 100644 index 000000000000..e90814b2741b --- /dev/null +++ b/tests/flow/comments/babel-only/jsfmt.spec.js @@ -0,0 +1 @@ +run_spec(__dirname, ["babel-flow"]); diff --git a/tests/flow/comments/babel-only/type_annotations-3.js b/tests/flow/comments/babel-only/type_annotations-3.js new file mode 100644 index 000000000000..2668a17a91cc --- /dev/null +++ b/tests/flow/comments/babel-only/type_annotations-3.js @@ -0,0 +1,9 @@ +import type { OneType } from './oneFile.js' +/*:: +import type { HelloType } from './otherFile.js' +*/ + +type PropTypes = {| + TestComponent: React.AbstractComponent, + hello: HelloType, +|}; \ No newline at end of file diff --git a/tests/flow/comments/type_annotations-2.js b/tests/flow/comments/type_annotations-2.js new file mode 100644 index 000000000000..e656b717d615 --- /dev/null +++ b/tests/flow/comments/type_annotations-2.js @@ -0,0 +1,4 @@ +foo/*::*/(baz); +class Foo { + bar( data: Array) {} +} \ No newline at end of file diff --git a/tests/flow/ignore/__snapshots__/jsfmt.spec.js.snap b/tests/flow/ignore/__snapshots__/jsfmt.spec.js.snap index de5212b5dc46..4272bd608916 100644 --- a/tests/flow/ignore/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/ignore/__snapshots__/jsfmt.spec.js.snap @@ -34,3 +34,41 @@ function a() { ================================================================================ `; + +exports[`type-cast-expression.js format 1`] = ` +====================================options===================================== +parsers: ["flow", "babel"] +printWidth: 80 + | printWidth +=====================================input====================================== +transform( + // prettier-ignore + (pointTransformer: T) +); + +transform( + // prettier-ignore + (/* comment */pointTransformer: T /* comment */) +); + +transform( + /* prettier-ignore */(/* prettier-ignore */pointTransformer: (Point => Point)) +); + +=====================================output===================================== +transform( + // prettier-ignore + (pointTransformer: T) +); + +transform( + // prettier-ignore + (/* comment */pointTransformer: T /* comment */) +); + +transform( + /* prettier-ignore */ (/* prettier-ignore */pointTransformer: (Point => Point)) +); + +================================================================================ +`; diff --git a/tests/flow/ignore/type-cast-expression.js b/tests/flow/ignore/type-cast-expression.js new file mode 100644 index 000000000000..ed1d6d5fbe4f --- /dev/null +++ b/tests/flow/ignore/type-cast-expression.js @@ -0,0 +1,13 @@ +transform( + // prettier-ignore + (pointTransformer: T) +); + +transform( + // prettier-ignore + (/* comment */pointTransformer: T /* comment */) +); + +transform( + /* prettier-ignore */(/* prettier-ignore */pointTransformer: (Point => Point)) +); diff --git a/tests/flow/this-annotation/__snapshots__/jsfmt.spec.js.snap b/tests/flow/this-annotation/__snapshots__/jsfmt.spec.js.snap index 12da03297d06..676102b83e37 100644 --- a/tests/flow/this-annotation/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/this-annotation/__snapshots__/jsfmt.spec.js.snap @@ -54,6 +54,17 @@ function baz(this: number, ...a) {} ================================================================================ `; +exports[`function_type.js - {"trailingComma":"all"} [babel-flow] format 1`] = ` +"Unexpected token, expected \\")\\" (3:16) + 1 | // @flow + 2 | +> 3 | type T = (this : number, a : string, b : number) => void + | ^ + 4 | + 5 | type U = (this : number, ...c : any) => void + 6 | " +`; + exports[`function_type.js - {"trailingComma":"all"} format 1`] = ` ====================================options===================================== parsers: ["flow", "babel-flow"] @@ -81,6 +92,17 @@ type V = (this: number) => void; ================================================================================ `; +exports[`line_break.js - {"trailingComma":"all"} [babel-flow] format 1`] = ` +"Unexpected token, expected \\")\\" (3:15) + 1 | // @flow + 2 | +> 3 | type T = (this: boolean, + | ^ + 4 | a: number, + 5 | + 6 | b: number," +`; + exports[`line_break.js - {"trailingComma":"all"} format 1`] = ` ====================================options===================================== parsers: ["flow", "babel-flow"] @@ -173,6 +195,17 @@ class A { ================================================================================ `; +exports[`union_type.js - {"trailingComma":"all"} [babel-flow] format 1`] = ` +"Unexpected token, expected \\")\\" (4:7) + 2 | + 3 | type A = ( +> 4 | this: | SupperLongLongLongLongLongLongLongLongLongLongLongType | FooBarBazLorem12345, + | ^ + 5 | b: number, + 6 | ) => boolean; + 7 | " +`; + exports[`union_type.js - {"trailingComma":"all"} format 1`] = ` ====================================options===================================== parsers: ["flow", "babel-flow"] diff --git a/tests/flow/type-parameters/__snapshots__/jsfmt.spec.js.snap b/tests/flow/type-parameters/__snapshots__/jsfmt.spec.js.snap index 5c87552f4572..4f8c9b1411ea 100644 --- a/tests/flow/type-parameters/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/type-parameters/__snapshots__/jsfmt.spec.js.snap @@ -2,7 +2,7 @@ exports[`empty_generic_break.js format 1`] = ` ====================================options===================================== -parsers: ["flow", "babel"] +parsers: ["flow", "babel-flow", "babel", "typescript"] printWidth: 80 | printWidth =====================================input====================================== @@ -17,3 +17,23 @@ class X { ================================================================================ `; + +exports[`simple-types.js format 1`] = ` +====================================options===================================== +parsers: ["flow", "babel-flow", "babel", "typescript"] +printWidth: 80 + | printWidth +=====================================input====================================== +const foo1: Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo = a; +const foo2: Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo<1n> = a; +const foo3: Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo<1_1n> = a; +const foo4: Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo<0xDeeD_BeeFn> = a; + +=====================================output===================================== +const foo1: Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo = a; +const foo2: Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo<1n> = a; +const foo3: Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo<1_1n> = a; +const foo4: Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo<0xdeed_beefn> = a; + +================================================================================ +`; diff --git a/tests/flow/type-parameters/jsfmt.spec.js b/tests/flow/type-parameters/jsfmt.spec.js index fbfa6501a049..a59561a15640 100644 --- a/tests/flow/type-parameters/jsfmt.spec.js +++ b/tests/flow/type-parameters/jsfmt.spec.js @@ -1 +1 @@ -run_spec(__dirname, ["flow", "babel"]); +run_spec(__dirname, ["flow", "babel-flow", "babel", "typescript"]); diff --git a/tests/flow/type-parameters/simple-types.js b/tests/flow/type-parameters/simple-types.js new file mode 100644 index 000000000000..82f16db862fc --- /dev/null +++ b/tests/flow/type-parameters/simple-types.js @@ -0,0 +1,4 @@ +const foo1: Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo = a; +const foo2: Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo<1n> = a; +const foo3: Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo<1_1n> = a; +const foo4: Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo<0xDeeD_BeeFn> = a; diff --git a/tests/flow/variance/__snapshots__/jsfmt.spec.js.snap b/tests/flow/variance/__snapshots__/jsfmt.spec.js.snap index 22982882263d..347cded9accd 100644 --- a/tests/flow/variance/__snapshots__/jsfmt.spec.js.snap +++ b/tests/flow/variance/__snapshots__/jsfmt.spec.js.snap @@ -2,7 +2,7 @@ exports[`variance.js format 1`] = ` ====================================options===================================== -parsers: ["flow", "babel"] +parsers: ["flow", "babel-flow"] printWidth: 80 | printWidth =====================================input====================================== diff --git a/tests/flow/variance/jsfmt.spec.js b/tests/flow/variance/jsfmt.spec.js index fbfa6501a049..f5bd7f6bdcd0 100644 --- a/tests/flow/variance/jsfmt.spec.js +++ b/tests/flow/variance/jsfmt.spec.js @@ -1 +1 @@ -run_spec(__dirname, ["flow", "babel"]); +run_spec(__dirname, ["flow", "babel-flow"]); diff --git a/tests/graphql/deprecation/__snapshots__/jsfmt.spec.js.snap b/tests/graphql/deprecation/__snapshots__/jsfmt.spec.js.snap new file mode 100644 index 000000000000..c9d78c47eb91 --- /dev/null +++ b/tests/graphql/deprecation/__snapshots__/jsfmt.spec.js.snap @@ -0,0 +1,154 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`directives.graphql format 1`] = ` +====================================options===================================== +parsers: ["graphql"] +printWidth: 80 + | printWidth +=====================================input====================================== +# https://github.com/graphql/graphql-js/pull/2733/files + +type Query { + someField( + nonDeprecated: String + deprecated: String @deprecated(reason: "Removed in 1.0") + deprecatedWithEmptyReason: String @deprecated(reason: "") + ): String +} + + +type Query { + someField( + nonDeprecated: String + deprecated: String @deprecated(reason: "Removed in 1.0") + ): String +} + +input SomeInputObject { + nonDeprecated: String + deprecated: String @deprecated(reason: "Removed in 1.0") + deprecatedWithEmptyReason: String @deprecated(reason: "") +} +type Query { + someField(someArg: SomeInputObject): String +} + +input SomeInputObject { + nonDeprecated: String + deprecated: String @deprecated(reason: "Removed in 1.0") +} +type Query { + someField(someArg: SomeInputObject): String +} + +type Query { + field(arg: SomeInputObject): String +} +input SomeInputObject { + badField: String! @deprecated + optionalField: String @deprecated + anotherOptionalField: String! = "" @deprecated +} + +directive @BadDirective( + badArg: String! @deprecated + optionalArg: String @deprecated + anotherOptionalArg: String! = "" @deprecated +) on FIELD +type Query { + test( + badArg: String! @deprecated + optionalArg: String @deprecated + anotherOptionalArg: String! = "" @deprecated + ): String +} + +input MyInput { + oldInput: String @deprecated + otherInput: String @deprecated(reason: "Use newInput") + newInput: String +} + +type Query { + field1: String @deprecated + field2: Int @deprecated(reason: "Because I said so") + enum: MyEnum + field3(oldArg: String @deprecated, arg: String): String + field4(oldArg: String @deprecated(reason: "Why not?"), arg: String): String + field5(arg: MyInput): String +} + +=====================================output===================================== +# https://github.com/graphql/graphql-js/pull/2733/files + +type Query { + someField( + nonDeprecated: String + deprecated: String @deprecated(reason: "Removed in 1.0") + deprecatedWithEmptyReason: String @deprecated(reason: "") + ): String +} + +type Query { + someField( + nonDeprecated: String + deprecated: String @deprecated(reason: "Removed in 1.0") + ): String +} + +input SomeInputObject { + nonDeprecated: String + deprecated: String @deprecated(reason: "Removed in 1.0") + deprecatedWithEmptyReason: String @deprecated(reason: "") +} +type Query { + someField(someArg: SomeInputObject): String +} + +input SomeInputObject { + nonDeprecated: String + deprecated: String @deprecated(reason: "Removed in 1.0") +} +type Query { + someField(someArg: SomeInputObject): String +} + +type Query { + field(arg: SomeInputObject): String +} +input SomeInputObject { + badField: String! @deprecated + optionalField: String @deprecated + anotherOptionalField: String! = "" @deprecated +} + +directive @BadDirective( + badArg: String! @deprecated + optionalArg: String @deprecated + anotherOptionalArg: String! = "" @deprecated +) on FIELD +type Query { + test( + badArg: String! @deprecated + optionalArg: String @deprecated + anotherOptionalArg: String! = "" @deprecated + ): String +} + +input MyInput { + oldInput: String @deprecated + otherInput: String @deprecated(reason: "Use newInput") + newInput: String +} + +type Query { + field1: String @deprecated + field2: Int @deprecated(reason: "Because I said so") + enum: MyEnum + field3(oldArg: String @deprecated, arg: String): String + field4(oldArg: String @deprecated(reason: "Why not?"), arg: String): String + field5(arg: MyInput): String +} + +================================================================================ +`; diff --git a/tests/graphql/deprecation/directives.graphql b/tests/graphql/deprecation/directives.graphql new file mode 100644 index 000000000000..1e24cbbfae28 --- /dev/null +++ b/tests/graphql/deprecation/directives.graphql @@ -0,0 +1,71 @@ +# https://github.com/graphql/graphql-js/pull/2733/files + +type Query { + someField( + nonDeprecated: String + deprecated: String @deprecated(reason: "Removed in 1.0") + deprecatedWithEmptyReason: String @deprecated(reason: "") + ): String +} + + +type Query { + someField( + nonDeprecated: String + deprecated: String @deprecated(reason: "Removed in 1.0") + ): String +} + +input SomeInputObject { + nonDeprecated: String + deprecated: String @deprecated(reason: "Removed in 1.0") + deprecatedWithEmptyReason: String @deprecated(reason: "") +} +type Query { + someField(someArg: SomeInputObject): String +} + +input SomeInputObject { + nonDeprecated: String + deprecated: String @deprecated(reason: "Removed in 1.0") +} +type Query { + someField(someArg: SomeInputObject): String +} + +type Query { + field(arg: SomeInputObject): String +} +input SomeInputObject { + badField: String! @deprecated + optionalField: String @deprecated + anotherOptionalField: String! = "" @deprecated +} + +directive @BadDirective( + badArg: String! @deprecated + optionalArg: String @deprecated + anotherOptionalArg: String! = "" @deprecated +) on FIELD +type Query { + test( + badArg: String! @deprecated + optionalArg: String @deprecated + anotherOptionalArg: String! = "" @deprecated + ): String +} + +input MyInput { + oldInput: String @deprecated + otherInput: String @deprecated(reason: "Use newInput") + newInput: String +} + +type Query { + field1: String @deprecated + field2: Int @deprecated(reason: "Because I said so") + enum: MyEnum + field3(oldArg: String @deprecated, arg: String): String + field4(oldArg: String @deprecated(reason: "Why not?"), arg: String): String + field5(arg: MyInput): String +} diff --git a/tests/graphql/deprecation/jsfmt.spec.js b/tests/graphql/deprecation/jsfmt.spec.js new file mode 100644 index 000000000000..4612e6ac5020 --- /dev/null +++ b/tests/graphql/deprecation/jsfmt.spec.js @@ -0,0 +1 @@ +run_spec(__dirname, ["graphql"]); diff --git a/tests/js/arrow-call/__snapshots__/jsfmt.spec.js.snap b/tests/js/arrow-call/__snapshots__/jsfmt.spec.js.snap index 0a3a3cd0e918..c11bf4473938 100644 --- a/tests/js/arrow-call/__snapshots__/jsfmt.spec.js.snap +++ b/tests/js/arrow-call/__snapshots__/jsfmt.spec.js.snap @@ -302,6 +302,26 @@ promise.then((result) => ================================================================================ `; +exports[`class-property.js [espree] format 1`] = ` +"Unexpected token = (3:22) + 1 | const composition = (ViewComponent, ContainerComponent) => + 2 | class extends React.Component { +> 3 | static propTypes = {}; + | ^ + 4 | }; + 5 | " +`; + +exports[`class-property.js - {"arrowParens":"always"} [espree] format 1`] = ` +"Unexpected token = (3:22) + 1 | const composition = (ViewComponent, ContainerComponent) => + 2 | class extends React.Component { +> 3 | static propTypes = {}; + | ^ + 4 | }; + 5 | " +`; + exports[`class-property.js - {"arrowParens":"always"} format 1`] = ` ====================================options===================================== arrowParens: "always" @@ -323,6 +343,16 @@ const composition = (ViewComponent, ContainerComponent) => ================================================================================ `; +exports[`class-property.js - {"trailingComma":"all"} [espree] format 1`] = ` +"Unexpected token = (3:22) + 1 | const composition = (ViewComponent, ContainerComponent) => + 2 | class extends React.Component { +> 3 | static propTypes = {}; + | ^ + 4 | }; + 5 | " +`; + exports[`class-property.js - {"trailingComma":"all"} format 1`] = ` ====================================options===================================== parsers: ["babel", "flow", "typescript"] diff --git a/tests/js/arrows-bind/__snapshots__/jsfmt.spec.js.snap b/tests/js/arrows-bind/__snapshots__/jsfmt.spec.js.snap index 78129e736e2b..a6820e80c2aa 100644 --- a/tests/js/arrows-bind/__snapshots__/jsfmt.spec.js.snap +++ b/tests/js/arrows-bind/__snapshots__/jsfmt.spec.js.snap @@ -1,5 +1,23 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`arrows-bind.js [espree] format 1`] = ` +"Unexpected token : (1:9) +> 1 | a => ({}::b()\`\`[''].c++ && 0 ? 0 : 0); + | ^ + 2 | (a => b)::c; + 3 | a::(b => c); + 4 | " +`; + +exports[`arrows-bind.js [meriyah] format 1`] = ` +"[1:9]: Expected ')' (1:9) +> 1 | a => ({}::b()\`\`[''].c++ && 0 ? 0 : 0); + | ^ + 2 | (a => b)::c; + 3 | a::(b => c); + 4 | " +`; + exports[`arrows-bind.js format 1`] = ` ====================================options===================================== parsers: ["babel"] diff --git a/tests/js/arrows-bind/jsfmt.spec.js b/tests/js/arrows-bind/jsfmt.spec.js index 726eaec01590..0fab4456dc8e 100644 --- a/tests/js/arrows-bind/jsfmt.spec.js +++ b/tests/js/arrows-bind/jsfmt.spec.js @@ -1 +1 @@ -run_spec(__dirname, ["babel"], { errors: { espree: true } }); +run_spec(__dirname, ["babel"], { errors: { espree: true, meriyah: true } }); diff --git a/tests/js/arrows/newline-before-arrow/__snapshots__/jsfmt.spec.js.snap b/tests/js/arrows/newline-before-arrow/__snapshots__/jsfmt.spec.js.snap index eb54f6c542eb..6618920b129a 100644 --- a/tests/js/arrows/newline-before-arrow/__snapshots__/jsfmt.spec.js.snap +++ b/tests/js/arrows/newline-before-arrow/__snapshots__/jsfmt.spec.js.snap @@ -1,5 +1,21 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`newline-before-arrow.js [espree] format 1`] = ` +"Unexpected token => (2:1) + 1 | async x +> 2 | => x + | ^ + 3 | " +`; + +exports[`newline-before-arrow.js [meriyah] format 1`] = ` +"[2:2]: No line break is allowed after '=>' (2:2) + 1 | async x +> 2 | => x + | ^ + 3 | " +`; + exports[`newline-before-arrow.js format 1`] = ` ====================================options===================================== parsers: ["babel"] diff --git a/tests/js/arrows/newline-before-arrow/jsfmt.spec.js b/tests/js/arrows/newline-before-arrow/jsfmt.spec.js index 29283fa30afa..4ce5f6e24a71 100644 --- a/tests/js/arrows/newline-before-arrow/jsfmt.spec.js +++ b/tests/js/arrows/newline-before-arrow/jsfmt.spec.js @@ -1,3 +1,6 @@ run_spec(__dirname, ["babel"], { - errors: { espree: ["newline-before-arrow.js"] }, + errors: { + espree: ["newline-before-arrow.js"], + meriyah: ["newline-before-arrow.js"], + }, }); diff --git a/tests/js/babel-plugins/__snapshots__/jsfmt.spec.js.snap b/tests/js/babel-plugins/__snapshots__/jsfmt.spec.js.snap index 26bfa6f5f464..ac88339fa089 100644 --- a/tests/js/babel-plugins/__snapshots__/jsfmt.spec.js.snap +++ b/tests/js/babel-plugins/__snapshots__/jsfmt.spec.js.snap @@ -292,6 +292,17 @@ const alsoGoodPrecision = 9007199254740993n; ================================================================================ `; +exports[`class-properties.js [espree] format 1`] = ` +"Unexpected token = (5:22) + 3 | class Bork { + 4 | //Property initializer syntax +> 5 | instanceProperty = \\"bork\\"; + | ^ + 6 | boundFunction = () => { + 7 | return this.instanceProperty; + 8 | };" +`; + exports[`class-properties.js format 1`] = ` ====================================options===================================== parsers: ["babel", "babel-ts", "babel-flow"] @@ -356,6 +367,27 @@ console.log(Bork.staticFunction()); // > "babelIsCool" ================================================================================ `; +exports[`class-static-block.js [espree] format 1`] = ` +"Unexpected character '#' (2:10) + 1 | class C { +> 2 | static #x = 42; + | ^ + 3 | static y; + 4 | static { + 5 | try {" +`; + +exports[`class-static-block.js [meriyah] format 1`] = ` +"[4:10]: Unexpected token: '{' (4:10) + 2 | static #x = 42; + 3 | static y; +> 4 | static { + | ^ + 5 | try { + 6 | this.y = doSomethingWith(this.#x); + 7 | } catch {" +`; + exports[`class-static-block.js format 1`] = ` ====================================options===================================== parsers: ["babel", "babel-ts", "babel-flow"] @@ -390,6 +422,28 @@ class C { ================================================================================ `; +exports[`decimal.js [espree] format 1`] = ` +"Identifier directly after number (3:4) + 1 | // https://github.com/babel/babel/pull/11640 + 2 | +> 3 | 100m; + | ^ + 4 | 9223372036854775807m; + 5 | 0.m; + 6 | 3.1415926535897932m;" +`; + +exports[`decimal.js [meriyah] format 1`] = ` +"[3:3]: No identifiers allowed directly after numeric literal (3:3) + 1 | // https://github.com/babel/babel/pull/11640 + 2 | +> 3 | 100m; + | ^ + 4 | 9223372036854775807m; + 5 | 0.m; + 6 | 3.1415926535897932m;" +`; + exports[`decimal.js format 1`] = ` ====================================options===================================== parsers: ["babel", "babel-ts", "babel-flow"] @@ -453,6 +507,17 @@ typeof 1m === "decimal128"; ================================================================================ `; +exports[`decorators.js [espree] format 1`] = ` +"Unexpected character '@' (3:1) + 1 | // https://babeljs.io/docs/en/babel-plugin-proposal-decorators + 2 | +> 3 | @annotation + | ^ + 4 | class MyClass { } + 5 | + 6 | function annotation(target) {" +`; + exports[`decorators.js format 1`] = ` ====================================options===================================== parsers: ["babel", "babel-ts", "babel-flow"] @@ -523,6 +588,28 @@ function enumerable(value) { ================================================================================ `; +exports[`do-expressions.js [espree] format 1`] = ` +"Unexpected token do (3:9) + 1 | // https://babeljs.io/docs/en/babel-plugin-proposal-do-expressions + 2 | +> 3 | let a = do { + | ^ + 4 | if(x > 10) { + 5 | 'big'; + 6 | } else {" +`; + +exports[`do-expressions.js [meriyah] format 1`] = ` +"[3:10]: Unexpected token: 'do' (3:10) + 1 | // https://babeljs.io/docs/en/babel-plugin-proposal-do-expressions + 2 | +> 3 | let a = do { + | ^ + 4 | if(x > 10) { + 5 | 'big'; + 6 | } else {" +`; + exports[`do-expressions.js format 1`] = ` ====================================options===================================== parsers: ["babel", "babel-ts", "babel-flow"] @@ -585,6 +672,24 @@ import(prettier).then((module) => console.log(module)); ================================================================================ `; +exports[`export-default-from.js [espree] format 1`] = ` +"Unexpected token v (4:8) + 2 | + 3 | +> 4 | export v from 'mod'; + | ^ + 5 | " +`; + +exports[`export-default-from.js [meriyah] format 1`] = ` +"[4:8]: Unexpected token: 'identifier' (4:8) + 2 | + 3 | +> 4 | export v from 'mod'; + | ^ + 5 | " +`; + exports[`export-default-from.js format 1`] = ` ====================================options===================================== parsers: ["babel", "babel-ts", "babel-flow"] @@ -622,6 +727,24 @@ export * as ns from "mod"; ================================================================================ `; +exports[`flow.js [espree] format 1`] = ` +"Unexpected token : (3:17) + 1 | // https://babeljs.io/docs/en/babel-preset-flow + 2 | +> 3 | function foo(one: any, two: number, three?): string {} + | ^ + 4 | " +`; + +exports[`flow.js [meriyah] format 1`] = ` +"[3:17]: Expected ')' (3:17) + 1 | // https://babeljs.io/docs/en/babel-preset-flow + 2 | +> 3 | function foo(one: any, two: number, three?): string {} + | ^ + 4 | " +`; + exports[`flow.js format 1`] = ` ====================================options===================================== parsers: ["babel", "babel-ts", "babel-flow"] @@ -640,6 +763,28 @@ function foo(one: any, two: number, three?): string {} ================================================================================ `; +exports[`function-bind.js [espree] format 1`] = ` +"Unexpected token : (3:5) + 1 | // https://babeljs.io/docs/en/babel-plugin-proposal-function-bind + 2 | +> 3 | obj::func + | ^ + 4 | // is equivalent to: + 5 | func.bind(obj) + 6 | " +`; + +exports[`function-bind.js [meriyah] format 1`] = ` +"[3:5]: Unexpected token: ':' (3:5) + 1 | // https://babeljs.io/docs/en/babel-plugin-proposal-function-bind + 2 | +> 3 | obj::func + | ^ + 4 | // is equivalent to: + 5 | func.bind(obj) + 6 | " +`; + exports[`function-bind.js format 1`] = ` ====================================options===================================== parsers: ["babel", "babel-ts", "babel-flow"] @@ -685,6 +830,28 @@ obj.func.call(obj, val); ================================================================================ `; +exports[`function-sent.js [espree] format 1`] = ` +"Unexpected token . (4:33) + 2 | + 3 | function* generator() { +> 4 | console.log(\\"Sent\\", function.sent); + | ^ + 5 | console.log(\\"Yield\\", yield); + 6 | } + 7 | " +`; + +exports[`function-sent.js [meriyah] format 1`] = ` +"[4:33]: Expected '(' (4:33) + 2 | + 3 | function* generator() { +> 4 | console.log(\\"Sent\\", function.sent); + | ^ + 5 | console.log(\\"Yield\\", yield); + 6 | } + 7 | " +`; + exports[`function-sent.js format 1`] = ` ====================================options===================================== parsers: ["babel", "babel-ts", "babel-flow"] @@ -717,6 +884,20 @@ iterator.next(2); // Logs "Yield 2" ================================================================================ `; +exports[`import-assertions-dynamic.js [espree] format 1`] = ` +"Unexpected token , (1:20) +> 1 | import(\\"./foo.json\\", { assert: { type: \\"json\\" } }); + | ^ + 2 | " +`; + +exports[`import-assertions-dynamic.js [meriyah] format 1`] = ` +"[1:20]: Expected ')' (1:20) +> 1 | import(\\"./foo.json\\", { assert: { type: \\"json\\" } }); + | ^ + 2 | " +`; + exports[`import-assertions-dynamic.js format 1`] = ` ====================================options===================================== parsers: ["babel", "babel-ts", "babel-flow"] @@ -731,6 +912,20 @@ import("./foo.json", { assert: { type: "json" } }); ================================================================================ `; +exports[`import-assertions-static.js [espree] format 1`] = ` +"Unexpected token assert (1:31) +> 1 | import json from \\"./foo.json\\" assert { type: \\"json\\" }; + | ^ + 2 | " +`; + +exports[`import-assertions-static.js [meriyah] format 1`] = ` +"[1:36]: Unexpected token: 'identifier' (1:36) +> 1 | import json from \\"./foo.json\\" assert { type: \\"json\\" }; + | ^ + 2 | " +`; + exports[`import-assertions-static.js format 1`] = ` ====================================options===================================== parsers: ["babel", "babel-ts", "babel-flow"] @@ -819,6 +1014,17 @@ var profile = ( ================================================================================ `; +exports[`logical-assignment-operators.js [meriyah] format 1`] = ` +"[3:5]: Unexpected token: '=' (3:5) + 1 | // https://babeljs.io/docs/en/babel-plugin-proposal-logical-assignment-operators + 2 | +> 3 | a ||= b; + | ^ + 4 | obj.a.b ||= c; + 5 | + 6 | a &&= b;" +`; + exports[`logical-assignment-operators.js format 1`] = ` ====================================options===================================== parsers: ["babel", "babel-ts", "babel-flow"] @@ -845,15 +1051,33 @@ obj.a.b &&= c; ================================================================================ `; +exports[`module-string-names.js [espree] format 1`] = ` +"Unexpected token \\"😄\\" (1:10) +> 1 | import { \\"😄\\" as smile } from \\"./emojis.js\\"; + | ^ + 2 | export { smile as \\"😄\\" } from \\"./emojis.js\\"; + 3 | " +`; + +exports[`module-string-names.js [meriyah] format 1`] = ` +"[1:13]: Expected '}' (1:13) +> 1 | import { \\"😄\\" as smile } from \\"./emojis.js\\"; + | ^ + 2 | export { smile as \\"😄\\" } from \\"./emojis.js\\"; + 3 | " +`; + exports[`module-string-names.js format 1`] = ` ====================================options===================================== parsers: ["babel", "babel-ts", "babel-flow"] printWidth: 80 | printWidth =====================================input====================================== +import { "😄" as smile } from "./emojis.js"; export { smile as "😄" } from "./emojis.js"; =====================================output===================================== +import { "😄" as smile } from "./emojis.js"; export { smile as "😄" } from "./emojis.js"; ================================================================================ @@ -1033,6 +1257,28 @@ try { ================================================================================ `; +exports[`optional-chaining.js [espree] format 1`] = ` +"Optional chaining cannot appear in the callee of new expressions (56:21) + 54 | }; + 55 | +> 56 | const baz3 = new obj?.foo?.bar?.baz(); // baz instance + | ^ + 57 | + 58 | const safe5 = new obj?.qux?.baz(); // undefined + 59 | const safe6 = new obj?.foo.bar.qux?.(); // undefined" +`; + +exports[`optional-chaining.js [meriyah] format 1`] = ` +"[56:22]: Invalid optional chain from new expression (56:22) + 54 | }; + 55 | +> 56 | const baz3 = new obj?.foo?.bar?.baz(); // baz instance + | ^ + 57 | + 58 | const safe5 = new obj?.qux?.baz(); // undefined + 59 | const safe6 = new obj?.foo.bar.qux?.(); // undefined" +`; + exports[`optional-chaining.js format 1`] = ` ====================================options===================================== parsers: ["babel", "babel-ts", "babel-flow"] @@ -1195,6 +1441,28 @@ const ret = delete obj?.foo?.bar?.baz; // true ================================================================================ `; +exports[`partial-application.js [espree] format 1`] = ` +"Unexpected token ? (5:23) + 3 | function add(x, y) { return x + y; } + 4 | +> 5 | const addOne = add(1, ?); // apply from the left + | ^ + 6 | addOne(2); // 3 + 7 | + 8 | const addTen = add(?, 10); // apply from the right" +`; + +exports[`partial-application.js [meriyah] format 1`] = ` +"[5:23]: Unexpected token: '?' (5:23) + 3 | function add(x, y) { return x + y; } + 4 | +> 5 | const addOne = add(1, ?); // apply from the left + | ^ + 6 | addOne(2); // 3 + 7 | + 8 | const addTen = add(?, 10); // apply from the right" +`; + exports[`partial-application.js format 1`] = ` ====================================options===================================== parsers: ["babel", "babel-ts", "babel-flow"] @@ -1249,6 +1517,28 @@ super.f(?); // partial application allowed for call on |SuperProperty| ================================================================================ `; +exports[`pipeline-operator-fsharp.js [espree] format 1`] = ` +"Unexpected token > (5:4) + 3 | + 4 | promise +> 5 | |> await + | ^ + 6 | |> x => doubleSay(x, ', ') + 7 | |> capitalize + 8 | |> x => x + '!'" +`; + +exports[`pipeline-operator-fsharp.js [meriyah] format 1`] = ` +"[5:4]: Unexpected token: '>' (5:4) + 3 | + 4 | promise +> 5 | |> await + | ^ + 6 | |> x => doubleSay(x, ', ') + 7 | |> capitalize + 8 | |> x => x + '!'" +`; + exports[`pipeline-operator-fsharp.js format 1`] = ` ====================================options===================================== parsers: ["babel", "babel-ts", "babel-flow"] @@ -1324,6 +1614,28 @@ let newScore = boundScore(0, 100, add(7, double(person.score))); ================================================================================ `; +exports[`pipeline-operator-minimal.js [espree] format 1`] = ` +"Identifier 'result' has already been declared (7:5) + 5 | result //=> \\"Hello, hello!\\" + 6 | +> 7 | let result = \\"hello\\" + | ^ + 8 | |> doubleSay + 9 | |> capitalize + 10 | |> exclaim;" +`; + +exports[`pipeline-operator-minimal.js [meriyah] format 1`] = ` +"[8:4]: Unexpected token: '>' (8:4) + 6 | + 7 | let result = \\"hello\\" +> 8 | |> doubleSay + | ^ + 9 | |> capitalize + 10 | |> exclaim; + 11 | " +`; + exports[`pipeline-operator-minimal.js format 1`] = ` ====================================options===================================== parsers: ["babel", "babel-ts", "babel-flow"] @@ -1357,6 +1669,28 @@ result; //=> "Hello, hello!" ================================================================================ `; +exports[`pipeline-operator-smart.js [espree] format 1`] = ` +"Unexpected token > (5:2) + 3 | + 4 | value +> 5 | |> await # + | ^ + 6 | |> doubleSay(#, ', ') + 7 | |> capitalize // This is a function call. + 8 | |> # + '!'" +`; + +exports[`pipeline-operator-smart.js [meriyah] format 1`] = ` +"[5:2]: Unexpected token: '>' (5:2) + 3 | + 4 | value +> 5 | |> await # + | ^ + 6 | |> doubleSay(#, ', ') + 7 | |> capitalize // This is a function call. + 8 | |> # + '!'" +`; + exports[`pipeline-operator-smart.js format 1`] = ` ====================================options===================================== parsers: ["babel", "babel-ts", "babel-flow"] @@ -1395,6 +1729,17 @@ value ================================================================================ `; +exports[`private-fields-in-in.js [espree] format 1`] = ` +"Unexpected character '#' (4:3) + 2 | + 3 | class C { +> 4 | #brand; + | ^ + 5 | + 6 | static isC(obj) { + 7 | try {" +`; + exports[`private-fields-in-in.js format 1`] = ` ====================================options===================================== parsers: ["babel", "babel-ts", "babel-flow"] @@ -1517,6 +1862,17 @@ class C { ================================================================================ `; +exports[`private-methods.js [espree] format 1`] = ` +"Unexpected character '#' (6:3) + 4 | + 5 | class Counter extends HTMLElement { +> 6 | #xValue = 0; + | ^ + 7 | + 8 | get #x() { return this.#xValue; } + 9 | set #x(value) {" +`; + exports[`private-methods.js format 1`] = ` ====================================options===================================== parsers: ["babel", "babel-ts", "babel-flow"] @@ -1566,6 +1922,24 @@ class Counter extends HTMLElement { ================================================================================ `; +exports[`record-tuple-record.js [espree] format 1`] = ` +"Unexpected character '#' (1:17) +> 1 | const record1 = #{ + | ^ + 2 | a: 1, + 3 | b: 2, + 4 | c: 3," +`; + +exports[`record-tuple-record.js [meriyah] format 1`] = ` +"[1:17]: '#' not followed by identifier (1:17) +> 1 | const record1 = #{ + | ^ + 2 | a: 1, + 3 | b: 2, + 4 | c: 3," +`; + exports[`record-tuple-record.js format 1`] = ` ====================================options===================================== parsers: ["babel", "babel-ts", "babel-flow"] @@ -1592,6 +1966,20 @@ const record2 = #{ ...record1, b: 5 }; ================================================================================ `; +exports[`record-tuple-tuple.js [espree] format 1`] = ` +"Unexpected character '#' (1:16) +> 1 | const tuple1 = #[1, 2, 3]; + | ^ + 2 | " +`; + +exports[`record-tuple-tuple.js [meriyah] format 1`] = ` +"[1:16]: '#' not followed by identifier (1:16) +> 1 | const tuple1 = #[1, 2, 3]; + | ^ + 2 | " +`; + exports[`record-tuple-tuple.js format 1`] = ` ====================================options===================================== parsers: ["babel", "babel-ts", "babel-flow"] @@ -1606,6 +1994,28 @@ const tuple1 = #[1, 2, 3]; ================================================================================ `; +exports[`throw-expressions.js [espree] format 1`] = ` +"Unexpected token throw (3:23) + 1 | // https://babeljs.io/docs/en/babel-plugin-proposal-throw-expressions + 2 | +> 3 | function test(param = throw new Error('required!')) { + | ^ + 4 | const test = param === true || throw new Error('Falsy!'); + 5 | } + 6 | " +`; + +exports[`throw-expressions.js [meriyah] format 1`] = ` +"[3:27]: Unexpected token: 'throw' (3:27) + 1 | // https://babeljs.io/docs/en/babel-plugin-proposal-throw-expressions + 2 | +> 3 | function test(param = throw new Error('required!')) { + | ^ + 4 | const test = param === true || throw new Error('Falsy!'); + 5 | } + 6 | " +`; + exports[`throw-expressions.js format 1`] = ` ====================================options===================================== parsers: ["babel", "babel-ts", "babel-flow"] @@ -1628,6 +2038,24 @@ function test(param = throw new Error("required!")) { ================================================================================ `; +exports[`typescript.js [espree] format 1`] = ` +"Unexpected token : (3:8) + 1 | // https://babeljs.io/docs/en/babel-preset-typescript + 2 | +> 3 | const x: number = 0; + | ^ + 4 | " +`; + +exports[`typescript.js [meriyah] format 1`] = ` +"[3:8]: Missing initializer in const declaration (3:8) + 1 | // https://babeljs.io/docs/en/babel-preset-typescript + 2 | +> 3 | const x: number = 0; + | ^ + 4 | " +`; + exports[`typescript.js format 1`] = ` ====================================options===================================== parsers: ["babel", "babel-ts", "babel-flow"] @@ -1646,6 +2074,28 @@ const x: number = 0; ================================================================================ `; +exports[`v8intrinsic.js [espree] format 1`] = ` +"Unexpected token % (3:1) + 1 | // https://github.com/babel/babel/pull/10148 + 2 | +> 3 | %DebugPrint(foo); + | ^ + 4 | + 5 | + 6 | // Invalid code https://github.com/JLHwung/babel/blob/c1a3cbfd65e08b7013fd6f8c62add8cb10b4b169/packages/babel-parser/test/fixtures/v8intrinsic/_errors/in-bind-expression/options.json" +`; + +exports[`v8intrinsic.js [meriyah] format 1`] = ` +"[3:1]: Unexpected token: '%' (3:1) + 1 | // https://github.com/babel/babel/pull/10148 + 2 | +> 3 | %DebugPrint(foo); + | ^ + 4 | + 5 | + 6 | // Invalid code https://github.com/JLHwung/babel/blob/c1a3cbfd65e08b7013fd6f8c62add8cb10b4b169/packages/babel-parser/test/fixtures/v8intrinsic/_errors/in-bind-expression/options.json" +`; + exports[`v8intrinsic.js format 1`] = ` ====================================options===================================== parsers: ["babel", "babel-ts", "babel-flow"] diff --git a/tests/js/babel-plugins/jsfmt.spec.js b/tests/js/babel-plugins/jsfmt.spec.js index 0e1838e07bef..0d5680faa330 100644 --- a/tests/js/babel-plugins/jsfmt.spec.js +++ b/tests/js/babel-plugins/jsfmt.spec.js @@ -29,5 +29,30 @@ run_spec(__dirname, ["babel", "babel-ts", "babel-flow"], { "module-string-names.js", "class-static-block.js", ], + meriyah: [ + "decimal.js", + "do-expressions.js", + "export-default-from.js", + "flow.js", + "function-bind.js", + "function-sent.js", + "logical-assignment-operators.js", + "module-attributes-dynamic.js", + "module-attributes-static.js", + "partial-application.js", + "pipeline-operator-fsharp.js", + "pipeline-operator-minimal.js", + "pipeline-operator-smart.js", + "record-tuple-record.js", + "record-tuple-tuple.js", + "throw-expressions.js", + "typescript.js", + "v8intrinsic.js", + "optional-chaining.js", + "class-static-block.js", + "import-assertions-dynamic.js", + "import-assertions-static.js", + "module-string-names.js", + ], }, }); diff --git a/tests/js/babel-plugins/module-string-names.js b/tests/js/babel-plugins/module-string-names.js index 631c04f79793..2bdb75fb7037 100644 --- a/tests/js/babel-plugins/module-string-names.js +++ b/tests/js/babel-plugins/module-string-names.js @@ -1 +1,2 @@ +import { "😄" as smile } from "./emojis.js"; export { smile as "😄" } from "./emojis.js"; diff --git a/tests/js/binary-expressions/__snapshots__/jsfmt.spec.js.snap b/tests/js/binary-expressions/__snapshots__/jsfmt.spec.js.snap index 7599f115f1e4..912e5c4eb4a8 100644 --- a/tests/js/binary-expressions/__snapshots__/jsfmt.spec.js.snap +++ b/tests/js/binary-expressions/__snapshots__/jsfmt.spec.js.snap @@ -740,6 +740,27 @@ printWidth: 80 ================================================================================ `; +exports[`like-regexp.js [espree] format 1`] = ` +"Unterminated regular expression (1:19) +> 1 | 0 ? a : { b : 1 }/2; + | ^ + 2 | " +`; + +exports[`like-regexp.js format 1`] = ` +====================================options===================================== +parsers: ["babel", "flow", "typescript"] +printWidth: 80 + | printWidth +=====================================input====================================== +0 ? a : { b : 1 }/2; + +=====================================output===================================== +0 ? a : { b: 1 } / 2; + +================================================================================ +`; + exports[`math.js format 1`] = ` ====================================options===================================== parsers: ["babel", "flow", "typescript"] diff --git a/tests/js/binary-expressions/jsfmt.spec.js b/tests/js/binary-expressions/jsfmt.spec.js index eb85eda6bd02..7872139988cb 100644 --- a/tests/js/binary-expressions/jsfmt.spec.js +++ b/tests/js/binary-expressions/jsfmt.spec.js @@ -1 +1,3 @@ -run_spec(__dirname, ["babel", "flow", "typescript"]); +run_spec(__dirname, ["babel", "flow", "typescript"], { + errors: { espree: ["like-regexp.js"] }, +}); diff --git a/tests/js/binary-expressions/like-regexp.js b/tests/js/binary-expressions/like-regexp.js new file mode 100644 index 000000000000..b424d657d3b4 --- /dev/null +++ b/tests/js/binary-expressions/like-regexp.js @@ -0,0 +1 @@ +0 ? a : { b : 1 }/2; diff --git a/tests/js/bind-expressions/__snapshots__/jsfmt.spec.js.snap b/tests/js/bind-expressions/__snapshots__/jsfmt.spec.js.snap index de930be378d3..1de03edb8546 100644 --- a/tests/js/bind-expressions/__snapshots__/jsfmt.spec.js.snap +++ b/tests/js/bind-expressions/__snapshots__/jsfmt.spec.js.snap @@ -1,5 +1,45 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`await.js [espree] format 1`] = ` +"Unexpected token : (3:27) + 1 | const doBothThings = async () => { + 2 | const request = doAsyncThing(); +> 3 | return (await request)::doSyncThing(); + | ^ + 4 | }; + 5 | " +`; + +exports[`await.js [meriyah] format 1`] = ` +"[3:27]: Unexpected token: ':' (3:27) + 1 | const doBothThings = async () => { + 2 | const request = doAsyncThing(); +> 3 | return (await request)::doSyncThing(); + | ^ + 4 | }; + 5 | " +`; + +exports[`await.js - {"semi":false} [espree] format 1`] = ` +"Unexpected token : (3:27) + 1 | const doBothThings = async () => { + 2 | const request = doAsyncThing(); +> 3 | return (await request)::doSyncThing(); + | ^ + 4 | }; + 5 | " +`; + +exports[`await.js - {"semi":false} [meriyah] format 1`] = ` +"[3:27]: Unexpected token: ':' (3:27) + 1 | const doBothThings = async () => { + 2 | const request = doAsyncThing(); +> 3 | return (await request)::doSyncThing(); + | ^ + 4 | }; + 5 | " +`; + exports[`await.js - {"semi":false} format 1`] = ` ====================================options===================================== parsers: ["babel"] @@ -41,6 +81,42 @@ const doBothThings = async () => { ================================================================================ `; +exports[`bind_parens.js [espree] format 1`] = ` +"Unexpected token : (1:9) +> 1 | (a || b)::c; + | ^ + 2 | a || (b::c); + 3 | ::obj.prop; + 4 | (void 0)::func();" +`; + +exports[`bind_parens.js [meriyah] format 1`] = ` +"[1:9]: Unexpected token: ':' (1:9) +> 1 | (a || b)::c; + | ^ + 2 | a || (b::c); + 3 | ::obj.prop; + 4 | (void 0)::func();" +`; + +exports[`bind_parens.js - {"semi":false} [espree] format 1`] = ` +"Unexpected token : (1:9) +> 1 | (a || b)::c; + | ^ + 2 | a || (b::c); + 3 | ::obj.prop; + 4 | (void 0)::func();" +`; + +exports[`bind_parens.js - {"semi":false} [meriyah] format 1`] = ` +"[1:9]: Unexpected token: ':' (1:9) +> 1 | (a || b)::c; + | ^ + 2 | a || (b::c); + 3 | ::obj.prop; + 4 | (void 0)::func();" +`; + exports[`bind_parens.js - {"semi":false} format 1`] = ` ====================================options===================================== parsers: ["babel"] @@ -202,6 +278,50 @@ f[a::b()]; ================================================================================ `; +exports[`long_name_method.js [espree] format 1`] = ` +"Unexpected token : (3:54) + 1 | class X { + 2 | constructor() { +> 3 | this.testLongNameMethodAndSomethingElseLallala = ::this.testLongNameMethodAndSomethingElseLallala; + | ^ + 4 | } + 5 | + 6 | testLongNameMethodAndSomethingElseLallala() {" +`; + +exports[`long_name_method.js [meriyah] format 1`] = ` +"[3:54]: Unexpected token: ':' (3:54) + 1 | class X { + 2 | constructor() { +> 3 | this.testLongNameMethodAndSomethingElseLallala = ::this.testLongNameMethodAndSomethingElseLallala; + | ^ + 4 | } + 5 | + 6 | testLongNameMethodAndSomethingElseLallala() {" +`; + +exports[`long_name_method.js - {"semi":false} [espree] format 1`] = ` +"Unexpected token : (3:54) + 1 | class X { + 2 | constructor() { +> 3 | this.testLongNameMethodAndSomethingElseLallala = ::this.testLongNameMethodAndSomethingElseLallala; + | ^ + 4 | } + 5 | + 6 | testLongNameMethodAndSomethingElseLallala() {" +`; + +exports[`long_name_method.js - {"semi":false} [meriyah] format 1`] = ` +"[3:54]: Unexpected token: ':' (3:54) + 1 | class X { + 2 | constructor() { +> 3 | this.testLongNameMethodAndSomethingElseLallala = ::this.testLongNameMethodAndSomethingElseLallala; + | ^ + 4 | } + 5 | + 6 | testLongNameMethodAndSomethingElseLallala() {" +`; + exports[`long_name_method.js - {"semi":false} format 1`] = ` ====================================options===================================== parsers: ["babel"] @@ -263,6 +383,50 @@ class X { ================================================================================ `; +exports[`method_chain.js [espree] format 1`] = ` +"Unexpected token : (10:9) + 8 | function test(observable) { + 9 | return observable +> 10 | ::filter(data => data.someTest) + | ^ + 11 | ::throttle(() => + 12 | interval(10) + 13 | ::take(1)" +`; + +exports[`method_chain.js [meriyah] format 1`] = ` +"[10:9]: Unexpected token: ':' (10:9) + 8 | function test(observable) { + 9 | return observable +> 10 | ::filter(data => data.someTest) + | ^ + 11 | ::throttle(() => + 12 | interval(10) + 13 | ::take(1)" +`; + +exports[`method_chain.js - {"semi":false} [espree] format 1`] = ` +"Unexpected token : (10:9) + 8 | function test(observable) { + 9 | return observable +> 10 | ::filter(data => data.someTest) + | ^ + 11 | ::throttle(() => + 12 | interval(10) + 13 | ::take(1)" +`; + +exports[`method_chain.js - {"semi":false} [meriyah] format 1`] = ` +"[10:9]: Unexpected token: ':' (10:9) + 8 | function test(observable) { + 9 | return observable +> 10 | ::filter(data => data.someTest) + | ^ + 11 | ::throttle(() => + 12 | interval(10) + 13 | ::take(1)" +`; + exports[`method_chain.js - {"semi":false} format 1`] = ` ====================================options===================================== parsers: ["babel"] @@ -356,6 +520,50 @@ function test(observable) { ================================================================================ `; +exports[`short_name_method.js [espree] format 1`] = ` +"Unexpected token : (3:24) + 1 | class X { + 2 | constructor() { +> 3 | this.shortMethod = ::this.shortMethod; + | ^ + 4 | } + 5 | + 6 | shortMethod() {" +`; + +exports[`short_name_method.js [meriyah] format 1`] = ` +"[3:24]: Unexpected token: ':' (3:24) + 1 | class X { + 2 | constructor() { +> 3 | this.shortMethod = ::this.shortMethod; + | ^ + 4 | } + 5 | + 6 | shortMethod() {" +`; + +exports[`short_name_method.js - {"semi":false} [espree] format 1`] = ` +"Unexpected token : (3:24) + 1 | class X { + 2 | constructor() { +> 3 | this.shortMethod = ::this.shortMethod; + | ^ + 4 | } + 5 | + 6 | shortMethod() {" +`; + +exports[`short_name_method.js - {"semi":false} [meriyah] format 1`] = ` +"[3:24]: Unexpected token: ':' (3:24) + 1 | class X { + 2 | constructor() { +> 3 | this.shortMethod = ::this.shortMethod; + | ^ + 4 | } + 5 | + 6 | shortMethod() {" +`; + exports[`short_name_method.js - {"semi":false} format 1`] = ` ====================================options===================================== parsers: ["babel"] @@ -415,6 +623,42 @@ class X { ================================================================================ `; +exports[`unary.js [espree] format 1`] = ` +"Unexpected token : (1:3) +> 1 | !x::y; + | ^ + 2 | !(x::y /* foo */); + 3 | !(/* foo */ x::y); + 4 | !(" +`; + +exports[`unary.js [meriyah] format 1`] = ` +"[1:3]: Unexpected token: ':' (1:3) +> 1 | !x::y; + | ^ + 2 | !(x::y /* foo */); + 3 | !(/* foo */ x::y); + 4 | !(" +`; + +exports[`unary.js - {"semi":false} [espree] format 1`] = ` +"Unexpected token : (1:3) +> 1 | !x::y; + | ^ + 2 | !(x::y /* foo */); + 3 | !(/* foo */ x::y); + 4 | !(" +`; + +exports[`unary.js - {"semi":false} [meriyah] format 1`] = ` +"[1:3]: Unexpected token: ':' (1:3) +> 1 | !x::y; + | ^ + 2 | !(x::y /* foo */); + 3 | !(/* foo */ x::y); + 4 | !(" +`; + exports[`unary.js - {"semi":false} format 1`] = ` ====================================options===================================== parsers: ["babel"] diff --git a/tests/js/bind-expressions/jsfmt.spec.js b/tests/js/bind-expressions/jsfmt.spec.js index 18153a1a934c..3eb482d30b87 100644 --- a/tests/js/bind-expressions/jsfmt.spec.js +++ b/tests/js/bind-expressions/jsfmt.spec.js @@ -1,2 +1,5 @@ -run_spec(__dirname, ["babel"], { errors: { espree: true } }); -run_spec(__dirname, ["babel"], { semi: false, errors: { espree: true } }); +run_spec(__dirname, ["babel"], { errors: { espree: true, meriyah: true } }); +run_spec(__dirname, ["babel"], { + semi: false, + errors: { espree: true, meriyah: true }, +}); diff --git a/tests/js/class-comment/__snapshots__/jsfmt.spec.js.snap b/tests/js/class-comment/__snapshots__/jsfmt.spec.js.snap index 7c34cc5daca2..b6ab6beaebf7 100644 --- a/tests/js/class-comment/__snapshots__/jsfmt.spec.js.snap +++ b/tests/js/class-comment/__snapshots__/jsfmt.spec.js.snap @@ -1,5 +1,15 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`class-property.js [espree] format 1`] = ` +"Unexpected token = (2:12) + 1 | class X { +> 2 | TEMPLATE = + | ^ + 3 | // tab index is needed so we can focus, which is needed for keyboard events + 4 | '
' + + 5 | '
' +" +`; + exports[`class-property.js format 1`] = ` ====================================options===================================== parsers: ["babel", "flow", "typescript"] diff --git a/tests/js/class-static-block/__snapshots__/jsfmt.spec.js.snap b/tests/js/class-static-block/__snapshots__/jsfmt.spec.js.snap index 90642e44cde6..70b25ea882e7 100644 --- a/tests/js/class-static-block/__snapshots__/jsfmt.spec.js.snap +++ b/tests/js/class-static-block/__snapshots__/jsfmt.spec.js.snap @@ -1,5 +1,26 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`class-static-block.js [espree] format 1`] = ` +"Unexpected character '#' (2:10) + 1 | class C { +> 2 | static #x = 42; + | ^ + 3 | static y; + 4 | static { + 5 | try {" +`; + +exports[`class-static-block.js [meriyah] format 1`] = ` +"[4:10]: Unexpected token: '{' (4:10) + 2 | static #x = 42; + 3 | static y; +> 4 | static { + | ^ + 5 | try { + 6 | this.y = doSomethingWith(this.#x); + 7 | } catch {" +`; + exports[`class-static-block.js format 1`] = ` ====================================options===================================== parsers: ["babel"] diff --git a/tests/js/class-static-block/jsfmt.spec.js b/tests/js/class-static-block/jsfmt.spec.js index 726eaec01590..0fab4456dc8e 100644 --- a/tests/js/class-static-block/jsfmt.spec.js +++ b/tests/js/class-static-block/jsfmt.spec.js @@ -1 +1 @@ -run_spec(__dirname, ["babel"], { errors: { espree: true } }); +run_spec(__dirname, ["babel"], { errors: { espree: true, meriyah: true } }); diff --git a/tests/js/classes-private-fields/__snapshots__/jsfmt.spec.js.snap b/tests/js/classes-private-fields/__snapshots__/jsfmt.spec.js.snap index 5904bcb640ee..ac500b314ec0 100644 --- a/tests/js/classes-private-fields/__snapshots__/jsfmt.spec.js.snap +++ b/tests/js/classes-private-fields/__snapshots__/jsfmt.spec.js.snap @@ -1,5 +1,41 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`optional-chaining.js [espree] format 1`] = ` +"Unexpected character '#' (3:13) + 1 | // https://github.com/babel/babel/pull/11669 + 2 | +> 3 | delete obj?.#x.a + | ^ + 4 | " +`; + +exports[`optional-chaining.js [meriyah] format 1`] = ` +"[3:13]: Dot property must be an identifier (3:13) + 1 | // https://github.com/babel/babel/pull/11669 + 2 | +> 3 | delete obj?.#x.a + | ^ + 4 | " +`; + +exports[`optional-chaining.js - {"semi":false} [espree] format 1`] = ` +"Unexpected character '#' (3:13) + 1 | // https://github.com/babel/babel/pull/11669 + 2 | +> 3 | delete obj?.#x.a + | ^ + 4 | " +`; + +exports[`optional-chaining.js - {"semi":false} [meriyah] format 1`] = ` +"[3:13]: Dot property must be an identifier (3:13) + 1 | // https://github.com/babel/babel/pull/11669 + 2 | +> 3 | delete obj?.#x.a + | ^ + 4 | " +`; + exports[`optional-chaining.js - {"semi":false} format 1`] = ` ====================================options===================================== parsers: ["babel"] @@ -37,6 +73,24 @@ delete obj?.#x.a; ================================================================================ `; +exports[`private_fields.js [espree] format 1`] = ` +"Unexpected character '#' (1:11) +> 1 | class A { #x; #y; } + | ^ + 2 | class B { #x = 0; #y = 1; } + 3 | + 4 | class C {" +`; + +exports[`private_fields.js - {"semi":false} [espree] format 1`] = ` +"Unexpected character '#' (1:11) +> 1 | class A { #x; #y; } + | ^ + 2 | class B { #x = 0; #y = 1; } + 3 | + 4 | class C {" +`; + exports[`private_fields.js - {"semi":false} format 1`] = ` ====================================options===================================== parsers: ["babel"] @@ -294,6 +348,26 @@ class F { ================================================================================ `; +exports[`with_comments.js [espree] format 1`] = ` +"Unexpected character '#' (2:3) + 1 | class A { +> 2 | #foobar = + | ^ + 3 | // comment to break + 4 | 1 + + 5 | // comment to break again" +`; + +exports[`with_comments.js - {"semi":false} [espree] format 1`] = ` +"Unexpected character '#' (2:3) + 1 | class A { +> 2 | #foobar = + | ^ + 3 | // comment to break + 4 | 1 + + 5 | // comment to break again" +`; + exports[`with_comments.js - {"semi":false} format 1`] = ` ====================================options===================================== parsers: ["babel"] diff --git a/tests/js/classes-private-fields/jsfmt.spec.js b/tests/js/classes-private-fields/jsfmt.spec.js index 18153a1a934c..4085f7737e22 100644 --- a/tests/js/classes-private-fields/jsfmt.spec.js +++ b/tests/js/classes-private-fields/jsfmt.spec.js @@ -1,2 +1,7 @@ -run_spec(__dirname, ["babel"], { errors: { espree: true } }); -run_spec(__dirname, ["babel"], { semi: false, errors: { espree: true } }); +run_spec(__dirname, ["babel"], { + errors: { espree: true, meriyah: ["optional-chaining.js"] }, +}); +run_spec(__dirname, ["babel"], { + semi: false, + errors: { espree: true, meriyah: ["optional-chaining.js"] }, +}); diff --git a/tests/js/classes/__snapshots__/jsfmt.spec.js.snap b/tests/js/classes/__snapshots__/jsfmt.spec.js.snap index d2dc7033bb63..2025489e6c3d 100644 --- a/tests/js/classes/__snapshots__/jsfmt.spec.js.snap +++ b/tests/js/classes/__snapshots__/jsfmt.spec.js.snap @@ -202,6 +202,16 @@ new Ctor(class {}); ================================================================================ `; +exports[`property.js [espree] format 1`] = ` +"Unexpected token = (2:10) + 1 | class A { +> 2 | foobar = + | ^ + 3 | // comment to break + 4 | 1 + + 5 | // comment to break again" +`; + exports[`property.js format 1`] = ` ====================================options===================================== parsers: ["babel", "flow", "typescript"] diff --git a/tests/js/classes/top-level-super/__snapshots__/jsfmt.spec.js.snap b/tests/js/classes/top-level-super/__snapshots__/jsfmt.spec.js.snap index 1e56130cfb90..97ffe2ef465d 100644 --- a/tests/js/classes/top-level-super/__snapshots__/jsfmt.spec.js.snap +++ b/tests/js/classes/top-level-super/__snapshots__/jsfmt.spec.js.snap @@ -1,5 +1,19 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`example.js [espree] format 1`] = ` +"'super' keyword outside a method (1:1) +> 1 | super(); + | ^ + 2 | " +`; + +exports[`example.js [meriyah] format 1`] = ` +"[1:6]: Calls to super must be in the \\"constructor\\" method of a class expression or class declaration that has a superclass (1:6) +> 1 | super(); + | ^ + 2 | " +`; + exports[`example.js format 1`] = ` ====================================options===================================== parsers: ["babel", "typescript"] diff --git a/tests/js/classes/top-level-super/jsfmt.spec.js b/tests/js/classes/top-level-super/jsfmt.spec.js index 7d3544f4b628..93e955c848a7 100644 --- a/tests/js/classes/top-level-super/jsfmt.spec.js +++ b/tests/js/classes/top-level-super/jsfmt.spec.js @@ -1 +1,3 @@ -run_spec(__dirname, ["babel", "typescript"], { errors: { espree: true } }); +run_spec(__dirname, ["babel", "typescript"], { + errors: { espree: true, meriyah: true }, +}); diff --git a/tests/js/comments-pipeline-own-line/__snapshots__/jsfmt.spec.js.snap b/tests/js/comments-pipeline-own-line/__snapshots__/jsfmt.spec.js.snap index af322b3904a8..3df1a940dabb 100644 --- a/tests/js/comments-pipeline-own-line/__snapshots__/jsfmt.spec.js.snap +++ b/tests/js/comments-pipeline-own-line/__snapshots__/jsfmt.spec.js.snap @@ -1,5 +1,27 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`pipeline_own_line.js [espree] format 1`] = ` +"Unexpected token > (4:3) + 2 | 0 + 3 | // Comment +> 4 | |> x + | ^ + 5 | } + 6 | + 7 | bifornCringerMoshedPerplexSawder(" +`; + +exports[`pipeline_own_line.js [meriyah] format 1`] = ` +"[4:3]: Unexpected token: '>' (4:3) + 2 | 0 + 3 | // Comment +> 4 | |> x + | ^ + 5 | } + 6 | + 7 | bifornCringerMoshedPerplexSawder(" +`; + exports[`pipeline_own_line.js format 1`] = ` ====================================options===================================== parsers: ["babel"] diff --git a/tests/js/comments-pipeline-own-line/jsfmt.spec.js b/tests/js/comments-pipeline-own-line/jsfmt.spec.js index 726eaec01590..0fab4456dc8e 100644 --- a/tests/js/comments-pipeline-own-line/jsfmt.spec.js +++ b/tests/js/comments-pipeline-own-line/jsfmt.spec.js @@ -1 +1 @@ -run_spec(__dirname, ["babel"], { errors: { espree: true } }); +run_spec(__dirname, ["babel"], { errors: { espree: true, meriyah: true } }); diff --git a/tests/js/comments/flow-types/__snapshots__/jsfmt.spec.js.snap b/tests/js/comments/flow-types/__snapshots__/jsfmt.spec.js.snap new file mode 100644 index 000000000000..c0641b06fd1f --- /dev/null +++ b/tests/js/comments/flow-types/__snapshots__/jsfmt.spec.js.snap @@ -0,0 +1,31 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`inline.js format 1`] = ` +====================================options===================================== +parsers: ["babel", "flow", "typescript"] +printWidth: 80 + | printWidth +=====================================input====================================== +btnActions[1] = () => ( + + // :testC +) + +a( + // :: + 1 +); + +=====================================output===================================== +btnActions[1] = () => ( + + // :testC +); + +a( + // :: + 1 +); + +================================================================================ +`; diff --git a/tests/js/comments/flow-types/inline.js b/tests/js/comments/flow-types/inline.js new file mode 100644 index 000000000000..df793d7aba48 --- /dev/null +++ b/tests/js/comments/flow-types/inline.js @@ -0,0 +1,9 @@ +btnActions[1] = () => ( + + // :testC +) + +a( + // :: + 1 +); diff --git a/tests/js/comments/flow-types/jsfmt.spec.js b/tests/js/comments/flow-types/jsfmt.spec.js new file mode 100644 index 000000000000..eb85eda6bd02 --- /dev/null +++ b/tests/js/comments/flow-types/jsfmt.spec.js @@ -0,0 +1 @@ +run_spec(__dirname, ["babel", "flow", "typescript"]); diff --git a/tests/js/comments/html-like/__snapshots__/jsfmt.spec.js.snap b/tests/js/comments/html-like/__snapshots__/jsfmt.spec.js.snap new file mode 100644 index 000000000000..71586d45cf03 --- /dev/null +++ b/tests/js/comments/html-like/__snapshots__/jsfmt.spec.js.snap @@ -0,0 +1,18 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`comment.js format 1`] = ` +====================================options===================================== +parsers: ["meriyah"] +printWidth: 80 + | printWidth +=====================================input====================================== + +=====================================output===================================== + + +================================================================================ +`; diff --git a/tests/js/comments/html-like/comment.js b/tests/js/comments/html-like/comment.js new file mode 100644 index 000000000000..5ef7d5b6c2cb --- /dev/null +++ b/tests/js/comments/html-like/comment.js @@ -0,0 +1,3 @@ + \ No newline at end of file diff --git a/tests/js/comments/html-like/jsfmt.spec.js b/tests/js/comments/html-like/jsfmt.spec.js new file mode 100644 index 000000000000..15a55dd5a70f --- /dev/null +++ b/tests/js/comments/html-like/jsfmt.spec.js @@ -0,0 +1 @@ +run_spec(__dirname, ["meriyah"]); diff --git a/tests/js/decorator-comments/__snapshots__/jsfmt.spec.js.snap b/tests/js/decorator-comments/__snapshots__/jsfmt.spec.js.snap index 90e004701acf..c1fda330293d 100644 --- a/tests/js/decorator-comments/__snapshots__/jsfmt.spec.js.snap +++ b/tests/js/decorator-comments/__snapshots__/jsfmt.spec.js.snap @@ -1,5 +1,25 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`comments.js [espree] format 1`] = ` +"Unexpected character '@' (2:5) + 1 | class Something { +> 2 | @Annotateme() + | ^ + 3 | // comment + 4 | static property: Array; + 5 | }" +`; + +exports[`comments.js [meriyah] format 1`] = ` +"[4:20]: Unexpected token: ':' (4:20) + 2 | @Annotateme() + 3 | // comment +> 4 | static property: Array; + | ^ + 5 | } + 6 | " +`; + exports[`comments.js format 1`] = ` ====================================options===================================== parsers: ["babel", "typescript"] diff --git a/tests/js/decorator-comments/jsfmt.spec.js b/tests/js/decorator-comments/jsfmt.spec.js index 7d3544f4b628..93e955c848a7 100644 --- a/tests/js/decorator-comments/jsfmt.spec.js +++ b/tests/js/decorator-comments/jsfmt.spec.js @@ -1 +1,3 @@ -run_spec(__dirname, ["babel", "typescript"], { errors: { espree: true } }); +run_spec(__dirname, ["babel", "typescript"], { + errors: { espree: true, meriyah: true }, +}); diff --git a/tests/js/decorators-export/__snapshots__/jsfmt.spec.js.snap b/tests/js/decorators-export/__snapshots__/jsfmt.spec.js.snap index 627d9c95783e..403bcc68df4c 100644 --- a/tests/js/decorators-export/__snapshots__/jsfmt.spec.js.snap +++ b/tests/js/decorators-export/__snapshots__/jsfmt.spec.js.snap @@ -1,5 +1,23 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`after_export.js [espree] format 1`] = ` +"Unexpected character '@' (1:8) +> 1 | export @decorator class Foo {} + | ^ + 2 | + 3 | export default @decorator class {} + 4 | " +`; + +exports[`after_export.js [meriyah] format 1`] = ` +"[1:8]: Unexpected token: '@' (1:8) +> 1 | export @decorator class Foo {} + | ^ + 2 | + 3 | export default @decorator class {} + 4 | " +`; + exports[`after_export.js format 1`] = ` ====================================options===================================== parsers: ["babel"] @@ -22,6 +40,15 @@ class {} ================================================================================ `; +exports[`before_export.js [espree] format 1`] = ` +"Unexpected character '@' (1:1) +> 1 | @decorator + | ^ + 2 | export class Foo {} + 3 | + 4 | @decorator" +`; + exports[`before_export.js format 1`] = ` ====================================options===================================== parsers: ["babel"] diff --git a/tests/js/decorators-export/jsfmt.spec.js b/tests/js/decorators-export/jsfmt.spec.js index b7b6d78084c5..defe51cfdee2 100644 --- a/tests/js/decorators-export/jsfmt.spec.js +++ b/tests/js/decorators-export/jsfmt.spec.js @@ -1,2 +1,4 @@ // TypeScript and Flow don't accept decorator after export -run_spec(__dirname, ["babel"], { errors: { espree: true } }); +run_spec(__dirname, ["babel"], { + errors: { espree: true, meriyah: ["after_export.js"] }, +}); diff --git a/tests/js/decorators/__snapshots__/jsfmt.spec.js.snap b/tests/js/decorators/__snapshots__/jsfmt.spec.js.snap index 9ef233b7763d..085fb5091115 100644 --- a/tests/js/decorators/__snapshots__/jsfmt.spec.js.snap +++ b/tests/js/decorators/__snapshots__/jsfmt.spec.js.snap @@ -1,5 +1,14 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`classes.js [espree] format 1`] = ` +"Unexpected character '@' (1:1) +> 1 | @deco class Foo {} + | ^ + 2 | + 3 | @deco export class Bar {} + 4 | " +`; + exports[`classes.js format 1`] = ` ====================================options===================================== parsers: ["babel"] @@ -47,6 +56,17 @@ const bar = ================================================================================ `; +exports[`comments.js [espree] format 1`] = ` +"Unexpected character '@' (3:1) + 1 | var x = 100 + 2 | +> 3 | @Hello({ + | ^ + 4 | a: 'a', // Comment is in the wrong place + 5 | // test + 6 | b: '2'" +`; + exports[`comments.js format 1`] = ` ====================================options===================================== parsers: ["babel"] @@ -118,6 +138,17 @@ export class Bar {} ================================================================================ `; +exports[`methods.js [espree] format 1`] = ` +"Unexpected character '@' (3:3) + 1 | + 2 | class Yo { +> 3 | @foo(\\"hello\\") + | ^ + 4 | async plop() {} + 5 | + 6 | @anotherDecoratorWithALongName(\\"and a very long string as a first argument\\")" +`; + exports[`methods.js format 1`] = ` ====================================options===================================== parsers: ["babel"] @@ -150,6 +181,17 @@ class Yo { ================================================================================ `; +exports[`mixed.js [espree] format 1`] = ` +"Unexpected character '@' (3:1) + 1 | // https://github.com/prettier/prettier/issues/6747 + 2 | +> 3 | @foo + | ^ + 4 | export default class MyComponent { + 5 | @task + 6 | *foo() {" +`; + exports[`mixed.js format 1`] = ` ====================================options===================================== parsers: ["babel"] @@ -176,6 +218,28 @@ export default class MyComponent { ================================================================================ `; +exports[`mobx.js [espree] format 1`] = ` +"Unexpected character '@' (3:1) + 1 | import {observable} from \\"mobx\\"; + 2 | +> 3 | @observer class OrderLine { + | ^ + 4 | @observable price:number = 0; + 5 | @observable amount:number = 1; + 6 | " +`; + +exports[`mobx.js [meriyah] format 1`] = ` +"[4:20]: Unexpected token: ':' (4:20) + 2 | + 3 | @observer class OrderLine { +> 4 | @observable price:number = 0; + | ^ + 5 | @observable amount:number = 1; + 6 | + 7 | constructor(price) {" +`; + exports[`mobx.js format 1`] = ` ====================================options===================================== parsers: ["babel"] @@ -270,6 +334,16 @@ class OrderLine { ================================================================================ `; +exports[`multiline.js [espree] format 1`] = ` +"Unexpected character '@' (2:3) + 1 | class Foo { +> 2 | @deco([ + | ^ + 3 | foo, + 4 | bar + 5 | ]) prop = value;" +`; + exports[`multiline.js format 1`] = ` ====================================options===================================== parsers: ["babel"] @@ -292,6 +366,26 @@ class Foo { ================================================================================ `; +exports[`multiple.js [espree] format 1`] = ` +"Unexpected character '@' (2:3) + 1 | const dog = { +> 2 | @readonly + | ^ + 3 | @nonenumerable + 4 | @doubledValue + 5 | legs: 4," +`; + +exports[`multiple.js [meriyah] format 1`] = ` +"[2:3]: Unexpected token: '@' (2:3) + 1 | const dog = { +> 2 | @readonly + | ^ + 3 | @nonenumerable + 4 | @doubledValue + 5 | legs: 4," +`; + exports[`multiple.js format 1`] = ` ====================================options===================================== parsers: ["babel"] @@ -337,6 +431,16 @@ const foo = { ================================================================================ `; +exports[`parens.js [espree] format 1`] = ` +"Unexpected character '@' (2:3) + 1 | class X { +> 2 | @(computed().volatile()) + | ^ + 3 | x + 4 | } + 5 | " +`; + exports[`parens.js format 1`] = ` ====================================options===================================== parsers: ["babel"] @@ -357,6 +461,15 @@ class X { ================================================================================ `; +exports[`redux.js [espree] format 1`] = ` +"Unexpected character '@' (1:1) +> 1 | @connect(mapStateToProps, mapDispatchToProps) + | ^ + 2 | export class MyApp extends React.Component {} + 3 | + 4 | @connect(state => ({ todos: state.todos }))" +`; + exports[`redux.js format 1`] = ` ====================================options===================================== parsers: ["babel"] diff --git a/tests/js/decorators/jsfmt.spec.js b/tests/js/decorators/jsfmt.spec.js index 726eaec01590..85e8b037ae63 100644 --- a/tests/js/decorators/jsfmt.spec.js +++ b/tests/js/decorators/jsfmt.spec.js @@ -1 +1,3 @@ -run_spec(__dirname, ["babel"], { errors: { espree: true } }); +run_spec(__dirname, ["babel"], { + errors: { espree: true, meriyah: ["multiple.js", "mobx.js"] }, +}); diff --git a/tests/js/do/__snapshots__/jsfmt.spec.js.snap b/tests/js/do/__snapshots__/jsfmt.spec.js.snap index 211b0d7c82c0..a82e84ebaa23 100644 --- a/tests/js/do/__snapshots__/jsfmt.spec.js.snap +++ b/tests/js/do/__snapshots__/jsfmt.spec.js.snap @@ -1,5 +1,27 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`do.js [espree] format 1`] = ` +"Unexpected token do (3:5) + 1 | const envSpecific = { + 2 | domain: +> 3 | do { + | ^ + 4 | if(env === 'production') 'https://abc.mno.com/'; + 5 | else if(env === 'development') 'http://localhost:4000'; + 6 | }" +`; + +exports[`do.js [meriyah] format 1`] = ` +"[3:6]: Unexpected token: 'do' (3:6) + 1 | const envSpecific = { + 2 | domain: +> 3 | do { + | ^ + 4 | if(env === 'production') 'https://abc.mno.com/'; + 5 | else if(env === 'development') 'http://localhost:4000'; + 6 | }" +`; + exports[`do.js format 1`] = ` ====================================options===================================== parsers: ["babel"] diff --git a/tests/js/do/jsfmt.spec.js b/tests/js/do/jsfmt.spec.js index 726eaec01590..0fab4456dc8e 100644 --- a/tests/js/do/jsfmt.spec.js +++ b/tests/js/do/jsfmt.spec.js @@ -1 +1 @@ -run_spec(__dirname, ["babel"], { errors: { espree: true } }); +run_spec(__dirname, ["babel"], { errors: { espree: true, meriyah: true } }); diff --git a/tests/js/dynamic-import/__snapshots__/jsfmt.spec.js.snap b/tests/js/dynamic-import/__snapshots__/jsfmt.spec.js.snap index 96762beef1fa..66f06ab32166 100644 --- a/tests/js/dynamic-import/__snapshots__/jsfmt.spec.js.snap +++ b/tests/js/dynamic-import/__snapshots__/jsfmt.spec.js.snap @@ -1,5 +1,33 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`assertions.js [espree] format 1`] = ` +"Unexpected token , (1:20) +> 1 | import(\\"./foo.json\\", { assert: { type: \\"json\\" } }); + | ^ + 2 | " +`; + +exports[`assertions.js [flow] format 1`] = ` +"Unexpected token \`,\`, expected the token \`)\` (1:20) +> 1 | import(\\"./foo.json\\", { assert: { type: \\"json\\" } }); + | ^ + 2 | " +`; + +exports[`assertions.js [meriyah] format 1`] = ` +"[1:20]: Expected ')' (1:20) +> 1 | import(\\"./foo.json\\", { assert: { type: \\"json\\" } }); + | ^ + 2 | " +`; + +exports[`assertions.js [typescript] format 1`] = ` +"Dynamic import must have one specifier as an argument. (1:8) +> 1 | import(\\"./foo.json\\", { assert: { type: \\"json\\" } }); + | ^ + 2 | " +`; + exports[`assertions.js format 1`] = ` ====================================options===================================== parsers: ["babel", "flow", "typescript"] diff --git a/tests/js/dynamic-import/jsfmt.spec.js b/tests/js/dynamic-import/jsfmt.spec.js index 0d480115c662..4fffde987af5 100644 --- a/tests/js/dynamic-import/jsfmt.spec.js +++ b/tests/js/dynamic-import/jsfmt.spec.js @@ -3,5 +3,6 @@ run_spec(__dirname, ["babel", "flow", "typescript"], { flow: ["assertions.js"], typescript: ["assertions.js"], espree: ["assertions.js"], + meriyah: ["assertions.js"], }, }); diff --git a/tests/js/empty-paren-comment/__snapshots__/jsfmt.spec.js.snap b/tests/js/empty-paren-comment/__snapshots__/jsfmt.spec.js.snap index 0151ae2872ca..e91495cca56b 100644 --- a/tests/js/empty-paren-comment/__snapshots__/jsfmt.spec.js.snap +++ b/tests/js/empty-paren-comment/__snapshots__/jsfmt.spec.js.snap @@ -25,6 +25,17 @@ class x { ================================================================================ `; +exports[`class-property.js [espree] format 1`] = ` +"Unexpected token = (4:5) + 2 | f(/* ... */) {} + 3 | f() /* ... */ {} +> 4 | f = (/* ... */) => {}; + | ^ + 5 | static f(/* ... */) {}; + 6 | static f = (/* ... */) => {}; + 7 | static f = function(/* ... */) {};" +`; + exports[`class-property.js format 1`] = ` ====================================options===================================== parsers: ["babel", "flow", "typescript"] diff --git a/tests/js/export-default/escaped/__snapshots__/jsfmt.spec.js.snap b/tests/js/export-default/escaped/__snapshots__/jsfmt.spec.js.snap index a87436136685..cec2b389d032 100644 --- a/tests/js/export-default/escaped/__snapshots__/jsfmt.spec.js.snap +++ b/tests/js/export-default/escaped/__snapshots__/jsfmt.spec.js.snap @@ -1,5 +1,19 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`default-escaped.js [espree] format 1`] = ` +"Unexpected token n\\\\u{63} (2:8) + 1 | // export asyn\\\\u{63} from \\"async\\"; +> 2 | export n\\\\u{63} from \\"async\\"; + | ^" +`; + +exports[`default-escaped.js [meriyah] format 1`] = ` +"[2:12]: Unexpected token: 'identifier' (2:12) + 1 | // export asyn\\\\u{63} from \\"async\\"; +> 2 | export n\\\\u{63} from \\"async\\"; + | ^" +`; + exports[`default-escaped.js format 1`] = ` ====================================options===================================== parsers: ["babel"] diff --git a/tests/js/export-default/escaped/jsfmt.spec.js b/tests/js/export-default/escaped/jsfmt.spec.js index 302810e990dc..d60e0b5257d8 100644 --- a/tests/js/export-default/escaped/jsfmt.spec.js +++ b/tests/js/export-default/escaped/jsfmt.spec.js @@ -1,3 +1,3 @@ run_spec(__dirname, ["babel"], { - errors: { espree: true }, + errors: { espree: true, meriyah: true }, }); diff --git a/tests/js/export-extension/__snapshots__/jsfmt.spec.js.snap b/tests/js/export-extension/__snapshots__/jsfmt.spec.js.snap index 04dba0966fa8..60144ebbde52 100644 --- a/tests/js/export-extension/__snapshots__/jsfmt.spec.js.snap +++ b/tests/js/export-extension/__snapshots__/jsfmt.spec.js.snap @@ -1,5 +1,25 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`export.js [espree] format 1`] = ` +"Unexpected token v (2:8) + 1 | export * as ns from 'mod'; +> 2 | export v from 'mod'; + | ^ + 3 | export a, * as b from 'mod'; + 4 | export c, { foo } from 'mod'; + 5 | export * as d, { bar } from 'mod';" +`; + +exports[`export.js [meriyah] format 1`] = ` +"[2:8]: Unexpected token: 'identifier' (2:8) + 1 | export * as ns from 'mod'; +> 2 | export v from 'mod'; + | ^ + 3 | export a, * as b from 'mod'; + 4 | export c, { foo } from 'mod'; + 5 | export * as d, { bar } from 'mod';" +`; + exports[`export.js format 1`] = ` ====================================options===================================== parsers: ["babel"] diff --git a/tests/js/export-extension/jsfmt.spec.js b/tests/js/export-extension/jsfmt.spec.js index 726eaec01590..0fab4456dc8e 100644 --- a/tests/js/export-extension/jsfmt.spec.js +++ b/tests/js/export-extension/jsfmt.spec.js @@ -1 +1 @@ -run_spec(__dirname, ["babel"], { errors: { espree: true } }); +run_spec(__dirname, ["babel"], { errors: { espree: true, meriyah: true } }); diff --git a/tests/js/exports/__snapshots__/jsfmt.spec.js.snap b/tests/js/exports/__snapshots__/jsfmt.spec.js.snap index f1d4309dbbde..0d9be4fbfa68 100644 --- a/tests/js/exports/__snapshots__/jsfmt.spec.js.snap +++ b/tests/js/exports/__snapshots__/jsfmt.spec.js.snap @@ -1,5 +1,27 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`test.js [espree] format 1`] = ` +"Unexpected token a (3:8) + 1 | export { value1, value2 as value2_renamed, value3, value4 as value4_renamed, value5 } from \\"exports\\"; + 2 | +> 3 | export a,{b} from \\"./baz\\"; + | ^ + 4 | + 5 | export * as ns from \\"mod\\"; + 6 | " +`; + +exports[`test.js [meriyah] format 1`] = ` +"[3:8]: Unexpected token: 'identifier' (3:8) + 1 | export { value1, value2 as value2_renamed, value3, value4 as value4_renamed, value5 } from \\"exports\\"; + 2 | +> 3 | export a,{b} from \\"./baz\\"; + | ^ + 4 | + 5 | export * as ns from \\"mod\\"; + 6 | " +`; + exports[`test.js format 1`] = ` ====================================options===================================== parsers: ["babel"] diff --git a/tests/js/exports/jsfmt.spec.js b/tests/js/exports/jsfmt.spec.js index 726eaec01590..0fab4456dc8e 100644 --- a/tests/js/exports/jsfmt.spec.js +++ b/tests/js/exports/jsfmt.spec.js @@ -1 +1 @@ -run_spec(__dirname, ["babel"], { errors: { espree: true } }); +run_spec(__dirname, ["babel"], { errors: { espree: true, meriyah: true } }); diff --git a/tests/js/import-assertions/__snapshots__/jsfmt.spec.js.snap b/tests/js/import-assertions/__snapshots__/jsfmt.spec.js.snap index df01ffc7403d..1dfb06751cb3 100644 --- a/tests/js/import-assertions/__snapshots__/jsfmt.spec.js.snap +++ b/tests/js/import-assertions/__snapshots__/jsfmt.spec.js.snap @@ -1,6 +1,20 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`import-assertions-dynamic.js format 1`] = ` +exports[`dynamic-import.js [espree] format 1`] = ` +"Unexpected token , (1:20) +> 1 | import(\\"./foo.json\\", { assert: { type: \\"json\\" } }); + | ^ + 2 | " +`; + +exports[`dynamic-import.js [meriyah] format 1`] = ` +"[1:20]: Expected ')' (1:20) +> 1 | import(\\"./foo.json\\", { assert: { type: \\"json\\" } }); + | ^ + 2 | " +`; + +exports[`dynamic-import.js format 1`] = ` ====================================options===================================== parsers: ["babel"] printWidth: 80 @@ -14,30 +28,75 @@ import("./foo.json", { assert: { type: "json" } }); ================================================================================ `; -exports[`import-assertions-multi-types.js format 1`] = ` +exports[`empty.js [espree] format 1`] = ` +"Unexpected token assert (2:33) + 1 | export * as foo from \\"foo.json\\" +> 2 | export * as bar from \\"bar.json\\" assert { } + | ^ + 3 | export * as baz from \\"baz.json\\" assert { /* comment */ } + 4 | + 5 | import * as foo from \\"foo.json\\"" +`; + +exports[`empty.js [meriyah] format 1`] = ` +"[2:38]: Unexpected token: 'identifier' (2:38) + 1 | export * as foo from \\"foo.json\\" +> 2 | export * as bar from \\"bar.json\\" assert { } + | ^ + 3 | export * as baz from \\"baz.json\\" assert { /* comment */ } + 4 | + 5 | import * as foo from \\"foo.json\\"" +`; + +exports[`empty.js format 1`] = ` ====================================options===================================== parsers: ["babel"] printWidth: 80 | printWidth =====================================input====================================== -import json from "./foo.json" assert { type: "json", type: "bar" }; +export * as foo from "foo.json" +export * as bar from "bar.json" assert { } +export * as baz from "baz.json" assert { /* comment */ } +import * as foo from "foo.json" +import * as bar from "bar.json" assert { } +import * as baz from "baz.json" assert { /* comment */ } =====================================output===================================== -import json from "./foo.json" assert { type: "json", type: "bar" }; +export * as foo from "foo.json"; +export * as bar from "bar.json"; +export * as baz from "baz.json" /* comment */; + +import * as foo from "foo.json"; +import * as bar from "bar.json"; +import * as baz from "baz.json" /* comment */; ================================================================================ `; -exports[`import-assertions-static.js format 1`] = ` +exports[`multi-types.js [espree] format 1`] = ` +"Unexpected token assert (1:31) +> 1 | import json from \\"./foo.json\\" assert { type: \\"json\\", type: \\"bar\\" }; + | ^ + 2 | " +`; + +exports[`multi-types.js [meriyah] format 1`] = ` +"[1:36]: Unexpected token: 'identifier' (1:36) +> 1 | import json from \\"./foo.json\\" assert { type: \\"json\\", type: \\"bar\\" }; + | ^ + 2 | " +`; + +exports[`multi-types.js format 1`] = ` ====================================options===================================== parsers: ["babel"] printWidth: 80 | printWidth =====================================input====================================== -import json from "./foo.json" assert { type: "json" }; +import json from "./foo.json" assert { type: "json", type: "bar" }; =====================================output===================================== -import json from "./foo.json" assert { type: "json" }; +import json from "./foo.json" assert { type: "json", type: "bar" }; ================================================================================ `; @@ -57,3 +116,95 @@ assert({ type: "json" }); ================================================================================ `; + +exports[`re-export.js [espree] format 1`] = ` +"Unexpected token assert (1:33) +> 1 | export { foo2 } from \\"foo.json\\" assert { type: \\"json\\" }; + | ^ + 2 | export * from \\"foo.json\\" assert { type: \\"json\\" }; + 3 | export * as foo3 from \\"foo.json\\" assert { type: \\"json\\" }; + 4 | " +`; + +exports[`re-export.js [meriyah] format 1`] = ` +"[1:38]: Unexpected token: 'identifier' (1:38) +> 1 | export { foo2 } from \\"foo.json\\" assert { type: \\"json\\" }; + | ^ + 2 | export * from \\"foo.json\\" assert { type: \\"json\\" }; + 3 | export * as foo3 from \\"foo.json\\" assert { type: \\"json\\" }; + 4 | " +`; + +exports[`re-export.js format 1`] = ` +====================================options===================================== +parsers: ["babel"] +printWidth: 80 + | printWidth +=====================================input====================================== +export { foo2 } from "foo.json" assert { type: "json" }; +export * from "foo.json" assert { type: "json" }; +export * as foo3 from "foo.json" assert { type: "json" }; + +=====================================output===================================== +export { foo2 } from "foo.json" assert { type: "json" }; +export * from "foo.json" assert { type: "json" }; +export * as foo3 from "foo.json" assert { type: "json" }; + +================================================================================ +`; + +exports[`static-import.js [espree] format 1`] = ` +"Unexpected token assert (1:31) +> 1 | import json from \\"./foo.json\\" assert { type: \\"json\\" }; + | ^ + 2 | " +`; + +exports[`static-import.js [meriyah] format 1`] = ` +"[1:36]: Unexpected token: 'identifier' (1:36) +> 1 | import json from \\"./foo.json\\" assert { type: \\"json\\" }; + | ^ + 2 | " +`; + +exports[`static-import.js format 1`] = ` +====================================options===================================== +parsers: ["babel"] +printWidth: 80 + | printWidth +=====================================input====================================== +import json from "./foo.json" assert { type: "json" }; + +=====================================output===================================== +import json from "./foo.json" assert { type: "json" }; + +================================================================================ +`; + +exports[`without-from.js [espree] format 1`] = ` +"Unexpected token assert (1:14) +> 1 | import \\"foo\\" assert { type: \\"json\\" } + | ^ + 2 | " +`; + +exports[`without-from.js [meriyah] format 1`] = ` +"[1:19]: Unexpected token: 'identifier' (1:19) +> 1 | import \\"foo\\" assert { type: \\"json\\" } + | ^ + 2 | " +`; + +exports[`without-from.js format 1`] = ` +====================================options===================================== +parsers: ["babel"] +printWidth: 80 + | printWidth +=====================================input====================================== +import "foo" assert { type: "json" } + +=====================================output===================================== +import "foo" assert { type: "json" }; + +================================================================================ +`; diff --git a/tests/js/import-assertions/bracket-spacing/__snapshots__/jsfmt.spec.js.snap b/tests/js/import-assertions/bracket-spacing/__snapshots__/jsfmt.spec.js.snap new file mode 100644 index 000000000000..3e06a9d9effe --- /dev/null +++ b/tests/js/import-assertions/bracket-spacing/__snapshots__/jsfmt.spec.js.snap @@ -0,0 +1,114 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`dynamic-import.js - {"bracketSpacing":false} [espree] format 1`] = ` +"Unexpected token , (1:20) +> 1 | import(\\"./foo.json\\", { assert: { type: \\"json\\" } }); + | ^ + 2 | " +`; + +exports[`dynamic-import.js - {"bracketSpacing":false} [meriyah] format 1`] = ` +"[1:20]: Expected ')' (1:20) +> 1 | import(\\"./foo.json\\", { assert: { type: \\"json\\" } }); + | ^ + 2 | " +`; + +exports[`dynamic-import.js - {"bracketSpacing":false} format 1`] = ` +====================================options===================================== +bracketSpacing: false +parsers: ["babel"] +printWidth: 80 + | printWidth +=====================================input====================================== +import("./foo.json", { assert: { type: "json" } }); + +=====================================output===================================== +import("./foo.json", {assert: {type: "json"}}); + +================================================================================ +`; + +exports[`empty.js - {"bracketSpacing":false} [espree] format 1`] = ` +"Unexpected token assert (1:33) +> 1 | export * as bar from \\"bar.json\\" assert { } + | ^" +`; + +exports[`empty.js - {"bracketSpacing":false} [meriyah] format 1`] = ` +"[1:38]: Unexpected token: 'identifier' (1:38) +> 1 | export * as bar from \\"bar.json\\" assert { } + | ^" +`; + +exports[`empty.js - {"bracketSpacing":false} format 1`] = ` +====================================options===================================== +bracketSpacing: false +parsers: ["babel"] +printWidth: 80 + | printWidth +=====================================input====================================== +export * as bar from "bar.json" assert { } +=====================================output===================================== +export * as bar from "bar.json"; + +================================================================================ +`; + +exports[`re-export.js - {"bracketSpacing":false} [espree] format 1`] = ` +"Unexpected token assert (1:33) +> 1 | export { foo2 } from \\"foo.json\\" assert { type: \\"json\\" }; + | ^ + 2 | " +`; + +exports[`re-export.js - {"bracketSpacing":false} [meriyah] format 1`] = ` +"[1:38]: Unexpected token: 'identifier' (1:38) +> 1 | export { foo2 } from \\"foo.json\\" assert { type: \\"json\\" }; + | ^ + 2 | " +`; + +exports[`re-export.js - {"bracketSpacing":false} format 1`] = ` +====================================options===================================== +bracketSpacing: false +parsers: ["babel"] +printWidth: 80 + | printWidth +=====================================input====================================== +export { foo2 } from "foo.json" assert { type: "json" }; + +=====================================output===================================== +export {foo2} from "foo.json" assert {type: "json"}; + +================================================================================ +`; + +exports[`static-import.js - {"bracketSpacing":false} [espree] format 1`] = ` +"Unexpected token assert (1:31) +> 1 | import json from \\"./foo.json\\" assert { type: \\"json\\" }; + | ^ + 2 | " +`; + +exports[`static-import.js - {"bracketSpacing":false} [meriyah] format 1`] = ` +"[1:36]: Unexpected token: 'identifier' (1:36) +> 1 | import json from \\"./foo.json\\" assert { type: \\"json\\" }; + | ^ + 2 | " +`; + +exports[`static-import.js - {"bracketSpacing":false} format 1`] = ` +====================================options===================================== +bracketSpacing: false +parsers: ["babel"] +printWidth: 80 + | printWidth +=====================================input====================================== +import json from "./foo.json" assert { type: "json" }; + +=====================================output===================================== +import json from "./foo.json" assert {type: "json"}; + +================================================================================ +`; diff --git a/tests/js/import-assertions/import-assertions-dynamic.js b/tests/js/import-assertions/bracket-spacing/dynamic-import.js similarity index 100% rename from tests/js/import-assertions/import-assertions-dynamic.js rename to tests/js/import-assertions/bracket-spacing/dynamic-import.js diff --git a/tests/js/import-assertions/bracket-spacing/empty.js b/tests/js/import-assertions/bracket-spacing/empty.js new file mode 100644 index 000000000000..f6b005613c7d --- /dev/null +++ b/tests/js/import-assertions/bracket-spacing/empty.js @@ -0,0 +1 @@ +export * as bar from "bar.json" assert { } \ No newline at end of file diff --git a/tests/js/import-assertions/bracket-spacing/jsfmt.spec.js b/tests/js/import-assertions/bracket-spacing/jsfmt.spec.js new file mode 100644 index 000000000000..141e96b4f27f --- /dev/null +++ b/tests/js/import-assertions/bracket-spacing/jsfmt.spec.js @@ -0,0 +1,17 @@ +run_spec(__dirname, ["babel"], { + bracketSpacing: false, + errors: { + espree: [ + "dynamic-import.js", + "static-import.js", + "re-export.js", + "empty.js", + ], + meriyah: [ + "dynamic-import.js", + "static-import.js", + "re-export.js", + "empty.js", + ], + }, +}); diff --git a/tests/js/import-assertions/bracket-spacing/re-export.js b/tests/js/import-assertions/bracket-spacing/re-export.js new file mode 100644 index 000000000000..d3a40791589d --- /dev/null +++ b/tests/js/import-assertions/bracket-spacing/re-export.js @@ -0,0 +1 @@ +export { foo2 } from "foo.json" assert { type: "json" }; diff --git a/tests/js/import-assertions/import-assertions-static.js b/tests/js/import-assertions/bracket-spacing/static-import.js similarity index 100% rename from tests/js/import-assertions/import-assertions-static.js rename to tests/js/import-assertions/bracket-spacing/static-import.js diff --git a/tests/js/import-assertions/dynamic-import.js b/tests/js/import-assertions/dynamic-import.js new file mode 100644 index 000000000000..2411a524bf12 --- /dev/null +++ b/tests/js/import-assertions/dynamic-import.js @@ -0,0 +1 @@ +import("./foo.json", { assert: { type: "json" } }); diff --git a/tests/js/import-assertions/empty.js b/tests/js/import-assertions/empty.js new file mode 100644 index 000000000000..25de961c2745 --- /dev/null +++ b/tests/js/import-assertions/empty.js @@ -0,0 +1,7 @@ +export * as foo from "foo.json" +export * as bar from "bar.json" assert { } +export * as baz from "baz.json" assert { /* comment */ } + +import * as foo from "foo.json" +import * as bar from "bar.json" assert { } +import * as baz from "baz.json" assert { /* comment */ } \ No newline at end of file diff --git a/tests/js/import-assertions/jsfmt.spec.js b/tests/js/import-assertions/jsfmt.spec.js index c3095e9d8d7f..69aab7bca670 100644 --- a/tests/js/import-assertions/jsfmt.spec.js +++ b/tests/js/import-assertions/jsfmt.spec.js @@ -1,9 +1,20 @@ run_spec(__dirname, ["babel"], { errors: { espree: [ - "import-assertions-dynamic.js", - "import-assertions-multi-types.js", - "import-assertions-static.js", + "dynamic-import.js", + "empty.js", + "multi-types.js", + "static-import.js", + "re-export.js", + "without-from.js", + ], + meriyah: [ + "dynamic-import.js", + "empty.js", + "multi-types.js", + "static-import.js", + "re-export.js", + "without-from.js", ], }, }); diff --git a/tests/js/import-assertions/import-assertions-multi-types.js b/tests/js/import-assertions/multi-types.js similarity index 100% rename from tests/js/import-assertions/import-assertions-multi-types.js rename to tests/js/import-assertions/multi-types.js diff --git a/tests/js/import-assertions/re-export.js b/tests/js/import-assertions/re-export.js new file mode 100644 index 000000000000..dd9640ec20ad --- /dev/null +++ b/tests/js/import-assertions/re-export.js @@ -0,0 +1,3 @@ +export { foo2 } from "foo.json" assert { type: "json" }; +export * from "foo.json" assert { type: "json" }; +export * as foo3 from "foo.json" assert { type: "json" }; diff --git a/tests/js/import-assertions/static-import.js b/tests/js/import-assertions/static-import.js new file mode 100644 index 000000000000..890e4290079e --- /dev/null +++ b/tests/js/import-assertions/static-import.js @@ -0,0 +1 @@ +import json from "./foo.json" assert { type: "json" }; diff --git a/tests/js/import-assertions/without-from.js b/tests/js/import-assertions/without-from.js new file mode 100644 index 000000000000..daf38156ebb5 --- /dev/null +++ b/tests/js/import-assertions/without-from.js @@ -0,0 +1 @@ +import "foo" assert { type: "json" } diff --git a/tests/js/invalid-code/__snapshots__/jsfmt.spec.js.snap b/tests/js/invalid-code/__snapshots__/jsfmt.spec.js.snap index d4af296354c5..5b5a129e1ae7 100644 --- a/tests/js/invalid-code/__snapshots__/jsfmt.spec.js.snap +++ b/tests/js/invalid-code/__snapshots__/jsfmt.spec.js.snap @@ -1,5 +1,12 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`duplicate_bindings.js [espree] format 1`] = ` +"Identifier 'A' has already been declared (1:19) +> 1 | class A{} class A{} + | ^ + 2 | " +`; + exports[`duplicate_bindings.js format 1`] = ` ====================================options===================================== parsers: ["babel"] diff --git a/tests/js/label/__snapshots__/jsfmt.spec.js.snap b/tests/js/label/__snapshots__/jsfmt.spec.js.snap index 0eb99749d530..d012d92b6198 100644 --- a/tests/js/label/__snapshots__/jsfmt.spec.js.snap +++ b/tests/js/label/__snapshots__/jsfmt.spec.js.snap @@ -1,5 +1,22 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`block-statement-and-regexp.js format 1`] = ` +====================================options===================================== +parsers: ["babel", "flow", "typescript"] +printWidth: 80 + | printWidth +=====================================input====================================== +a : { b : 1 }/2/; + +=====================================output===================================== +a: { + b: 1; +} +/2/; + +================================================================================ +`; + exports[`comment.js format 1`] = ` ====================================options===================================== parsers: ["babel", "flow", "typescript"] diff --git a/tests/js/label/block-statement-and-regexp.js b/tests/js/label/block-statement-and-regexp.js new file mode 100644 index 000000000000..b69bf681e7d9 --- /dev/null +++ b/tests/js/label/block-statement-and-regexp.js @@ -0,0 +1 @@ +a : { b : 1 }/2/; diff --git a/tests/js/literal/__snapshots__/jsfmt.spec.js.snap b/tests/js/literal/__snapshots__/jsfmt.spec.js.snap index 0f5a81730ae3..c57ee64718fa 100644 --- a/tests/js/literal/__snapshots__/jsfmt.spec.js.snap +++ b/tests/js/literal/__snapshots__/jsfmt.spec.js.snap @@ -1,5 +1,26 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`invalid-exponent.js [espree] format 1`] = ` +"Invalid number (1:1) +> 1 | 12.3e + | ^ + 2 | " +`; + +exports[`invalid-exponent.js [meriyah] format 1`] = ` +"[1:5]: Non-number found after exponent indicator (1:5) +> 1 | 12.3e + | ^ + 2 | " +`; + +exports[`invalid-exponent.js [typescript] format 1`] = ` +"Digit expected. (1:6) +> 1 | 12.3e + | ^ + 2 | " +`; + exports[`invalid-exponent.js format 1`] = ` ====================================options===================================== parsers: ["babel", "typescript"] @@ -14,6 +35,26 @@ printWidth: 80 ================================================================================ `; +exports[`number.js [espree] format 1`] = ` +"Unexpected token : (2:17) + 1 | // parentheses around numeric literal should be preserved +> 2 | function test5(): string { + | ^ + 3 | return (100).toString(); + 4 | } + 5 | " +`; + +exports[`number.js [meriyah] format 1`] = ` +"[2:17]: Expected '{' (2:17) + 1 | // parentheses around numeric literal should be preserved +> 2 | function test5(): string { + | ^ + 3 | return (100).toString(); + 4 | } + 5 | " +`; + exports[`number.js format 1`] = ` ====================================options===================================== parsers: ["babel", "typescript"] diff --git a/tests/js/literal/jsfmt.spec.js b/tests/js/literal/jsfmt.spec.js index 6c46c013dc71..fc211ea905ed 100644 --- a/tests/js/literal/jsfmt.spec.js +++ b/tests/js/literal/jsfmt.spec.js @@ -1,4 +1,4 @@ // flow-parser@0.38.0 fails to parse `1.e1`, so use babel here. run_spec(__dirname, ["babel", "typescript"], { - errors: { espree: true, typescript: ["invalid-exponent.js"] }, + errors: { espree: true, meriyah: true, typescript: ["invalid-exponent.js"] }, }); diff --git a/tests/js/logical-assignment/__snapshots__/jsfmt.spec.js.snap b/tests/js/logical-assignment/__snapshots__/jsfmt.spec.js.snap index 6394cf7d467c..20ffcc223e94 100644 --- a/tests/js/logical-assignment/__snapshots__/jsfmt.spec.js.snap +++ b/tests/js/logical-assignment/__snapshots__/jsfmt.spec.js.snap @@ -1,5 +1,19 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`invalid.js [espree] format 1`] = ` +"Assigning to rvalue (1:21) +> 1 | c.foo.bar().baz ??= result.foo.bar().baz(a.baz) &&= result.baz; + | ^ + 2 | " +`; + +exports[`invalid.js [meriyah] format 1`] = ` +"[1:19]: Unexpected token: '=' (1:19) +> 1 | c.foo.bar().baz ??= result.foo.bar().baz(a.baz) &&= result.baz; + | ^ + 2 | " +`; + exports[`invalid.js format 1`] = ` ====================================options===================================== parsers: ["babel", "typescript"] @@ -14,6 +28,15 @@ c.foo.bar().baz ??= result.foo.bar().baz(a.baz) &&= result.baz; ================================================================================ `; +exports[`logical-assignment.js [meriyah] format 1`] = ` +"[1:5]: Unexpected token: '=' (1:5) +> 1 | a ||= b; + | ^ + 2 | + 3 | a &&= \\"foo\\"; + 4 | b ||= \\"foo\\";" +`; + exports[`logical-assignment.js format 1`] = ` ====================================options===================================== parsers: ["babel", "typescript"] diff --git a/tests/js/logical-assignment/jsfmt.spec.js b/tests/js/logical-assignment/jsfmt.spec.js index 70359a9d23e8..77c17c6e6f5f 100644 --- a/tests/js/logical-assignment/jsfmt.spec.js +++ b/tests/js/logical-assignment/jsfmt.spec.js @@ -1,3 +1,3 @@ run_spec(__dirname, ["babel", "typescript"], { - errors: { espree: ["invalid.js"] }, + errors: { espree: ["invalid.js"], meriyah: true }, }); diff --git a/tests/js/module-string-names/__snapshots__/jsfmt.spec.js.snap b/tests/js/module-string-names/__snapshots__/jsfmt.spec.js.snap index b2f9e1c02d49..2dab89f0b1d8 100644 --- a/tests/js/module-string-names/__snapshots__/jsfmt.spec.js.snap +++ b/tests/js/module-string-names/__snapshots__/jsfmt.spec.js.snap @@ -1,6 +1,24 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`module-string-names.js format 1`] = ` +exports[`module-string-names-export.js [espree] format 1`] = ` +"Unexpected token \\"smile\\" (1:19) +> 1 | export { smile as \\"smile\\" } from \\"./emojis.js\\"; + | ^ + 2 | export { \\"smile\\" as smile } from \\"./emojis.js\\"; + 3 | export { \\"smile\\" as \\"smile\\" } from \\"./emojis.js\\"; + 4 | export { foo, bar as \\"foo\\" } from \\"./emojis.js\\";" +`; + +exports[`module-string-names-export.js [meriyah] format 1`] = ` +"[1:25]: Only a identifier can be used to indicate alias (1:25) +> 1 | export { smile as \\"smile\\" } from \\"./emojis.js\\"; + | ^ + 2 | export { \\"smile\\" as smile } from \\"./emojis.js\\"; + 3 | export { \\"smile\\" as \\"smile\\" } from \\"./emojis.js\\"; + 4 | export { foo, bar as \\"foo\\" } from \\"./emojis.js\\";" +`; + +exports[`module-string-names-export.js format 1`] = ` ====================================options===================================== parsers: ["babel"] printWidth: 80 @@ -30,3 +48,39 @@ export { "smile" } from "./emojis.js"; ================================================================================ `; + +exports[`module-string-names-import.js [espree] format 1`] = ` +"Unexpected token \\"default\\" (1:10) +> 1 | import { \\"default\\" as quotation } from \\"Confucius\\"; + | ^ + 2 | import { \\"foo\\" as bar, \\"default\\" as qux } from \\"module-a\\"; + 3 | import { \\"學而時習之,不亦說乎?\\" as quotation } from \\"Confucius\\"; + 4 | " +`; + +exports[`module-string-names-import.js [meriyah] format 1`] = ` +"[1:18]: Expected '}' (1:18) +> 1 | import { \\"default\\" as quotation } from \\"Confucius\\"; + | ^ + 2 | import { \\"foo\\" as bar, \\"default\\" as qux } from \\"module-a\\"; + 3 | import { \\"學而時習之,不亦說乎?\\" as quotation } from \\"Confucius\\"; + 4 | " +`; + +exports[`module-string-names-import.js format 1`] = ` +====================================options===================================== +parsers: ["babel"] +printWidth: 80 + | printWidth +=====================================input====================================== +import { "default" as quotation } from "Confucius"; +import { "foo" as bar, "default" as qux } from "module-a"; +import { "學而時習之,不亦說乎?" as quotation } from "Confucius"; + +=====================================output===================================== +import { "default" as quotation } from "Confucius"; +import { "foo" as bar, "default" as qux } from "module-a"; +import { "學而時習之,不亦說乎?" as quotation } from "Confucius"; + +================================================================================ +`; diff --git a/tests/js/module-string-names/jsfmt.spec.js b/tests/js/module-string-names/jsfmt.spec.js index 726eaec01590..0fab4456dc8e 100644 --- a/tests/js/module-string-names/jsfmt.spec.js +++ b/tests/js/module-string-names/jsfmt.spec.js @@ -1 +1 @@ -run_spec(__dirname, ["babel"], { errors: { espree: true } }); +run_spec(__dirname, ["babel"], { errors: { espree: true, meriyah: true } }); diff --git a/tests/js/module-string-names/module-string-names.js b/tests/js/module-string-names/module-string-names-export.js similarity index 100% rename from tests/js/module-string-names/module-string-names.js rename to tests/js/module-string-names/module-string-names-export.js diff --git a/tests/js/module-string-names/module-string-names-import.js b/tests/js/module-string-names/module-string-names-import.js new file mode 100644 index 000000000000..84ca0d81bcec --- /dev/null +++ b/tests/js/module-string-names/module-string-names-import.js @@ -0,0 +1,3 @@ +import { "default" as quotation } from "Confucius"; +import { "foo" as bar, "default" as qux } from "module-a"; +import { "學而時習之,不亦說乎?" as quotation } from "Confucius"; diff --git a/tests/js/multiparser-invalid/__snapshots__/jsfmt.spec.js.snap b/tests/js/multiparser-invalid/__snapshots__/jsfmt.spec.js.snap index 437f6e376bc1..c5f782e1ee86 100644 --- a/tests/js/multiparser-invalid/__snapshots__/jsfmt.spec.js.snap +++ b/tests/js/multiparser-invalid/__snapshots__/jsfmt.spec.js.snap @@ -1,5 +1,45 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`text.js [espree] format 1`] = ` +"Bad escape sequence in untagged template literal (6:18) + 4 | foo = markdown\`\\\\u{prettier}\\\\u{0065}\`; + 5 | foo = css\`\\\\u{prettier}\\\\u{0065}\`; +> 6 | foo = /* HTML */\`\\\\u{prettier}\\\\u{0065}\`; + | ^ + 7 | foo = /* GraphQL */\`\\\\u{prettier}\\\\u{0065}\`; + 8 | + 9 | foo = foo\`\\\\u{prettier}\${foo}pr\\\\u{0065}ttier\`;" +`; + +exports[`text.js [flow] format 1`] = ` +"Unexpected token ILLEGAL (1:12) +> 1 | foo = foo\`\\\\u{prettier}\\\\u{0065}\`; + | ^ + 2 | foo = html\`\\\\u{prettier}\\\\u{0065}\`; + 3 | foo = graphql\`\\\\u{prettier}\\\\u{0065}\`; + 4 | foo = markdown\`\\\\u{prettier}\\\\u{0065}\`;" +`; + +exports[`text.js [meriyah] format 1`] = ` +"[6:20]: Invalid hexadecimal escape sequence (6:20) + 4 | foo = markdown\`\\\\u{prettier}\\\\u{0065}\`; + 5 | foo = css\`\\\\u{prettier}\\\\u{0065}\`; +> 6 | foo = /* HTML */\`\\\\u{prettier}\\\\u{0065}\`; + | ^ + 7 | foo = /* GraphQL */\`\\\\u{prettier}\\\\u{0065}\`; + 8 | + 9 | foo = foo\`\\\\u{prettier}\${foo}pr\\\\u{0065}ttier\`;" +`; + +exports[`text.js [typescript] format 1`] = ` +"Hexadecimal digit expected. (1:14) +> 1 | foo = foo\`\\\\u{prettier}\\\\u{0065}\`; + | ^ + 2 | foo = html\`\\\\u{prettier}\\\\u{0065}\`; + 3 | foo = graphql\`\\\\u{prettier}\\\\u{0065}\`; + 4 | foo = markdown\`\\\\u{prettier}\\\\u{0065}\`;" +`; + exports[`text.js format 1`] = ` ====================================options===================================== parsers: ["babel", "flow", "typescript"] diff --git a/tests/js/multiparser-invalid/jsfmt.spec.js b/tests/js/multiparser-invalid/jsfmt.spec.js index 6e2b8e1a6b99..06a6e2a3dce9 100644 --- a/tests/js/multiparser-invalid/jsfmt.spec.js +++ b/tests/js/multiparser-invalid/jsfmt.spec.js @@ -1,3 +1,3 @@ run_spec(__dirname, ["babel", "flow", "typescript"], { - errors: { espree: true, flow: true, typescript: true }, + errors: { espree: true, flow: true, typescript: true, meriyah: true }, }); diff --git a/tests/js/no-semi-babylon-extensions/__snapshots__/jsfmt.spec.js.snap b/tests/js/no-semi-babylon-extensions/__snapshots__/jsfmt.spec.js.snap index d778db2a3126..1419ffdcc0fc 100644 --- a/tests/js/no-semi-babylon-extensions/__snapshots__/jsfmt.spec.js.snap +++ b/tests/js/no-semi-babylon-extensions/__snapshots__/jsfmt.spec.js.snap @@ -1,5 +1,45 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`no-semi.js [espree] format 1`] = ` +"Unexpected token : (2:2) + 1 | a +> 2 | ;::b.c + | ^ + 3 | + 4 | class A { + 5 | a = b;" +`; + +exports[`no-semi.js [meriyah] format 1`] = ` +"[2:2]: Unexpected token: ':' (2:2) + 1 | a +> 2 | ;::b.c + | ^ + 3 | + 4 | class A { + 5 | a = b;" +`; + +exports[`no-semi.js - {"semi":false} [espree] format 1`] = ` +"Unexpected token : (2:2) + 1 | a +> 2 | ;::b.c + | ^ + 3 | + 4 | class A { + 5 | a = b;" +`; + +exports[`no-semi.js - {"semi":false} [meriyah] format 1`] = ` +"[2:2]: Unexpected token: ':' (2:2) + 1 | a +> 2 | ;::b.c + | ^ + 3 | + 4 | class A { + 5 | a = b;" +`; + exports[`no-semi.js - {"semi":false} format 1`] = ` ====================================options===================================== parsers: ["babel"] diff --git a/tests/js/no-semi-babylon-extensions/jsfmt.spec.js b/tests/js/no-semi-babylon-extensions/jsfmt.spec.js index 18153a1a934c..3eb482d30b87 100644 --- a/tests/js/no-semi-babylon-extensions/jsfmt.spec.js +++ b/tests/js/no-semi-babylon-extensions/jsfmt.spec.js @@ -1,2 +1,5 @@ -run_spec(__dirname, ["babel"], { errors: { espree: true } }); -run_spec(__dirname, ["babel"], { semi: false, errors: { espree: true } }); +run_spec(__dirname, ["babel"], { errors: { espree: true, meriyah: true } }); +run_spec(__dirname, ["babel"], { + semi: false, + errors: { espree: true, meriyah: true }, +}); diff --git a/tests/js/no-semi/__snapshots__/jsfmt.spec.js.snap b/tests/js/no-semi/__snapshots__/jsfmt.spec.js.snap index d50c3330831d..ec3792c20dc1 100644 --- a/tests/js/no-semi/__snapshots__/jsfmt.spec.js.snap +++ b/tests/js/no-semi/__snapshots__/jsfmt.spec.js.snap @@ -1,5 +1,27 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`class.js [espree] format 1`] = ` +"Unexpected token ; (12:6) + 10 | + 11 | class C1 { +> 12 | get; // The semicolon *is* necessary + | ^ + 13 | x(){} + 14 | } + 15 | class C2 {" +`; + +exports[`class.js - {"semi":false} [espree] format 1`] = ` +"Unexpected token ; (12:6) + 10 | + 11 | class C1 { +> 12 | get; // The semicolon *is* necessary + | ^ + 13 | x(){} + 14 | } + 15 | class C2 {" +`; + exports[`class.js - {"semi":false} format 1`] = ` ====================================options===================================== parsers: ["babel", "flow"] @@ -36,7 +58,7 @@ class C4 { -class A { +class A1 { a = 0; [b](){} @@ -74,7 +96,7 @@ class A { b = 1; } -class A { +class A2 { a = 0; [b](){} @@ -154,7 +176,7 @@ class C4 { x() {} } -class A { +class A1 { a = 0; [b]() {} @@ -192,7 +214,7 @@ class A { b = 1 } -class A { +class A2 { a = 0; [b]() {} @@ -282,7 +304,7 @@ class C4 { -class A { +class A1 { a = 0; [b](){} @@ -320,7 +342,7 @@ class A { b = 1; } -class A { +class A2 { a = 0; [b](){} @@ -400,7 +422,7 @@ class C4 { x() {} } -class A { +class A1 { a = 0; [b]() {} @@ -438,7 +460,7 @@ class A { b = 1; } -class A { +class A2 { a = 0; [b]() {} diff --git a/tests/js/no-semi/class.js b/tests/js/no-semi/class.js index 1747fe0836a2..586ea4ef615d 100644 --- a/tests/js/no-semi/class.js +++ b/tests/js/no-semi/class.js @@ -27,7 +27,7 @@ class C4 { -class A { +class A1 { a = 0; [b](){} @@ -65,7 +65,7 @@ class A { b = 1; } -class A { +class A2 { a = 0; [b](){} diff --git a/tests/js/objects/__snapshots__/jsfmt.spec.js.snap b/tests/js/objects/__snapshots__/jsfmt.spec.js.snap index e47156c4dc6d..4b85057b751a 100644 --- a/tests/js/objects/__snapshots__/jsfmt.spec.js.snap +++ b/tests/js/objects/__snapshots__/jsfmt.spec.js.snap @@ -52,6 +52,28 @@ const Component2 = ({ props }) => Test; ================================================================================ `; +exports[`expression.js [espree] format 1`] = ` +"Unexpected token : (5:4) + 3 | a = () => ({}).x; + 4 | ({} && a, b); +> 5 | ({}::b, 0); + | ^ + 6 | ({}::b()\`\`[''].c++ && 0 ? 0 : 0, 0); + 7 | ({}(), 0); + 8 | ({} = 0);" +`; + +exports[`expression.js [meriyah] format 1`] = ` +"[5:4]: Expected ')' (5:4) + 3 | a = () => ({}).x; + 4 | ({} && a, b); +> 5 | ({}::b, 0); + | ^ + 6 | ({}::b()\`\`[''].c++ && 0 ? 0 : 0, 0); + 7 | ({}(), 0); + 8 | ({} = 0);" +`; + exports[`expression.js format 1`] = ` ====================================options===================================== parsers: ["babel"] @@ -113,6 +135,28 @@ const a3 = { ================================================================================ `; +exports[`invalid-accessor-generator.js [espree] format 1`] = ` +"Unexpected token * (5:9) + 3 | + 4 | ({ +> 5 | get *iterator() { }, + | ^ + 6 | set *iterator(iter) { }, + 7 | get iterator2() { }, + 8 | set iterator2(iter) { }," +`; + +exports[`invalid-accessor-generator.js [meriyah] format 1`] = ` +"[5:9]: A getter cannot be a generator (5:9) + 3 | + 4 | ({ +> 5 | get *iterator() { }, + | ^ + 6 | set *iterator(iter) { }, + 7 | get iterator2() { }, + 8 | set iterator2(iter) { }," +`; + exports[`invalid-accessor-generator.js format 1`] = ` ====================================options===================================== parsers: ["babel"] @@ -143,6 +187,20 @@ printWidth: 80 ================================================================================ `; +exports[`invalid-setter.js [espree] format 1`] = ` +"setter should have exactly one param (1:9) +> 1 | ({ set x(){} }); + | ^ + 2 | " +`; + +exports[`invalid-setter.js [meriyah] format 1`] = ` +"[1:10]: Setter functions must have exactly one argument (1:10) +> 1 | ({ set x(){} }); + | ^ + 2 | " +`; + exports[`invalid-setter.js format 1`] = ` ====================================options===================================== parsers: ["babel"] diff --git a/tests/js/objects/jsfmt.spec.js b/tests/js/objects/jsfmt.spec.js index 74867c290696..432d0d511191 100644 --- a/tests/js/objects/jsfmt.spec.js +++ b/tests/js/objects/jsfmt.spec.js @@ -5,5 +5,10 @@ run_spec(__dirname, ["babel"], { "invalid-accessor-generator.js", "invalid-setter.js", ], + meriyah: [ + "expression.js", + "invalid-accessor-generator.js", + "invalid-setter.js", + ], }, }); diff --git a/tests/js/partial-application/__snapshots__/jsfmt.spec.js.snap b/tests/js/partial-application/__snapshots__/jsfmt.spec.js.snap index 35628806dbc0..4d92092e5b89 100644 --- a/tests/js/partial-application/__snapshots__/jsfmt.spec.js.snap +++ b/tests/js/partial-application/__snapshots__/jsfmt.spec.js.snap @@ -1,5 +1,23 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`test.js [espree] format 1`] = ` +"Unexpected token ? (1:23) +> 1 | const addOne = add(1, ?); // apply from the left + | ^ + 2 | addOne(2); // 3 + 3 | + 4 | const addTen = add(?, 10); // apply from the right" +`; + +exports[`test.js [meriyah] format 1`] = ` +"[1:23]: Unexpected token: '?' (1:23) +> 1 | const addOne = add(1, ?); // apply from the left + | ^ + 2 | addOne(2); // 3 + 3 | + 4 | const addTen = add(?, 10); // apply from the right" +`; + exports[`test.js format 1`] = ` ====================================options===================================== parsers: ["babel"] diff --git a/tests/js/partial-application/jsfmt.spec.js b/tests/js/partial-application/jsfmt.spec.js index 726eaec01590..0fab4456dc8e 100644 --- a/tests/js/partial-application/jsfmt.spec.js +++ b/tests/js/partial-application/jsfmt.spec.js @@ -1 +1 @@ -run_spec(__dirname, ["babel"], { errors: { espree: true } }); +run_spec(__dirname, ["babel"], { errors: { espree: true, meriyah: true } }); diff --git a/tests/js/pipeline-operator/__snapshots__/jsfmt.spec.js.snap b/tests/js/pipeline-operator/__snapshots__/jsfmt.spec.js.snap index 0c818807379e..a25032b01820 100644 --- a/tests/js/pipeline-operator/__snapshots__/jsfmt.spec.js.snap +++ b/tests/js/pipeline-operator/__snapshots__/jsfmt.spec.js.snap @@ -1,5 +1,25 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`block-comments.js [espree] format 1`] = ` +"Unexpected token > (2:2) + 1 | bifornCringerMoshedPerplexSawder +> 2 | |> foo1 + | ^ + 3 | |> foo2 /* comment1 */ + 4 | |> foo3 /* comment2 */ + 5 | |> kochabCooieGameOnOboleUnweave" +`; + +exports[`block-comments.js [meriyah] format 1`] = ` +"[2:2]: Unexpected token: '>' (2:2) + 1 | bifornCringerMoshedPerplexSawder +> 2 | |> foo1 + | ^ + 3 | |> foo2 /* comment1 */ + 4 | |> foo3 /* comment2 */ + 5 | |> kochabCooieGameOnOboleUnweave" +`; + exports[`block-comments.js format 1`] = ` ====================================options===================================== parsers: ["babel"] @@ -24,6 +44,26 @@ bifornCringerMoshedPerplexSawder ================================================================================ `; +exports[`fsharp_style_pipeline_operator.js [espree] format 1`] = ` +"Unexpected token > (2:4) + 1 | promise +> 2 | |> await + | ^ + 3 | |> x => doubleSay(x, ', ') + 4 | |> capitalize + 5 | |> x => x + '!'" +`; + +exports[`fsharp_style_pipeline_operator.js [meriyah] format 1`] = ` +"[2:4]: Unexpected token: '>' (2:4) + 1 | promise +> 2 | |> await + | ^ + 3 | |> x => doubleSay(x, ', ') + 4 | |> capitalize + 5 | |> x => x + '!'" +`; + exports[`fsharp_style_pipeline_operator.js format 1`] = ` ====================================options===================================== parsers: ["babel"] @@ -119,6 +159,24 @@ const f = x |> (f) => f |> f; ================================================================================ `; +exports[`minimal_pipeline_operator.js [espree] format 1`] = ` +"Unexpected token > (1:4) +> 1 | a |> b |> c; + | ^ + 2 | + 3 | a |> (b |> c); + 4 | " +`; + +exports[`minimal_pipeline_operator.js [meriyah] format 1`] = ` +"[1:4]: Unexpected token: '>' (1:4) +> 1 | a |> b |> c; + | ^ + 2 | + 3 | a |> (b |> c); + 4 | " +`; + exports[`minimal_pipeline_operator.js format 1`] = ` ====================================options===================================== parsers: ["babel"] @@ -230,6 +288,24 @@ const result2 = [4, 9].map((x) => x |> inc |> double); ================================================================================ `; +exports[`smart_pipeline_operator.js [espree] format 1`] = ` +"Unexpected token > (1:4) +> 1 | a |> await # |> # * 3; + | ^ + 2 | + 3 | foo + 4 | |> await #" +`; + +exports[`smart_pipeline_operator.js [meriyah] format 1`] = ` +"[1:4]: Unexpected token: '>' (1:4) +> 1 | a |> await # |> # * 3; + | ^ + 2 | + 3 | foo + 4 | |> await #" +`; + exports[`smart_pipeline_operator.js format 1`] = ` ====================================options===================================== parsers: ["babel"] diff --git a/tests/js/pipeline-operator/jsfmt.spec.js b/tests/js/pipeline-operator/jsfmt.spec.js index 726eaec01590..0fab4456dc8e 100644 --- a/tests/js/pipeline-operator/jsfmt.spec.js +++ b/tests/js/pipeline-operator/jsfmt.spec.js @@ -1 +1 @@ -run_spec(__dirname, ["babel"], { errors: { espree: true } }); +run_spec(__dirname, ["babel"], { errors: { espree: true, meriyah: true } }); diff --git a/tests/js/private-in/__snapshots__/jsfmt.spec.js.snap b/tests/js/private-in/__snapshots__/jsfmt.spec.js.snap index 8e01adb9449e..d2d8b4cf8580 100644 --- a/tests/js/private-in/__snapshots__/jsfmt.spec.js.snap +++ b/tests/js/private-in/__snapshots__/jsfmt.spec.js.snap @@ -1,5 +1,14 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`private-in.js [espree] format 1`] = ` +"Unexpected character '#' (1:5) +> 1 | if (#prop in obj) { + | ^ + 2 | } + 3 | + 4 | #prop in obj;" +`; + exports[`private-in.js format 1`] = ` ====================================options===================================== parsers: ["babel"] diff --git a/tests/js/quote-props/__snapshots__/jsfmt.spec.js.snap b/tests/js/quote-props/__snapshots__/jsfmt.spec.js.snap index 607faf8b47ce..83682b7920fa 100644 --- a/tests/js/quote-props/__snapshots__/jsfmt.spec.js.snap +++ b/tests/js/quote-props/__snapshots__/jsfmt.spec.js.snap @@ -1,5 +1,15 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`classes.js - {"quoteProps":"as-needed"} [espree] format 1`] = ` +"Unexpected token = (2:5) + 1 | class A { +> 2 | a = \\"a\\" + | ^ + 3 | }; + 4 | + 5 | class B {" +`; + exports[`classes.js - {"quoteProps":"as-needed"} format 1`] = ` ====================================options===================================== parsers: ["babel"] @@ -47,6 +57,16 @@ class D { ================================================================================ `; +exports[`classes.js - {"quoteProps":"consistent","singleQuote":true} [espree] format 1`] = ` +"Unexpected token = (2:5) + 1 | class A { +> 2 | a = \\"a\\" + | ^ + 3 | }; + 4 | + 5 | class B {" +`; + exports[`classes.js - {"quoteProps":"consistent","singleQuote":true} format 1`] = ` ====================================options===================================== parsers: ["babel"] @@ -95,6 +115,16 @@ class D { ================================================================================ `; +exports[`classes.js - {"quoteProps":"consistent"} [espree] format 1`] = ` +"Unexpected token = (2:5) + 1 | class A { +> 2 | a = \\"a\\" + | ^ + 3 | }; + 4 | + 5 | class B {" +`; + exports[`classes.js - {"quoteProps":"consistent"} format 1`] = ` ====================================options===================================== parsers: ["babel"] @@ -142,6 +172,16 @@ class D { ================================================================================ `; +exports[`classes.js - {"quoteProps":"preserve"} [espree] format 1`] = ` +"Unexpected token = (2:5) + 1 | class A { +> 2 | a = \\"a\\" + | ^ + 3 | }; + 4 | + 5 | class B {" +`; + exports[`classes.js - {"quoteProps":"preserve"} format 1`] = ` ====================================options===================================== parsers: ["babel"] diff --git a/tests/js/quote-props/jsfmt.spec.js b/tests/js/quote-props/jsfmt.spec.js index cec36fee178b..3939c465ac60 100644 --- a/tests/js/quote-props/jsfmt.spec.js +++ b/tests/js/quote-props/jsfmt.spec.js @@ -1,4 +1,6 @@ -const errors = { espree: ["classes.js"] }; +const errors = { + espree: ["classes.js"], +}; run_spec(__dirname, ["babel"], { quoteProps: "as-needed", diff --git a/tests/js/record/__snapshots__/jsfmt.spec.js.snap b/tests/js/record/__snapshots__/jsfmt.spec.js.snap index 19c846580527..71e89b736966 100644 --- a/tests/js/record/__snapshots__/jsfmt.spec.js.snap +++ b/tests/js/record/__snapshots__/jsfmt.spec.js.snap @@ -1,5 +1,25 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`computed.js [espree] format 1`] = ` +"Unexpected character '#' (2:8) + 1 | const key = \\"a\\"; +> 2 | assert(#{ [key]: 1 } === #{ a: 1 }) + | ^ + 3 | assert(#{ [key.toUpperCase()]: 1 } === #{ A: 1 }) + 4 | + 5 | assert(#{ [true]: 1 } === #{ true: 1 })" +`; + +exports[`computed.js [meriyah] format 1`] = ` +"[2:8]: '#' not followed by identifier (2:8) + 1 | const key = \\"a\\"; +> 2 | assert(#{ [key]: 1 } === #{ a: 1 }) + | ^ + 3 | assert(#{ [key.toUpperCase()]: 1 } === #{ A: 1 }) + 4 | + 5 | assert(#{ [true]: 1 } === #{ true: 1 })" +`; + exports[`computed.js format 1`] = ` ====================================options===================================== parsers: ["babel"] @@ -30,6 +50,24 @@ assert(#{ [9 + 1]: "ten" } === #{ ["10"]: "ten" }); ================================================================================ `; +exports[`destructuring.js [espree] format 1`] = ` +"Unexpected character '#' (1:18) +> 1 | const { a, b } = #{ a: 1, b: 2 }; + | ^ + 2 | assert(a === 1); + 3 | assert(b === 2); + 4 | " +`; + +exports[`destructuring.js [meriyah] format 1`] = ` +"[1:18]: '#' not followed by identifier (1:18) +> 1 | const { a, b } = #{ a: 1, b: 2 }; + | ^ + 2 | assert(a === 1); + 3 | assert(b === 2); + 4 | " +`; + exports[`destructuring.js format 1`] = ` ====================================options===================================== parsers: ["babel"] @@ -60,6 +98,28 @@ assert(rest.c === 3); ================================================================================ `; +exports[`invalid-record-method.js [espree] format 1`] = ` +"Unexpected character '#' (3:1) + 1 | // Invalid, https://github.com/babel/babel/pull/11652/ + 2 | +> 3 | #{ + | ^ + 4 | a() {}, + 5 | async b() {}, + 6 | get c() {}," +`; + +exports[`invalid-record-method.js [meriyah] format 1`] = ` +"[3:1]: '#' not followed by identifier (3:1) + 1 | // Invalid, https://github.com/babel/babel/pull/11652/ + 2 | +> 3 | #{ + | ^ + 4 | a() {}, + 5 | async b() {}, + 6 | get c() {}," +`; + exports[`invalid-record-method.js format 1`] = ` ====================================options===================================== parsers: ["babel"] @@ -90,6 +150,24 @@ printWidth: 80 ================================================================================ `; +exports[`record.js [espree] format 1`] = ` +"Unexpected character '#' (1:17) +> 1 | const record1 = #{ + | ^ + 2 | a: 1, + 3 | b: 2, + 4 | c: 3," +`; + +exports[`record.js [meriyah] format 1`] = ` +"[1:17]: '#' not followed by identifier (1:17) +> 1 | const record1 = #{ + | ^ + 2 | a: 1, + 3 | b: 2, + 4 | c: 3," +`; + exports[`record.js format 1`] = ` ====================================options===================================== parsers: ["babel"] @@ -134,6 +212,24 @@ assert(record1.d?.a === undefined); ================================================================================ `; +exports[`shorthand.js [espree] format 1`] = ` +"Unexpected character '#' (2:16) + 1 | const url = \\"https://github.com/tc39/proposal-record-tuple\\"; +> 2 | const record = #{ url } + | ^ + 3 | console.log(record.url) // https://github.com/tc39/proposal-record-tuple + 4 | " +`; + +exports[`shorthand.js [meriyah] format 1`] = ` +"[2:16]: '#' not followed by identifier (2:16) + 1 | const url = \\"https://github.com/tc39/proposal-record-tuple\\"; +> 2 | const record = #{ url } + | ^ + 3 | console.log(record.url) // https://github.com/tc39/proposal-record-tuple + 4 | " +`; + exports[`shorthand.js format 1`] = ` ====================================options===================================== parsers: ["babel"] @@ -152,6 +248,24 @@ console.log(record.url); // https://github.com/tc39/proposal-record-tuple ================================================================================ `; +exports[`spread.js [espree] format 1`] = ` +"Unexpected character '#' (1:18) +> 1 | const formData = #{ title: \\"Implement all the things\\" } + | ^ + 2 | const taskNow = #{ id: 42, status: \\"WIP\\", ...formData } + 3 | const taskLater = #{ ...taskNow, status: \\"DONE\\" } + 4 | " +`; + +exports[`spread.js [meriyah] format 1`] = ` +"[1:18]: '#' not followed by identifier (1:18) +> 1 | const formData = #{ title: \\"Implement all the things\\" } + | ^ + 2 | const taskNow = #{ id: 42, status: \\"WIP\\", ...formData } + 3 | const taskLater = #{ ...taskNow, status: \\"DONE\\" } + 4 | " +`; + exports[`spread.js format 1`] = ` ====================================options===================================== parsers: ["babel"] @@ -176,6 +290,24 @@ assert(taskLater === #{ status: "DONE", title: formData.title, id: 42 }); ================================================================================ `; +exports[`syntax.js [espree] format 1`] = ` +"Unexpected character '#' (1:1) +> 1 | #{} + | ^ + 2 | #{ a: 1, b: 2 } + 3 | #{ a: 1, b: #[2, 3, #{ c: 4 }] } + 4 | " +`; + +exports[`syntax.js [meriyah] format 1`] = ` +"[1:1]: '#' not followed by identifier (1:1) +> 1 | #{} + | ^ + 2 | #{ a: 1, b: 2 } + 3 | #{ a: 1, b: #[2, 3, #{ c: 4 }] } + 4 | " +`; + exports[`syntax.js format 1`] = ` ====================================options===================================== parsers: ["babel"] diff --git a/tests/js/record/jsfmt.spec.js b/tests/js/record/jsfmt.spec.js index 726eaec01590..0fab4456dc8e 100644 --- a/tests/js/record/jsfmt.spec.js +++ b/tests/js/record/jsfmt.spec.js @@ -1 +1 @@ -run_spec(__dirname, ["babel"], { errors: { espree: true } }); +run_spec(__dirname, ["babel"], { errors: { espree: true, meriyah: true } }); diff --git a/tests/js/reserved-word/__snapshots__/jsfmt.spec.js.snap b/tests/js/reserved-word/__snapshots__/jsfmt.spec.js.snap new file mode 100644 index 000000000000..797ffc7d403c --- /dev/null +++ b/tests/js/reserved-word/__snapshots__/jsfmt.spec.js.snap @@ -0,0 +1,59 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`interfaces.js [espree] format 1`] = ` +"The keyword 'interface' is reserved (1:1) +> 1 | interface = \\"foo\\"; + | ^ + 2 | interface + 3; + 3 | interface(); + 4 | class interface {}" +`; + +exports[`interfaces.js [meriyah] format 1`] = ` +"[1:9]: Unexpected token: 'interface' (1:9) +> 1 | interface = \\"foo\\"; + | ^ + 2 | interface + 3; + 3 | interface(); + 4 | class interface {}" +`; + +exports[`interfaces.js format 1`] = ` +====================================options===================================== +parsers: ["babel"] +printWidth: 80 + | printWidth +=====================================input====================================== +interface = "foo"; +interface + 3; +interface(); +class interface {} +interface ? true : false; +function interface() {} +import interface from "foo"; +foo.interface; +interface.foo; +new interface(); +({ interface: "foo" }); +(interface, "foo"); +void interface; +const interface = "foo"; + +=====================================output===================================== +interface = "foo"; +interface + 3; +interface(); +class interface {} +interface ? true : false; +function interface() {} +import interface from "foo"; +foo.interface; +interface.foo; +new interface(); +({ interface: "foo" }); +interface, "foo"; +void interface; +const interface = "foo"; + +================================================================================ +`; diff --git a/tests/js/reserved-word/interfaces.js b/tests/js/reserved-word/interfaces.js new file mode 100644 index 000000000000..2ce057e27fd8 --- /dev/null +++ b/tests/js/reserved-word/interfaces.js @@ -0,0 +1,14 @@ +interface = "foo"; +interface + 3; +interface(); +class interface {} +interface ? true : false; +function interface() {} +import interface from "foo"; +foo.interface; +interface.foo; +new interface(); +({ interface: "foo" }); +(interface, "foo"); +void interface; +const interface = "foo"; diff --git a/tests/js/reserved-word/jsfmt.spec.js b/tests/js/reserved-word/jsfmt.spec.js new file mode 100644 index 000000000000..0fab4456dc8e --- /dev/null +++ b/tests/js/reserved-word/jsfmt.spec.js @@ -0,0 +1 @@ +run_spec(__dirname, ["babel"], { errors: { espree: true, meriyah: true } }); diff --git a/tests/js/rest/__snapshots__/jsfmt.spec.js.snap b/tests/js/rest/__snapshots__/jsfmt.spec.js.snap index 528c935ce8dd..0c9c293cd5c9 100644 --- a/tests/js/rest/__snapshots__/jsfmt.spec.js.snap +++ b/tests/js/rest/__snapshots__/jsfmt.spec.js.snap @@ -1,5 +1,23 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`trailing-commas.js - {"trailingComma":"all"} [espree] format 1`] = ` +"Unexpected token class (1:9) +> 1 | declare class C { + | ^ + 2 | f( + 3 | superSuperSuperSuperSuperSuperSuperSuperSuperSuperSuperSuperSuperSuperLong, + 4 | ...args" +`; + +exports[`trailing-commas.js - {"trailingComma":"all"} [meriyah] format 1`] = ` +"[1:13]: Unexpected token: 'class' (1:13) +> 1 | declare class C { + | ^ + 2 | f( + 3 | superSuperSuperSuperSuperSuperSuperSuperSuperSuperSuperSuperSuperSuperLong, + 4 | ...args" +`; + exports[`trailing-commas.js - {"trailingComma":"all"} format 1`] = ` ====================================options===================================== parsers: ["babel", "flow"] diff --git a/tests/js/rest/jsfmt.spec.js b/tests/js/rest/jsfmt.spec.js index 98fb7f5cafe6..2a762db04261 100644 --- a/tests/js/rest/jsfmt.spec.js +++ b/tests/js/rest/jsfmt.spec.js @@ -1,4 +1,4 @@ run_spec(__dirname, ["babel", "flow"], { trailingComma: "all", - errors: { espree: true }, + errors: { espree: true, meriyah: true }, }); diff --git a/tests/js/throw_expressions/__snapshots__/jsfmt.spec.js.snap b/tests/js/throw_expressions/__snapshots__/jsfmt.spec.js.snap index 1180a797d4f0..4d2513a7dc96 100644 --- a/tests/js/throw_expressions/__snapshots__/jsfmt.spec.js.snap +++ b/tests/js/throw_expressions/__snapshots__/jsfmt.spec.js.snap @@ -1,5 +1,23 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`throw_expression.js [espree] format 1`] = ` +"Unexpected token throw (1:26) +> 1 | function save(filename = throw new TypeError(\\"Argument required\\")) {} + | ^ + 2 | + 3 | lint(ast, { + 4 | with: () => throw new Error(\\"avoid using 'with' statements.\\")" +`; + +exports[`throw_expression.js [meriyah] format 1`] = ` +"[1:30]: Unexpected token: 'throw' (1:30) +> 1 | function save(filename = throw new TypeError(\\"Argument required\\")) {} + | ^ + 2 | + 3 | lint(ast, { + 4 | with: () => throw new Error(\\"avoid using 'with' statements.\\")" +`; + exports[`throw_expression.js format 1`] = ` ====================================options===================================== parsers: ["babel"] diff --git a/tests/js/throw_expressions/jsfmt.spec.js b/tests/js/throw_expressions/jsfmt.spec.js index 726eaec01590..0fab4456dc8e 100644 --- a/tests/js/throw_expressions/jsfmt.spec.js +++ b/tests/js/throw_expressions/jsfmt.spec.js @@ -1 +1 @@ -run_spec(__dirname, ["babel"], { errors: { espree: true } }); +run_spec(__dirname, ["babel"], { errors: { espree: true, meriyah: true } }); diff --git a/tests/js/top-level-await/__snapshots__/jsfmt.spec.js.snap b/tests/js/top-level-await/__snapshots__/jsfmt.spec.js.snap index 04b2cd75cf92..937de6b840e1 100644 --- a/tests/js/top-level-await/__snapshots__/jsfmt.spec.js.snap +++ b/tests/js/top-level-await/__snapshots__/jsfmt.spec.js.snap @@ -1,5 +1,19 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`example.js [espree] format 1`] = ` +"Cannot use keyword 'await' outside an async function (1:1) +> 1 | await something(); + | ^ + 2 | " +`; + +exports[`example.js [meriyah] format 1`] = ` +"[1:5]: 'Await' may not be used as an identifier in this context (1:5) +> 1 | await something(); + | ^ + 2 | " +`; + exports[`example.js format 1`] = ` ====================================options===================================== parsers: ["babel", "typescript"] diff --git a/tests/js/top-level-await/jsfmt.spec.js b/tests/js/top-level-await/jsfmt.spec.js index 7d3544f4b628..93e955c848a7 100644 --- a/tests/js/top-level-await/jsfmt.spec.js +++ b/tests/js/top-level-await/jsfmt.spec.js @@ -1 +1,3 @@ -run_spec(__dirname, ["babel", "typescript"], { errors: { espree: true } }); +run_spec(__dirname, ["babel", "typescript"], { + errors: { espree: true, meriyah: true }, +}); diff --git a/tests/js/trailing-whitespace/__snapshots__/jsfmt.spec.js.snap b/tests/js/trailing-whitespace/__snapshots__/jsfmt.spec.js.snap index ceb8d16278ff..f4f990be58f2 100644 --- a/tests/js/trailing-whitespace/__snapshots__/jsfmt.spec.js.snap +++ b/tests/js/trailing-whitespace/__snapshots__/jsfmt.spec.js.snap @@ -1,5 +1,23 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`trailing.js [espree] format 1`] = ` +"Unexpected token type (1:8) +> 1 | export type Result = | { kind: \\"not-test-editor1\\" } | { kind: \\"not-test-editor2\\" }; + | ^ + 2 | + 3 | // Note: there are trailing whitespace in this file + 4 | \`" +`; + +exports[`trailing.js [meriyah] format 1`] = ` +"[1:11]: Unexpected token: 'identifier' (1:11) +> 1 | export type Result = | { kind: \\"not-test-editor1\\" } | { kind: \\"not-test-editor2\\" }; + | ^ + 2 | + 3 | // Note: there are trailing whitespace in this file + 4 | \`" +`; + exports[`trailing.js format 1`] = ` ====================================options===================================== parsers: ["babel", "flow", "typescript"] diff --git a/tests/js/trailing-whitespace/jsfmt.spec.js b/tests/js/trailing-whitespace/jsfmt.spec.js index 4e2e7967220b..5a410ee235db 100644 --- a/tests/js/trailing-whitespace/jsfmt.spec.js +++ b/tests/js/trailing-whitespace/jsfmt.spec.js @@ -1,3 +1,3 @@ run_spec(__dirname, ["babel", "flow", "typescript"], { - errors: { espree: true }, + errors: { espree: true, meriyah: true }, }); diff --git a/tests/js/tuple/__snapshots__/jsfmt.spec.js.snap b/tests/js/tuple/__snapshots__/jsfmt.spec.js.snap index b4f54554812a..68255cd61fb1 100644 --- a/tests/js/tuple/__snapshots__/jsfmt.spec.js.snap +++ b/tests/js/tuple/__snapshots__/jsfmt.spec.js.snap @@ -1,5 +1,23 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`destructuring.js [espree] format 1`] = ` +"Unexpected character '#' (1:16) +> 1 | const [a, b] = #[1, 2]; + | ^ + 2 | assert(a === 1); + 3 | assert(b === 2); + 4 | " +`; + +exports[`destructuring.js [meriyah] format 1`] = ` +"[1:16]: '#' not followed by identifier (1:16) +> 1 | const [a, b] = #[1, 2]; + | ^ + 2 | assert(a === 1); + 3 | assert(b === 2); + 4 | " +`; + exports[`destructuring.js format 1`] = ` ====================================options===================================== parsers: ["babel"] @@ -30,6 +48,20 @@ assert(rest[1] === 3); ================================================================================ `; +exports[`invalid-tuple-holes.js [espree] format 1`] = ` +"Unexpected character '#' (1:1) +> 1 | #[,] + | ^ + 2 | " +`; + +exports[`invalid-tuple-holes.js [meriyah] format 1`] = ` +"[1:1]: '#' not followed by identifier (1:1) +> 1 | #[,] + | ^ + 2 | " +`; + exports[`invalid-tuple-holes.js format 1`] = ` ====================================options===================================== parsers: ["babel"] @@ -44,6 +76,24 @@ printWidth: 80 ================================================================================ `; +exports[`syntax.js [espree] format 1`] = ` +"Unexpected character '#' (1:1) +> 1 | #[] + | ^ + 2 | #[1, 2] + 3 | #[1, 2, #{ a: 3 }] + 4 | " +`; + +exports[`syntax.js [meriyah] format 1`] = ` +"[1:1]: '#' not followed by identifier (1:1) +> 1 | #[] + | ^ + 2 | #[1, 2] + 3 | #[1, 2, #{ a: 3 }] + 4 | " +`; + exports[`syntax.js format 1`] = ` ====================================options===================================== parsers: ["babel"] @@ -62,6 +112,24 @@ printWidth: 80 ================================================================================ `; +exports[`tuple.js [espree] format 1`] = ` +"Unexpected character '#' (1:16) +> 1 | const tuple1 = #[1, 2, 3]; + | ^ + 2 | + 3 | assert(tuple1[0] === 1); + 4 | " +`; + +exports[`tuple.js [meriyah] format 1`] = ` +"[1:16]: '#' not followed by identifier (1:16) +> 1 | const tuple1 = #[1, 2, 3]; + | ^ + 2 | + 3 | assert(tuple1[0] === 1); + 4 | " +`; + exports[`tuple.js format 1`] = ` ====================================options===================================== parsers: ["babel"] @@ -108,6 +176,20 @@ assert(tuple5 === #[2, 2, 3, 4]); ================================================================================ `; +exports[`tuple-trailing-comma.js [espree] format 1`] = ` +"Unexpected character '#' (1:1) +> 1 | #[1,] + | ^ + 2 | " +`; + +exports[`tuple-trailing-comma.js [meriyah] format 1`] = ` +"[1:1]: '#' not followed by identifier (1:1) +> 1 | #[1,] + | ^ + 2 | " +`; + exports[`tuple-trailing-comma.js format 1`] = ` ====================================options===================================== parsers: ["babel"] diff --git a/tests/js/tuple/jsfmt.spec.js b/tests/js/tuple/jsfmt.spec.js index 726eaec01590..0fab4456dc8e 100644 --- a/tests/js/tuple/jsfmt.spec.js +++ b/tests/js/tuple/jsfmt.spec.js @@ -1 +1 @@ -run_spec(__dirname, ["babel"], { errors: { espree: true } }); +run_spec(__dirname, ["babel"], { errors: { espree: true, meriyah: true } }); diff --git a/tests/js/v8_intrinsic/__snapshots__/jsfmt.spec.js.snap b/tests/js/v8_intrinsic/__snapshots__/jsfmt.spec.js.snap index 961369628704..e9919cda5177 100644 --- a/tests/js/v8_intrinsic/__snapshots__/jsfmt.spec.js.snap +++ b/tests/js/v8_intrinsic/__snapshots__/jsfmt.spec.js.snap @@ -1,5 +1,25 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`intrinsic_call.js [espree] format 1`] = ` +"Unexpected token % (2:13) + 1 | function doSmth() { +> 2 | %DebugPrint + | ^ + 3 | ( + 4 | foo ) + 5 | }" +`; + +exports[`intrinsic_call.js [meriyah] format 1`] = ` +"[2:13]: Unexpected token: '%' (2:13) + 1 | function doSmth() { +> 2 | %DebugPrint + | ^ + 3 | ( + 4 | foo ) + 5 | }" +`; + exports[`intrinsic_call.js format 1`] = ` ====================================options===================================== parsers: ["babel"] diff --git a/tests/js/v8_intrinsic/jsfmt.spec.js b/tests/js/v8_intrinsic/jsfmt.spec.js index 726eaec01590..0fab4456dc8e 100644 --- a/tests/js/v8_intrinsic/jsfmt.spec.js +++ b/tests/js/v8_intrinsic/jsfmt.spec.js @@ -1 +1 @@ -run_spec(__dirname, ["babel"], { errors: { espree: true } }); +run_spec(__dirname, ["babel"], { errors: { espree: true, meriyah: true } }); diff --git a/tests/js/variable_declarator/__snapshots__/jsfmt.spec.js.snap b/tests/js/variable_declarator/__snapshots__/jsfmt.spec.js.snap index a89b178417dc..12ff04f0f920 100644 --- a/tests/js/variable_declarator/__snapshots__/jsfmt.spec.js.snap +++ b/tests/js/variable_declarator/__snapshots__/jsfmt.spec.js.snap @@ -1,5 +1,26 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`invalid-const.js [espree] format 1`] = ` +"Unexpected token ; (1:10) +> 1 | const foo; + | ^ + 2 | " +`; + +exports[`invalid-const.js [flow] format 1`] = ` +"Const must be initialized (1:7) +> 1 | const foo; + | ^^^ + 2 | " +`; + +exports[`invalid-const.js [meriyah] format 1`] = ` +"[1:10]: Missing initializer in const declaration (1:10) +> 1 | const foo; + | ^ + 2 | " +`; + exports[`invalid-const.js format 1`] = ` ====================================options===================================== parsers: ["babel", "flow", "typescript"] diff --git a/tests/js/variable_declarator/jsfmt.spec.js b/tests/js/variable_declarator/jsfmt.spec.js index 7ad187763274..4bc05ead07fd 100644 --- a/tests/js/variable_declarator/jsfmt.spec.js +++ b/tests/js/variable_declarator/jsfmt.spec.js @@ -2,5 +2,6 @@ run_spec(__dirname, ["babel", "flow", "typescript"], { errors: { espree: ["invalid-const.js"], flow: ["invalid-const.js"], + meriyah: ["invalid-const.js"], }, }); diff --git a/tests/js/yield/__snapshots__/jsfmt.spec.js.snap b/tests/js/yield/__snapshots__/jsfmt.spec.js.snap index efcb49b53841..a2425bb19e70 100644 --- a/tests/js/yield/__snapshots__/jsfmt.spec.js.snap +++ b/tests/js/yield/__snapshots__/jsfmt.spec.js.snap @@ -1,5 +1,16 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`arrow.js [meriyah] format 1`] = ` +"[3:14]: Expected ')' (3:14) + 1 | function *f() { + 2 | (yield a => a); +> 3 | (yield async a => a); + | ^ + 4 | (yield async (a) => a); + 5 | } + 6 | " +`; + exports[`arrow.js format 1`] = ` ====================================options===================================== parsers: ["babel", "typescript"] diff --git a/tests/js/yield/jsfmt.spec.js b/tests/js/yield/jsfmt.spec.js index 858ac91aadcc..b5e48a42878a 100644 --- a/tests/js/yield/jsfmt.spec.js +++ b/tests/js/yield/jsfmt.spec.js @@ -1 +1,3 @@ -run_spec(__dirname, ["babel", "typescript"]); +run_spec(__dirname, ["babel", "typescript"], { + errors: { meriyah: ["arrow.js"] }, +}); diff --git a/tests/misc/errors/babel-ts/__snapshots__/jsfmt.spec.js.snap b/tests/misc/errors/babel-ts/__snapshots__/jsfmt.spec.js.snap index 63d4dde0ac58..e5c3104547cb 100644 --- a/tests/misc/errors/babel-ts/__snapshots__/jsfmt.spec.js.snap +++ b/tests/misc/errors/babel-ts/__snapshots__/jsfmt.spec.js.snap @@ -13,3 +13,14 @@ exports[`type-annotation-func.ts error test 1`] = ` | ^ 2 | " `; + +exports[`type-annotation-in-jsx.tsx error test 1`] = ` +"Did not expect a type annotation here. (3:22) + 1 | function Foo() { + 2 | return ( +> 3 |
+ | ^ + 4 | ); + 5 | } + 6 | " +`; diff --git a/tests/misc/errors/babel-ts/type-annotation-in-jsx.tsx b/tests/misc/errors/babel-ts/type-annotation-in-jsx.tsx new file mode 100644 index 000000000000..ae4343ec3e21 --- /dev/null +++ b/tests/misc/errors/babel-ts/type-annotation-in-jsx.tsx @@ -0,0 +1,5 @@ +function Foo() { + return ( +
+ ); +} diff --git a/tests/misc/errors/invalid/__snapshots__/jsfmt.spec.js.snap b/tests/misc/errors/invalid/__snapshots__/jsfmt.spec.js.snap new file mode 100644 index 000000000000..0c8fd5a18988 --- /dev/null +++ b/tests/misc/errors/invalid/__snapshots__/jsfmt.spec.js.snap @@ -0,0 +1,37 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`snippet: #0 error test 1`] = ` +"Unexpected token, expected \\"(\\" (1:5) +> 1 | for each (a in b) {} + | ^" +`; + +exports[`snippet: #0 error test 2`] = ` +"Unexpected identifier, expected the token \`(\` (1:5) +> 1 | for each (a in b) {} + | ^^^^" +`; + +exports[`snippet: #0 error test 3`] = ` +"'(' expected. (1:5) +> 1 | for each (a in b) {} + | ^" +`; + +exports[`snippet: #0 error test 4`] = ` +"Unexpected token, expected \\"(\\" (1:5) +> 1 | for each (a in b) {} + | ^" +`; + +exports[`snippet: #0 error test 5`] = ` +"Unexpected token, expected \\"(\\" (1:5) +> 1 | for each (a in b) {} + | ^" +`; + +exports[`snippet: #0 error test 6`] = ` +"Unexpected token each (1:5) +> 1 | for each (a in b) {} + | ^" +`; diff --git a/tests/misc/errors/invalid/jsfmt.spec.js b/tests/misc/errors/invalid/jsfmt.spec.js new file mode 100644 index 000000000000..a8e44852b798 --- /dev/null +++ b/tests/misc/errors/invalid/jsfmt.spec.js @@ -0,0 +1,16 @@ +for (const parser of [ + "babel", + "flow", + "typescript", + "babel-flow", + "babel-ts", + "espree", +]) { + run_spec( + { + dirname: __dirname, + snippets: ["for each (a in b) {}"], + }, + [parser] + ); +} diff --git a/tests/misc/errors/js/__snapshots__/jsfmt.spec.js.snap b/tests/misc/errors/js/__snapshots__/jsfmt.spec.js.snap index 5354a8b1c146..8c01590d2d70 100644 --- a/tests/misc/errors/js/__snapshots__/jsfmt.spec.js.snap +++ b/tests/misc/errors/js/__snapshots__/jsfmt.spec.js.snap @@ -11,6 +11,13 @@ exports[`html-like-comments.js error test 1`] = ` 6 | " `; +exports[`import-assertions-for-export-without-from.js error test 1`] = ` +"Unexpected token, expected \\";\\" (1:16) +> 1 | export { foo } assert { type: \\"json\\" }; + | ^ + 2 | " +`; + exports[`import-assertions-with-parens.js error test 1`] = ` "Unexpected token (1:19) > 1 | import \\"x\\" assert ({type: 'json'}); @@ -25,14 +32,6 @@ exports[`module-attributes.js error test 1`] = ` 2 | " `; -exports[`module-string-name-import.js error test 1`] = ` -"Unexpected token (2:10) - 1 | // https://github.com/babel/babel/issues/12209 -> 2 | import { \\"foo\\" as foo } from \\"module-a\\"; - | ^ - 3 | " -`; - exports[`no-for-in-init-concise-binary-in.js error test 1`] = ` "Unexpected token, expected \\")\\" (3:18) 1 | // https://github.com/babel/babel/pull/11931 diff --git a/tests/misc/errors/js/import-assertions-for-export-without-from.js b/tests/misc/errors/js/import-assertions-for-export-without-from.js new file mode 100644 index 000000000000..bf54727d56a0 --- /dev/null +++ b/tests/misc/errors/js/import-assertions-for-export-without-from.js @@ -0,0 +1 @@ +export { foo } assert { type: "json" }; diff --git a/tests/misc/errors/js/module-string-name-import.js b/tests/misc/errors/js/module-string-name-import.js deleted file mode 100644 index 53167a0d5443..000000000000 --- a/tests/misc/errors/js/module-string-name-import.js +++ /dev/null @@ -1,2 +0,0 @@ -// https://github.com/babel/babel/issues/12209 -import { "foo" as foo } from "module-a"; diff --git a/tests/typescript/class/__snapshots__/jsfmt.spec.js.snap b/tests/typescript/class/__snapshots__/jsfmt.spec.js.snap index c8f5488ae1a5..a137842353f5 100644 --- a/tests/typescript/class/__snapshots__/jsfmt.spec.js.snap +++ b/tests/typescript/class/__snapshots__/jsfmt.spec.js.snap @@ -1,5 +1,15 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`constructor.ts [babel-ts] format 1`] = ` +"Unexpected token, expected \\",\\" (2:22) + 1 | class foo { +> 2 | constructor(static a: number) {} + | ^ + 3 | } + 4 | + 5 | class foo {" +`; + exports[`constructor.ts format 1`] = ` ====================================options===================================== parsers: ["typescript"] @@ -217,6 +227,15 @@ class ImplementsInterfaceClassWithComments1< ================================================================================ `; +exports[`generics.ts [babel-ts] format 1`] = ` +"A class name is required (1:6) +> 1 | class implements Map {} + | ^ + 2 | + 3 | interface AudioBufferList { + 4 | mBuffers: interop.Reference;" +`; + exports[`generics.ts format 1`] = ` ====================================options===================================== parsers: ["typescript"] @@ -239,6 +258,17 @@ interface AudioBufferList { ================================================================================ `; +exports[`methods.ts [babel-ts] format 1`] = ` +"Unexpected token, expected \\";\\" (6:10) + 4 | + 5 | interface Iterable { +> 6 | export [Symbol.iterator](): Iterator; + | ^ + 7 | } + 8 | + 9 | export class Check {" +`; + exports[`methods.ts format 1`] = ` ====================================options===================================== parsers: ["typescript"] diff --git a/tests/typescript/comments/__snapshots__/jsfmt.spec.js.snap b/tests/typescript/comments/__snapshots__/jsfmt.spec.js.snap index f0088c2dbb28..b20ab8598bb3 100644 --- a/tests/typescript/comments/__snapshots__/jsfmt.spec.js.snap +++ b/tests/typescript/comments/__snapshots__/jsfmt.spec.js.snap @@ -702,9 +702,7 @@ interface Foo { } type T = (arg) => any; -functionName< - A // comment ->(); +functionName(); // comment const a: T< // comment > = 1; diff --git a/tests/typescript/compiler/__snapshots__/jsfmt.spec.js.snap b/tests/typescript/compiler/__snapshots__/jsfmt.spec.js.snap index 57083c87a4ea..21aa5587eff0 100644 --- a/tests/typescript/compiler/__snapshots__/jsfmt.spec.js.snap +++ b/tests/typescript/compiler/__snapshots__/jsfmt.spec.js.snap @@ -408,6 +408,12 @@ x[x++]++; ================================================================================ `; +exports[`downlevelLetConst1.ts [babel-ts] format 1`] = ` +"Unexpected token (1:6) +> 1 | const + | ^" +`; + exports[`downlevelLetConst1.ts format 1`] = ` ====================================options===================================== parsers: ["typescript"] @@ -421,6 +427,15 @@ const; ================================================================================ `; +exports[`errorOnInitializerInInterfaceProperty.ts [babel-ts] format 1`] = ` +"Unexpected token, expected \\";\\" (2:17) + 1 | interface Foo { +> 2 | bar: number = 5; + | ^ + 3 | } + 4 | " +`; + exports[`errorOnInitializerInInterfaceProperty.ts format 1`] = ` ====================================options===================================== parsers: ["typescript"] @@ -632,6 +647,14 @@ const shouldFail: { important: boolean } = output.x.children; ================================================================================ `; +exports[`modifiersOnInterfaceIndexSignature1.ts [babel-ts] format 1`] = ` +"Unexpected token, expected \\";\\" (2:10) + 1 | interface I { +> 2 | public [a: string]: number; + | ^ + 3 | }" +`; + exports[`modifiersOnInterfaceIndexSignature1.ts format 1`] = ` ====================================options===================================== parsers: ["typescript"] diff --git a/tests/typescript/conformance/classes/classDeclarations/classAbstractKeyword/__snapshots__/jsfmt.spec.js.snap b/tests/typescript/conformance/classes/classDeclarations/classAbstractKeyword/__snapshots__/jsfmt.spec.js.snap index 5b67d956846c..c2035fc91cd7 100644 --- a/tests/typescript/conformance/classes/classDeclarations/classAbstractKeyword/__snapshots__/jsfmt.spec.js.snap +++ b/tests/typescript/conformance/classes/classDeclarations/classAbstractKeyword/__snapshots__/jsfmt.spec.js.snap @@ -633,6 +633,17 @@ abstract class A { ================================================================================ `; +exports[`classAbstractMixedWithModifiers.ts [babel-ts] format 1`] = ` +"Unexpected token (8:21) + 6 | private abstract foo_d(); + 7 | +> 8 | abstract public foo_bb(); + | ^ + 9 | abstract protected foo_cc(); + 10 | abstract private foo_dd(); + 11 | " +`; + exports[`classAbstractMixedWithModifiers.ts format 1`] = ` ====================================options===================================== parsers: ["typescript"] diff --git a/tests/typescript/conformance/classes/constructorDeclarations/constructorParameters/__snapshots__/jsfmt.spec.js.snap b/tests/typescript/conformance/classes/constructorDeclarations/constructorParameters/__snapshots__/jsfmt.spec.js.snap index b6a16cc473b6..055cf0afbb7f 100644 --- a/tests/typescript/conformance/classes/constructorDeclarations/constructorParameters/__snapshots__/jsfmt.spec.js.snap +++ b/tests/typescript/conformance/classes/constructorDeclarations/constructorParameters/__snapshots__/jsfmt.spec.js.snap @@ -440,6 +440,17 @@ class E extends D { ================================================================================ `; +exports[`readonlyInConstructorParameters.ts [babel-ts] format 1`] = ` +"Unexpected token, expected \\",\\" (7:33) + 5 | + 6 | class E { +> 7 | constructor(readonly public x: number) {} + | ^ + 8 | } + 9 | + 10 | class F {" +`; + exports[`readonlyInConstructorParameters.ts format 1`] = ` ====================================options===================================== parsers: ["typescript"] @@ -477,6 +488,15 @@ new F(1).x; ================================================================================ `; +exports[`readonlyReadonly.ts [babel-ts] format 1`] = ` +"Unexpected token, expected \\",\\" (3:35) + 1 | class C { + 2 | readonly readonly x: number; +> 3 | constructor(readonly readonly y: number) {} + | ^ + 4 | }" +`; + exports[`readonlyReadonly.ts format 1`] = ` ====================================options===================================== parsers: ["typescript"] diff --git a/tests/typescript/conformance/parser/ecmascript5/Statements/__snapshots__/jsfmt.spec.js.snap b/tests/typescript/conformance/parser/ecmascript5/Statements/__snapshots__/jsfmt.spec.js.snap index 79cb40f4e649..c6c0388024a1 100644 --- a/tests/typescript/conformance/parser/ecmascript5/Statements/__snapshots__/jsfmt.spec.js.snap +++ b/tests/typescript/conformance/parser/ecmascript5/Statements/__snapshots__/jsfmt.spec.js.snap @@ -1,5 +1,14 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`parserES5ForOfStatement2.ts [babel-ts] format 1`] = ` +"Unexpected token, expected \\";\\" (2:13) + 1 | //@target: ES5 +> 2 | for (var of X) { + | ^ + 3 | } + 4 | " +`; + exports[`parserES5ForOfStatement2.ts format 1`] = ` ====================================options===================================== parsers: ["typescript"] @@ -18,6 +27,14 @@ for (var of X) { ================================================================================ `; +exports[`parserES5ForOfStatement21.ts [babel-ts] format 1`] = ` +"Unexpected token (2:15) + 1 | //@target: ES5 +> 2 | for (var of of) { } + | ^ + 3 | " +`; + exports[`parserES5ForOfStatement21.ts format 1`] = ` ====================================options===================================== parsers: ["typescript"] @@ -35,6 +52,14 @@ for (var of of) { ================================================================================ `; +exports[`parserForInStatement2.ts [babel-ts] format 1`] = ` +"Unexpected token, expected \\";\\" (1:13) +> 1 | for (var in X) { + | ^ + 2 | } + 3 | " +`; + exports[`parserForInStatement2.ts format 1`] = ` ====================================options===================================== parsers: ["typescript"] diff --git a/tests/typescript/conformance/types/abstractKeyword/__snapshots__/jsfmt.spec.js.snap b/tests/typescript/conformance/types/abstractKeyword/__snapshots__/jsfmt.spec.js.snap index 5d8631a61c01..1d1ce60dae2e 100644 --- a/tests/typescript/conformance/types/abstractKeyword/__snapshots__/jsfmt.spec.js.snap +++ b/tests/typescript/conformance/types/abstractKeyword/__snapshots__/jsfmt.spec.js.snap @@ -1,5 +1,12 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`abstractKeyword.ts [babel-ts] format 1`] = ` +"Unexpected token, expected \\";\\" (1:10) +> 1 | abstract interface I {} + | ^ + 2 | " +`; + exports[`abstractKeyword.ts format 1`] = ` ====================================options===================================== parsers: ["typescript"] diff --git a/tests/typescript/conformance/types/decorator/__snapshots__/jsfmt.spec.js.snap b/tests/typescript/conformance/types/decorator/__snapshots__/jsfmt.spec.js.snap index 71ddb401cec3..38c86cce315c 100644 --- a/tests/typescript/conformance/types/decorator/__snapshots__/jsfmt.spec.js.snap +++ b/tests/typescript/conformance/types/decorator/__snapshots__/jsfmt.spec.js.snap @@ -1,5 +1,14 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`decorator.ts [babel-ts] format 1`] = ` +"Leading decorators must be attached to a class declaration (4:1) + 2 | + 3 | @dec +> 4 | enum E {} + | ^ + 5 | " +`; + exports[`decorator.ts format 1`] = ` ====================================options===================================== parsers: ["typescript"] diff --git a/tests/typescript/conformance/types/functions/__snapshots__/jsfmt.spec.js.snap b/tests/typescript/conformance/types/functions/__snapshots__/jsfmt.spec.js.snap index 255e93018b3c..098a018bdebf 100644 --- a/tests/typescript/conformance/types/functions/__snapshots__/jsfmt.spec.js.snap +++ b/tests/typescript/conformance/types/functions/__snapshots__/jsfmt.spec.js.snap @@ -592,6 +592,16 @@ function f(x: string): void { ================================================================================ `; +exports[`functionOverloadErrorsSyntax.ts [babel-ts] format 1`] = ` +"Rest element must be last element (9:36) + 7 | + 8 | //Function overload signature with rest param followed by non-optional parameter +> 9 | function fn5(x: string, ...y: any[], z: string); + | ^ + 10 | function fn5() { } + 11 | " +`; + exports[`functionOverloadErrorsSyntax.ts format 1`] = ` ====================================options===================================== parsers: ["typescript"] diff --git a/tests/typescript/custom/abstract/__snapshots__/jsfmt.spec.js.snap b/tests/typescript/custom/abstract/__snapshots__/jsfmt.spec.js.snap index 2eb6d5fe98c1..b8f660e7abe9 100644 --- a/tests/typescript/custom/abstract/__snapshots__/jsfmt.spec.js.snap +++ b/tests/typescript/custom/abstract/__snapshots__/jsfmt.spec.js.snap @@ -38,6 +38,16 @@ export class Y {} ================================================================================ `; +exports[`abstractProperties.ts [babel-ts] format 1`] = ` +"Unexpected token (2:22) + 1 | abstract class Foo { +> 2 | abstract private a: 1; + | ^ + 3 | private abstract b: 2; + 4 | static abstract c: 3; + 5 | " +`; + exports[`abstractProperties.ts format 1`] = ` ====================================options===================================== parsers: ["typescript"] @@ -76,6 +86,16 @@ abstract class Foo { ================================================================================ `; +exports[`abstractPropertiesWithBreaks.ts [babel-ts] format 1`] = ` +"Unexpected token (2:22) + 1 | abstract class Foo { +> 2 | abstract private foobar = + | ^ + 3 | // comment to break + 4 | 1 + + 5 | // another comment to break" +`; + exports[`abstractPropertiesWithBreaks.ts format 1`] = ` ====================================options===================================== parsers: ["typescript"] diff --git a/tests/typescript/declare/__snapshots__/jsfmt.spec.js.snap b/tests/typescript/declare/__snapshots__/jsfmt.spec.js.snap index 9f673f0da2f3..fe39e136e522 100644 --- a/tests/typescript/declare/__snapshots__/jsfmt.spec.js.snap +++ b/tests/typescript/declare/__snapshots__/jsfmt.spec.js.snap @@ -110,11 +110,23 @@ declare interface Dictionary { [index: string]: T } +declare interface B { + foo([]?): void; + bar({}, []?): any; + baz(a: string, b: number, []?): void; +} + =====================================output===================================== declare interface Dictionary { [index: string]: T; } +declare interface B { + foo([]?): void; + bar({}, []?): any; + baz(a: string, b: number, []?): void; +} + ================================================================================ `; diff --git a/tests/typescript/declare/declare_interface.ts b/tests/typescript/declare/declare_interface.ts index 77a9962cd03a..14e4bfe6177d 100644 --- a/tests/typescript/declare/declare_interface.ts +++ b/tests/typescript/declare/declare_interface.ts @@ -1,3 +1,9 @@ declare interface Dictionary { [index: string]: T } + +declare interface B { + foo([]?): void; + bar({}, []?): any; + baz(a: string, b: number, []?): void; +} diff --git a/tests/typescript/decorators/__snapshots__/jsfmt.spec.js.snap b/tests/typescript/decorators/__snapshots__/jsfmt.spec.js.snap index 774d1014e88a..e0d418a9854b 100644 --- a/tests/typescript/decorators/__snapshots__/jsfmt.spec.js.snap +++ b/tests/typescript/decorators/__snapshots__/jsfmt.spec.js.snap @@ -389,14 +389,24 @@ class Bar { } class MyContainerComponent { - @ContentChildren(MyComponent) components: QueryListSomeBigName< - MyComponentThat - >; + @ContentChildren(MyComponent) + components: QueryListSomeBigName; } ================================================================================ `; +exports[`interface.ts [babel-ts] format 1`] = ` +"Leading decorators must be attached to a class declaration (4:1) + 2 | + 3 | @hello() +> 4 | interface MyInterface { + | ^ + 5 | id: string; + 6 | } + 7 | " +`; + exports[`interface.ts format 1`] = ` ====================================options===================================== parsers: ["typescript"] diff --git a/tests/typescript/error-recovery/__snapshots__/jsfmt.spec.js.snap b/tests/typescript/error-recovery/__snapshots__/jsfmt.spec.js.snap index 832267ded498..48ea1c51c84e 100644 --- a/tests/typescript/error-recovery/__snapshots__/jsfmt.spec.js.snap +++ b/tests/typescript/error-recovery/__snapshots__/jsfmt.spec.js.snap @@ -152,6 +152,28 @@ class f7<> { ================================================================================ `; +exports[`index-signature.ts [babel-ts] format 1`] = ` +"Unexpected token, expected \\"]\\" (4:13) + 2 | + 3 | type TwoParams = { +> 4 | [a: string, b: string]: string; + | ^ + 5 | }; + 6 | type ThreeParams = { + 7 | [a: string, b: string, c: string]: string;" +`; + +exports[`index-signature.ts - {"trailingComma":"all"} [babel-ts] format 1`] = ` +"Unexpected token, expected \\"]\\" (4:13) + 2 | + 3 | type TwoParams = { +> 4 | [a: string, b: string]: string; + | ^ + 5 | }; + 6 | type ThreeParams = { + 7 | [a: string, b: string, c: string]: string;" +`; + exports[`index-signature.ts - {"trailingComma":"all"} format 1`] = ` ====================================options===================================== parsers: ["typescript"] @@ -215,6 +237,17 @@ type TooLongSingleParam = { ================================================================================ `; +exports[`index-signature.ts - {"trailingComma":"es5"} [babel-ts] format 1`] = ` +"Unexpected token, expected \\"]\\" (4:13) + 2 | + 3 | type TwoParams = { +> 4 | [a: string, b: string]: string; + | ^ + 5 | }; + 6 | type ThreeParams = { + 7 | [a: string, b: string, c: string]: string;" +`; + exports[`index-signature.ts - {"trailingComma":"es5"} format 1`] = ` ====================================options===================================== parsers: ["typescript"] @@ -340,6 +373,24 @@ type TooLongSingleParam = { ================================================================================ `; +exports[`jsdoc_only_types.ts [babel-ts] format 1`] = ` +"Unexpected token (1:8) +> 1 | let a: *; + | ^ + 2 | function b(x: ?) {} + 3 | let c: ?string; + 4 | let d: string?;" +`; + +exports[`jsdoc_only_types.ts - {"trailingComma":"all"} [babel-ts] format 1`] = ` +"Unexpected token (1:8) +> 1 | let a: *; + | ^ + 2 | function b(x: ?) {} + 3 | let c: ?string; + 4 | let d: string?;" +`; + exports[`jsdoc_only_types.ts - {"trailingComma":"all"} format 1`] = ` ====================================options===================================== parsers: ["typescript"] @@ -369,6 +420,15 @@ let h: !(string | number); ================================================================================ `; +exports[`jsdoc_only_types.ts - {"trailingComma":"es5"} [babel-ts] format 1`] = ` +"Unexpected token (1:8) +> 1 | let a: *; + | ^ + 2 | function b(x: ?) {} + 3 | let c: ?string; + 4 | let d: string?;" +`; + exports[`jsdoc_only_types.ts - {"trailingComma":"es5"} format 1`] = ` ====================================options===================================== parsers: ["typescript"] diff --git a/tests/typescript/generic/__snapshots__/jsfmt.spec.js.snap b/tests/typescript/generic/__snapshots__/jsfmt.spec.js.snap index 470b1ece141e..38e2ba125b99 100644 --- a/tests/typescript/generic/__snapshots__/jsfmt.spec.js.snap +++ b/tests/typescript/generic/__snapshots__/jsfmt.spec.js.snap @@ -73,9 +73,7 @@ export const getVehicleDescriptor = async ( export const getVehicleDescriptor = async ( vehicleId: string -): Promise< - Collections.Parts.PrintedCircuitBoardAssemblyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy -> => {}; +): Promise => {}; export const getVehicleDescriptor = async ( vehicleId: string diff --git a/tests/typescript/interface/__snapshots__/jsfmt.spec.js.snap b/tests/typescript/interface/__snapshots__/jsfmt.spec.js.snap index 393512f5267e..da391f1508f9 100644 --- a/tests/typescript/interface/__snapshots__/jsfmt.spec.js.snap +++ b/tests/typescript/interface/__snapshots__/jsfmt.spec.js.snap @@ -1,5 +1,23 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`abstract.ts [babel-ts] format 1`] = ` +"Unexpected token, expected \\";\\" (1:10) +> 1 | abstract interface I { + | ^ + 2 | + 3 | } + 4 | " +`; + +exports[`abstract.ts - {"semi":false} [babel-ts] format 1`] = ` +"Unexpected token, expected \\";\\" (1:10) +> 1 | abstract interface I { + | ^ + 2 | + 3 | } + 4 | " +`; + exports[`abstract.ts - {"semi":false} format 1`] = ` ====================================options===================================== parsers: ["typescript"] @@ -844,6 +862,51 @@ export interface ThirdVeryLongAndBoringInterfaceName ================================================================================ `; +exports[`pattern-parameters.ts - {"semi":false} format 1`] = ` +====================================options===================================== +parsers: ["typescript"] +printWidth: 80 +semi: false + | printWidth +=====================================input====================================== +interface B { + foo([]?): void; + bar({}, []?): any; + baz(a: string, b: number, []?): void; +} + +=====================================output===================================== +interface B { + foo([]?): void + bar({}, []?): any + baz(a: string, b: number, []?): void +} + +================================================================================ +`; + +exports[`pattern-parameters.ts format 1`] = ` +====================================options===================================== +parsers: ["typescript"] +printWidth: 80 + | printWidth +=====================================input====================================== +interface B { + foo([]?): void; + bar({}, []?): any; + baz(a: string, b: number, []?): void; +} + +=====================================output===================================== +interface B { + foo([]?): void; + bar({}, []?): any; + baz(a: string, b: number, []?): void; +} + +================================================================================ +`; + exports[`separator.ts - {"semi":false} format 1`] = ` ====================================options===================================== parsers: ["typescript"] diff --git a/tests/typescript/interface/pattern-parameters.ts b/tests/typescript/interface/pattern-parameters.ts new file mode 100644 index 000000000000..f1cf8d0d3d73 --- /dev/null +++ b/tests/typescript/interface/pattern-parameters.ts @@ -0,0 +1,5 @@ +interface B { + foo([]?): void; + bar({}, []?): any; + baz(a: string, b: number, []?): void; +} diff --git a/tests/typescript/key-remapping-in-mapped-types/__snapshots__/jsfmt.spec.js.snap b/tests/typescript/key-remapping-in-mapped-types/__snapshots__/jsfmt.spec.js.snap index 6d6725530082..b46fb45264a4 100644 --- a/tests/typescript/key-remapping-in-mapped-types/__snapshots__/jsfmt.spec.js.snap +++ b/tests/typescript/key-remapping-in-mapped-types/__snapshots__/jsfmt.spec.js.snap @@ -1,5 +1,15 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`key-remapping.ts [typescript] format 1`] = ` +"']' expected. (2:17) + 1 | type MappedTypeWithNewKeys = { +> 2 | [K in keyof T as NewKeyType]: T[K] + | ^ + 3 | }; + 4 | + 5 | type RemoveKindField = {" +`; + exports[`key-remapping.ts format 1`] = ` ====================================options===================================== parsers: ["babel-ts", "typescript"] diff --git a/tests/typescript/keywords/__snapshots__/jsfmt.spec.js.snap b/tests/typescript/keywords/__snapshots__/jsfmt.spec.js.snap index 314b06aadb31..ebdf7fa1a534 100644 --- a/tests/typescript/keywords/__snapshots__/jsfmt.spec.js.snap +++ b/tests/typescript/keywords/__snapshots__/jsfmt.spec.js.snap @@ -1,5 +1,16 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`keywords.ts [babel-ts] format 1`] = ` +"Unexpected token, expected \\";\\" (4:12) + 2 | + 3 | module Y3 { +> 4 | public module Module { + | ^ + 5 | class A { s: string } + 6 | } + 7 | " +`; + exports[`keywords.ts format 1`] = ` ====================================options===================================== parsers: ["typescript"] diff --git a/tests/typescript/template-literal-types/__snapshots__/jsfmt.spec.js.snap b/tests/typescript/template-literal-types/__snapshots__/jsfmt.spec.js.snap index 8c44481543a2..de4070dd930e 100644 --- a/tests/typescript/template-literal-types/__snapshots__/jsfmt.spec.js.snap +++ b/tests/typescript/template-literal-types/__snapshots__/jsfmt.spec.js.snap @@ -1,5 +1,14 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`template-literal-types.ts [typescript] format 1`] = ` +"Type expected. (1:8) +> 1 | let x: \`foo-\${infer bar}\`; + | ^ + 2 | type HelloWorld = \`\${Hello}, \${World}\` + 3 | type SeussFish = \`\${Quantity | Color} fish\`; + 4 | declare function setAlignment(value: \`\${VerticalAlignment}-\${HorizontalAlignment}\`): void;" +`; + exports[`template-literal-types.ts format 1`] = ` ====================================options===================================== parsers: ["babel-ts", "typescript"] diff --git a/tests/typescript/template-literals/__snapshots__/jsfmt.spec.js.snap b/tests/typescript/template-literals/__snapshots__/jsfmt.spec.js.snap index 1153f60f24a6..f56f6190cf10 100644 --- a/tests/typescript/template-literals/__snapshots__/jsfmt.spec.js.snap +++ b/tests/typescript/template-literals/__snapshots__/jsfmt.spec.js.snap @@ -39,9 +39,7 @@ printWidth: 80 =====================================input====================================== const bar = tag\`but where will prettier wrap such a long tagged template literal? \${foo.bar.baz} long long long long long long long long long long long long long long\`; =====================================output===================================== -const bar = tag< - number ->\`but where will prettier wrap such a long tagged template literal? \${foo.bar.baz} long long long long long long long long long long long long long long\`; +const bar = tag\`but where will prettier wrap such a long tagged template literal? \${foo.bar.baz} long long long long long long long long long long long long long long\`; ================================================================================ `; diff --git a/tests/typescript/type-alias/__snapshots__/jsfmt.spec.js.snap b/tests/typescript/type-alias/__snapshots__/jsfmt.spec.js.snap new file mode 100644 index 000000000000..7f2c78b4eb82 --- /dev/null +++ b/tests/typescript/type-alias/__snapshots__/jsfmt.spec.js.snap @@ -0,0 +1,23 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`pattern-parameter.ts format 1`] = ` +====================================options===================================== +parsers: ["typescript"] +printWidth: 80 + | printWidth +=====================================input====================================== +type C = { + foo([]?): void; + bar({}, []?): any; + baz(a: string, b: number, []?): void; +}; + +=====================================output===================================== +type C = { + foo([]?): void; + bar({}, []?): any; + baz(a: string, b: number, []?): void; +}; + +================================================================================ +`; diff --git a/tests/typescript/type-alias/jsfmt.spec.js b/tests/typescript/type-alias/jsfmt.spec.js new file mode 100644 index 000000000000..2ea3bb6eb2e4 --- /dev/null +++ b/tests/typescript/type-alias/jsfmt.spec.js @@ -0,0 +1 @@ +run_spec(__dirname, ["typescript"]); diff --git a/tests/typescript/type-alias/pattern-parameter.ts b/tests/typescript/type-alias/pattern-parameter.ts new file mode 100644 index 000000000000..6880a5bff23a --- /dev/null +++ b/tests/typescript/type-alias/pattern-parameter.ts @@ -0,0 +1,5 @@ +type C = { + foo([]?): void; + bar({}, []?): any; + baz(a: string, b: number, []?): void; +}; diff --git a/tests/typescript/typeparams/consistent/__snapshots__/jsfmt.spec.js.snap b/tests/typescript/typeparams/consistent/__snapshots__/jsfmt.spec.js.snap new file mode 100644 index 000000000000..bc59c79cff51 --- /dev/null +++ b/tests/typescript/typeparams/consistent/__snapshots__/jsfmt.spec.js.snap @@ -0,0 +1,91 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`flow-only.ts format 1`] = ` +====================================options===================================== +parsers: ["typescript", "flow", "babel-flow", "babel"] +printWidth: 80 + | printWidth +=====================================input====================================== + +const foo6: Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo = a; +const foo7: Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo = a; + +=====================================output===================================== +const foo6: Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo = a; +const foo7: Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo = a; + +================================================================================ +`; + +exports[`issue-9501.ts format 1`] = ` +====================================options===================================== +parsers: ["typescript", "flow", "babel-flow", "babel"] +printWidth: 80 + | printWidth +=====================================input====================================== +const name: SomeGeneric< + Pick +> = null; + +=====================================output===================================== +const name: SomeGeneric< + Pick +> = null; + +================================================================================ +`; + +exports[`simple-types.ts format 1`] = ` +====================================options===================================== +parsers: ["typescript", "flow", "babel-flow", "babel"] +printWidth: 80 + | printWidth +=====================================input====================================== +const foo1: Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo = a; +const foo2: Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo = a; +const foo3: Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo = a; +const foo4: Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo = a; +const foo5: Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo = a; +const foo6: Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo = a; +const foo7: Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo = a; +const foo8: Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo = a; +const foo9: Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo<"STRING"> = a; +const foo10: Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo<0> = a; +const foo11: Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo<0xDeeD_Beef> = a; +const foo12: Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo<0xDeeD_Beefn> = a; + +=====================================output===================================== +const foo1: Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo = a; +const foo2: Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo = a; +const foo3: Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo = a; +const foo4: Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo = a; +const foo5: Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo = a; +const foo6: Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo = a; +const foo7: Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo = a; +const foo8: Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo = a; +const foo9: Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo<"STRING"> = a; +const foo10: Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo<0> = a; +const foo11: Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo<0xdeed_beef> = a; +const foo12: Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo<0xdeed_beefn> = a; + +================================================================================ +`; + +exports[`typescript-only.ts format 1`] = ` +====================================options===================================== +parsers: ["typescript", "flow", "babel-flow", "babel"] +printWidth: 80 + | printWidth +=====================================input====================================== +const foo1: Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo = a; +const foo2: Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo = a; +const foo3: Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo = a; +const foo4: Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo = a; +=====================================output===================================== +const foo1: Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo = a; +const foo2: Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo = a; +const foo3: Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo = a; +const foo4: Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo = a; + +================================================================================ +`; diff --git a/tests/typescript/typeparams/consistent/flow-only.ts b/tests/typescript/typeparams/consistent/flow-only.ts new file mode 100644 index 000000000000..c4f7f6e5fc58 --- /dev/null +++ b/tests/typescript/typeparams/consistent/flow-only.ts @@ -0,0 +1,3 @@ + +const foo6: Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo = a; +const foo7: Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo = a; diff --git a/tests/typescript/typeparams/consistent/issue-9501.ts b/tests/typescript/typeparams/consistent/issue-9501.ts new file mode 100644 index 000000000000..c5cbe73864fc --- /dev/null +++ b/tests/typescript/typeparams/consistent/issue-9501.ts @@ -0,0 +1,3 @@ +const name: SomeGeneric< + Pick +> = null; diff --git a/tests/typescript/typeparams/consistent/jsfmt.spec.js b/tests/typescript/typeparams/consistent/jsfmt.spec.js new file mode 100644 index 000000000000..61cd597f9ee9 --- /dev/null +++ b/tests/typescript/typeparams/consistent/jsfmt.spec.js @@ -0,0 +1 @@ +run_spec(__dirname, ["typescript", "flow", "babel-flow", "babel"]); diff --git a/tests/typescript/typeparams/consistent/simple-types.ts b/tests/typescript/typeparams/consistent/simple-types.ts new file mode 100644 index 000000000000..d88a4ac7721c --- /dev/null +++ b/tests/typescript/typeparams/consistent/simple-types.ts @@ -0,0 +1,12 @@ +const foo1: Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo = a; +const foo2: Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo = a; +const foo3: Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo = a; +const foo4: Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo = a; +const foo5: Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo = a; +const foo6: Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo = a; +const foo7: Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo = a; +const foo8: Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo = a; +const foo9: Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo<"STRING"> = a; +const foo10: Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo<0> = a; +const foo11: Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo<0xDeeD_Beef> = a; +const foo12: Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo<0xDeeD_Beefn> = a; diff --git a/tests/typescript/typeparams/consistent/typescript-only.ts b/tests/typescript/typeparams/consistent/typescript-only.ts new file mode 100644 index 000000000000..fcea89f2a2f9 --- /dev/null +++ b/tests/typescript/typeparams/consistent/typescript-only.ts @@ -0,0 +1,4 @@ +const foo1: Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo = a; +const foo2: Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo = a; +const foo3: Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo = a; +const foo4: Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo = a; \ No newline at end of file diff --git a/tests_config/run_spec.js b/tests_config/run_spec.js index 01f596247023..862ad62a93cf 100644 --- a/tests_config/run_spec.js +++ b/tests_config/run_spec.js @@ -40,6 +40,7 @@ const unstableTests = new Map( ], ["js/no-semi/comments.js", (options) => options.semi === false], ["flow/no-semi/comments.js", (options) => options.semi === false], + "js/comments/html-like/comment.js", ].map((fixture) => { const [file, isUnstable = () => true] = Array.isArray(fixture) ? fixture @@ -54,6 +55,7 @@ const espreeDisabledTests = new Set( "comments-closure-typecast", ].map((directory) => path.join(__dirname, "../tests/js", directory)) ); +const meriyahDisabledTests = espreeDisabledTests; const isUnstable = (filename, options) => { const testFunction = unstableTests.get(filename); @@ -142,17 +144,18 @@ function runSpec(fixtures, parsers, options) { const [parser] = parsers; const allParsers = [...parsers]; + if (parsers.includes("typescript") && !parsers.includes("babel-ts")) { allParsers.push("babel-ts"); } - if ( - parsers.includes("babel") && - !parsers.includes("espree") && - isTestDirectory(dirname, "js") && - !espreeDisabledTests.has(dirname) - ) { - allParsers.push("espree"); + if (parsers.includes("babel") && isTestDirectory(dirname, "js")) { + if (!parsers.includes("espree") && !espreeDisabledTests.has(dirname)) { + allParsers.push("espree"); + } + if (!parsers.includes("meriyah") && !meriyahDisabledTests.has(dirname)) { + allParsers.push("meriyah"); + } } const stringifiedOptions = stringifyOptionsForTitle(options); @@ -212,12 +215,13 @@ function runTest({ // Verify parsers if (parser !== parsers[0]) { + formatTestTitle = `[${parser}] format`; formatOptions = { ...mainParserFormatResult.options, parser }; const runFormat = () => format(code, formatOptions); if (shouldThrowOnFormat(name, formatOptions)) { - test(`[${parser}] expect SyntaxError`, () => { - expect(runFormat).toThrow(TEST_STANDALONE ? undefined : SyntaxError); + test(formatTestTitle, () => { + expect(runFormat).toThrowErrorMatchingSnapshot(); }); return; } @@ -225,7 +229,6 @@ function runTest({ // Verify parsers format result should be the same as main parser output = mainParserFormatResult.outputWithCursor; formatResult = runFormat(); - formatTestTitle = `[${parser}] format`; } test(formatTestTitle, () => { diff --git a/tests_config/utils/check-parsers.js b/tests_config/utils/check-parsers.js index b55f2b37c27b..dfd2b683c622 100644 --- a/tests_config/utils/check-parsers.js +++ b/tests_config/utils/check-parsers.js @@ -50,8 +50,16 @@ const categoryParsers = new Map([ [ "js", { - parsers: ["babel"], - verifyParsers: ["babel", "flow", "babel-flow", "typescript", "babel-ts"], + parsers: ["babel", "meriyah", "espree"], + verifyParsers: [ + "babel", + "meriyah", + "espree", + "flow", + "babel-flow", + "typescript", + "babel-ts", + ], extensions: [".js"], }, ], diff --git a/tests_integration/__tests__/__snapshots__/early-exit.js.snap b/tests_integration/__tests__/__snapshots__/early-exit.js.snap index 21fa7cb0a030..eb58ce63ea98 100644 --- a/tests_integration/__tests__/__snapshots__/early-exit.js.snap +++ b/tests_integration/__tests__/__snapshots__/early-exit.js.snap @@ -84,7 +84,7 @@ Format options: Defaults to false. --jsx-single-quote Use single quotes in JSX. Defaults to false. - --parser + --parser Which parser to use. --print-width The line length where Prettier will try wrap. Defaults to 80. @@ -180,7 +180,7 @@ exports[`show warning with --help not-found (typo) (stderr) 1`] = ` `; exports[`show warning with --help not-found (typo) (stdout) 1`] = ` -"--parser +"--parser Which parser to use. @@ -192,6 +192,7 @@ Valid options: babel-ts TypeScript typescript TypeScript espree JavaScript + meriyah JavaScript css CSS less Less scss SCSS @@ -245,7 +246,7 @@ Format options: Defaults to false. --jsx-single-quote Use single quotes in JSX. Defaults to false. - --parser + --parser Which parser to use. --print-width The line length where Prettier will try wrap. Defaults to 80. diff --git a/tests_integration/__tests__/__snapshots__/help-options.js.snap b/tests_integration/__tests__/__snapshots__/help-options.js.snap index a262c653367c..0b8f6343b585 100644 --- a/tests_integration/__tests__/__snapshots__/help-options.js.snap +++ b/tests_integration/__tests__/__snapshots__/help-options.js.snap @@ -361,7 +361,7 @@ exports[`show detailed usage with --help no-semi (write) 1`] = `Array []`; exports[`show detailed usage with --help parser (stderr) 1`] = `""`; exports[`show detailed usage with --help parser (stdout) 1`] = ` -"--parser +"--parser Which parser to use. @@ -373,6 +373,7 @@ Valid options: babel-ts TypeScript typescript TypeScript espree JavaScript + meriyah JavaScript css CSS less Less scss SCSS diff --git a/tests_integration/__tests__/__snapshots__/plugin-options-string.js.snap b/tests_integration/__tests__/__snapshots__/plugin-options-string.js.snap index d5c3c6014f6d..a26fe7ba329b 100644 --- a/tests_integration/__tests__/__snapshots__/plugin-options-string.js.snap +++ b/tests_integration/__tests__/__snapshots__/plugin-options-string.js.snap @@ -20,8 +20,8 @@ exports[` 1`] = ` Defaults to false. --jsx-single-quote Use single quotes in JSX. Defaults to false. -- --parser -+ --parser +- --parser ++ --parser Which parser to use. --print-width The line length where Prettier will try wrap. Defaults to 80. diff --git a/tests_integration/__tests__/__snapshots__/plugin-options.js.snap b/tests_integration/__tests__/__snapshots__/plugin-options.js.snap index 641cdbbb9555..37d71257b0e3 100644 --- a/tests_integration/__tests__/__snapshots__/plugin-options.js.snap +++ b/tests_integration/__tests__/__snapshots__/plugin-options.js.snap @@ -20,8 +20,8 @@ exports[` 1`] = ` Defaults to false. --jsx-single-quote Use single quotes in JSX. Defaults to false. -- --parser -+ --parser +- --parser ++ --parser Which parser to use. --print-width The line length where Prettier will try wrap. Defaults to 80. @@ -32,7 +32,7 @@ exports[` 1`] = ` exports[`include plugin's parsers to the values of the \`parser\` option\` (stderr) 1`] = `""`; exports[`include plugin's parsers to the values of the \`parser\` option\` (stdout) 1`] = ` -"--parser +"--parser Which parser to use. @@ -44,6 +44,7 @@ Valid options: babel-ts TypeScript typescript TypeScript espree JavaScript + meriyah JavaScript css CSS less Less scss SCSS diff --git a/tests_integration/__tests__/__snapshots__/schema.js.snap b/tests_integration/__tests__/__snapshots__/schema.js.snap index 74f5bda0b332..337ebad5d84e 100644 --- a/tests_integration/__tests__/__snapshots__/schema.js.snap +++ b/tests_integration/__tests__/__snapshots__/schema.js.snap @@ -168,6 +168,12 @@ This option cannot be used with --range-start and --range-end.", "espree", ], }, + Object { + "description": "JavaScript", + "enum": Array [ + "meriyah", + ], + }, Object { "description": "CSS", "enum": Array [ diff --git a/tests_integration/__tests__/__snapshots__/support-info.js.snap b/tests_integration/__tests__/__snapshots__/support-info.js.snap index e71ffe1517cc..5d94316818b6 100644 --- a/tests_integration/__tests__/__snapshots__/support-info.js.snap +++ b/tests_integration/__tests__/__snapshots__/support-info.js.snap @@ -38,10 +38,12 @@ Object { "flow", "typescript", "espree", + "meriyah", ], "JavaScript": Array [ "babel", "espree", + "meriyah", "babel-flow", "babel-ts", "flow", @@ -153,6 +155,7 @@ Object { "babel-ts", "typescript", "espree", + "meriyah", "css", "less", "scss", @@ -319,6 +322,7 @@ exports[`CLI --support-info (stdout) 1`] = ` \\"parsers\\": [ \\"babel\\", \\"espree\\", + \\"meriyah\\", \\"babel-flow\\", \\"babel-ts\\", \\"flow\\", @@ -371,7 +375,8 @@ exports[`CLI --support-info (stdout) 1`] = ` \\"babel-ts\\", \\"flow\\", \\"typescript\\", - \\"espree\\" + \\"espree\\", + \\"meriyah\\" ], \\"since\\": \\"0.0.0\\", \\"tmScope\\": \\"source.js.jsx\\", @@ -881,6 +886,7 @@ exports[`CLI --support-info (stdout) 1`] = ` \\"value\\": \\"typescript\\" }, { \\"description\\": \\"JavaScript\\", \\"since\\": \\"2.2.0\\", \\"value\\": \\"espree\\" }, + { \\"description\\": \\"JavaScript\\", \\"since\\": \\"2.2.0\\", \\"value\\": \\"meriyah\\" }, { \\"description\\": \\"CSS\\", \\"since\\": \\"1.7.1\\", \\"value\\": \\"css\\" }, { \\"description\\": \\"Less\\", \\"since\\": \\"1.7.1\\", \\"value\\": \\"less\\" }, { \\"description\\": \\"SCSS\\", \\"since\\": \\"1.7.1\\", \\"value\\": \\"scss\\" }, diff --git a/website/package.json b/website/package.json index ce6026d4e2a3..5660dd2856ee 100644 --- a/website/package.json +++ b/website/package.json @@ -16,14 +16,14 @@ "react-dom": "17.0.1" }, "devDependencies": { - "@babel/preset-react": "7.12.1", + "@babel/preset-react": "7.12.5", "@sandhose/prettier-animated-logo": "1.0.3", "babel-loader": "8.1.0", "concurrently": "5.3.0", "docusaurus": "1.14.6", "js-yaml": "3.14.0", "svgo": "1.3.2", - "webpack": "5.2.0", - "webpack-cli": "4.1.0" + "webpack": "5.4.0", + "webpack-cli": "4.2.0" } } diff --git a/website/playground/codeSamples.js b/website/playground/codeSamples.js index 0b3e978e4969..e5b258633ca8 100644 --- a/website/playground/codeSamples.js +++ b/website/playground/codeSamples.js @@ -2,6 +2,7 @@ export default function (parser) { switch (parser) { case "babel": case "espree": + case "meriyah": return [ 'function HelloWorld({greeting = "hello", greeted = \'"World"\', silent = false, onMouseOver,}) {', "", diff --git a/website/static/worker.js b/website/static/worker.js index beee1c7c3cb8..9751137ccd3f 100644 --- a/website/static/worker.js +++ b/website/static/worker.js @@ -37,6 +37,15 @@ self.onmessage = function (event) { }); }; +function serializeAst(ast) { + return JSON.stringify( + ast, + (_, value) => + typeof value === "bigint" ? `BigInt('${String(value)}')` : value, + 2 + ); +} + function handleMessage(message) { if (message.type === "meta") { return { @@ -75,7 +84,7 @@ function handleMessage(message) { let ast; let errored = false; try { - ast = JSON.stringify(prettier.__debug.parse(message.code, options).ast); + ast = serializeAst(prettier.__debug.parse(message.code, options).ast); } catch (e) { errored = true; ast = String(e); @@ -85,7 +94,7 @@ function handleMessage(message) { try { ast = formatCode(ast, { parser: "json", plugins }); } catch (e) { - ast = JSON.stringify(ast, null, 2); + ast = serializeAst(ast); } } response.debug.ast = ast; diff --git a/website/yarn.lock b/website/yarn.lock index 9a75d6dd4beb..a5cbada72295 100644 --- a/website/yarn.lock +++ b/website/yarn.lock @@ -736,10 +736,10 @@ dependencies: "@babel/helper-plugin-utils" "^7.10.4" -"@babel/plugin-transform-react-jsx-development@^7.12.1": - version "7.12.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-react-jsx-development/-/plugin-transform-react-jsx-development-7.12.1.tgz#0b8f8cd531dcf7991f1e5f2c10a2a4f1cfc78e36" - integrity sha512-IilcGWdN1yNgEGOrB96jbTplRh+V2Pz1EoEwsKsHfX1a/L40cUYuD71Zepa7C+ujv7kJIxnDftWeZbKNEqZjCQ== +"@babel/plugin-transform-react-jsx-development@^7.12.5": + version "7.12.5" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-react-jsx-development/-/plugin-transform-react-jsx-development-7.12.5.tgz#677de5b96da310430d6cfb7fee16a1603afa3d56" + integrity sha512-1JJusg3iPgsZDthyWiCr3KQiGs31ikU/mSf2N2dSYEAO0GEImmVUbWf0VoSDGDFTAn5Dj4DUiR6SdIXHY7tELA== dependencies: "@babel/helper-builder-react-jsx-experimental" "^7.12.1" "@babel/helper-plugin-utils" "^7.10.4" @@ -759,10 +759,10 @@ dependencies: "@babel/helper-plugin-utils" "^7.10.4" -"@babel/plugin-transform-react-jsx@^7.12.1": - version "7.12.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-react-jsx/-/plugin-transform-react-jsx-7.12.1.tgz#c2d96c77c2b0e4362cc4e77a43ce7c2539d478cb" - integrity sha512-RmKejwnT0T0QzQUzcbP5p1VWlpnP8QHtdhEtLG55ZDQnJNalbF3eeDyu3dnGKvGzFIQiBzFhBYTwvv435p9Xpw== +"@babel/plugin-transform-react-jsx@^7.12.5": + version "7.12.5" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-react-jsx/-/plugin-transform-react-jsx-7.12.5.tgz#39ede0e30159770561b6963be143e40af3bde00c" + integrity sha512-2xkcPqqrYiOQgSlM/iwto1paPijjsDbUynN13tI6bosDz/jOW3CRzYguIE8wKX32h+msbBM22Dv5fwrFkUOZjQ== dependencies: "@babel/helper-builder-react-jsx" "^7.10.4" "@babel/helper-builder-react-jsx-experimental" "^7.12.1" @@ -937,15 +937,15 @@ "@babel/types" "^7.4.4" esutils "^2.0.2" -"@babel/preset-react@7.12.1", "@babel/preset-react@^7.9.4": - version "7.12.1" - resolved "https://registry.yarnpkg.com/@babel/preset-react/-/preset-react-7.12.1.tgz#7f022b13f55b6dd82f00f16d1c599ae62985358c" - integrity sha512-euCExymHCi0qB9u5fKw7rvlw7AZSjw/NaB9h7EkdTt5+yHRrXdiRTh7fkG3uBPpJg82CqLfp1LHLqWGSCrab+g== +"@babel/preset-react@7.12.5", "@babel/preset-react@^7.9.4": + version "7.12.5" + resolved "https://registry.yarnpkg.com/@babel/preset-react/-/preset-react-7.12.5.tgz#d45625f65d53612078a43867c5c6750e78772c56" + integrity sha512-jcs++VPrgyFehkMezHtezS2BpnUlR7tQFAyesJn1vGTO9aTFZrgIQrA5YydlTwxbcjMwkFY6i04flCigRRr3GA== dependencies: "@babel/helper-plugin-utils" "^7.10.4" "@babel/plugin-transform-react-display-name" "^7.12.1" - "@babel/plugin-transform-react-jsx" "^7.12.1" - "@babel/plugin-transform-react-jsx-development" "^7.12.1" + "@babel/plugin-transform-react-jsx" "^7.12.5" + "@babel/plugin-transform-react-jsx-development" "^7.12.5" "@babel/plugin-transform-react-jsx-self" "^7.12.1" "@babel/plugin-transform-react-jsx-source" "^7.12.1" "@babel/plugin-transform-react-pure-annotations" "^7.12.1" @@ -1225,17 +1225,17 @@ "@webassemblyjs/wast-parser" "1.9.0" "@xtuc/long" "4.2.2" -"@webpack-cli/info@^1.0.2": - version "1.0.2" - resolved "https://registry.yarnpkg.com/@webpack-cli/info/-/info-1.0.2.tgz#7ba1a7cfa9efa5b51e76b20ada88ac33b0340ad3" - integrity sha512-FEfLQwmN4pXZSYSrtp+KC84rFanoCIxXFpS2wUvviDCE2fnajwxw2GXzbj83IlH4Dl8Wq8kJjavVwvxv3YJmnw== +"@webpack-cli/info@^1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@webpack-cli/info/-/info-1.1.0.tgz#c596d5bc48418b39df00c5ed7341bf0f102dbff1" + integrity sha512-uNWSdaYHc+f3LdIZNwhdhkjjLDDl3jP2+XBqAq9H8DjrJUvlOKdP8TNruy1yEaDfgpAIgbSAN7pye4FEHg9tYQ== dependencies: envinfo "^7.7.3" -"@webpack-cli/serve@^1.0.1": - version "1.0.1" - resolved "https://registry.yarnpkg.com/@webpack-cli/serve/-/serve-1.0.1.tgz#28abe7dcb18224ccd4b4e2d37f70e5be66c3d6a9" - integrity sha512-WGMaTMTK6NOe29Hw1WBEok9vGLfKg5C6jWzNOS/6HH1YadR+RL+TRWRcSyc81Dzulljhk/Ree9mrDM4Np9GGOQ== +"@webpack-cli/serve@^1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@webpack-cli/serve/-/serve-1.1.0.tgz#13ad38f89b6e53d1133bac0006a128217a6ebf92" + integrity sha512-7RfnMXCpJ/NThrhq4gYQYILB18xWyoQcBey81oIyVbmgbc6m5ZHHyFK+DyH7pLHJf0p14MxL4mTsoPAgBSTpIg== "@xtuc/ieee754@^1.2.0": version "1.2.0" @@ -1315,13 +1315,6 @@ ansi-escapes@^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-escapes@^4.3.1: - version "4.3.1" - resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-4.3.1.tgz#a5c47cc43181f1f38ffd7076837700d395522a61" - integrity sha512-JWF7ocqNrp8u9oqpgV+wH5ftbt+cfvv+PTjOvKLT3AdYly/LmORARfEVT1iyjwN+4MqE5UmVKoAdIBqeoCHgLA== - dependencies: - type-fest "^0.11.0" - ansi-red@^0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/ansi-red/-/ansi-red-0.1.1.tgz#8c638f9d1080800a353c9c28c8a81ca4705d946c" @@ -2108,10 +2101,10 @@ commander@^4.0.1: resolved "https://registry.yarnpkg.com/commander/-/commander-4.0.1.tgz#b67622721785993182e807f4883633e6401ba53c" integrity sha512-IPF4ouhCP+qdlcmCedhxX4xiGBPyigb8v5NeUp+0LyhwLgxMqyp3S0vl7TAPfS/hiP7FC3caI/PB9lTmP8r1NA== -commander@^6.0.0: - version "6.1.0" - resolved "https://registry.yarnpkg.com/commander/-/commander-6.1.0.tgz#f8d722b78103141006b66f4c7ba1e97315ba75bc" - integrity sha512-wl7PNrYWd2y5mp1OK/LhTlv8Ff4kQJQRXXAvF+uU/TPNiVJUxZLRYGj/B0y/lPGAVcSbJqH2Za/cvHmrPMC8mA== +commander@^6.2.0: + version "6.2.0" + resolved "https://registry.yarnpkg.com/commander/-/commander-6.2.0.tgz#b990bfb8ac030aedc6d11bc04d1488ffef56db75" + integrity sha512-zP4jEKbe8SHzKJYQmq8Y9gYjtO/POJLgIdKgV7B9qNmABVFVc+ctqSX6iXh4mCpJfRBOabiZ2YKPg8ciDw6C+Q== commondir@^1.0.1: version "1.0.1" @@ -2687,9 +2680,9 @@ domutils@^1.5.1, domutils@^1.7.0: domelementtype "1" dot-prop@^4.1.1: - version "4.2.0" - resolved "https://registry.yarnpkg.com/dot-prop/-/dot-prop-4.2.0.tgz#1f19e0c2e1aa0e32797c49799f2837ac6af69c57" - integrity sha512-tUMXrxlExSW6U2EXiiKGSBVdYgtV8qlHL+C10TsW4PURY/ic+eaysnSkwB4kA/mBlCyy/IKDJ+Lc3wbWeaXtuQ== + version "4.2.1" + resolved "https://registry.yarnpkg.com/dot-prop/-/dot-prop-4.2.1.tgz#45884194a71fc2cda71cbb4bceb3a4dd2f433ba4" + integrity sha512-l0p4+mIuJIua0mhxGoh4a+iNL9bmeK5DvnSVQa6T0OhrVmaEa1XScX5Etc673FePCJOArq/4Pa2cLGODUWTPOQ== dependencies: is-obj "^1.0.0" @@ -2792,15 +2785,15 @@ end-of-stream@^1.1.0: dependencies: once "^1.4.0" -enhanced-resolve@^5.3.0: - version "5.3.0" - resolved "https://registry.yarnpkg.com/enhanced-resolve/-/enhanced-resolve-5.3.0.tgz#14be504e14ad58e9821a311ea6a9037c716786d9" - integrity sha512-EENz3E701+77g0wfbOITeI8WLPNso2kQNMBIBEi/TH/BEa9YXtS01X7sIEk5XXsfFq1jNkhIpu08hBPH1TRLIQ== +enhanced-resolve@^5.3.1: + version "5.3.1" + resolved "https://registry.yarnpkg.com/enhanced-resolve/-/enhanced-resolve-5.3.1.tgz#3f988d0d7775bdc2d96ede321dc81f8249492f57" + integrity sha512-G1XD3MRGrGfNcf6Hg0LVZG7GIKcYkbfHa5QMxt1HDUTdYoXH0JR1xXyg+MaKLF73E9A27uWNVxvFivNRYeUB6w== dependencies: graceful-fs "^4.2.4" tapable "^2.0.0" -enquirer@^2.3.4: +enquirer@^2.3.6: version "2.3.6" resolved "https://registry.yarnpkg.com/enquirer/-/enquirer-2.3.6.tgz#2a7fe5dd634a1e4125a975ec994ff5456dc3734d" integrity sha512-yjNnPr315/FjS4zIsUxYguYUPP2e1NK4d7E7ZOLiyYCcbFBiTMyID+2wvm2w6+pZ/odMA7cRkjhsPbltwBOrLg== @@ -2957,10 +2950,10 @@ execa@^1.0.0: signal-exit "^3.0.0" strip-eof "^1.0.0" -execa@^4.0.0: - version "4.0.3" - resolved "https://registry.yarnpkg.com/execa/-/execa-4.0.3.tgz#0a34dabbad6d66100bd6f2c576c8669403f317f2" - integrity sha512-WFDXGHckXPWZX19t1kCsXzOpqX9LWYNqn4C+HqZlk/V0imTkzJZqf87ZBhvpHaftERYknpk0fjSylnXVlVgI0A== +execa@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/execa/-/execa-4.1.0.tgz#4e5491ad1572f2f17a77d388c6c857135b22847a" + integrity sha512-j5W0//W7f8UxAn8hXVnwG8tLwdiUy4FJLcSupCg6maBYZDpyBvTApK7KyuI4bKj8KOh1r2YH+6ucuYtJv1bTZA== dependencies: cross-spawn "^7.0.0" get-stream "^5.0.0" @@ -3975,7 +3968,7 @@ interpret@^1.0.0: resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.4.0.tgz#665ab8bc4da27a774a40584e812e3e0fa45b1a1e" integrity sha512-agE4QfB2Lkp9uICn7BAqoscw4SZP9kTE2hxiFI3jBPmXJfdqiahTbUuKGsMoN2GtqL9AxhYioAcVvgsb1HvRbA== -interpret@^2.0.0: +interpret@^2.2.0: version "2.2.0" resolved "https://registry.yarnpkg.com/interpret/-/interpret-2.2.0.tgz#1a78a0b5965c40a5416d007ad6f50ad27c417df9" integrity sha512-Ju0Bz/cEia55xDwUWEa8+olFpCiQoypjnQySseKtmjNrnps3P+xfpUmGr90T7yjlVJmOtybRvPXhKMbHr+fWnw== @@ -4180,6 +4173,7 @@ is-number@^3.0.0: is-obj@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/is-obj/-/is-obj-1.0.1.tgz#3e4729ac1f5fde025cd7d83a896dab9f4f67db0f" + integrity sha1-PkcprB9f3gJc19g6iW2rn09n2w8= is-object@^1.0.1: version "1.0.1" @@ -4309,10 +4303,10 @@ isurl@^1.0.0-alpha5: has-to-string-tag-x "^1.2.0" is-object "^1.0.1" -jest-worker@^26.5.0: - version "26.5.0" - resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-26.5.0.tgz#87deee86dbbc5f98d9919e0dadf2c40e3152fa30" - integrity sha512-kTw66Dn4ZX7WpjZ7T/SUDgRhapFRKWmisVAF0Rv4Fu8SLFD7eLbqpLvbxVqYhSgaWa7I+bW7pHnbyfNsH6stug== +jest-worker@^26.6.1: + version "26.6.1" + resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-26.6.1.tgz#c2ae8cde6802cc14056043f997469ec170d9c32a" + integrity sha512-R5IE3qSGz+QynJx8y+ICEkdI2OJ3RJjRQVEyCcFAd3yVhQSEtquziPO29Mlzgn07LOVE8u8jhJ1FqcwegiXWOw== dependencies: "@types/node" "*" merge-stream "^2.0.0" @@ -6971,22 +6965,22 @@ tempfile@^2.0.0: temp-dir "^1.0.0" uuid "^3.0.1" -terser-webpack-plugin@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/terser-webpack-plugin/-/terser-webpack-plugin-5.0.0.tgz#88f58d27d1c8244965c59540d3ccda1598fc958c" - integrity sha512-rf7l5a9xamIVX3enQeTl0MY2MNeZClo5yPX/tVPy22oY0nzu0b45h7JqyFi/bygqKWtzXMnml0u12mArhQPsBQ== +terser-webpack-plugin@^5.0.3: + version "5.0.3" + resolved "https://registry.yarnpkg.com/terser-webpack-plugin/-/terser-webpack-plugin-5.0.3.tgz#ec60542db2421f45735c719d2e17dabfbb2e3e42" + integrity sha512-zFdGk8Lh9ZJGPxxPE6jwysOlATWB8GMW8HcfGULWA/nPal+3VdATflQvSBSLQJRCmYZnfFJl6vkRTiwJGNgPiQ== dependencies: - jest-worker "^26.5.0" + jest-worker "^26.6.1" p-limit "^3.0.2" schema-utils "^3.0.0" serialize-javascript "^5.0.1" source-map "^0.6.1" - terser "^5.3.5" + terser "^5.3.8" -terser@^5.3.5: - version "5.3.5" - resolved "https://registry.yarnpkg.com/terser/-/terser-5.3.5.tgz#9e080baa0568f96654621b20eb9effa440b1484e" - integrity sha512-Qw3CZAMmmfU824AoGKalx+riwocSI5Cs0PoGp9RdSLfmxkmJgyBxqLBP/isDNtFyhHnitikvRMZzyVgeq+U+Tg== +terser@^5.3.8: + version "5.3.8" + resolved "https://registry.yarnpkg.com/terser/-/terser-5.3.8.tgz#991ae8ba21a3d990579b54aa9af11586197a75dd" + integrity sha512-zVotuHoIfnYjtlurOouTazciEfL7V38QMAOhGqpXDEg6yT13cF4+fEP9b0rrCEQTn+tT46uxgFsTZzhygk+CzQ== dependencies: commander "^2.20.0" source-map "~0.7.2" @@ -7141,11 +7135,6 @@ tweetnacl@^0.14.3, tweetnacl@~0.14.0: version "0.14.5" resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-0.14.5.tgz#5ae68177f192d4456269d108afa93ff8743f4f64" -type-fest@^0.11.0: - version "0.11.0" - resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.11.0.tgz#97abf0872310fed88a5c466b25681576145e33f1" - integrity sha512-OdjXJxnCN1AvyLSzeKIgXTXxV+99ZuXl3Hpo9XpJAv9MBcHrrJOQ5kV7ypXOuQie+AmWG25hLbiKdwYTifzcfQ== - type-is@~1.6.17, type-is@~1.6.18: version "1.6.18" resolved "https://registry.yarnpkg.com/type-is/-/type-is-1.6.18.tgz#4e552cd05df09467dcbc4ef739de89f2cf37c131" @@ -7304,10 +7293,10 @@ uuid@^3.0.1, uuid@^3.3.2: resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.3.3.tgz#4568f0216e78760ee1dbf3a4d2cf53e224112866" integrity sha512-pW0No1RGHgzlpHJO1nsVrHKpOEIxkGg1xB+v0ZmdNH5OAeAwzAVrCnI2/6Mtx+Uys6iaylxa+D3g4j63IKKjSQ== -v8-compile-cache@^2.1.0: - version "2.1.1" - resolved "https://registry.yarnpkg.com/v8-compile-cache/-/v8-compile-cache-2.1.1.tgz#54bc3cdd43317bca91e35dcaf305b1a7237de745" - integrity sha512-8OQ9CL+VWyt3JStj7HX7/ciTL2V3Rl1Wf5OL+SNTm0yK1KvtReVulksyeRnCANHHuUxHlQig+JJDlUhBt1NQDQ== +v8-compile-cache@^2.2.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/v8-compile-cache/-/v8-compile-cache-2.2.0.tgz#9471efa3ef9128d2f7c6a7ca39c4dd6b5055b132" + integrity sha512-gTpR5XQNKFwOd4clxfnhaqvfqMpqEwr4tOtCyz4MtYZX2JYhfr1JvBFKdS+7K/9rfpZR3VLX+YWBbKoxCgS43Q== validate-npm-package-license@^3.0.1: version "3.0.3" @@ -7350,23 +7339,23 @@ webidl-conversions@^4.0.2: resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-4.0.2.tgz#a855980b1f0b6b359ba1d5d9fb39ae941faa63ad" integrity sha512-YQ+BmxuTgd6UXZW3+ICGfyqRyHXVlD5GtQr5+qjiNW7bF0cqrzX500HVXPBOvgXb5YnzDd+h0zqyv61KUD7+Sg== -webpack-cli@4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/webpack-cli/-/webpack-cli-4.1.0.tgz#3a8fe05326015cc92b67abea68e3c320d418b16e" - integrity sha512-NdhxXMZmoik62Y05t0h1y65LjBM7BwFPq311ihXuMM3RY6dlc4KkCTyHLzTuBEc+bqq6d3xh+CWmU0xRexNJBA== +webpack-cli@4.2.0: + version "4.2.0" + resolved "https://registry.yarnpkg.com/webpack-cli/-/webpack-cli-4.2.0.tgz#10a09030ad2bd4d8b0f78322fba6ea43ec56aaaa" + integrity sha512-EIl3k88vaF4fSxWSgtAQR+VwicfLMTZ9amQtqS4o+TDPW9HGaEpbFBbAZ4A3ZOT5SOnMxNOzROsSTPiE8tBJPA== dependencies: - "@webpack-cli/info" "^1.0.2" - "@webpack-cli/serve" "^1.0.1" - ansi-escapes "^4.3.1" + "@webpack-cli/info" "^1.1.0" + "@webpack-cli/serve" "^1.1.0" colorette "^1.2.1" command-line-usage "^6.1.0" - commander "^6.0.0" - enquirer "^2.3.4" - execa "^4.0.0" + commander "^6.2.0" + enquirer "^2.3.6" + execa "^4.1.0" import-local "^3.0.2" - interpret "^2.0.0" + interpret "^2.2.0" + leven "^3.1.0" rechoir "^0.7.0" - v8-compile-cache "^2.1.0" + v8-compile-cache "^2.2.0" webpack-merge "^4.2.2" webpack-merge@^4.2.2: @@ -7376,18 +7365,18 @@ webpack-merge@^4.2.2: dependencies: lodash "^4.17.15" -webpack-sources@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-2.0.1.tgz#1467f6e692ddce91e88b8044c44347b1087bbd4f" - integrity sha512-A9oYz7ANQBK5EN19rUXbvNgfdfZf5U2gP0769OXsj9CvYkCR6OHOsd6OKyEy4H38GGxpsQPKIL83NC64QY6Xmw== +webpack-sources@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-2.1.1.tgz#6922dc1bf7f7f95aab56675535b6e20f87b9147f" + integrity sha512-hraq9n99K564zuZUsE61iATO3jvzxOmGo20UlOe3zgdHOBp8inTJgv7EY4RgvCv7Ywx0/vpQTyYSjnFpv4gNtQ== dependencies: source-list-map "^2.0.1" source-map "^0.6.1" -webpack@5.2.0: - version "5.2.0" - resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.2.0.tgz#02f22466b79751a80a50f20f027a716e296b3ef5" - integrity sha512-evtOjOJQq3zaHJIWsJjM4TGtNHtSrNVAIyQ+tdPW/fRd+4PLGbUG6S3xt+N4+QwDBOaCVd0xCWiHd4R6lWO5DQ== +webpack@5.4.0: + version "5.4.0" + resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.4.0.tgz#4fdc6ec8a0ff9160701fb8f2eb8d06b33ecbae0f" + integrity sha512-udpYTyqz8toTTdaOsL2QKPLeZLt2IEm9qY7yTXuFEQhKu5bk0yQD9BtAdVQksmz4jFbbWOiWmm3NHarO0zr/ng== dependencies: "@types/eslint-scope" "^3.7.0" "@types/estree" "^0.0.45" @@ -7398,7 +7387,7 @@ webpack@5.2.0: acorn "^8.0.4" browserslist "^4.14.5" chrome-trace-event "^1.0.2" - enhanced-resolve "^5.3.0" + enhanced-resolve "^5.3.1" eslint-scope "^5.1.1" events "^3.2.0" glob-to-regexp "^0.4.1" @@ -7410,9 +7399,9 @@ webpack@5.2.0: pkg-dir "^4.2.0" schema-utils "^3.0.0" tapable "^2.0.0" - terser-webpack-plugin "^5.0.0" + terser-webpack-plugin "^5.0.3" watchpack "^2.0.0" - webpack-sources "^2.0.1" + webpack-sources "^2.1.1" websocket-driver@>=0.5.1: version "0.7.0" diff --git a/yarn.lock b/yarn.lock index 3a7c6b1fe2d6..367ae0e98d24 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,10 +2,10 @@ # yarn lockfile v1 -"@angular/compiler@10.2.0": - version "10.2.0" - resolved "https://registry.yarnpkg.com/@angular/compiler/-/compiler-10.2.0.tgz#1cd4e6b528494514c016be4c83b1dfbeb13681b5" - integrity sha512-r+zNEDJmfH7pyQULgs6iQgMv/zH/CokepTuemrVbBKkUjd8F9Q84XdflR2Tx2rukiAAl4B0BuG+v4tSb9pR1WQ== +"@angular/compiler@10.2.2": + version "10.2.2" + resolved "https://registry.yarnpkg.com/@angular/compiler/-/compiler-10.2.2.tgz#020377613e23c03448483be304018ab3ebf549fb" + integrity sha512-62wb/aj8ORaUyVcI6cxf07gBc3/hb+bVGl9Yni51e8//G2W7gleyQAXtIeZsT9NHi0KX1nKdXvUVwAoq4u7eHw== dependencies: tslib "^2.0.0" @@ -277,10 +277,10 @@ chalk "^2.0.0" js-tokens "^4.0.0" -"@babel/parser@7.12.3", "@babel/parser@^7.1.0", "@babel/parser@^7.10.4", "@babel/parser@^7.12.1", "@babel/parser@^7.12.3", "@babel/parser@^7.7.0": - version "7.12.3" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.12.3.tgz#a305415ebe7a6c7023b40b5122a0662d928334cd" - integrity sha512-kFsOS0IbsuhO5ojF8Hc8z/8vEIOkylVBrjiZUbLTE3XFe0Qi+uu6HjzQixkFaqr0ZPAMZcBVxEwmsnsLPZ2Xsw== +"@babel/parser@7.12.5", "@babel/parser@^7.1.0", "@babel/parser@^7.10.4", "@babel/parser@^7.12.1", "@babel/parser@^7.12.3", "@babel/parser@^7.7.0": + version "7.12.5" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.12.5.tgz#b4af32ddd473c0bfa643bd7ff0728b8e71b81ea0" + integrity sha512-FVM6RZQ0mn2KCf1VUED7KepYeUWoVShczewOCfm3nzoBybaih51h+sYVVGthW9M6lPByEPTQf+xm27PBdlpwmQ== "@babel/plugin-proposal-async-generator-functions@^7.12.1": version "7.12.1" @@ -480,7 +480,7 @@ dependencies: "@babel/helper-plugin-utils" "^7.8.0" -"@babel/plugin-syntax-top-level-await@^7.12.1": +"@babel/plugin-syntax-top-level-await@^7.12.1", "@babel/plugin-syntax-top-level-await@^7.8.3": version "7.12.1" resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-top-level-await/-/plugin-syntax-top-level-await-7.12.1.tgz#dd6c0b357ac1bb142d98537450a319625d13d2a0" integrity sha512-i7ooMZFS+a/Om0crxZodrTzNEPJHZrlMVGMTEpFAj6rYY/bKCddB0Dk/YxfPuYXOopuhKk/e1jV6h+WUU9XN3A== @@ -851,10 +851,10 @@ globals "^11.1.0" lodash "^4.17.19" -"@babel/types@7.12.1", "@babel/types@^7.0.0", "@babel/types@^7.10.4", "@babel/types@^7.11.0", "@babel/types@^7.12.1", "@babel/types@^7.3.0", "@babel/types@^7.3.3", "@babel/types@^7.4.4", "@babel/types@^7.7.0": - version "7.12.1" - resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.12.1.tgz#e109d9ab99a8de735be287ee3d6a9947a190c4ae" - integrity sha512-BzSY3NJBKM4kyatSOWh3D/JJ2O3CVzBybHWxtgxnggaxEuaSTTDqeiSb/xk9lrkw2Tbqyivw5ZU4rT+EfznQsA== +"@babel/types@7.12.6", "@babel/types@^7.0.0", "@babel/types@^7.10.4", "@babel/types@^7.11.0", "@babel/types@^7.12.1", "@babel/types@^7.3.0", "@babel/types@^7.3.3", "@babel/types@^7.4.4", "@babel/types@^7.7.0": + version "7.12.6" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.12.6.tgz#ae0e55ef1cce1fbc881cd26f8234eb3e657edc96" + integrity sha512-hwyjw6GvjBLiyy3W0YQf0Z5Zf4NpYejUnKFcfcUhZCSffoBBp30w6wP2Wn6pk31jMYZvcOrB/1b7cGXvEoKogA== dependencies: "@babel/helper-validator-identifier" "^7.10.4" lodash "^4.17.19" @@ -873,10 +873,10 @@ exec-sh "^0.3.2" minimist "^1.2.0" -"@eslint/eslintrc@^0.2.0": - version "0.2.0" - resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-0.2.0.tgz#bc7e3c4304d4c8720968ccaee793087dfb5fe6b4" - integrity sha512-+cIGPCBdLCzqxdtwppswP+zTsH9BOIGzAeKfBIbtb4gW/giMlfMwP0HUSFfhzh20f9u8uZ8hOp62+4GPquTbwQ== +"@eslint/eslintrc@^0.2.1": + version "0.2.1" + resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-0.2.1.tgz#f72069c330461a06684d119384435e12a5d76e3c" + integrity sha512-XRUeBZ5zBWLYgSANMpThFddrZZkEbGHgUdt5UJjZfnlN9BGCiUBrf+nvbRupSjMvqzwnQN0qwCmOxITt1cfywA== dependencies: ajv "^6.12.4" debug "^4.1.1" @@ -894,57 +894,57 @@ resolved "https://registry.yarnpkg.com/@glimmer/env/-/env-0.1.7.tgz#fd2d2b55a9029c6b37a6c935e8c8871ae70dfa07" integrity sha1-/S0rVakCnGs3psk16MiHGucN+gc= -"@glimmer/global-context@0.62.3": - version "0.62.3" - resolved "https://registry.yarnpkg.com/@glimmer/global-context/-/global-context-0.62.3.tgz#d77f03d26aea0cb2a2275d0b7d71f52fee7ca9d5" - integrity sha512-TjjiuR0urcL2wrY3DMoXkU4838UbG2T9MIUE9Wsh1W9XwoyFMz6CqMOgq2/k7dASYzyAY2dhQB6Y+rEHibAZgA== +"@glimmer/global-context@0.62.4": + version "0.62.4" + resolved "https://registry.yarnpkg.com/@glimmer/global-context/-/global-context-0.62.4.tgz#6b942b6ca0d23141a88fe707f7ce6bcac6709336" + integrity sha512-F1vD6+zURXOzFKYUL7Dw+zDasfYKpBWt/7GJ8lUVNJ7XOZQQOOeY8Tr29K4ZUrqu3lByTqyBR46gpE8UdbsJ2w== dependencies: "@glimmer/env" "^0.1.7" -"@glimmer/interfaces@0.62.3": - version "0.62.3" - resolved "https://registry.yarnpkg.com/@glimmer/interfaces/-/interfaces-0.62.3.tgz#8ad314d66d1a43197663509806e1cc2088db6741" - integrity sha512-bhbKs5vfys4mo+LRxcA4bfMl2zGn+43et4uAzsYppuNPSkP7rwdPD+mLXTYQRkTm0G5K4SnyxDPxMsWCWUNuTw== +"@glimmer/interfaces@0.62.4": + version "0.62.4" + resolved "https://registry.yarnpkg.com/@glimmer/interfaces/-/interfaces-0.62.4.tgz#e9027d637a0ea80522f29a241aa819e686c623ae" + integrity sha512-x3L9YUL17fRgxFrnUvUYTxgnLoh8BipdqkweUEVA5qdIa1dcidUzHUFtWgRiWZ+dKCJBtxh2ubEwjOfgobpMuQ== dependencies: "@simple-dom/interface" "^1.4.0" -"@glimmer/reference@0.62.3": - version "0.62.3" - resolved "https://registry.yarnpkg.com/@glimmer/reference/-/reference-0.62.3.tgz#23c6861eaad57def8d8ad54c94aefd1f6fa5541e" - integrity sha512-pAyZTFhswKyXOyQzcjh1DA7BMH8WNqjswfeAu8V98b4vfAYb2JYH3IdUadTDwsM5vbYou4e01+dFSAaPHex/lg== +"@glimmer/reference@0.62.4": + version "0.62.4" + resolved "https://registry.yarnpkg.com/@glimmer/reference/-/reference-0.62.4.tgz#50dbd0d202ca94f73bbcdfe19ce450ca5c6babdc" + integrity sha512-oabqcfZrMB8FoVLZqqD4w0cUcWt1/d8uBGtXKGGNLkrV2smPFJO/rcfFpZq8alMgzqII5F9Q57gRL+qh0AD8og== dependencies: "@glimmer/env" "^0.1.7" - "@glimmer/global-context" "0.62.3" - "@glimmer/interfaces" "0.62.3" - "@glimmer/util" "0.62.3" - "@glimmer/validator" "0.62.3" - -"@glimmer/syntax@0.62.3": - version "0.62.3" - resolved "https://registry.yarnpkg.com/@glimmer/syntax/-/syntax-0.62.3.tgz#8c4abd245a54e8cc084a47ab4a65c33194256fda" - integrity sha512-PU4PpMg9UOeYFTODkHN9K6As74lm16XGEQAQbd59oAbvGRu5OAIWFtSU4sMexpKOXu6iJacFO5udX7gVTACRQQ== - dependencies: - "@glimmer/interfaces" "0.62.3" - "@glimmer/util" "0.62.3" + "@glimmer/global-context" "0.62.4" + "@glimmer/interfaces" "0.62.4" + "@glimmer/util" "0.62.4" + "@glimmer/validator" "0.62.4" + +"@glimmer/syntax@0.62.4": + version "0.62.4" + resolved "https://registry.yarnpkg.com/@glimmer/syntax/-/syntax-0.62.4.tgz#9d5ec15584fed85d807762992a1879fe7fe15ae8" + integrity sha512-c/c+tqv1Ob+IaiVYe3DfHsLQwk/DZ3RA14gVcrE8Bbqrr7RtmjdKPfgNswiQhx7b+1ygcUhvYUfxfI8nCVswIw== + dependencies: + "@glimmer/interfaces" "0.62.4" + "@glimmer/util" "0.62.4" "@handlebars/parser" "^1.1.0" simple-html-tokenizer "^0.5.10" -"@glimmer/util@0.62.3": - version "0.62.3" - resolved "https://registry.yarnpkg.com/@glimmer/util/-/util-0.62.3.tgz#d6fc5d64e5e97cbec02b5fcf8a8c78c7f67dc6f5" - integrity sha512-HImkS2UJuZYPxyjXPFL9PS659kwjNcRIr5hnUo1PzrPfyZxXwWys2+vTxIv34tI1xkgkQmB1pB0S8pCdNrJY5w== +"@glimmer/util@0.62.4": + version "0.62.4" + resolved "https://registry.yarnpkg.com/@glimmer/util/-/util-0.62.4.tgz#2e33dd2a8e3e81f5ffc8325fdc9bebb0e274c421" + integrity sha512-7x04I4mQpxveAoEbpFfXFFkYpuJoATHuGdwPjgcQc0nSjAkGDkzIMlRN3stgZAz32eSVj9n7SOXHVtHEhw3cCg== dependencies: "@glimmer/env" "0.1.7" - "@glimmer/interfaces" "0.62.3" + "@glimmer/interfaces" "0.62.4" "@simple-dom/interface" "^1.4.0" -"@glimmer/validator@0.62.3": - version "0.62.3" - resolved "https://registry.yarnpkg.com/@glimmer/validator/-/validator-0.62.3.tgz#241d97c3a42130a4d06d821de66147e50602ffe5" - integrity sha512-bge8EhoWvZNDvpfRI5BVvoT1E1+8GsYOWqOYIjXmQJObzXUE6KWgLMI1RGGcS+PItrAnniS1nv+hVdqk4aHDQQ== +"@glimmer/validator@0.62.4": + version "0.62.4" + resolved "https://registry.yarnpkg.com/@glimmer/validator/-/validator-0.62.4.tgz#80570d3fbf9c9a9e6a50e5c022a073da24d14d85" + integrity sha512-yZ3cfvbW/S3kAu/EDFCxqMrOp4lWiZ5QxKiDej+GVkuz8yirYVBkf1vZnxogmDyCWLZGvmTr/7QimvQZSHQxVw== dependencies: "@glimmer/env" "^0.1.7" - "@glimmer/global-context" "0.62.3" + "@glimmer/global-context" "0.62.4" "@handlebars/parser@^1.1.0": version "1.1.0" @@ -984,93 +984,93 @@ jest-util "^26.3.0" slash "^3.0.0" -"@jest/console@^26.6.1": - version "26.6.1" - resolved "https://registry.yarnpkg.com/@jest/console/-/console-26.6.1.tgz#6a19eaac4aa8687b4db9130495817c65aec3d34e" - integrity sha512-cjqcXepwC5M+VeIhwT6Xpi/tT4AiNzlIx8SMJ9IihduHnsSrnWNvTBfKIpmqOOCNOPqtbBx6w2JqfoLOJguo8g== +"@jest/console@^26.6.2": + version "26.6.2" + resolved "https://registry.yarnpkg.com/@jest/console/-/console-26.6.2.tgz#4e04bc464014358b03ab4937805ee36a0aeb98f2" + integrity sha512-IY1R2i2aLsLr7Id3S6p2BA82GNWryt4oSvEXLAKc+L2zdi89dSkE8xC1C+0kpATG4JhBJREnQOH7/zmccM2B0g== dependencies: - "@jest/types" "^26.6.1" + "@jest/types" "^26.6.2" "@types/node" "*" chalk "^4.0.0" - jest-message-util "^26.6.1" - jest-util "^26.6.1" + jest-message-util "^26.6.2" + jest-util "^26.6.2" slash "^3.0.0" -"@jest/core@^26.6.1": - version "26.6.1" - resolved "https://registry.yarnpkg.com/@jest/core/-/core-26.6.1.tgz#77426822f667a2cda82bf917cee11cc8ba71f9ac" - integrity sha512-p4F0pgK3rKnoS9olXXXOkbus1Bsu6fd8pcvLMPsUy4CVXZ8WSeiwQ1lK5hwkCIqJ+amZOYPd778sbPha/S8Srw== - dependencies: - "@jest/console" "^26.6.1" - "@jest/reporters" "^26.6.1" - "@jest/test-result" "^26.6.1" - "@jest/transform" "^26.6.1" - "@jest/types" "^26.6.1" +"@jest/core@^26.6.3": + version "26.6.3" + resolved "https://registry.yarnpkg.com/@jest/core/-/core-26.6.3.tgz#7639fcb3833d748a4656ada54bde193051e45fad" + integrity sha512-xvV1kKbhfUqFVuZ8Cyo+JPpipAHHAV3kcDBftiduK8EICXmTFddryy3P7NfZt8Pv37rA9nEJBKCCkglCPt/Xjw== + dependencies: + "@jest/console" "^26.6.2" + "@jest/reporters" "^26.6.2" + "@jest/test-result" "^26.6.2" + "@jest/transform" "^26.6.2" + "@jest/types" "^26.6.2" "@types/node" "*" ansi-escapes "^4.2.1" chalk "^4.0.0" exit "^0.1.2" graceful-fs "^4.2.4" - jest-changed-files "^26.6.1" - jest-config "^26.6.1" - jest-haste-map "^26.6.1" - jest-message-util "^26.6.1" + jest-changed-files "^26.6.2" + jest-config "^26.6.3" + jest-haste-map "^26.6.2" + jest-message-util "^26.6.2" jest-regex-util "^26.0.0" - jest-resolve "^26.6.1" - jest-resolve-dependencies "^26.6.1" - jest-runner "^26.6.1" - jest-runtime "^26.6.1" - jest-snapshot "^26.6.1" - jest-util "^26.6.1" - jest-validate "^26.6.1" - jest-watcher "^26.6.1" + jest-resolve "^26.6.2" + jest-resolve-dependencies "^26.6.3" + jest-runner "^26.6.3" + jest-runtime "^26.6.3" + jest-snapshot "^26.6.2" + jest-util "^26.6.2" + jest-validate "^26.6.2" + jest-watcher "^26.6.2" micromatch "^4.0.2" p-each-series "^2.1.0" rimraf "^3.0.0" slash "^3.0.0" strip-ansi "^6.0.0" -"@jest/environment@^26.6.1": - version "26.6.1" - resolved "https://registry.yarnpkg.com/@jest/environment/-/environment-26.6.1.tgz#38a56f1cc66f96bf53befcc5ebeaf1c2dce90e9a" - integrity sha512-GNvHwkOFJtNgSwdzH9flUPzF9AYAZhUg124CBoQcwcZCM9s5TLz8Y3fMtiaWt4ffbigoetjGk5PU2Dd8nLrSEw== +"@jest/environment@^26.6.2": + version "26.6.2" + resolved "https://registry.yarnpkg.com/@jest/environment/-/environment-26.6.2.tgz#ba364cc72e221e79cc8f0a99555bf5d7577cf92c" + integrity sha512-nFy+fHl28zUrRsCeMB61VDThV1pVTtlEokBRgqPrcT1JNq4yRNIyTHfyht6PqtUvY9IsuLGTrbG8kPXjSZIZwA== dependencies: - "@jest/fake-timers" "^26.6.1" - "@jest/types" "^26.6.1" + "@jest/fake-timers" "^26.6.2" + "@jest/types" "^26.6.2" "@types/node" "*" - jest-mock "^26.6.1" + jest-mock "^26.6.2" -"@jest/fake-timers@^26.6.1": - version "26.6.1" - resolved "https://registry.yarnpkg.com/@jest/fake-timers/-/fake-timers-26.6.1.tgz#5aafba1822075b7142e702b906094bea15f51acf" - integrity sha512-T/SkMLgOquenw/nIisBRD6XAYpFir0kNuclYLkse5BpzeDUukyBr+K31xgAo9M0hgjU9ORlekAYPSzc0DKfmKg== +"@jest/fake-timers@^26.6.2": + version "26.6.2" + resolved "https://registry.yarnpkg.com/@jest/fake-timers/-/fake-timers-26.6.2.tgz#459c329bcf70cee4af4d7e3f3e67848123535aad" + integrity sha512-14Uleatt7jdzefLPYM3KLcnUl1ZNikaKq34enpb5XG9i81JpppDb5muZvonvKyrl7ftEHkKS5L5/eB/kxJ+bvA== dependencies: - "@jest/types" "^26.6.1" + "@jest/types" "^26.6.2" "@sinonjs/fake-timers" "^6.0.1" "@types/node" "*" - jest-message-util "^26.6.1" - jest-mock "^26.6.1" - jest-util "^26.6.1" + jest-message-util "^26.6.2" + jest-mock "^26.6.2" + jest-util "^26.6.2" -"@jest/globals@^26.6.1": - version "26.6.1" - resolved "https://registry.yarnpkg.com/@jest/globals/-/globals-26.6.1.tgz#b232c7611d8a2de62b4bf9eb9a007138322916f4" - integrity sha512-acxXsSguuLV/CeMYmBseefw6apO7NuXqpE+v5r3yD9ye2PY7h1nS20vY7Obk2w6S7eJO4OIAJeDnoGcLC/McEQ== +"@jest/globals@^26.6.2": + version "26.6.2" + resolved "https://registry.yarnpkg.com/@jest/globals/-/globals-26.6.2.tgz#5b613b78a1aa2655ae908eba638cc96a20df720a" + integrity sha512-85Ltnm7HlB/KesBUuALwQ68YTU72w9H2xW9FjZ1eL1U3lhtefjjl5c2MiUbpXt/i6LaPRvoOFJ22yCBSfQ0JIA== dependencies: - "@jest/environment" "^26.6.1" - "@jest/types" "^26.6.1" - expect "^26.6.1" + "@jest/environment" "^26.6.2" + "@jest/types" "^26.6.2" + expect "^26.6.2" -"@jest/reporters@^26.6.1": - version "26.6.1" - resolved "https://registry.yarnpkg.com/@jest/reporters/-/reporters-26.6.1.tgz#582ede05278cf5eeffe58bc519f4a35f54fbcb0d" - integrity sha512-J6OlXVFY3q1SXWJhjme5i7qT/BAZSikdOK2t8Ht5OS32BDo6KfG5CzIzzIFnAVd82/WWbc9Hb7SJ/jwSvVH9YA== +"@jest/reporters@^26.6.2": + version "26.6.2" + resolved "https://registry.yarnpkg.com/@jest/reporters/-/reporters-26.6.2.tgz#1f518b99637a5f18307bd3ecf9275f6882a667f6" + integrity sha512-h2bW53APG4HvkOnVMo8q3QXa6pcaNt1HkwVsOPMBV6LD/q9oSpxNSYZQYkAnjdMjrJ86UuYeLo+aEZClV6opnw== dependencies: "@bcoe/v8-coverage" "^0.2.3" - "@jest/console" "^26.6.1" - "@jest/test-result" "^26.6.1" - "@jest/transform" "^26.6.1" - "@jest/types" "^26.6.1" + "@jest/console" "^26.6.2" + "@jest/test-result" "^26.6.2" + "@jest/transform" "^26.6.2" + "@jest/types" "^26.6.2" chalk "^4.0.0" collect-v8-coverage "^1.0.0" exit "^0.1.2" @@ -1081,22 +1081,22 @@ istanbul-lib-report "^3.0.0" istanbul-lib-source-maps "^4.0.0" istanbul-reports "^3.0.2" - jest-haste-map "^26.6.1" - jest-resolve "^26.6.1" - jest-util "^26.6.1" - jest-worker "^26.6.1" + jest-haste-map "^26.6.2" + jest-resolve "^26.6.2" + jest-util "^26.6.2" + jest-worker "^26.6.2" slash "^3.0.0" source-map "^0.6.0" string-length "^4.0.1" terminal-link "^2.0.0" - v8-to-istanbul "^6.0.1" + v8-to-istanbul "^7.0.0" optionalDependencies: node-notifier "^8.0.0" -"@jest/source-map@^26.5.0": - version "26.5.0" - resolved "https://registry.yarnpkg.com/@jest/source-map/-/source-map-26.5.0.tgz#98792457c85bdd902365cd2847b58fff05d96367" - integrity sha512-jWAw9ZwYHJMe9eZq/WrsHlwF8E3hM9gynlcDpOyCb9bR8wEd9ZNBZCi7/jZyzHxC7t3thZ10gO2IDhu0bPKS5g== +"@jest/source-map@^26.6.2": + version "26.6.2" + resolved "https://registry.yarnpkg.com/@jest/source-map/-/source-map-26.6.2.tgz#29af5e1e2e324cafccc936f218309f54ab69d535" + integrity sha512-YwYcCwAnNmOVsZ8mr3GfnzdXDAl4LaenZP5z+G0c8bzC9/dugL8zRmxZzdoTl4IaS3CryS1uWnROLPFmb6lVvA== dependencies: callsites "^3.0.0" graceful-fs "^4.2.4" @@ -1112,52 +1112,52 @@ "@types/istanbul-lib-coverage" "^2.0.0" collect-v8-coverage "^1.0.0" -"@jest/test-result@^26.6.1": - version "26.6.1" - resolved "https://registry.yarnpkg.com/@jest/test-result/-/test-result-26.6.1.tgz#d75698d8a06aa663e8936663778c831512330cc1" - integrity sha512-wqAgIerIN2gSdT2A8WeA5+AFh9XQBqYGf8etK143yng3qYd0mF0ie2W5PVmgnjw4VDU6ammI9NdXrKgNhreawg== +"@jest/test-result@^26.6.2": + version "26.6.2" + resolved "https://registry.yarnpkg.com/@jest/test-result/-/test-result-26.6.2.tgz#55da58b62df134576cc95476efa5f7949e3f5f18" + integrity sha512-5O7H5c/7YlojphYNrK02LlDIV2GNPYisKwHm2QTKjNZeEzezCbwYs9swJySv2UfPMyZ0VdsmMv7jIlD/IKYQpQ== dependencies: - "@jest/console" "^26.6.1" - "@jest/types" "^26.6.1" + "@jest/console" "^26.6.2" + "@jest/types" "^26.6.2" "@types/istanbul-lib-coverage" "^2.0.0" collect-v8-coverage "^1.0.0" -"@jest/test-sequencer@^26.6.1": - version "26.6.1" - resolved "https://registry.yarnpkg.com/@jest/test-sequencer/-/test-sequencer-26.6.1.tgz#34216ac2c194b0eeebde30d25424d1134703fd2e" - integrity sha512-0csqA/XApZiNeTIPYh6koIDCACSoR6hi29T61tKJMtCZdEC+tF3PoNt7MS0oK/zKC6daBgCbqXxia5ztr/NyCQ== +"@jest/test-sequencer@^26.6.3": + version "26.6.3" + resolved "https://registry.yarnpkg.com/@jest/test-sequencer/-/test-sequencer-26.6.3.tgz#98e8a45100863886d074205e8ffdc5a7eb582b17" + integrity sha512-YHlVIjP5nfEyjlrSr8t/YdNfU/1XEt7c5b4OxcXCjyRhjzLYu/rO69/WHPuYcbCWkz8kAeZVZp2N2+IOLLEPGw== dependencies: - "@jest/test-result" "^26.6.1" + "@jest/test-result" "^26.6.2" graceful-fs "^4.2.4" - jest-haste-map "^26.6.1" - jest-runner "^26.6.1" - jest-runtime "^26.6.1" + jest-haste-map "^26.6.2" + jest-runner "^26.6.3" + jest-runtime "^26.6.3" -"@jest/transform@^26.6.1": - version "26.6.1" - resolved "https://registry.yarnpkg.com/@jest/transform/-/transform-26.6.1.tgz#f70786f96e0f765947b4fb4f54ffcfb7bd783711" - integrity sha512-oNFAqVtqRxZRx6vXL3I4bPKUK0BIlEeaalkwxyQGGI8oXDQBtYQBpiMe5F7qPs4QdvvFYB42gPGIMMcxXaBBxQ== +"@jest/transform@^26.6.2": + version "26.6.2" + resolved "https://registry.yarnpkg.com/@jest/transform/-/transform-26.6.2.tgz#5ac57c5fa1ad17b2aae83e73e45813894dcf2e4b" + integrity sha512-E9JjhUgNzvuQ+vVAL21vlyfy12gP0GhazGgJC4h6qUt1jSdUXGWJ1wfu/X7Sd8etSgxV4ovT1pb9v5D6QW4XgA== dependencies: "@babel/core" "^7.1.0" - "@jest/types" "^26.6.1" + "@jest/types" "^26.6.2" babel-plugin-istanbul "^6.0.0" chalk "^4.0.0" convert-source-map "^1.4.0" fast-json-stable-stringify "^2.0.0" graceful-fs "^4.2.4" - jest-haste-map "^26.6.1" + jest-haste-map "^26.6.2" jest-regex-util "^26.0.0" - jest-util "^26.6.1" + jest-util "^26.6.2" micromatch "^4.0.2" pirates "^4.0.1" slash "^3.0.0" source-map "^0.6.1" write-file-atomic "^3.0.0" -"@jest/types@^26.1.0", "@jest/types@^26.3.0", "@jest/types@^26.6.1": - version "26.6.1" - resolved "https://registry.yarnpkg.com/@jest/types/-/types-26.6.1.tgz#2638890e8031c0bc8b4681e0357ed986e2f866c5" - integrity sha512-ywHavIKNpAVrStiRY5wiyehvcktpijpItvGiK72RAn5ctqmzvPk8OvKnvHeBqa1XdQr959CTWAJMqxI8BTibyg== +"@jest/types@^26.1.0", "@jest/types@^26.3.0", "@jest/types@^26.6.2": + version "26.6.2" + resolved "https://registry.yarnpkg.com/@jest/types/-/types-26.6.2.tgz#bef5a532030e1d88a2f5a6d933f84e97226ed48e" + integrity sha512-fC6QCp7Sc5sX6g8Tvbmj4XUTbyrik0akgRy03yjXbQaBWWNWGE7SGtJk98m0N8nzegD/7SggrUlivxo5ax4KWQ== dependencies: "@types/istanbul-lib-coverage" "^2.0.0" "@types/istanbul-reports" "^3.0.0" @@ -1201,10 +1201,10 @@ "@babel/helper-module-imports" "^7.10.4" "@rollup/pluginutils" "^3.1.0" -"@rollup/plugin-commonjs@15.1.0": - version "15.1.0" - resolved "https://registry.yarnpkg.com/@rollup/plugin-commonjs/-/plugin-commonjs-15.1.0.tgz#1e7d076c4f1b2abf7e65248570e555defc37c238" - integrity sha512-xCQqz4z/o0h2syQ7d9LskIMvBSH4PX5PjYdpSSvgS+pQik3WahkQVNWg3D8XJeYjZoVWnIUQYDghuEMRGrmQYQ== +"@rollup/plugin-commonjs@16.0.0": + version "16.0.0" + resolved "https://registry.yarnpkg.com/@rollup/plugin-commonjs/-/plugin-commonjs-16.0.0.tgz#169004d56cd0f0a1d0f35915d31a036b0efe281f" + integrity sha512-LuNyypCP3msCGVQJ7ki8PqYdpjfEkE/xtFa5DqlF+7IBD0JsfMZ87C58heSwIMint58sAUZbt3ITqOmdQv/dXw== dependencies: "@rollup/pluginutils" "^3.1.0" commondir "^1.0.1" @@ -1221,10 +1221,10 @@ dependencies: "@rollup/pluginutils" "^3.0.8" -"@rollup/plugin-node-resolve@9.0.0": - version "9.0.0" - resolved "https://registry.yarnpkg.com/@rollup/plugin-node-resolve/-/plugin-node-resolve-9.0.0.tgz#39bd0034ce9126b39c1699695f440b4b7d2b62e6" - integrity sha512-gPz+utFHLRrd41WMP13Jq5mqqzHL3OXrfj3/MkSyB6UBIcuNt9j60GCbarzMzdf1VHFpOxfQh/ez7wyadLMqkg== +"@rollup/plugin-node-resolve@10.0.0": + version "10.0.0" + resolved "https://registry.yarnpkg.com/@rollup/plugin-node-resolve/-/plugin-node-resolve-10.0.0.tgz#44064a2b98df7530e66acf8941ff262fc9b4ead8" + integrity sha512-sNijGta8fqzwA1VwUEtTvWCx2E7qC70NMsDh4ZG13byAXYigBNZMxALhKUSycBks5gupJdq0lFrKumFrRZ8H3A== dependencies: "@rollup/pluginutils" "^3.1.0" "@types/resolve" "1.17.1" @@ -1233,13 +1233,13 @@ is-module "^1.0.0" resolve "^1.17.0" -"@rollup/plugin-replace@2.3.3": - version "2.3.3" - resolved "https://registry.yarnpkg.com/@rollup/plugin-replace/-/plugin-replace-2.3.3.tgz#cd6bae39444de119f5d905322b91ebd4078562e7" - integrity sha512-XPmVXZ7IlaoWaJLkSCDaa0Y6uVo5XQYHhiMFzOd5qSv5rE+t/UJToPIOE56flKIxBFQI27ONsxb7dqHnwSsjKQ== +"@rollup/plugin-replace@2.3.4": + version "2.3.4" + resolved "https://registry.yarnpkg.com/@rollup/plugin-replace/-/plugin-replace-2.3.4.tgz#7dd84c17755d62b509577f2db37eb524d7ca88ca" + integrity sha512-waBhMzyAtjCL1GwZes2jaE9MjuQ/DQF2BatH3fRivUF3z0JBFrU0U6iBNC/4WR+2rLKhaAhPWDNPYp4mI6RqdQ== dependencies: - "@rollup/pluginutils" "^3.0.8" - magic-string "^0.25.5" + "@rollup/pluginutils" "^3.1.0" + magic-string "^0.25.7" "@rollup/pluginutils@^3.0.8", "@rollup/pluginutils@^3.1.0": version "3.1.0" @@ -1652,6 +1652,11 @@ array-includes@^3.1.1: es-abstract "^1.17.0" is-string "^1.0.5" +array-timsort@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/array-timsort/-/array-timsort-1.0.3.tgz#3c9e4199e54fb2b9c3fe5976396a21614ef0d926" + integrity sha512-/+3GRL7dDAGEfM6TseQk/U+mi18TU2Ms9I3UlLdUMhz2hbvGNTKdj9xniwXfUqgYhHxRx0+8UnKkvlNwVU+cWQ== + array-union@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/array-union/-/array-union-2.1.0.tgz#b798420adbeb1de828d84acd8a2e23d3efe85e8d" @@ -1738,16 +1743,16 @@ babel-eslint@^10.1.0: eslint-visitor-keys "^1.0.0" resolve "^1.12.0" -babel-jest@26.6.1, babel-jest@^26.6.1: - version "26.6.1" - resolved "https://registry.yarnpkg.com/babel-jest/-/babel-jest-26.6.1.tgz#07bd7bec14de47fe0f2c9a139741329f1f41788b" - integrity sha512-duMWEOKrSBYRVTTNpL2SipNIWnZOjP77auOBMPQ3zXAdnDbyZQWU8r/RxNWpUf9N6cgPFecQYelYLytTVXVDtA== +babel-jest@26.6.3, babel-jest@^26.6.3: + version "26.6.3" + resolved "https://registry.yarnpkg.com/babel-jest/-/babel-jest-26.6.3.tgz#d87d25cb0037577a0c89f82e5755c5d293c01056" + integrity sha512-pl4Q+GAVOHwvjrck6jKjvmGhnO3jHX/xuB9d27f+EJZ/6k+6nMuPjorrYp7s++bKKdANwzElBWnLWaObvTnaZA== dependencies: - "@jest/transform" "^26.6.1" - "@jest/types" "^26.6.1" + "@jest/transform" "^26.6.2" + "@jest/types" "^26.6.2" "@types/babel__core" "^7.1.7" babel-plugin-istanbul "^6.0.0" - babel-preset-jest "^26.5.0" + babel-preset-jest "^26.6.2" chalk "^4.0.0" graceful-fs "^4.2.4" slash "^3.0.0" @@ -1781,20 +1786,20 @@ babel-plugin-istanbul@^6.0.0: istanbul-lib-instrument "^4.0.0" test-exclude "^6.0.0" -babel-plugin-jest-hoist@^26.5.0: - version "26.5.0" - resolved "https://registry.yarnpkg.com/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-26.5.0.tgz#3916b3a28129c29528de91e5784a44680db46385" - integrity sha512-ck17uZFD3CDfuwCLATWZxkkuGGFhMij8quP8CNhwj8ek1mqFgbFzRJ30xwC04LLscj/aKsVFfRST+b5PT7rSuw== +babel-plugin-jest-hoist@^26.6.2: + version "26.6.2" + resolved "https://registry.yarnpkg.com/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-26.6.2.tgz#8185bd030348d254c6d7dd974355e6a28b21e62d" + integrity sha512-PO9t0697lNTmcEHH69mdtYiOIkkOlj9fySqfO3K1eCcdISevLAE0xY59VLLUj0SoiPiTX/JU2CYFpILydUa5Lw== dependencies: "@babel/template" "^7.3.3" "@babel/types" "^7.3.3" "@types/babel__core" "^7.0.0" "@types/babel__traverse" "^7.0.6" -babel-preset-current-node-syntax@^0.1.3: - version "0.1.3" - resolved "https://registry.yarnpkg.com/babel-preset-current-node-syntax/-/babel-preset-current-node-syntax-0.1.3.tgz#b4b547acddbf963cba555ba9f9cbbb70bfd044da" - integrity sha512-uyexu1sVwcdFnyq9o8UQYsXwXflIh8LvrF5+cKrYam93ned1CStffB3+BEcsxGSgagoA3GEyjDqO4a/58hyPYQ== +babel-preset-current-node-syntax@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/babel-preset-current-node-syntax/-/babel-preset-current-node-syntax-1.0.0.tgz#cf5feef29551253471cfa82fc8e0f5063df07a77" + integrity sha512-mGkvkpocWJes1CmMKtgGUwCeeq0pOhALyymozzDWYomHTbDLwueDYG6p4TK1YOeYHCzBzYPsWkgTto10JubI1Q== dependencies: "@babel/plugin-syntax-async-generators" "^7.8.4" "@babel/plugin-syntax-bigint" "^7.8.3" @@ -1807,14 +1812,15 @@ babel-preset-current-node-syntax@^0.1.3: "@babel/plugin-syntax-object-rest-spread" "^7.8.3" "@babel/plugin-syntax-optional-catch-binding" "^7.8.3" "@babel/plugin-syntax-optional-chaining" "^7.8.3" + "@babel/plugin-syntax-top-level-await" "^7.8.3" -babel-preset-jest@^26.5.0: - version "26.5.0" - resolved "https://registry.yarnpkg.com/babel-preset-jest/-/babel-preset-jest-26.5.0.tgz#f1b166045cd21437d1188d29f7fba470d5bdb0e7" - integrity sha512-F2vTluljhqkiGSJGBg/jOruA8vIIIL11YrxRcO7nviNTMbbofPSHwnm8mgP7d/wS7wRSexRoI6X1A6T74d4LQA== +babel-preset-jest@^26.6.2: + version "26.6.2" + resolved "https://registry.yarnpkg.com/babel-preset-jest/-/babel-preset-jest-26.6.2.tgz#747872b1171df032252426586881d62d31798fee" + integrity sha512-YvdtlVm9t3k777c5NPQIv6cxFFFapys25HiUmuSgHwIZhfifweR5c5Sf5nwE3MAbfu327CYSvps8Yx6ANLyleQ== dependencies: - babel-plugin-jest-hoist "^26.5.0" - babel-preset-current-node-syntax "^0.1.3" + babel-plugin-jest-hoist "^26.6.2" + babel-preset-current-node-syntax "^1.0.0" bail@^1.0.0: version "1.0.5" @@ -1947,10 +1953,10 @@ callsites@^3.0.0: resolved "https://registry.yarnpkg.com/callsites/-/callsites-3.1.0.tgz#b3630abd8943432f54b3f0519238e33cd7df2f73" integrity sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ== -camelcase@6.1.0, camelcase@^6.0.0: - version "6.1.0" - resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-6.1.0.tgz#27dc176173725fb0adf8a48b647f4d7871944d78" - integrity sha512-WCMml9ivU60+8rEJgELlFp1gxFcEGxwYleE3bziHEDeqsqAWGHdimB7beBFGjLzVNgPGyDsfgXLQEYMpmIFnVQ== +camelcase@6.2.0, camelcase@^6.0.0: + version "6.2.0" + resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-6.2.0.tgz#924af881c9d525ac9d87f40d964e5cea982a1809" + integrity sha512-c7wVvbw3f37nuobQNtgsgG9POC9qMbNuMQmTCqZv23b6MIz0fcYpBiOlv9gEN/hdLdnZTDQhg6e9Dq5M1vKvfg== camelcase@^5.0.0, camelcase@^5.3.1: version "5.3.1" @@ -2028,10 +2034,10 @@ cjk-regex@2.0.0: regexp-util "^1.2.1" unicode-regex "^2.0.0" -cjs-module-lexer@^0.4.2: - version "0.4.3" - resolved "https://registry.yarnpkg.com/cjs-module-lexer/-/cjs-module-lexer-0.4.3.tgz#9e31f7fe701f5fcee5793f77ab4e58fa8dcde8bc" - integrity sha512-5RLK0Qfs0PNDpEyBXIr3bIT1Muw3ojSlvpw6dAmkUcO0+uTrsBn7GuEIgx40u+OzbCBLDta7nvmud85P4EmTsQ== +cjs-module-lexer@^0.6.0: + version "0.6.0" + resolved "https://registry.yarnpkg.com/cjs-module-lexer/-/cjs-module-lexer-0.6.0.tgz#4186fcca0eae175970aee870b9fe2d6cf8d5655f" + integrity sha512-uc2Vix1frTfnuzxxu1Hp4ktSvM3QaI4oXl4ZUqL1wjTu/BGki9TrCWoqLTg/drR1KwAEarXuRFCG2Svr1GxPFw== class-utils@^0.3.5: version "0.3.6" @@ -2128,16 +2134,17 @@ commander@^2.19.0, commander@^2.20.0: resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33" integrity sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ== -commander@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/commander/-/commander-6.0.0.tgz#2b270da94f8fb9014455312f829a1129dbf8887e" - integrity sha512-s7EA+hDtTYNhuXkTlhqew4txMZVdszBmKWSPEMxGr8ru8JXR7bLUFIAtPhcSuFdJQ0ILMxnJi8GkQL0yvDy/YA== +commander@^6.1.0: + version "6.2.0" + resolved "https://registry.yarnpkg.com/commander/-/commander-6.2.0.tgz#b990bfb8ac030aedc6d11bc04d1488ffef56db75" + integrity sha512-zP4jEKbe8SHzKJYQmq8Y9gYjtO/POJLgIdKgV7B9qNmABVFVc+ctqSX6iXh4mCpJfRBOabiZ2YKPg8ciDw6C+Q== -comment-json@^3.0.3: - version "3.0.3" - resolved "https://registry.yarnpkg.com/comment-json/-/comment-json-3.0.3.tgz#0cadacd6278602b57b8c51b1814dc5d311d228c4" - integrity sha512-P7XwYkC3qjIK45EAa9c5Y3lR7SMXhJqwFdWg3niAIAcbk3zlpKDdajV8Hyz/Y3sGNn3l+YNMl8A2N/OubSArHg== +comment-json@^4.0.6, comment-json@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/comment-json/-/comment-json-4.1.0.tgz#09d08f0fbc4ad5eeccbac20f469adbb967dcbd2c" + integrity sha512-WEghmVYaNq9NlWbrkzQTSsya9ycLyxJxpTQfZEan6a5Jomnjw18zS3Podf8q1Zf9BvonvQd/+Z7Z39L7KKzzdQ== dependencies: + array-timsort "^1.0.3" core-util-is "^1.0.2" esprima "^4.0.1" has-own-prop "^2.0.0" @@ -2243,192 +2250,234 @@ crypto-random-string@^2.0.0: resolved "https://registry.yarnpkg.com/crypto-random-string/-/crypto-random-string-2.0.0.tgz#ef2a7a966ec11083388369baa02ebead229b30d5" integrity sha512-v1plID3y9r/lPhviJ1wrXpLeyUIGAZ2SHNYTEapm7/8A9nLPoyvVp3RK/EPFqn5kEznyWgYZNsRtYYIWbuG8KA== -cspell-dict-aws@^1.0.6: - version "1.0.6" - resolved "https://registry.yarnpkg.com/cspell-dict-aws/-/cspell-dict-aws-1.0.6.tgz#8ca5436c7c22bea1c71accb796652abeab6965ab" - integrity sha512-EAF/XyI1RIzlAxaQSu+lxS0HxggoUO0zuDFlqfy0gb0hOGH14lcraILQ4ZExl04bAU2v7eatgoM5s4x/uFSGow== +cspell-dict-aws@^1.0.7: + version "1.0.7" + resolved "https://registry.yarnpkg.com/cspell-dict-aws/-/cspell-dict-aws-1.0.7.tgz#c4b9d26de3ff90bd6e16ba7d347ee99d341adbf1" + integrity sha512-/8lvWfwrWuWNe2VPH0v2fLyeKyMBWI/ZkKlB1DwKn/LgzMpjBtdsdZhEAkx0ETBjAXR+bgZnN/QldCWCS1D6wA== dependencies: configstore "^5.0.1" -cspell-dict-bash@^1.0.4: - version "1.0.4" - resolved "https://registry.yarnpkg.com/cspell-dict-bash/-/cspell-dict-bash-1.0.4.tgz#7f086d8e4f6813fcbd9ea4123c583bc20c148449" - integrity sha512-/BLAhGLRsQMpLp8LdjhR7Nrt3egKIlHBg7/Lu3P+zGCxSWkhp/maObW21eAod63zJiS5WitJfL9e+E+7zxamWQ== +cspell-dict-bash@^1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/cspell-dict-bash/-/cspell-dict-bash-1.0.5.tgz#3de537b462ec939cfd8f782905a11c042549497a" + integrity sha512-fyF+W6AsSauF3TcUoCqesiMlj4tp9+gf5PWEJKV0dujTjO8p5dy4RwCX0I4Zw2nC92Knt4If3L+J/4TlNzJGtw== dependencies: configstore "^5.0.1" -cspell-dict-companies@^1.0.23: - version "1.0.23" - resolved "https://registry.yarnpkg.com/cspell-dict-companies/-/cspell-dict-companies-1.0.23.tgz#64734b9ec9578a17f201e12ad0d368beda8dbf9f" - integrity sha512-MSUd2boJzgnwaSLarBF5Kiquf/mHEnv7gpOgXdpWmZ/mSmdlz1rW8/G09sCEle14YWo1/zDYX2ewi+a2SqTxmw== +cspell-dict-companies@^1.0.30: + version "1.0.30" + resolved "https://registry.yarnpkg.com/cspell-dict-companies/-/cspell-dict-companies-1.0.30.tgz#d4046ba6cc98ff310783e7370c0df2d336136c02" + integrity sha512-h+agGF0t+/rNJdpb5sBTZAHGZL7uKCOJfCLVakYi/9E6juocISTq/zDls/Junb1SKiWulbH8y1CeEMgyKAsCaA== dependencies: configstore "^5.0.1" -cspell-dict-cpp@^1.1.28: - version "1.1.28" - resolved "https://registry.yarnpkg.com/cspell-dict-cpp/-/cspell-dict-cpp-1.1.28.tgz#ba39074d42a581a9aa40e5d642e27c58a0761a30" - integrity sha512-lr53hT4LNWfFcH2q3NWqwnI5JtfiIrZt60AkVWnaumfIV7MO7qcWPSohhqSQW2VF2idx9rH6iK6/UwKz0RzLZw== +cspell-dict-cpp@^1.1.29: + version "1.1.29" + resolved "https://registry.yarnpkg.com/cspell-dict-cpp/-/cspell-dict-cpp-1.1.29.tgz#e4de6d2546b5164cd86e94af431ea864c575996b" + integrity sha512-rRSUV53+6oZo5fCiweqq7gwpbV6qXmTfxRo13Dce688w5UaDkSSn9Cz2FEgWqpYZj8l530QtMKeFtmGLgpPBww== dependencies: configstore "^5.0.1" -cspell-dict-cryptocurrencies@^1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/cspell-dict-cryptocurrencies/-/cspell-dict-cryptocurrencies-1.0.3.tgz#c71a323230a130f9f157a7f2a95d979bdcdaa91a" - integrity sha512-kue3B8A4MJ8jLTFHgEhJHe4pbi2R+AgrB8+JSmIaV74m7ZAu01ARKu/CBCoXm0jxYyVm2O3Ks/wBb9WXYhQIOA== +cspell-dict-cryptocurrencies@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/cspell-dict-cryptocurrencies/-/cspell-dict-cryptocurrencies-1.0.4.tgz#8d5f8e0cfbc08bb45aee3ca1bc6748814b97e13a" + integrity sha512-jIiBmxnEyWfQ6AzXoUCvxt8kUMbsCbngNBHZVMcIf75iUzSkJsZVCVRoIS/G9BYaiw6/i5uj0QEdefX+J71N1A== + dependencies: + configstore "^5.0.0" + +cspell-dict-csharp@^1.0.3: + version "1.0.5" + resolved "https://registry.yarnpkg.com/cspell-dict-csharp/-/cspell-dict-csharp-1.0.5.tgz#fc4c187a2412dd5aaecdb24b48ed8cf7c1741ae3" + integrity sha512-BNo5rLAhwCpg5w09+aaInUJozaPv5ND1K/wOwSPrEA9DW8F1EP703ekUxhB0islzYkEcoAuyM7Xu7SKpzh+8PQ== dependencies: configstore "^5.0.0" -cspell-dict-django@^1.0.16: +cspell-dict-css@^1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/cspell-dict-css/-/cspell-dict-css-1.0.5.tgz#6d83c3773ae92063e4cdb1c5f46960528f138df1" + integrity sha512-/rs7ctTiP5Yfh50SNLiiT+aPGkOS57KYaF8QFTAjar0O8lKKK9ghAxoMXgjijTEXoqc0yujOK8yQltcJzTdvog== + dependencies: + configstore "^5.0.0" + +cspell-dict-django@^1.0.17: + version "1.0.17" + resolved "https://registry.yarnpkg.com/cspell-dict-django/-/cspell-dict-django-1.0.17.tgz#d18ac063eac966ce0ca136cce582ae6477a45abb" + integrity sha512-6LdpmyqlGpUwgcGZiUXDJKz6rq4gc5Omkv3NZKJ8fwocdRI6ZD0Vlo3/18PSzD8XSYay1c9pCIr6V6N0fexbYw== + dependencies: + configstore "^5.0.1" + +cspell-dict-dotnet@^1.0.16: version "1.0.16" - resolved "https://registry.yarnpkg.com/cspell-dict-django/-/cspell-dict-django-1.0.16.tgz#3dd70d8a9abfd07eddb4524d85fe3c6d257419fe" - integrity sha512-TY31T1DQAPZ1YjYbhtIQmWpfLSA9Vu2AavdfBaCUiun+wIxWyguEfiopNSovor6StMGC9BStXipoALcXuCO7OQ== + resolved "https://registry.yarnpkg.com/cspell-dict-dotnet/-/cspell-dict-dotnet-1.0.16.tgz#1f429dfd758fb7f9c6871cae26671142e409ca19" + integrity sha512-07UbbIuAcj7KDt2cPFwjQRnHplCPyks07/FEpwXc7+WroFdxIbhwqV6d8Ol+DcnIR+1PoK0Ertp8iCBzTHPceA== dependencies: configstore "^5.0.1" -cspell-dict-dotnet@^1.0.15: +cspell-dict-elixir@^1.0.15: version "1.0.15" - resolved "https://registry.yarnpkg.com/cspell-dict-dotnet/-/cspell-dict-dotnet-1.0.15.tgz#924a58de0d12af1049e66fdc801dab5856ae0e47" - integrity sha512-8o6v64cM+68ggm2nVtIS+65DKKPit9uLhuV1cN3Vj8665j6FMZJAEwQY/Bjpq2J8EI9iZbkklTWOeS9jgx9wAA== + resolved "https://registry.yarnpkg.com/cspell-dict-elixir/-/cspell-dict-elixir-1.0.15.tgz#dceebd56ce6bfd318bc258a8e1900ddeb252b5b2" + integrity sha512-M6tx+1gI1lrtqaF466hFEihj4VRxLnF+ZxweyJZQJ6elR+VvvwRq2SVD8NAgBE3Dr0oU49uxgzdjuZz3S1kD8w== dependencies: configstore "^5.0.1" -cspell-dict-elixir@^1.0.14: - version "1.0.14" - resolved "https://registry.yarnpkg.com/cspell-dict-elixir/-/cspell-dict-elixir-1.0.14.tgz#eee5c4159e83dcb02101bace934e3a02a16f3984" - integrity sha512-8tc7AV0TgcpklQezGksWw+O1XfnL+hwBFR400ud8k8P+iDrDLp85JiRKqAMIfXrFaS4D8LmXa35oZWaCV450hA== +cspell-dict-en-gb@^1.1.20: + version "1.1.20" + resolved "https://registry.yarnpkg.com/cspell-dict-en-gb/-/cspell-dict-en-gb-1.1.20.tgz#6f9c28e2629f1e799506f92a30394230ca519b10" + integrity sha512-cYsJV6UyIqMal8+NMlg6DHn95LwTdM4wcDkjDDatRqQFhVi5m1yUB+l/JfnIbfYxaz51cJfNqpZSOE2LeF38Vw== dependencies: configstore "^5.0.1" -cspell-dict-en-gb@^1.1.19: - version "1.1.19" - resolved "https://registry.yarnpkg.com/cspell-dict-en-gb/-/cspell-dict-en-gb-1.1.19.tgz#999d8a76dd1fffcdc982fbd2bef5674352209abb" - integrity sha512-GB7Dw6yEZdz/ajNoEkunLhkCQL4+KH8owVFSZG27h/GD0wwkReOd/iKNvctCZFhZNYQDj90l+zZD9J7j2IURVA== +cspell-dict-en_us@^1.2.30: + version "1.2.30" + resolved "https://registry.yarnpkg.com/cspell-dict-en_us/-/cspell-dict-en_us-1.2.30.tgz#4bfcc38dbcf669a490561e6e2b866be865feb727" + integrity sha512-A6tcz4LPBhOQ5uRMx+gjPq4QpgfpMeoMWgd8As41bAoxpun2/ZXe2+A/Gl9GdOF+Zb9o7ccsx10NQDSeodhKgQ== dependencies: configstore "^5.0.1" -cspell-dict-en_us@^1.2.29: - version "1.2.29" - resolved "https://registry.yarnpkg.com/cspell-dict-en_us/-/cspell-dict-en_us-1.2.29.tgz#3d2a2295b417d477eecf2d9a1e6d12c4c986ce54" - integrity sha512-cnfsQI/9vVXyodK3DIMwmVEv1H8dvHR62Du0gIbOeYAEGapMZnWW4UdXaeP4TGWOwBocrPm165K9djSZG0TT+Q== +cspell-dict-filetypes@^1.0.3: + version "1.1.0" + resolved "https://registry.yarnpkg.com/cspell-dict-filetypes/-/cspell-dict-filetypes-1.1.0.tgz#04dcad32ea000ab145e1f52190da69e9098acca8" + integrity sha512-uzLMSUzR3Z1fcX/6VXY3vrdFIR7BzcDTJHa35Y8mSOIt0sWldBh/1uFB9t+TA1+6Og4Rr7n6rSKhGIppGzU4ZA== + dependencies: + configstore "^5.0.0" + +cspell-dict-fonts@^1.0.7: + version "1.0.7" + resolved "https://registry.yarnpkg.com/cspell-dict-fonts/-/cspell-dict-fonts-1.0.7.tgz#93ec7d9c5b85af0b87750d76b136553548d559c4" + integrity sha512-po4Rb3wEn0PVCLbFBkAWtXd76ljJPzXHDiRCeLjpwr6pjyoBb/S6KvcIBTlgSGWXVQQGdy2XW9ChFtljz1FOOA== dependencies: configstore "^5.0.1" -cspell-dict-fonts@^1.0.6: - version "1.0.6" - resolved "https://registry.yarnpkg.com/cspell-dict-fonts/-/cspell-dict-fonts-1.0.6.tgz#cd0a7978f3a15367b84f489be7f2074252306d76" - integrity sha512-ksuBPyXGz4NxtlICul/ELLVYDT4s3SQIBwiMlhlL74kvaEjhJUdgfBs5ZBzkT9XZrUTNkMe4FGXsyZPTuPtw2Q== +cspell-dict-fullstack@^1.0.31: + version "1.0.31" + resolved "https://registry.yarnpkg.com/cspell-dict-fullstack/-/cspell-dict-fullstack-1.0.31.tgz#3bf06bc0583fd393b74ccc3f5e3c31fbef43479e" + integrity sha512-0xYe5eANBaDPnDsACsf8Vla0qGLspUdk3nPkKU+7LqTUb1LvKAE20As8ihxblD/SxBKsmD5FyLFIhCgYvLb4ng== dependencies: configstore "^5.0.1" -cspell-dict-fullstack@^1.0.24: - version "1.0.24" - resolved "https://registry.yarnpkg.com/cspell-dict-fullstack/-/cspell-dict-fullstack-1.0.24.tgz#006b4a011667c5ec606e68ac57922249e4dbdd58" - integrity sha512-TfcAsYXBpJBTK8IamP4uUAF3+UAnqxZ5fw1jqDfWqy0TaEiePahL92ibrqw5wKqJmis0O169VdP5iETznGT+Vg== +cspell-dict-golang@^1.1.16: + version "1.1.16" + resolved "https://registry.yarnpkg.com/cspell-dict-golang/-/cspell-dict-golang-1.1.16.tgz#fa5741542973ac83c3323f9212ed0d8c67e8b455" + integrity sha512-15wd23uwr8jM+3JDsFRsyjmne3psuxDIrrNnM8LWxJuytlm/2d+weXF00XDjMZ/bSDCeyZ8sz08aulr6i9c9cw== dependencies: configstore "^5.0.1" -cspell-dict-golang@^1.1.15: - version "1.1.15" - resolved "https://registry.yarnpkg.com/cspell-dict-golang/-/cspell-dict-golang-1.1.15.tgz#b127bfd67b44e0881e6b99b3b074b4f93605ae18" - integrity sha512-Yc1XhYGcKLR7Xp29XS5Ypd3eeqVQGE79QfyuR03OXEkZ0cVvleH1sPO5kOoKlcnQjEKwhPgkWjfb/SNrq0D/WA== +cspell-dict-haskell@^1.0.6: + version "1.0.6" + resolved "https://registry.yarnpkg.com/cspell-dict-haskell/-/cspell-dict-haskell-1.0.6.tgz#8945c36631230e85aa3952b774851d7b816b36a6" + integrity sha512-j0hDxShC/9kU6FLw+3wwxdEvZcoHLYSoPdlGhDvhFwMqReogNwdFf/YrzzlVDasxOD5eY25Arqz0t3L3mB3Efg== dependencies: configstore "^5.0.1" -cspell-dict-haskell@^1.0.5: - version "1.0.5" - resolved "https://registry.yarnpkg.com/cspell-dict-haskell/-/cspell-dict-haskell-1.0.5.tgz#125f34ae9cfcf64ab89d83e049ac55a30327b88e" - integrity sha512-imNCu1qn8yfn0/uMaZep9HJHuxUlTNTrY3M+TD7dsi6NtXcUE8f7pE+BIuO8f1xfg+m991B8ZMbRAAN3+E0jXw== +cspell-dict-html-symbol-entities@^1.0.15: + version "1.0.15" + resolved "https://registry.yarnpkg.com/cspell-dict-html-symbol-entities/-/cspell-dict-html-symbol-entities-1.0.15.tgz#50d70ac7632f2ef40a3da7df0c531882403c8ea5" + integrity sha512-F956/ormR3VvLjSNrrRdMQu/5cCVr3kYqsplJGxsTLC/ejrXy+HPJQUMMckXi/zG2SrzmLP7Lg6d5QHf5PcHQQ== dependencies: configstore "^5.0.1" -cspell-dict-html-symbol-entities@^1.0.14: +cspell-dict-html@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/cspell-dict-html/-/cspell-dict-html-1.1.0.tgz#dee8d75e5d70531b9f207c375423ef495e9eb85e" + integrity sha512-KXXqOE6QM/3OdIh0ax0YlfOg/+ogqt7f/WoBTjb+1L2CReYfWsOfYVjuZG+L6j5GW34wnMyq1QYo9APX4NF3nw== + dependencies: + configstore "^5.0.0" + +cspell-dict-java@^1.0.14: version "1.0.14" - resolved "https://registry.yarnpkg.com/cspell-dict-html-symbol-entities/-/cspell-dict-html-symbol-entities-1.0.14.tgz#b07a12339abaefa95e058db089049731bb2e3da9" - integrity sha512-hLWjTcLJmY+6DTNIsSC1Uuq54uIxYSianJFm1fEvxzgUYFcPts/HLLNyFD+OuWMBX4KHd/ihoyAFwiiLabjC8Q== + resolved "https://registry.yarnpkg.com/cspell-dict-java/-/cspell-dict-java-1.0.14.tgz#7a5449730b81c69ed29e7142af8a3d3b486dbcbb" + integrity sha512-PemBu/fl4o6PSygaQWYU+ioaLV5qgiBxc0YdqFC2Rxo5g9B6S1yVwf4Vgs+jEJq40gN6I2G/JMw2WlrYj4h4gw== dependencies: configstore "^5.0.1" -cspell-dict-java@^1.0.13: - version "1.0.13" - resolved "https://registry.yarnpkg.com/cspell-dict-java/-/cspell-dict-java-1.0.13.tgz#337b890a6f2990a6c93a4b5a04576885aba7a70f" - integrity sha512-PjtqsqyO00q/L/g3F5tcW8VG5Z66MIddM+YMMS+O40giSGJ23e4Ts++SBnP8IYmDfi/KDElWFwLJmb+1RZgAkg== +cspell-dict-latex@^1.0.15: + version "1.0.15" + resolved "https://registry.yarnpkg.com/cspell-dict-latex/-/cspell-dict-latex-1.0.15.tgz#a74198565dd4eda349382cfbc51f7e30b1a38bed" + integrity sha512-4vHniog3px2qMYIYuCKY55eYoAV9xIUsWsUHrOpT+rqmibZijYH0RnST2ZZ2Q9b0gr9C5TSUHVBBSCeRL3dxbA== dependencies: configstore "^5.0.1" -cspell-dict-latex@^1.0.14: +cspell-dict-lorem-ipsum@^1.0.14: version "1.0.14" - resolved "https://registry.yarnpkg.com/cspell-dict-latex/-/cspell-dict-latex-1.0.14.tgz#a175d73911b700df17403bea8ff2ff93737149a1" - integrity sha512-VSUzrIyA+zc08T+3q46AAq5tdsF8PsRZaBLFxQZwZ1n3dAhyWzkiQ07iwawuu6DkAeRbNmGaYg9Rd9vMAd9tUw== + resolved "https://registry.yarnpkg.com/cspell-dict-lorem-ipsum/-/cspell-dict-lorem-ipsum-1.0.14.tgz#81603b6c074abc0211e789ce9318c42485ad508e" + integrity sha512-4xI3naVG8TnNdF23ElLH91KHO/msdiMS7kUCjguD5NNTOOwUiTxqW8YShMzEXQ7YOsXBCqQi7LstFjgEnV84Ow== dependencies: configstore "^5.0.1" -cspell-dict-lorem-ipsum@^1.0.13: - version "1.0.13" - resolved "https://registry.yarnpkg.com/cspell-dict-lorem-ipsum/-/cspell-dict-lorem-ipsum-1.0.13.tgz#664751ea88f4f54e6b8e0741574e71668476db11" - integrity sha512-B/1C4hKRg5Trnm6SNSw6XbYASoggHrBzUzhV+g/MxDVHIHazESLXO1nfJIVCooKSQwxBRnrn2uEtX4ryIdyVBQ== +cspell-dict-lua@^1.0.10: + version "1.0.10" + resolved "https://registry.yarnpkg.com/cspell-dict-lua/-/cspell-dict-lua-1.0.10.tgz#5293172675c5bb92d25396a850ad66f124ac7247" + integrity sha512-+21ca6nsLgLVg/s9GNnsuhEV0JgmkMFXqcV2lvBnTo1NeqPB6CwrcHU2d5OzB6Nnp0M4AbyL727C1EFuX5zLLA== dependencies: configstore "^5.0.1" -cspell-dict-lua@^1.0.9: - version "1.0.9" - resolved "https://registry.yarnpkg.com/cspell-dict-lua/-/cspell-dict-lua-1.0.9.tgz#07552dbbde141e1caff4bac3441583de8e172421" - integrity sha512-28o0KHYuD7wbjgG57SnlJqp2nF2r3diqx4BuYcVGli0+i12oCPu6Ii6n6g3U4yXSLfsch21GjfSbPMa8FeOepQ== +cspell-dict-node@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/cspell-dict-node/-/cspell-dict-node-1.0.3.tgz#5d871b811c315b74fc6aa47df5fb55a4708a205c" + integrity sha512-LoSBB63YWIFL6BMpikSHlQ8VILucUpvDAHjFHIKppFpoczK8iubejvBmemDWLMdtEyUKo7sSIrEH4eVojQEHUA== dependencies: - configstore "^5.0.1" + configstore "^5.0.0" -cspell-dict-php@^1.0.14: - version "1.0.14" - resolved "https://registry.yarnpkg.com/cspell-dict-php/-/cspell-dict-php-1.0.14.tgz#d8ccd535d8389cbe1d5cb068dbe0ab6946c58cd9" - integrity sha512-MD+86VH263sl4t2OJd0/2aHuJcPVNMJTm8bszk+MOB29LnmYdTbu2Fu5miIZ1l+zVpAZr0wfYVZWsYtuSkFGUQ== +cspell-dict-npm@^1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/cspell-dict-npm/-/cspell-dict-npm-1.0.5.tgz#a4f11b4b1919479607b56251079c9620298a55a1" + integrity sha512-gdEf1obAPnWC9fzU99nCFEV3UGVZ2FSbbsh15hvv9VHe/w5n5RaxQGsd4dDvjdHTYqsRimjX15ppuJb7xjN93Q== dependencies: - configstore "^5.0.1" + configstore "^5.0.0" -cspell-dict-powershell@^1.0.7: - version "1.0.7" - resolved "https://registry.yarnpkg.com/cspell-dict-powershell/-/cspell-dict-powershell-1.0.7.tgz#0e9761c3d84c57945b540f781c81380d8c64bc5d" - integrity sha512-Ay+lFRZP6pvSMBkkJ9PPjuqgfqufeEgohPjZ34/yh6xXODkmopsf7sgUkirdjcFryosilnDze0Mwii1o+iEwJA== +cspell-dict-php@^1.0.15: + version "1.0.15" + resolved "https://registry.yarnpkg.com/cspell-dict-php/-/cspell-dict-php-1.0.15.tgz#f8273048958eaa110e4fdfdef0a7f12c654be77d" + integrity sha512-WDUnTV7jje/Ksl3gtaO7ffiB+LW9Ji9bnq0AvD6iOFOeYcrHjZS9t+23b+oP7mRCdXeGv1/AKtchEMY10iyxBA== dependencies: configstore "^5.0.1" -cspell-dict-python@^1.0.22: - version "1.0.22" - resolved "https://registry.yarnpkg.com/cspell-dict-python/-/cspell-dict-python-1.0.22.tgz#47b986db58b89a29dcb513f976782e16c97f3d07" - integrity sha512-ddLd+MPQPkVAe3CveCLAe2JQtuV1nqod2nnrXabdspD2Q4yQI/iEj3oMe1Ig4N63ZGZcn0MirC7k2Dcy4uGKsQ== +cspell-dict-powershell@^1.0.8: + version "1.0.8" + resolved "https://registry.yarnpkg.com/cspell-dict-powershell/-/cspell-dict-powershell-1.0.8.tgz#d3b9afbc3ae449086f8cd453e082a01a1d511f0d" + integrity sha512-Kjcx8XeqBoPaCVg/tbaeIImdLwlScpV9FEakV0ZBDqY2FOh6Wle6wYXVcz77+6EK6ChhS+WTqeoo6ft+oQ3c3A== dependencies: configstore "^5.0.1" -cspell-dict-ruby@^1.0.4: - version "1.0.4" - resolved "https://registry.yarnpkg.com/cspell-dict-ruby/-/cspell-dict-ruby-1.0.4.tgz#1f91ea12e6ac2875e86b3982f0b6549e4b6eb567" - integrity sha512-OHfxzwZqLzrJGu5NjmnKN6fS3cD8veOXr7T3eeUEyuckICArD6nbFwX1MLBDKFs7pn80QZkRUsU4nklPvXUomA== +cspell-dict-python@^1.0.23: + version "1.0.23" + resolved "https://registry.yarnpkg.com/cspell-dict-python/-/cspell-dict-python-1.0.23.tgz#c8ebbf4fb892bf66483e9b8ff1e1a4a387825a8f" + integrity sha512-nO3boMGkoKbek7LCrz75ZwBJmSOasS9bbhCIYkE9VA8hSr4aempKqCXaI/D4cykIOdBX6H8nvbyXyXxgHBmFLw== dependencies: configstore "^5.0.1" -cspell-dict-rust@^1.0.13: - version "1.0.13" - resolved "https://registry.yarnpkg.com/cspell-dict-rust/-/cspell-dict-rust-1.0.13.tgz#91e336c6b1be079ef0e23caefcd8ca68df6bde36" - integrity sha512-Ib8CcgSB/bUYyM51te2xkkasYHgtlhhaE0CLRkBKQBpKs+OjSqk7Y+wsyPjJR/C8m29k7QFnPGA3ueq5UzMUYw== +cspell-dict-ruby@^1.0.6: + version "1.0.6" + resolved "https://registry.yarnpkg.com/cspell-dict-ruby/-/cspell-dict-ruby-1.0.6.tgz#09bc56863f4430087ad1777dfc62ab2ff8e599ca" + integrity sha512-KJp1aD6hck+e03Kp3cq1mc4crPya0a+9MFgD+KTuca0cQ8S9KbwB1/s9BylGifedsb41q3gVFmxavdDAxrigTg== dependencies: configstore "^5.0.1" -cspell-dict-scala@^1.0.12: - version "1.0.12" - resolved "https://registry.yarnpkg.com/cspell-dict-scala/-/cspell-dict-scala-1.0.12.tgz#00c930ac58db0744eed861557cfb475c92ad8fa0" - integrity sha512-sFqTlLNI1z2NnvTusJcdP2xnIk4X+rdg6Df5ifZ/cEXvf0U45UofdTwgZ39ISEgQ12d9bPQtPZ0+Td5w/FDkig== +cspell-dict-rust@^1.0.14: + version "1.0.14" + resolved "https://registry.yarnpkg.com/cspell-dict-rust/-/cspell-dict-rust-1.0.14.tgz#58bd526599fd5e77d0527ababebba75f45988247" + integrity sha512-dLQwl0JCbXJLGegETNBS1QejW/pNkZf4vCeUwChmLRxciESm61QXYFObks1VE4/h8ayxybdN/mfvLMHOFCmhgA== dependencies: configstore "^5.0.1" -cspell-dict-software-terms@^1.0.13: +cspell-dict-scala@^1.0.13: version "1.0.13" - resolved "https://registry.yarnpkg.com/cspell-dict-software-terms/-/cspell-dict-software-terms-1.0.13.tgz#a2035351a61dd5637eeeb06490d6a4dda30ee9c9" - integrity sha512-djSM4y7JrlL2tibSGhig2j8kKYjgi24V3n1pI7S99oRDy7MCiFeHBnN5zcJFlWSUFjN7u2K/IanNF2M6Lu+UiQ== + resolved "https://registry.yarnpkg.com/cspell-dict-scala/-/cspell-dict-scala-1.0.13.tgz#ae040b008cc84646799368fa9d4c5a85f04a013f" + integrity sha512-Z4vode68Tl8W1oD8xbkcWa3+Z6UmbLK+CPbYODLpilojtgq6sPdNN6wL9N1bN4NdJ4hUupoU/ZS3xLi+fxL+Eg== dependencies: configstore "^5.0.1" -cspell-dict-typescript@^1.0.6: - version "1.0.6" - resolved "https://registry.yarnpkg.com/cspell-dict-typescript/-/cspell-dict-typescript-1.0.6.tgz#c590741a413d2cf8c5de700fa4732f4081f22cee" - integrity sha512-U2gA19Rqpoy/UAFk3ENgncQNCB3+55Upz3PrZ9YCMTuTkGWnm+e/TJZMSRWzpQbGafc2i3ZIeBQQ8CzAqL5VQg== +cspell-dict-software-terms@^1.0.18: + version "1.0.18" + resolved "https://registry.yarnpkg.com/cspell-dict-software-terms/-/cspell-dict-software-terms-1.0.18.tgz#7a4651d8d758a31da831a477772f5c2d828c6248" + integrity sha512-vi3DPagUre2hyQ6n+pTpOe2HLJlIBWaaazKyHG+/KSWH7pkxQHYvic7bRM6W6enDs5hBQIzBSnxKqaGhbleGDA== + dependencies: + configstore "^5.0.1" + +cspell-dict-typescript@^1.0.11: + version "1.0.11" + resolved "https://registry.yarnpkg.com/cspell-dict-typescript/-/cspell-dict-typescript-1.0.11.tgz#3c9bf77efb342befe0bfb0f86f30cf0cb0bd0982" + integrity sha512-w6IUN6jVrW8SsPT8I9isFD9Tca3qRGegk63+SJZrtgAe9gM6c/HKz34VmS0cYhoZRtCFOuWuNXVFW96mSrErWw== dependencies: configstore "^5.0.1" @@ -2447,71 +2496,77 @@ cspell-io@^4.1.1: iconv-lite "^0.6.2" iterable-to-stream "^1.0.1" -cspell-lib@^4.2.2: - version "4.2.2" - resolved "https://registry.yarnpkg.com/cspell-lib/-/cspell-lib-4.2.2.tgz#d31ccd2e831e8c34ba06b12aafc163db220617b3" - integrity sha512-mXOHV9ipIuXHt2jx/u2dnrvIHpf5fYGOFD80DS/lO6pQ4O+hJ/ZI0KwGJdwv63U4GBYAkHLM9mMIqtBtVM182A== +cspell-lib@^4.3.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/cspell-lib/-/cspell-lib-4.3.0.tgz#f2285613909b6eaa976efd190c2f3036cd6b7cf7" + integrity sha512-TkL7nPGOEHeBlPE6t4I2xJYlrPfw5IjpjWzXFkDFV0EWLDjgXZCHReUPjAqsAfkX98U5qXRVx7z7EsGK4fKREA== dependencies: - comment-json "^3.0.3" + comment-json "^4.1.0" configstore "^5.0.1" - cspell-dict-aws "^1.0.6" - cspell-dict-bash "^1.0.4" - cspell-dict-companies "^1.0.23" - cspell-dict-cpp "^1.1.28" - cspell-dict-cryptocurrencies "^1.0.3" - cspell-dict-django "^1.0.16" - cspell-dict-dotnet "^1.0.15" - cspell-dict-elixir "^1.0.14" - cspell-dict-en-gb "^1.1.19" - cspell-dict-en_us "^1.2.29" - cspell-dict-fonts "^1.0.6" - cspell-dict-fullstack "^1.0.24" - cspell-dict-golang "^1.1.15" - cspell-dict-haskell "^1.0.5" - cspell-dict-html-symbol-entities "^1.0.14" - cspell-dict-java "^1.0.13" - cspell-dict-latex "^1.0.14" - cspell-dict-lorem-ipsum "^1.0.13" - cspell-dict-lua "^1.0.9" - cspell-dict-php "^1.0.14" - cspell-dict-powershell "^1.0.7" - cspell-dict-python "^1.0.22" - cspell-dict-ruby "^1.0.4" - cspell-dict-rust "^1.0.13" - cspell-dict-scala "^1.0.12" - cspell-dict-software-terms "^1.0.13" - cspell-dict-typescript "^1.0.6" + cspell-dict-aws "^1.0.7" + cspell-dict-bash "^1.0.5" + cspell-dict-companies "^1.0.30" + cspell-dict-cpp "^1.1.29" + cspell-dict-cryptocurrencies "^1.0.4" + cspell-dict-csharp "^1.0.3" + cspell-dict-css "^1.0.5" + cspell-dict-django "^1.0.17" + cspell-dict-dotnet "^1.0.16" + cspell-dict-elixir "^1.0.15" + cspell-dict-en-gb "^1.1.20" + cspell-dict-en_us "^1.2.30" + cspell-dict-filetypes "^1.0.3" + cspell-dict-fonts "^1.0.7" + cspell-dict-fullstack "^1.0.31" + cspell-dict-golang "^1.1.16" + cspell-dict-haskell "^1.0.6" + cspell-dict-html "^1.1.0" + cspell-dict-html-symbol-entities "^1.0.15" + cspell-dict-java "^1.0.14" + cspell-dict-latex "^1.0.15" + cspell-dict-lorem-ipsum "^1.0.14" + cspell-dict-lua "^1.0.10" + cspell-dict-node "^1.0.3" + cspell-dict-npm "^1.0.5" + cspell-dict-php "^1.0.15" + cspell-dict-powershell "^1.0.8" + cspell-dict-python "^1.0.23" + cspell-dict-ruby "^1.0.6" + cspell-dict-rust "^1.0.14" + cspell-dict-scala "^1.0.13" + cspell-dict-software-terms "^1.0.18" + cspell-dict-typescript "^1.0.11" cspell-io "^4.1.1" - cspell-trie-lib "^4.2.1" - cspell-util-bundle "^4.1.1" + cspell-trie-lib "^4.2.2" + cspell-util-bundle "^4.1.2" fs-extra "^9.0.1" gensequence "^3.1.1" minimatch "^3.0.4" resolve-from "^5.0.0" vscode-uri "^2.1.2" -cspell-trie-lib@^4.2.1: - version "4.2.1" - resolved "https://registry.yarnpkg.com/cspell-trie-lib/-/cspell-trie-lib-4.2.1.tgz#32fe988a1f82d165da2220149b08d709c63f37f4" - integrity sha512-oW3x8K8xXOko7eVRo3B+3Dlu1dwpHp1jtsdI6Zq2POx10WDbobTf8xSIpu8qFAPXFUHKQ5JSM7AUy6auCaPWNw== +cspell-trie-lib@^4.2.2: + version "4.2.2" + resolved "https://registry.yarnpkg.com/cspell-trie-lib/-/cspell-trie-lib-4.2.2.tgz#0d3a2d6c8343a7f08fb78111f2a48ca2db8d5f6b" + integrity sha512-FKwubuKs7XhFIAZN8Twh4RUSKc1h2X+EHsaSu8Y4E9QIcz5vBKooejCC3HTCgTzARXbX4pw0HazehSDqjraE+g== dependencies: gensequence "^3.1.1" -cspell-util-bundle@^4.1.1: - version "4.1.1" - resolved "https://registry.yarnpkg.com/cspell-util-bundle/-/cspell-util-bundle-4.1.1.tgz#753b33c622a666371246423f6a6b686243e9d650" - integrity sha512-ROeJfdekgq4zE/+hFzFryCqnnR9D3ncm00R4FlGVwPJsONzrkZGnYVGViQKN6f+VyQAEHjTWj4G4uLcnySehyQ== - -cspell@4.1.2: +cspell-util-bundle@^4.1.2: version "4.1.2" - resolved "https://registry.yarnpkg.com/cspell/-/cspell-4.1.2.tgz#220fd115e6b51491f204621ff524c856461f2b72" - integrity sha512-K/JLpd2YyO1xOModcu6A/WjAf1wZPlH0CECg9p3F7XokGKqqhf0EJNpHh/0ryTn/Nxl20U8sMVCh9Sibt9Z0oA== + resolved "https://registry.yarnpkg.com/cspell-util-bundle/-/cspell-util-bundle-4.1.2.tgz#9437df20cca3e72b147098eb33bde85a26d3a394" + integrity sha512-PozIUa5aWGED09nTOTxGdPULtKnYgIDZ6JjflqAaEeeMnIKWD+w0XkIiiMTpqOszZT2CbzyI7VJZGUr8x5sopQ== + +cspell@4.1.3: + version "4.1.3" + resolved "https://registry.yarnpkg.com/cspell/-/cspell-4.1.3.tgz#ba316864e65fdad5efb0ef64277630d75ef9570e" + integrity sha512-xOoNMswrkubBlGnVs0xcVOjRGLovKYf1y1vtZOUcnGooGTxX7whBkpd02QSTJttDrwPugR/LbuPD7z25gm6fFw== dependencies: chalk "^4.1.0" - commander "^6.0.0" - comment-json "^3.0.3" + commander "^6.1.0" + comment-json "^4.0.6" cspell-glob "^0.1.21" - cspell-lib "^4.2.2" + cspell-lib "^4.3.0" fs-extra "^9.0.1" gensequence "^3.1.1" get-stdin "^8.0.0" @@ -2653,10 +2708,10 @@ diff-sequences@^26.0.0: resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-26.0.0.tgz#0760059a5c287637b842bd7085311db7060e88a6" integrity sha512-JC/eHYEC3aSS0vZGjuoc4vHA0yAQTzhQQldXMeMF+JlxLGJlCO38Gma82NV9gk1jGFz8mDzUMeaKXvjRRdJ2dg== -diff-sequences@^26.5.0: - version "26.5.0" - resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-26.5.0.tgz#ef766cf09d43ed40406611f11c6d8d9dd8b2fefd" - integrity sha512-ZXx86srb/iYy6jG71k++wBN9P9J05UNQ5hQHQd9MtMPvcqXPx/vKU69jfHV637D00Q2gSgPk2D+jSx3l1lDW/Q== +diff-sequences@^26.6.2: + version "26.6.2" + resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-26.6.2.tgz#48ba99157de1923412eed41db6b6d4aa9ca7c0b1" + integrity sha512-Mv/TDa3nZ9sbc5soK+OoA74BsS3mL37yixCvUAQkiuA4Wz6YtwP/K47n2rv2ovzHZvoiQeA5FTQOschKkEwB0Q== diff@4.0.2: version "4.0.2" @@ -2859,10 +2914,10 @@ eslint-ast-utils@^1.1.0: lodash.get "^4.4.2" lodash.zip "^4.2.0" -eslint-config-prettier@6.14.0: - version "6.14.0" - resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-6.14.0.tgz#390e7863a8ae99970981933826476169285b3a27" - integrity sha512-DbVwh0qZhAC7CNDWcq8cBdK6FcVHiMTKmCypOPWeZkp9hJ8xYwTaWSa6bb6cjfi8KOeJy0e9a8Izxyx+O4+gCQ== +eslint-config-prettier@6.15.0: + version "6.15.0" + resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-6.15.0.tgz#7f93f6cb7d45a92f1537a70ecc06366e1ac6fed9" + integrity sha512-a1+kOYLR8wMGustcgAjdydMsQ2A/2ipRPwRKUmfYaSxc9ZPcrku080Ctl6zrZzZNs/U82MjSv+qKREkoq3bJaw== dependencies: get-stdin "^6.0.0" @@ -2920,7 +2975,7 @@ eslint-plugin-jest@24.1.0: "@typescript-eslint/experimental-utils" "^4.0.1" "eslint-plugin-prettier-internal-rules@file:scripts/tools/eslint-plugin-prettier-internal-rules": - version "1.0.0" + version "1.0.3" eslint-plugin-react@7.21.5: version "7.21.5" @@ -2993,13 +3048,13 @@ eslint-visitor-keys@^2.0.0: resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-2.0.0.tgz#21fdc8fbcd9c795cc0321f0563702095751511a8" integrity sha512-QudtT6av5WXels9WjIM7qz1XD1cWGvX4gGXvp/zBn9nXG02D0utdU3Em2m/QjTnrsk6bBjmCygl3rmj118msQQ== -eslint@7.12.0: - version "7.12.0" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-7.12.0.tgz#7b6a85f87a9adc239e979bb721cde5ce0dc27da6" - integrity sha512-n5pEU27DRxCSlOhJ2rO57GDLcNsxO0LPpAbpFdh7xmcDmjmlGUfoyrsB3I7yYdQXO5N3gkSTiDrPSPNFiiirXA== +eslint@7.13.0: + version "7.13.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-7.13.0.tgz#7f180126c0dcdef327bfb54b211d7802decc08da" + integrity sha512-uCORMuOO8tUzJmsdRtrvcGq5qposf7Rw0LwkTJkoDbOycVQtQjmnhZSuLQnozLE4TmAzlMVV45eCHmQ1OpDKUQ== dependencies: "@babel/code-frame" "^7.0.0" - "@eslint/eslintrc" "^0.2.0" + "@eslint/eslintrc" "^0.2.1" ajv "^6.10.0" chalk "^4.0.0" cross-spawn "^7.0.2" @@ -3109,10 +3164,10 @@ exec-sh@^0.3.2: resolved "https://registry.yarnpkg.com/exec-sh/-/exec-sh-0.3.4.tgz#3a018ceb526cc6f6df2bb504b2bfe8e3a4934ec5" integrity sha512-sEFIkc61v75sWeOe72qyrqg2Qg0OuLESziUDk/O/z2qgS15y2gWVFrI6f2Qn/qw/0/NCfCEsmNA4zOjkwEZT1A== -execa@4.0.3, execa@^4.0.0: - version "4.0.3" - resolved "https://registry.yarnpkg.com/execa/-/execa-4.0.3.tgz#0a34dabbad6d66100bd6f2c576c8669403f317f2" - integrity sha512-WFDXGHckXPWZX19t1kCsXzOpqX9LWYNqn4C+HqZlk/V0imTkzJZqf87ZBhvpHaftERYknpk0fjSylnXVlVgI0A== +execa@4.1.0, execa@^4.0.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/execa/-/execa-4.1.0.tgz#4e5491ad1572f2f17a77d388c6c857135b22847a" + integrity sha512-j5W0//W7f8UxAn8hXVnwG8tLwdiUy4FJLcSupCg6maBYZDpyBvTApK7KyuI4bKj8KOh1r2YH+6ucuYtJv1bTZA== dependencies: cross-spawn "^7.0.0" get-stream "^5.0.0" @@ -3167,16 +3222,16 @@ expect@^26.1.0: jest-message-util "^26.1.0" jest-regex-util "^26.0.0" -expect@^26.6.1: - version "26.6.1" - resolved "https://registry.yarnpkg.com/expect/-/expect-26.6.1.tgz#e1e053cdc43b21a452b36fc7cc9401e4603949c1" - integrity sha512-BRfxIBHagghMmr1D2MRY0Qv5d3Nc8HCqgbDwNXw/9izmM5eBb42a2YjLKSbsqle76ozGkAEPELQX4IdNHAKRNA== +expect@^26.6.2: + version "26.6.2" + resolved "https://registry.yarnpkg.com/expect/-/expect-26.6.2.tgz#c6b996bf26bf3fe18b67b2d0f51fc981ba934417" + integrity sha512-9/hlOBkQl2l/PLHJx6JjoDF6xPKcJEsUlWKb23rKE7KzeDqUZKXKNMW27KIue5JMdBV9HgmoJPcc8HtO85t9IA== dependencies: - "@jest/types" "^26.6.1" + "@jest/types" "^26.6.2" ansi-styles "^4.0.0" jest-get-type "^26.3.0" - jest-matcher-utils "^26.6.1" - jest-message-util "^26.6.1" + jest-matcher-utils "^26.6.2" + jest-message-util "^26.6.2" jest-regex-util "^26.0.0" extend-shallow@^2.0.1: @@ -3343,10 +3398,10 @@ flatten@^1.0.2: resolved "https://registry.yarnpkg.com/flatten/-/flatten-1.0.3.tgz#c1283ac9f27b368abc1e36d1ff7b04501a30356b" integrity sha512-dVsPA/UwQ8+2uoFe5GHtiBMu48dWLTdsuEd7CKGlZlD78r1TTWBvDuFaFGKCo/ZfEr95Uk56vZoX86OsHkUeIg== -flow-parser@0.136.0: - version "0.136.0" - resolved "https://registry.yarnpkg.com/flow-parser/-/flow-parser-0.136.0.tgz#95e09bde3ba7f63f55c2c015cdd7cfd36ef8e652" - integrity sha512-PB2vYAqmz+dRikpx8TpNgRtBsyemP+7oQa0BcPZWnGABlJlB2WgJc/Lx0HeEPOUxDO/TxBbPaIHsffEIL9M6BQ== +flow-parser@0.137.0: + version "0.137.0" + resolved "https://registry.yarnpkg.com/flow-parser/-/flow-parser-0.137.0.tgz#8c05612ff9344648d8bcdeaa4c58d131e875d842" + integrity sha512-i3KXJZ8lhlQI0n+BoZzIeH/rv+fNvAiu1i9/s64MklBV+HuhFbycUML7367J2eng0gapLnwvYPFNaPZys8POsA== for-in@^1.0.2: version "1.0.2" @@ -3508,10 +3563,10 @@ graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.2.0, graceful-fs@^4.2.4: resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.4.tgz#2256bde14d3632958c465ebc96dc467ca07a29fb" integrity sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw== -graphql@15.3.0: - version "15.3.0" - resolved "https://registry.yarnpkg.com/graphql/-/graphql-15.3.0.tgz#3ad2b0caab0d110e3be4a5a9b2aa281e362b5278" - integrity sha512-GTCJtzJmkFLWRfFJuoo9RWWa/FfamUHgiFosxi/X1Ani4AVWbeyBenZTNX6dM+7WSbbFfTo/25eh0LLkwHMw2w== +graphql@15.4.0: + version "15.4.0" + resolved "https://registry.yarnpkg.com/graphql/-/graphql-15.4.0.tgz#e459dea1150da5a106486ba7276518b5295a4347" + integrity sha512-EB3zgGchcabbsU9cFe1j+yxdzKQKAbGUWRb13DsrsMN1yyfmmIq+2+L5MqVWcDCE4V89R5AyUOi7sMOGxdsYtA== growly@^1.3.0: version "1.3.0" @@ -4093,57 +4148,57 @@ iterable-to-stream@^1.0.1: resolved "https://registry.yarnpkg.com/iterable-to-stream/-/iterable-to-stream-1.0.1.tgz#37e86baacf6b1a0e9233dad4eb526d0423d08bf3" integrity sha512-O62gD5ADMUGtJoOoM9U6LQ7i4byPXUNoHJ6mqsmkQJcom331ZJGDApWgDESWyBMEHEJRjtHozgIiTzYo9RU4UA== -jest-changed-files@^26.6.1: - version "26.6.1" - resolved "https://registry.yarnpkg.com/jest-changed-files/-/jest-changed-files-26.6.1.tgz#2fac3dc51297977ee883347948d8e3d37c417fba" - integrity sha512-NhSdZ5F6b/rIN5V46x1l31vrmukD/bJUXgYAY8VtP1SknYdJwjYDRxuLt7Z8QryIdqCjMIn2C0Cd98EZ4umo8Q== +jest-changed-files@^26.6.2: + version "26.6.2" + resolved "https://registry.yarnpkg.com/jest-changed-files/-/jest-changed-files-26.6.2.tgz#f6198479e1cc66f22f9ae1e22acaa0b429c042d0" + integrity sha512-fDS7szLcY9sCtIip8Fjry9oGf3I2ht/QT21bAHm5Dmf0mD4X3ReNUf17y+bO6fR8WgbIZTlbyG1ak/53cbRzKQ== dependencies: - "@jest/types" "^26.6.1" + "@jest/types" "^26.6.2" execa "^4.0.0" throat "^5.0.0" -jest-cli@^26.6.1: - version "26.6.1" - resolved "https://registry.yarnpkg.com/jest-cli/-/jest-cli-26.6.1.tgz#8952242fa812c05bd129abf7c022424045b7fd67" - integrity sha512-aPLoEjlwFrCWhiPpW5NUxQA1X1kWsAnQcQ0SO/fHsCvczL3W75iVAcH9kP6NN+BNqZcHNEvkhxT5cDmBfEAh+w== +jest-cli@^26.6.3: + version "26.6.3" + resolved "https://registry.yarnpkg.com/jest-cli/-/jest-cli-26.6.3.tgz#43117cfef24bc4cd691a174a8796a532e135e92a" + integrity sha512-GF9noBSa9t08pSyl3CY4frMrqp+aQXFGFkf5hEPbh/pIUFYWMK6ZLTfbmadxJVcJrdRoChlWQsA2VkJcDFK8hg== dependencies: - "@jest/core" "^26.6.1" - "@jest/test-result" "^26.6.1" - "@jest/types" "^26.6.1" + "@jest/core" "^26.6.3" + "@jest/test-result" "^26.6.2" + "@jest/types" "^26.6.2" chalk "^4.0.0" exit "^0.1.2" graceful-fs "^4.2.4" import-local "^3.0.2" is-ci "^2.0.0" - jest-config "^26.6.1" - jest-util "^26.6.1" - jest-validate "^26.6.1" + jest-config "^26.6.3" + jest-util "^26.6.2" + jest-validate "^26.6.2" prompts "^2.0.1" yargs "^15.4.1" -jest-config@^26.6.1: - version "26.6.1" - resolved "https://registry.yarnpkg.com/jest-config/-/jest-config-26.6.1.tgz#8c343fbdd9c24ad003e261f73583c3c020f32b42" - integrity sha512-mtJzIynIwW1d1nMlKCNCQiSgWaqFn8cH/fOSNY97xG7Y9tBCZbCSuW2GTX0RPmceSJGO7l27JgwC18LEg0Vg+g== +jest-config@^26.6.3: + version "26.6.3" + resolved "https://registry.yarnpkg.com/jest-config/-/jest-config-26.6.3.tgz#64f41444eef9eb03dc51d5c53b75c8c71f645349" + integrity sha512-t5qdIj/bCj2j7NFVHb2nFB4aUdfucDn3JRKgrZnplb8nieAirAzRSHP8uDEd+qV6ygzg9Pz4YG7UTJf94LPSyg== dependencies: "@babel/core" "^7.1.0" - "@jest/test-sequencer" "^26.6.1" - "@jest/types" "^26.6.1" - babel-jest "^26.6.1" + "@jest/test-sequencer" "^26.6.3" + "@jest/types" "^26.6.2" + babel-jest "^26.6.3" chalk "^4.0.0" deepmerge "^4.2.2" glob "^7.1.1" graceful-fs "^4.2.4" - jest-environment-jsdom "^26.6.1" - jest-environment-node "^26.6.1" + jest-environment-jsdom "^26.6.2" + jest-environment-node "^26.6.2" jest-get-type "^26.3.0" - jest-jasmine2 "^26.6.1" + jest-jasmine2 "^26.6.3" jest-regex-util "^26.0.0" - jest-resolve "^26.6.1" - jest-util "^26.6.1" - jest-validate "^26.6.1" + jest-resolve "^26.6.2" + jest-util "^26.6.2" + jest-validate "^26.6.2" micromatch "^4.0.2" - pretty-format "^26.6.1" + pretty-format "^26.6.2" jest-diff@^26.1.0: version "26.1.0" @@ -4155,15 +4210,15 @@ jest-diff@^26.1.0: jest-get-type "^26.0.0" pretty-format "^26.1.0" -jest-diff@^26.6.1: - version "26.6.1" - resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-26.6.1.tgz#38aa194979f454619bb39bdee299fb64ede5300c" - integrity sha512-BBNy/zin2m4kG5In126O8chOBxLLS/XMTuuM2+YhgyHk87ewPzKTuTJcqj3lOWOi03NNgrl+DkMeV/exdvG9gg== +jest-diff@^26.6.2: + version "26.6.2" + resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-26.6.2.tgz#1aa7468b52c3a68d7d5c5fdcdfcd5e49bd164394" + integrity sha512-6m+9Z3Gv9wN0WFVasqjCL/06+EFCMTqDEUl/b87HYK2rAPTyfz4ZIuSlPhY51PIQRWx5TaxeF1qmXKe9gfN3sA== dependencies: chalk "^4.0.0" - diff-sequences "^26.5.0" + diff-sequences "^26.6.2" jest-get-type "^26.3.0" - pretty-format "^26.6.1" + pretty-format "^26.6.2" jest-docblock@26.0.0, jest-docblock@^26.0.0: version "26.0.0" @@ -4172,41 +4227,41 @@ jest-docblock@26.0.0, jest-docblock@^26.0.0: dependencies: detect-newline "^3.0.0" -jest-each@^26.6.1: - version "26.6.1" - resolved "https://registry.yarnpkg.com/jest-each/-/jest-each-26.6.1.tgz#e968e88309a3e2ae9648634af8f89d8ee5acfddd" - integrity sha512-gSn8eB3buchuq45SU7pLB7qmCGax1ZSxfaWuEFblCyNMtyokYaKFh9dRhYPujK6xYL57dLIPhLKatjmB5XWzGA== +jest-each@^26.6.2: + version "26.6.2" + resolved "https://registry.yarnpkg.com/jest-each/-/jest-each-26.6.2.tgz#02526438a77a67401c8a6382dfe5999952c167cb" + integrity sha512-Mer/f0KaATbjl8MCJ+0GEpNdqmnVmDYqCTJYTvoo7rqmRiDllmp2AYN+06F93nXcY3ur9ShIjS+CO/uD+BbH4A== dependencies: - "@jest/types" "^26.6.1" + "@jest/types" "^26.6.2" chalk "^4.0.0" jest-get-type "^26.3.0" - jest-util "^26.6.1" - pretty-format "^26.6.1" + jest-util "^26.6.2" + pretty-format "^26.6.2" -jest-environment-jsdom@^26.6.1: - version "26.6.1" - resolved "https://registry.yarnpkg.com/jest-environment-jsdom/-/jest-environment-jsdom-26.6.1.tgz#63093bf89daee6139616568a43633b84cf7aac21" - integrity sha512-A17RiXuHYNVlkM+3QNcQ6n5EZyAc6eld8ra9TW26luounGWpku4tj03uqRgHJCI1d4uHr5rJiuCH5JFRtdmrcA== +jest-environment-jsdom@^26.6.2: + version "26.6.2" + resolved "https://registry.yarnpkg.com/jest-environment-jsdom/-/jest-environment-jsdom-26.6.2.tgz#78d09fe9cf019a357009b9b7e1f101d23bd1da3e" + integrity sha512-jgPqCruTlt3Kwqg5/WVFyHIOJHsiAvhcp2qiR2QQstuG9yWox5+iHpU3ZrcBxW14T4fe5Z68jAfLRh7joCSP2Q== dependencies: - "@jest/environment" "^26.6.1" - "@jest/fake-timers" "^26.6.1" - "@jest/types" "^26.6.1" + "@jest/environment" "^26.6.2" + "@jest/fake-timers" "^26.6.2" + "@jest/types" "^26.6.2" "@types/node" "*" - jest-mock "^26.6.1" - jest-util "^26.6.1" + jest-mock "^26.6.2" + jest-util "^26.6.2" jsdom "^16.4.0" -jest-environment-node@^26.6.1: - version "26.6.1" - resolved "https://registry.yarnpkg.com/jest-environment-node/-/jest-environment-node-26.6.1.tgz#4d73d8b33c26989a92a0ed3ad0bfd6f7a196d9bd" - integrity sha512-YffaCp6h0j1kbcf1NVZ7umC6CPgD67YS+G1BeornfuSkx5s3xdhuwG0DCxSiHPXyT81FfJzA1L7nXvhq50OWIg== +jest-environment-node@^26.6.2: + version "26.6.2" + resolved "https://registry.yarnpkg.com/jest-environment-node/-/jest-environment-node-26.6.2.tgz#824e4c7fb4944646356f11ac75b229b0035f2b0c" + integrity sha512-zhtMio3Exty18dy8ee8eJ9kjnRyZC1N4C1Nt/VShN1apyXc8rWGtJ9lI7vqiWcyyXS4BVSEn9lxAM2D+07/Tag== dependencies: - "@jest/environment" "^26.6.1" - "@jest/fake-timers" "^26.6.1" - "@jest/types" "^26.6.1" + "@jest/environment" "^26.6.2" + "@jest/fake-timers" "^26.6.2" + "@jest/types" "^26.6.2" "@types/node" "*" - jest-mock "^26.6.1" - jest-util "^26.6.1" + jest-mock "^26.6.2" + jest-util "^26.6.2" jest-get-type@^26.0.0: version "26.0.0" @@ -4238,58 +4293,58 @@ jest-haste-map@^26.1.0: optionalDependencies: fsevents "^2.1.2" -jest-haste-map@^26.6.1: - version "26.6.1" - resolved "https://registry.yarnpkg.com/jest-haste-map/-/jest-haste-map-26.6.1.tgz#97e96f5fd7576d980307fbe6160b10c016b543d4" - integrity sha512-9kPafkv0nX6ta1PrshnkiyhhoQoFWncrU/uUBt3/AP1r78WSCU5iLceYRTwDvJl67H3RrXqSlSVDDa/AsUB7OQ== +jest-haste-map@^26.6.2: + version "26.6.2" + resolved "https://registry.yarnpkg.com/jest-haste-map/-/jest-haste-map-26.6.2.tgz#dd7e60fe7dc0e9f911a23d79c5ff7fb5c2cafeaa" + integrity sha512-easWIJXIw71B2RdR8kgqpjQrbMRWQBgiBwXYEhtGUTaX+doCjBheluShdDMeR8IMfJiTqH4+zfhtg29apJf/8w== dependencies: - "@jest/types" "^26.6.1" + "@jest/types" "^26.6.2" "@types/graceful-fs" "^4.1.2" "@types/node" "*" anymatch "^3.0.3" fb-watchman "^2.0.0" graceful-fs "^4.2.4" jest-regex-util "^26.0.0" - jest-serializer "^26.5.0" - jest-util "^26.6.1" - jest-worker "^26.6.1" + jest-serializer "^26.6.2" + jest-util "^26.6.2" + jest-worker "^26.6.2" micromatch "^4.0.2" sane "^4.0.3" walker "^1.0.7" optionalDependencies: fsevents "^2.1.2" -jest-jasmine2@^26.6.1: - version "26.6.1" - resolved "https://registry.yarnpkg.com/jest-jasmine2/-/jest-jasmine2-26.6.1.tgz#11c92603d1fa97e3c33404359e69d6cec7e57017" - integrity sha512-2uYdT32o/ZzSxYAPduAgokO8OlAL1YdG/9oxcEY138EDNpIK5XRRJDaGzTZdIBWSxk0aR8XxN44FvfXtHB+Fiw== +jest-jasmine2@^26.6.3: + version "26.6.3" + resolved "https://registry.yarnpkg.com/jest-jasmine2/-/jest-jasmine2-26.6.3.tgz#adc3cf915deacb5212c93b9f3547cd12958f2edd" + integrity sha512-kPKUrQtc8aYwBV7CqBg5pu+tmYXlvFlSFYn18ev4gPFtrRzB15N2gW/Roew3187q2w2eHuu0MU9TJz6w0/nPEg== dependencies: "@babel/traverse" "^7.1.0" - "@jest/environment" "^26.6.1" - "@jest/source-map" "^26.5.0" - "@jest/test-result" "^26.6.1" - "@jest/types" "^26.6.1" + "@jest/environment" "^26.6.2" + "@jest/source-map" "^26.6.2" + "@jest/test-result" "^26.6.2" + "@jest/types" "^26.6.2" "@types/node" "*" chalk "^4.0.0" co "^4.6.0" - expect "^26.6.1" + expect "^26.6.2" is-generator-fn "^2.0.0" - jest-each "^26.6.1" - jest-matcher-utils "^26.6.1" - jest-message-util "^26.6.1" - jest-runtime "^26.6.1" - jest-snapshot "^26.6.1" - jest-util "^26.6.1" - pretty-format "^26.6.1" + jest-each "^26.6.2" + jest-matcher-utils "^26.6.2" + jest-message-util "^26.6.2" + jest-runtime "^26.6.3" + jest-snapshot "^26.6.2" + jest-util "^26.6.2" + pretty-format "^26.6.2" throat "^5.0.0" -jest-leak-detector@^26.6.1: - version "26.6.1" - resolved "https://registry.yarnpkg.com/jest-leak-detector/-/jest-leak-detector-26.6.1.tgz#f63e46dc4e3aa30d29b40ae49966a15730d25bbe" - integrity sha512-j9ZOtJSJKlHjrs4aIxWjiQUjyrffPdiAQn2Iw0916w7qZE5Lk0T2KhIH6E9vfhzP6sw0Q0jtnLLb4vQ71o1HlA== +jest-leak-detector@^26.6.2: + version "26.6.2" + resolved "https://registry.yarnpkg.com/jest-leak-detector/-/jest-leak-detector-26.6.2.tgz#7717cf118b92238f2eba65054c8a0c9c653a91af" + integrity sha512-i4xlXpsVSMeKvg2cEKdfhh0H39qlJlP5Ex1yQxwF9ubahboQYMgTtz5oML35AVA3B4Eu+YsmwaiKVev9KCvLxg== dependencies: jest-get-type "^26.3.0" - pretty-format "^26.6.1" + pretty-format "^26.6.2" jest-matcher-utils@^26.1.0: version "26.1.0" @@ -4301,15 +4356,15 @@ jest-matcher-utils@^26.1.0: jest-get-type "^26.0.0" pretty-format "^26.1.0" -jest-matcher-utils@^26.6.1: - version "26.6.1" - resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-26.6.1.tgz#bc90822d352c91c2ec1814731327691d06598400" - integrity sha512-9iu3zrsYlUnl8pByhREF9rr5eYoiEb1F7ymNKg6lJr/0qD37LWS5FSW/JcoDl8UdMX2+zAzabDs7sTO+QFKjCg== +jest-matcher-utils@^26.6.2: + version "26.6.2" + resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-26.6.2.tgz#8e6fd6e863c8b2d31ac6472eeb237bc595e53e7a" + integrity sha512-llnc8vQgYcNqDrqRDXWwMr9i7rS5XFiCwvh6DTP7Jqa2mqpcCBBlpCbn+trkG0KNhPu/h8rzyBkriOtBstvWhw== dependencies: chalk "^4.0.0" - jest-diff "^26.6.1" + jest-diff "^26.6.2" jest-get-type "^26.3.0" - pretty-format "^26.6.1" + pretty-format "^26.6.2" jest-message-util@^26.1.0: version "26.1.0" @@ -4339,26 +4394,27 @@ jest-message-util@^26.3.0: slash "^3.0.0" stack-utils "^2.0.2" -jest-message-util@^26.6.1: - version "26.6.1" - resolved "https://registry.yarnpkg.com/jest-message-util/-/jest-message-util-26.6.1.tgz#d62c20c0fe7be10bfd6020b675abb9b5fa933ff3" - integrity sha512-cqM4HnqncIebBNdTKrBoWR/4ufHTll0pK/FWwX0YasK+TlBQEMqw3IEdynuuOTjDPFO3ONlFn37280X48beByw== +jest-message-util@^26.6.2: + version "26.6.2" + resolved "https://registry.yarnpkg.com/jest-message-util/-/jest-message-util-26.6.2.tgz#58173744ad6fc0506b5d21150b9be56ef001ca07" + integrity sha512-rGiLePzQ3AzwUshu2+Rn+UMFk0pHN58sOG+IaJbk5Jxuqo3NYO1U2/MIR4S1sKgsoYSXSzdtSa0TgrmtUwEbmA== dependencies: "@babel/code-frame" "^7.0.0" - "@jest/types" "^26.6.1" + "@jest/types" "^26.6.2" "@types/stack-utils" "^2.0.0" chalk "^4.0.0" graceful-fs "^4.2.4" micromatch "^4.0.2" + pretty-format "^26.6.2" slash "^3.0.0" stack-utils "^2.0.2" -jest-mock@^26.6.1: - version "26.6.1" - resolved "https://registry.yarnpkg.com/jest-mock/-/jest-mock-26.6.1.tgz#6c12a92a82fc833f81a5b6de6b67d78386e276a3" - integrity sha512-my0lPTBu1awY8iVG62sB2sx9qf8zxNDVX+5aFgoB8Vbqjb6LqIOsfyFA8P1z6H2IsqMbvOX9oCJnK67Y3yUIMA== +jest-mock@^26.6.2: + version "26.6.2" + resolved "https://registry.yarnpkg.com/jest-mock/-/jest-mock-26.6.2.tgz#d6cb712b041ed47fe0d9b6fc3474bc6543feb302" + integrity sha512-YyFjePHHp1LzpzYcmgqkJ0nm0gg/lJx2aZFzFy1S6eUqNjXsOqTK10zNRff2dNfssgokjkG65OlWNcIlgd3zew== dependencies: - "@jest/types" "^26.6.1" + "@jest/types" "^26.6.2" "@types/node" "*" jest-pnp-resolver@^1.2.1, jest-pnp-resolver@^1.2.2: @@ -4371,14 +4427,14 @@ jest-regex-util@^26.0.0: resolved "https://registry.yarnpkg.com/jest-regex-util/-/jest-regex-util-26.0.0.tgz#d25e7184b36e39fd466c3bc41be0971e821fee28" integrity sha512-Gv3ZIs/nA48/Zvjrl34bf+oD76JHiGDUxNOVgUjh3j890sblXryjY4rss71fPtD/njchl6PSE2hIhvyWa1eT0A== -jest-resolve-dependencies@^26.6.1: - version "26.6.1" - resolved "https://registry.yarnpkg.com/jest-resolve-dependencies/-/jest-resolve-dependencies-26.6.1.tgz#e9d091a159ad198c029279737a8b4c507791d75c" - integrity sha512-MN6lufbZJ3RBfTnJesZtHu3hUCBqPdHRe2+FhIt0yiqJ3fMgzWRqMRQyN/d/QwOE7KXwAG2ekZutbPhuD7s51A== +jest-resolve-dependencies@^26.6.3: + version "26.6.3" + resolved "https://registry.yarnpkg.com/jest-resolve-dependencies/-/jest-resolve-dependencies-26.6.3.tgz#6680859ee5d22ee5dcd961fe4871f59f4c784fb6" + integrity sha512-pVwUjJkxbhe4RY8QEWzN3vns2kqyuldKpxlxJlzEYfKSvY6/bMvxoFrYYzUO1Gx28yKWN37qyV7rIoIp2h8fTg== dependencies: - "@jest/types" "^26.6.1" + "@jest/types" "^26.6.2" jest-regex-util "^26.0.0" - jest-snapshot "^26.6.1" + jest-snapshot "^26.6.2" jest-resolve@^26.1.0: version "26.1.0" @@ -4394,75 +4450,75 @@ jest-resolve@^26.1.0: resolve "^1.17.0" slash "^3.0.0" -jest-resolve@^26.6.1: - version "26.6.1" - resolved "https://registry.yarnpkg.com/jest-resolve/-/jest-resolve-26.6.1.tgz#e9a9130cc069620d5aeeb87043dd9e130b68c6a1" - integrity sha512-hiHfQH6rrcpAmw9xCQ0vD66SDuU+7ZulOuKwc4jpbmFFsz0bQG/Ib92K+9/489u5rVw0btr/ZhiHqBpmkbCvuQ== +jest-resolve@^26.6.2: + version "26.6.2" + resolved "https://registry.yarnpkg.com/jest-resolve/-/jest-resolve-26.6.2.tgz#a3ab1517217f469b504f1b56603c5bb541fbb507" + integrity sha512-sOxsZOq25mT1wRsfHcbtkInS+Ek7Q8jCHUB0ZUTP0tc/c41QHriU/NunqMfCUWsL4H3MHpvQD4QR9kSYhS7UvQ== dependencies: - "@jest/types" "^26.6.1" + "@jest/types" "^26.6.2" chalk "^4.0.0" graceful-fs "^4.2.4" jest-pnp-resolver "^1.2.2" - jest-util "^26.6.1" + jest-util "^26.6.2" read-pkg-up "^7.0.1" resolve "^1.18.1" slash "^3.0.0" -jest-runner@^26.6.1: - version "26.6.1" - resolved "https://registry.yarnpkg.com/jest-runner/-/jest-runner-26.6.1.tgz#a945971b5a23740c1fe20e372a38de668b7c76bf" - integrity sha512-DmpNGdgsbl5s0FGkmsInmqnmqCtliCSnjWA2TFAJS1m1mL5atwfPsf+uoZ8uYQ2X0uDj4NM+nPcDnUpbNTRMBA== +jest-runner@^26.6.3: + version "26.6.3" + resolved "https://registry.yarnpkg.com/jest-runner/-/jest-runner-26.6.3.tgz#2d1fed3d46e10f233fd1dbd3bfaa3fe8924be159" + integrity sha512-atgKpRHnaA2OvByG/HpGA4g6CSPS/1LK0jK3gATJAoptC1ojltpmVlYC3TYgdmGp+GLuhzpH30Gvs36szSL2JQ== dependencies: - "@jest/console" "^26.6.1" - "@jest/environment" "^26.6.1" - "@jest/test-result" "^26.6.1" - "@jest/types" "^26.6.1" + "@jest/console" "^26.6.2" + "@jest/environment" "^26.6.2" + "@jest/test-result" "^26.6.2" + "@jest/types" "^26.6.2" "@types/node" "*" chalk "^4.0.0" emittery "^0.7.1" exit "^0.1.2" graceful-fs "^4.2.4" - jest-config "^26.6.1" + jest-config "^26.6.3" jest-docblock "^26.0.0" - jest-haste-map "^26.6.1" - jest-leak-detector "^26.6.1" - jest-message-util "^26.6.1" - jest-resolve "^26.6.1" - jest-runtime "^26.6.1" - jest-util "^26.6.1" - jest-worker "^26.6.1" + jest-haste-map "^26.6.2" + jest-leak-detector "^26.6.2" + jest-message-util "^26.6.2" + jest-resolve "^26.6.2" + jest-runtime "^26.6.3" + jest-util "^26.6.2" + jest-worker "^26.6.2" source-map-support "^0.5.6" throat "^5.0.0" -jest-runtime@^26.6.1: - version "26.6.1" - resolved "https://registry.yarnpkg.com/jest-runtime/-/jest-runtime-26.6.1.tgz#9a131e7b4f0bc6beefd62e7443f757c1d5fa9dec" - integrity sha512-7uOCNeezXDWgjEyzYbRN2ViY7xNZzusNVGAMmU0UHRUNXuY4j4GBHKGMqPo/cBPZA9bSYp+lwK2DRRBU5Dv6YQ== - dependencies: - "@jest/console" "^26.6.1" - "@jest/environment" "^26.6.1" - "@jest/fake-timers" "^26.6.1" - "@jest/globals" "^26.6.1" - "@jest/source-map" "^26.5.0" - "@jest/test-result" "^26.6.1" - "@jest/transform" "^26.6.1" - "@jest/types" "^26.6.1" +jest-runtime@^26.6.3: + version "26.6.3" + resolved "https://registry.yarnpkg.com/jest-runtime/-/jest-runtime-26.6.3.tgz#4f64efbcfac398331b74b4b3c82d27d401b8fa2b" + integrity sha512-lrzyR3N8sacTAMeonbqpnSka1dHNux2uk0qqDXVkMv2c/A3wYnvQ4EXuI013Y6+gSKSCxdaczvf4HF0mVXHRdw== + dependencies: + "@jest/console" "^26.6.2" + "@jest/environment" "^26.6.2" + "@jest/fake-timers" "^26.6.2" + "@jest/globals" "^26.6.2" + "@jest/source-map" "^26.6.2" + "@jest/test-result" "^26.6.2" + "@jest/transform" "^26.6.2" + "@jest/types" "^26.6.2" "@types/yargs" "^15.0.0" chalk "^4.0.0" - cjs-module-lexer "^0.4.2" + cjs-module-lexer "^0.6.0" collect-v8-coverage "^1.0.0" exit "^0.1.2" glob "^7.1.3" graceful-fs "^4.2.4" - jest-config "^26.6.1" - jest-haste-map "^26.6.1" - jest-message-util "^26.6.1" - jest-mock "^26.6.1" + jest-config "^26.6.3" + jest-haste-map "^26.6.2" + jest-message-util "^26.6.2" + jest-mock "^26.6.2" jest-regex-util "^26.0.0" - jest-resolve "^26.6.1" - jest-snapshot "^26.6.1" - jest-util "^26.6.1" - jest-validate "^26.6.1" + jest-resolve "^26.6.2" + jest-snapshot "^26.6.2" + jest-util "^26.6.2" + jest-validate "^26.6.2" slash "^3.0.0" strip-bom "^4.0.0" yargs "^15.4.1" @@ -4474,10 +4530,10 @@ jest-serializer@^26.1.0: dependencies: graceful-fs "^4.2.4" -jest-serializer@^26.5.0: - version "26.5.0" - resolved "https://registry.yarnpkg.com/jest-serializer/-/jest-serializer-26.5.0.tgz#f5425cc4c5f6b4b355f854b5f0f23ec6b962bc13" - integrity sha512-+h3Gf5CDRlSLdgTv7y0vPIAoLgX/SI7T4v6hy+TEXMgYbv+ztzbg5PSN6mUXAT/hXYHvZRWm+MaObVfqkhCGxA== +jest-serializer@^26.6.2: + version "26.6.2" + resolved "https://registry.yarnpkg.com/jest-serializer/-/jest-serializer-26.6.2.tgz#d139aafd46957d3a448f3a6cdabe2919ba0742d1" + integrity sha512-S5wqyz0DXnNJPd/xfIzZ5Xnp1HrJWBczg8mMfMpN78OJ5eDxXyf+Ygld9wX1DnUWbIbhM1YDY95NjR4CBXkb2g== dependencies: "@types/node" "*" graceful-fs "^4.2.4" @@ -4516,26 +4572,26 @@ jest-snapshot@^26.1.0: pretty-format "^26.1.0" semver "^7.3.2" -jest-snapshot@^26.6.1: - version "26.6.1" - resolved "https://registry.yarnpkg.com/jest-snapshot/-/jest-snapshot-26.6.1.tgz#469e9d0b749496aea7dad0d7e5e5c88b91cdb4cc" - integrity sha512-JA7bZp7HRTIJYAi85pJ/OZ2eur2dqmwIToA5/6d7Mn90isGEfeF9FvuhDLLEczgKP1ihreBzrJ6Vr7zteP5JNA== +jest-snapshot@^26.6.2: + version "26.6.2" + resolved "https://registry.yarnpkg.com/jest-snapshot/-/jest-snapshot-26.6.2.tgz#f3b0af1acb223316850bd14e1beea9837fb39c84" + integrity sha512-OLhxz05EzUtsAmOMzuupt1lHYXCNib0ECyuZ/PZOx9TrZcC8vL0x+DUG3TL+GLX3yHG45e6YGjIm0XwDc3q3og== dependencies: "@babel/types" "^7.0.0" - "@jest/types" "^26.6.1" + "@jest/types" "^26.6.2" "@types/babel__traverse" "^7.0.4" "@types/prettier" "^2.0.0" chalk "^4.0.0" - expect "^26.6.1" + expect "^26.6.2" graceful-fs "^4.2.4" - jest-diff "^26.6.1" + jest-diff "^26.6.2" jest-get-type "^26.3.0" - jest-haste-map "^26.6.1" - jest-matcher-utils "^26.6.1" - jest-message-util "^26.6.1" - jest-resolve "^26.6.1" + jest-haste-map "^26.6.2" + jest-matcher-utils "^26.6.2" + jest-message-util "^26.6.2" + jest-resolve "^26.6.2" natural-compare "^1.4.0" - pretty-format "^26.6.1" + pretty-format "^26.6.2" semver "^7.3.2" jest-util@^26.1.0: @@ -4561,29 +4617,29 @@ jest-util@^26.3.0: is-ci "^2.0.0" micromatch "^4.0.2" -jest-util@^26.6.1: - version "26.6.1" - resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-26.6.1.tgz#4cc0d09ec57f28d12d053887eec5dc976a352e9b" - integrity sha512-xCLZUqVoqhquyPLuDXmH7ogceGctbW8SMyQVjD9o+1+NPWI7t0vO08udcFLVPLgKWcvc+zotaUv/RuaR6l8HIA== +jest-util@^26.6.2: + version "26.6.2" + resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-26.6.2.tgz#907535dbe4d5a6cb4c47ac9b926f6af29576cbc1" + integrity sha512-MDW0fKfsn0OI7MS7Euz6h8HNDXVQ0gaM9uW6RjfDmd1DAFcaxX9OqIakHIqhbnmF08Cf2DLDG+ulq8YQQ0Lp0Q== dependencies: - "@jest/types" "^26.6.1" + "@jest/types" "^26.6.2" "@types/node" "*" chalk "^4.0.0" graceful-fs "^4.2.4" is-ci "^2.0.0" micromatch "^4.0.2" -jest-validate@^26.6.1: - version "26.6.1" - resolved "https://registry.yarnpkg.com/jest-validate/-/jest-validate-26.6.1.tgz#28730eb8570d60968d9d06f1a8c94d922167bd2a" - integrity sha512-BEFpGbylKocnNPZULcnk+TGaz1oFZQH/wcaXlaXABbu0zBwkOGczuWgdLucUouuQqn7VadHZZeTvo8VSFDLMOA== +jest-validate@^26.6.2: + version "26.6.2" + resolved "https://registry.yarnpkg.com/jest-validate/-/jest-validate-26.6.2.tgz#23d380971587150467342911c3d7b4ac57ab20ec" + integrity sha512-NEYZ9Aeyj0i5rQqbq+tpIOom0YS1u2MVu6+euBsvpgIme+FOfRmoC4R5p0JiAUpaFvFy24xgrpMknarR/93XjQ== dependencies: - "@jest/types" "^26.6.1" + "@jest/types" "^26.6.2" camelcase "^6.0.0" chalk "^4.0.0" jest-get-type "^26.3.0" leven "^3.1.0" - pretty-format "^26.6.1" + pretty-format "^26.6.2" jest-watch-typeahead@0.6.1: version "0.6.1" @@ -4611,20 +4667,20 @@ jest-watcher@^26.3.0: jest-util "^26.3.0" string-length "^4.0.1" -jest-watcher@^26.6.1: - version "26.6.1" - resolved "https://registry.yarnpkg.com/jest-watcher/-/jest-watcher-26.6.1.tgz#debfa34e9c5c3e735593403794fe53d2955bfabc" - integrity sha512-0LBIPPncNi9CaLKK15bnxyd2E8OMl4kJg0PTiNOI+MXztXw1zVdtX/x9Pr6pXaQYps+eS/ts43O4+HByZ7yJSw== +jest-watcher@^26.6.2: + version "26.6.2" + resolved "https://registry.yarnpkg.com/jest-watcher/-/jest-watcher-26.6.2.tgz#a5b683b8f9d68dbcb1d7dae32172d2cca0592975" + integrity sha512-WKJob0P/Em2csiVthsI68p6aGKTIcsfjH9Gsx1f0A3Italz43e3ho0geSAVsmj09RWOELP1AZ/DXyJgOgDKxXQ== dependencies: - "@jest/test-result" "^26.6.1" - "@jest/types" "^26.6.1" + "@jest/test-result" "^26.6.2" + "@jest/types" "^26.6.2" "@types/node" "*" ansi-escapes "^4.2.1" chalk "^4.0.0" - jest-util "^26.6.1" + jest-util "^26.6.2" string-length "^4.0.1" -jest-worker@^26.1.0, jest-worker@^26.2.1, jest-worker@^26.6.1: +jest-worker@^26.1.0, jest-worker@^26.2.1: version "26.6.1" resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-26.6.1.tgz#c2ae8cde6802cc14056043f997469ec170d9c32a" integrity sha512-R5IE3qSGz+QynJx8y+ICEkdI2OJ3RJjRQVEyCcFAd3yVhQSEtquziPO29Mlzgn07LOVE8u8jhJ1FqcwegiXWOw== @@ -4633,14 +4689,23 @@ jest-worker@^26.1.0, jest-worker@^26.2.1, jest-worker@^26.6.1: merge-stream "^2.0.0" supports-color "^7.0.0" -jest@26.6.1: - version "26.6.1" - resolved "https://registry.yarnpkg.com/jest/-/jest-26.6.1.tgz#821e8280d2bdeeed40ac7bc43941dceff0f1b650" - integrity sha512-f+ahfqw3Ffy+9vA7sWFGpTmhtKEMsNAZiWBVXDkrpIO73zIz22iimjirnV78kh/eWlylmvLh/0WxHN6fZraZdA== +jest-worker@^26.6.2: + version "26.6.2" + resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-26.6.2.tgz#7f72cbc4d643c365e27b9fd775f9d0eaa9c7a8ed" + integrity sha512-KWYVV1c4i+jbMpaBC+U++4Va0cp8OisU185o73T1vo99hqi7w8tSJfUXYswwqqrjzwxa6KpRK54WhPvwf5w6PQ== + dependencies: + "@types/node" "*" + merge-stream "^2.0.0" + supports-color "^7.0.0" + +jest@26.6.3: + version "26.6.3" + resolved "https://registry.yarnpkg.com/jest/-/jest-26.6.3.tgz#40e8fdbe48f00dfa1f0ce8121ca74b88ac9148ef" + integrity sha512-lGS5PXGAzR4RF7V5+XObhqz2KZIDUA1yD0DG6pBVmy10eh0ZIXQImRuzocsI/N2XZ1GrLFwTS27In2i2jlpq1Q== dependencies: - "@jest/core" "^26.6.1" + "@jest/core" "^26.6.3" import-local "^3.0.2" - jest-cli "^26.6.1" + jest-cli "^26.6.3" "js-tokens@^3.0.0 || ^4.0.0", js-tokens@^4.0.0: version "4.0.0" @@ -4935,7 +5000,7 @@ magic-string@^0.22.5: dependencies: vlq "^0.2.2" -magic-string@^0.25.5, magic-string@^0.25.7: +magic-string@^0.25.7: version "0.25.7" resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.25.7.tgz#3f497d6fd34c669c6798dcb821f2ef31f5445051" integrity sha512-4CrMT5DOHTDk4HYDlzmwu4FVCcIYI8gauveasrdCu2IKIFOJ3f0v/8MDGJCDL9oD2ppz/Av1b0Nj345H9M+XIA== @@ -5011,6 +5076,11 @@ merge2@^1.3.0: resolved "https://registry.yarnpkg.com/merge2/-/merge2-1.4.1.tgz#4368892f885e907455a6fd7dc55c0c9d404990ae" integrity sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg== +meriyah@3.1.2: + version "3.1.2" + resolved "https://registry.yarnpkg.com/meriyah/-/meriyah-3.1.2.tgz#42aac8a1e05b186f8e08b74b2ee47ea00306b7b9" + integrity sha512-CXPkXT3xdk7KAVdrOV9SDvKUkE8r24aQe4ee/Uj7UJQcoNAS+Bz2QjOpDyrFiLD81GyJ3e5SrKn/125Ow0Ryqg== + micromatch@^3.1.4: version "3.1.10" resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-3.1.10.tgz#70859bc95c9840952f359a068a3fc49f9ecfac23" @@ -5688,12 +5758,12 @@ pretty-format@^26.1.0: ansi-styles "^4.0.0" react-is "^16.12.0" -pretty-format@^26.6.1: - version "26.6.1" - resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-26.6.1.tgz#af9a2f63493a856acddeeb11ba6bcf61989660a8" - integrity sha512-MeqqsP5PYcRBbGMvwzsyBdmAJ4EFX7pWFyl7x4+dMVg5pE0ZDdBIvEH2ergvIO+Gvwv1wh64YuOY9y5LuyY/GA== +pretty-format@^26.6.2: + version "26.6.2" + resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-26.6.2.tgz#e35c2705f14cb7fe2fe94fa078345b444120fc93" + integrity sha512-7AeGuCYNGmycyQbCqd/3PWH4eOoX/OiCa0uphp57NVTeAGdJGaAliecxwBDHYQCIvrW7aDBZCYeNTP/WX69mkg== dependencies: - "@jest/types" "^26.6.1" + "@jest/types" "^26.6.2" ansi-regex "^5.0.0" ansi-styles "^4.0.0" react-is "^17.0.1" @@ -6097,10 +6167,10 @@ rollup-pluginutils@^2.3.1: dependencies: estree-walker "^0.6.1" -rollup@2.32.1: - version "2.32.1" - resolved "https://registry.yarnpkg.com/rollup/-/rollup-2.32.1.tgz#625a92c54f5b4d28ada12d618641491d4dbb548c" - integrity sha512-Op2vWTpvK7t6/Qnm1TTh7VjEZZkN8RWgf0DHbkKzQBwNf748YhXbozHVefqpPp/Fuyk/PQPAnYsBxAEtlMvpUw== +rollup@2.33.1: + version "2.33.1" + resolved "https://registry.yarnpkg.com/rollup/-/rollup-2.33.1.tgz#802795164164ee63cd47769d8879c33ec8ae0c40" + integrity sha512-uY4O/IoL9oNW8MMcbA5hcOaz6tZTMIh7qJHx/tzIJm+n1wLoY38BLn6fuy7DhR57oNFLMbDQtDeJoFURt5933w== optionalDependencies: fsevents "~2.1.2" @@ -6835,10 +6905,10 @@ typedarray-to-buffer@^3.1.5: dependencies: is-typedarray "^1.0.0" -typescript@4.0.3: - version "4.0.3" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.0.3.tgz#153bbd468ef07725c1df9c77e8b453f8d36abba5" - integrity sha512-tEu6DGxGgRJPb/mVPIZ48e69xCn2yRmCgYmDugAVwmJ6o+0u1RI18eO7E7WBTLYLaEVVOhwQmcdhQHweux/WPg== +typescript@4.0.5: + version "4.0.5" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.0.5.tgz#ae9dddfd1069f1cb5beb3ef3b2170dd7c1332389" + integrity sha512-ywmr/VrTVCmNTJ6iV2LwIrfG1P+lv6luD8sUJs+2eI9NLGigaN+nUQc13iHqisq7bra9lnmUSYqbJvegraBOPQ== unherit@^1.0.4: version "1.1.3" @@ -7000,10 +7070,10 @@ v8-compile-cache@^2.0.3: resolved "https://registry.yarnpkg.com/v8-compile-cache/-/v8-compile-cache-2.1.1.tgz#54bc3cdd43317bca91e35dcaf305b1a7237de745" integrity sha512-8OQ9CL+VWyt3JStj7HX7/ciTL2V3Rl1Wf5OL+SNTm0yK1KvtReVulksyeRnCANHHuUxHlQig+JJDlUhBt1NQDQ== -v8-to-istanbul@^6.0.1: - version "6.0.1" - resolved "https://registry.yarnpkg.com/v8-to-istanbul/-/v8-to-istanbul-6.0.1.tgz#7ef0e32faa10f841fe4c1b0f8de96ed067c0be1e" - integrity sha512-PzM1WlqquhBvsV+Gco6WSFeg1AGdD53ccMRkFeyHRE/KRZaVacPOmQYP3EeVgDBtKD2BJ8kgynBQ5OtKiHCH+w== +v8-to-istanbul@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/v8-to-istanbul/-/v8-to-istanbul-7.0.0.tgz#b4fe00e35649ef7785a9b7fcebcea05f37c332fc" + integrity sha512-fLL2rFuQpMtm9r8hrAV2apXX/WqHJ6+IC4/eQVdMDGBUgH/YMV4Gv3duk3kjmyg6uiQWBAA9nJwue4iJUOkHeA== dependencies: "@types/istanbul-lib-coverage" "^2.0.1" convert-source-map "^1.6.0"