Merge branch 'main' into next
# Conflicts: # .github/workflows/dev-test.yml # jest.config.mjs # package.json # scripts/vendors/vendor-meta.json # scripts/vendors/vendors.mjs # src/cli/format.js # src/cli/options/create-minimist-options.js # src/cli/options/parse-cli-arguments.js # src/cli/usage.js # src/cli/utils.js # src/common/create-ignorer.js # src/common/load-plugins.js # src/config/resolve-config.js # src/index.js # src/language-css/utils/css-units.evaluate.js # src/language-html/ast.js # src/language-html/print-preprocess.js # src/language-html/utils/index.js # src/main/multiparser.js # tests/format/markdown/auto-link/jsfmt.spec.js # tests/integration/__tests__/__snapshots__/config-resolution.js.snap # tests/integration/__tests__/__snapshots__/with-config-precedence.js.snap # tests/integration/__tests__/file-info.js # yarn.lock
This commit is contained in:
commit
a85f38f096
142 files changed
+2792
-1992
No files matched your search
@@ -30,7 +30,7 @@ jobs:
|
|||||||
run: yarn build
|
run: yarn build
|
||||||
|
|
||||||
- name: Upload Artifact
|
- name: Upload Artifact
|
||||||
uses: actions/upload-artifact@v2
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: dist
|
name: dist
|
||||||
path: dist
|
path: dist
|
||||||
@@ -50,7 +50,7 @@ jobs:
|
|||||||
uses: actions/setup-node@v2.5.1
|
uses: actions/setup-node@v2.5.1
|
||||||
|
|
||||||
- name: Download Artifact
|
- name: Download Artifact
|
||||||
uses: actions/download-artifact@v2
|
uses: actions/download-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: dist
|
name: dist
|
||||||
path: dist
|
path: dist
|
||||||
|
|||||||
@@ -19,20 +19,21 @@ jobs:
|
|||||||
- "macos-latest"
|
- "macos-latest"
|
||||||
- "windows-latest"
|
- "windows-latest"
|
||||||
node:
|
node:
|
||||||
|
- "18"
|
||||||
- "16"
|
- "16"
|
||||||
- "14"
|
- "14"
|
||||||
include:
|
include:
|
||||||
# only enable coverage on the fastest job
|
# only enable coverage on the fastest job
|
||||||
- os: "ubuntu-latest"
|
- os: "ubuntu-latest"
|
||||||
node: "16"
|
node: "18"
|
||||||
ENABLE_CODE_COVERAGE: true
|
ENABLE_CODE_COVERAGE: true
|
||||||
FULL_TEST: true
|
FULL_TEST: true
|
||||||
CHECK_TEST_PARSERS: true
|
CHECK_TEST_PARSERS: true
|
||||||
# exclude:
|
exclude:
|
||||||
# - os: "macos-latest"
|
- os: "macos-latest"
|
||||||
# node: "14"
|
node: "16"
|
||||||
# - os: "windows-latest"
|
- os: "windows-latest"
|
||||||
# node: "14"
|
node: "16"
|
||||||
env:
|
env:
|
||||||
ENABLE_CODE_COVERAGE: ${{ matrix.ENABLE_CODE_COVERAGE }}
|
ENABLE_CODE_COVERAGE: ${{ matrix.ENABLE_CODE_COVERAGE }}
|
||||||
FULL_TEST: ${{ matrix.FULL_TEST }}
|
FULL_TEST: ${{ matrix.FULL_TEST }}
|
||||||
@@ -75,7 +76,7 @@ jobs:
|
|||||||
run: yarn c8 yarn test:format --maxWorkers=2
|
run: yarn c8 yarn test:format --maxWorkers=2
|
||||||
|
|
||||||
- name: Upload Coverage
|
- name: Upload Coverage
|
||||||
uses: codecov/codecov-action@v2.1.0
|
uses: codecov/codecov-action@v3.1.0
|
||||||
if: ${{ matrix.ENABLE_CODE_COVERAGE }}
|
if: ${{ matrix.ENABLE_CODE_COVERAGE }}
|
||||||
with:
|
with:
|
||||||
fail_ci_if_error: true
|
fail_ci_if_error: true
|
||||||
@@ -87,7 +88,7 @@ jobs:
|
|||||||
# PRETTIER_FALLBACK_RESOLVE: true
|
# PRETTIER_FALLBACK_RESOLVE: true
|
||||||
|
|
||||||
# - name: Upload Coverage (PRETTIER_FALLBACK_RESOLVE)
|
# - name: Upload Coverage (PRETTIER_FALLBACK_RESOLVE)
|
||||||
# uses: codecov/codecov-action@v2.1.0
|
# uses: codecov/codecov-action@v3.1.0
|
||||||
# if: ${{ matrix.ENABLE_CODE_COVERAGE }}
|
# if: ${{ matrix.ENABLE_CODE_COVERAGE }}
|
||||||
# with:
|
# with:
|
||||||
# fail_ci_if_error: true
|
# fail_ci_if_error: true
|
||||||
@@ -28,7 +28,7 @@ jobs:
|
|||||||
run: yarn build
|
run: yarn build
|
||||||
|
|
||||||
- name: Upload Artifact
|
- name: Upload Artifact
|
||||||
uses: actions/upload-artifact@v2
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: dist
|
name: dist
|
||||||
path: dist
|
path: dist
|
||||||
@@ -50,7 +50,7 @@ jobs:
|
|||||||
run: yarn install --frozen-lockfile
|
run: yarn install --frozen-lockfile
|
||||||
|
|
||||||
- name: Download Artifact
|
- name: Download Artifact
|
||||||
uses: actions/download-artifact@v2
|
uses: actions/download-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: dist
|
name: dist
|
||||||
path: dist
|
path: dist
|
||||||
@@ -68,16 +68,21 @@ jobs:
|
|||||||
- "macos-latest"
|
- "macos-latest"
|
||||||
- "windows-latest"
|
- "windows-latest"
|
||||||
node:
|
node:
|
||||||
|
- "18"
|
||||||
- "16"
|
- "16"
|
||||||
- "14"
|
- "14"
|
||||||
- "12"
|
- "12"
|
||||||
include:
|
include:
|
||||||
- os: "ubuntu-latest"
|
- os: "ubuntu-latest"
|
||||||
node: "16"
|
node: "18"
|
||||||
FULL_TEST: true
|
FULL_TEST: true
|
||||||
exclude:
|
exclude:
|
||||||
|
- os: "macos-latest"
|
||||||
|
node: "16"
|
||||||
- os: "macos-latest"
|
- os: "macos-latest"
|
||||||
node: "14"
|
node: "14"
|
||||||
|
- os: "windows-latest"
|
||||||
|
node: "16"
|
||||||
- os: "windows-latest"
|
- os: "windows-latest"
|
||||||
node: "14"
|
node: "14"
|
||||||
env:
|
env:
|
||||||
@@ -103,7 +108,7 @@ jobs:
|
|||||||
run: yarn install --frozen-lockfile
|
run: yarn install --frozen-lockfile
|
||||||
|
|
||||||
- name: Download Artifact
|
- name: Download Artifact
|
||||||
uses: actions/download-artifact@v2
|
uses: actions/download-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: dist
|
name: dist
|
||||||
path: dist
|
path: dist
|
||||||
@@ -145,7 +150,7 @@ jobs:
|
|||||||
node-version: "0.10.48"
|
node-version: "0.10.48"
|
||||||
|
|
||||||
- name: Download Artifact
|
- name: Download Artifact
|
||||||
uses: actions/download-artifact@v2
|
uses: actions/download-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: dist
|
name: dist
|
||||||
path: dist
|
path: dist
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
#### Print the number of files need change (#12561 by @Harry-Hopkinson)
|
||||||
|
|
||||||
|
```console
|
||||||
|
# Prettier stable
|
||||||
|
$ prettier src --check
|
||||||
|
Checking formatting...
|
||||||
|
[warn] src/fileA.js
|
||||||
|
[warn] Code style issues found in the above file(s). Forgot to run Prettier?
|
||||||
|
|
||||||
|
# Prettier main
|
||||||
|
$ prettier src --check
|
||||||
|
Checking formatting...
|
||||||
|
[warn] src/fileA.js
|
||||||
|
[warn] src/fileB.js
|
||||||
|
[warn] Code style issues found in 2 files. Forgot to run Prettier?
|
||||||
|
|
||||||
|
$ prettier src --check
|
||||||
|
Checking formatting...
|
||||||
|
[warn] src/fileA.js
|
||||||
|
[warn] Code style issues found in the above file. Forgot to run Prettier?
|
||||||
|
```
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
#### Infer parser for `.importmap` files (#12603 by @fisker)
|
||||||
|
|
||||||
|
Format [`.importmap`](https://github.com/WICG/import-maps#import-map-processing) files as a JSON files.
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
#### Skip print code or write file when performance flags found (#12682 by @fisker)
|
||||||
|
|
||||||
|
When `--debug-benchmark` or `--debug-repeat` is used, the CLI will skip print the formatted code to the screen or write files.
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
#### Fix single line and empty description formatting (#12608 by @chimurai, @fisker)
|
||||||
|
|
||||||
|
<!-- prettier-ignore -->
|
||||||
|
```graphql
|
||||||
|
# Input
|
||||||
|
""" Customer """
|
||||||
|
type Person {
|
||||||
|
name: String
|
||||||
|
}
|
||||||
|
|
||||||
|
""""""
|
||||||
|
type Person {
|
||||||
|
name: String
|
||||||
|
}
|
||||||
|
|
||||||
|
# Prettier 2.6.2
|
||||||
|
"""
|
||||||
|
Customer
|
||||||
|
"""
|
||||||
|
type Person {
|
||||||
|
name: String
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
"""
|
||||||
|
type Person {
|
||||||
|
name: String
|
||||||
|
}
|
||||||
|
|
||||||
|
# Prettier 2.6.2 (second format)
|
||||||
|
"""
|
||||||
|
Customer
|
||||||
|
"""
|
||||||
|
type Person {
|
||||||
|
name: String
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
"""
|
||||||
|
type Person {
|
||||||
|
name: String
|
||||||
|
}
|
||||||
|
|
||||||
|
# Prettier main
|
||||||
|
"""
|
||||||
|
Customer
|
||||||
|
"""
|
||||||
|
type Person {
|
||||||
|
name: String
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
"""
|
||||||
|
type Person {
|
||||||
|
name: String
|
||||||
|
}
|
||||||
|
```
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
#### Allow formatting for Vue template expression written in TypeScript (#12584 by @sosukesuzuki)
|
||||||
|
|
||||||
|
<!-- prettier-ignore -->
|
||||||
|
```vue
|
||||||
|
<!-- input -->
|
||||||
|
<script setup lang="ts">
|
||||||
|
let x: string | number = 1
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
{{ (x as number).toFixed(2) }}
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<!-- Prettier stable -->
|
||||||
|
<script setup lang="ts">
|
||||||
|
let x: string | number = 1
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
{{ (x as number).toFixed(2) }}
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<!-- Prettier main -->
|
||||||
|
<script setup lang="ts">
|
||||||
|
let x: string | number = 1;
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
{{ (x as number).toFixed(2) }}
|
||||||
|
</template>
|
||||||
|
```
|
||||||
+1
-1
@@ -69,7 +69,7 @@ Console output if some of the files require re-formatting:
|
|||||||
Checking formatting...
|
Checking formatting...
|
||||||
[warn] src/fileA.js
|
[warn] src/fileA.js
|
||||||
[warn] src/fileB.js
|
[warn] src/fileB.js
|
||||||
[warn] Code style issues found in the above file(s). Forgot to run Prettier?
|
[warn] Code style issues found in 2 files. Forgot to run Prettier?
|
||||||
```
|
```
|
||||||
|
|
||||||
The command will return exit code `1` in the second case, which is helpful inside the CI pipelines.
|
The command will return exit code `1` in the second case, which is helpful inside the CI pipelines.
|
||||||
|
|||||||
@@ -24,6 +24,27 @@ coverage
|
|||||||
|
|
||||||
It’s recommended to have a `.prettierignore` in your project! This way you can run `prettier --write .` to make sure that everything is formatted (without mangling files you don’t want, or choking on generated files). And – your editor will know which files _not_ to format!
|
It’s recommended to have a `.prettierignore` in your project! This way you can run `prettier --write .` to make sure that everything is formatted (without mangling files you don’t want, or choking on generated files). And – your editor will know which files _not_ to format!
|
||||||
|
|
||||||
|
By default prettier ignores files in version control systems directories (".git", ".svn" and ".hg") and `node_modules` (if [`--with-node-modules` CLI option](cli.md#--with-node-modules) not specified)
|
||||||
|
|
||||||
|
So by default it will be
|
||||||
|
|
||||||
|
```js
|
||||||
|
**/.git
|
||||||
|
**/.svn
|
||||||
|
**/.hg
|
||||||
|
**/node_modules
|
||||||
|
```
|
||||||
|
|
||||||
|
and
|
||||||
|
|
||||||
|
```js
|
||||||
|
**/.git
|
||||||
|
**/.svn
|
||||||
|
**/.hg
|
||||||
|
```
|
||||||
|
|
||||||
|
if [`--with-node-modules` CLI option](cli.md#--with-node-modules) provided
|
||||||
|
|
||||||
(See also the [`--ignore-path` CLI option](cli.md#--ignore-path).)
|
(See also the [`--ignore-path` CLI option](cli.md#--ignore-path).)
|
||||||
|
|
||||||
## JavaScript
|
## JavaScript
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ const isProduction = process.env.NODE_ENV === "production";
|
|||||||
const ENABLE_CODE_COVERAGE = Boolean(process.env.ENABLE_CODE_COVERAGE);
|
const ENABLE_CODE_COVERAGE = Boolean(process.env.ENABLE_CODE_COVERAGE);
|
||||||
const TEST_STANDALONE = Boolean(process.env.TEST_STANDALONE);
|
const TEST_STANDALONE = Boolean(process.env.TEST_STANDALONE);
|
||||||
const INSTALL_PACKAGE = Boolean(process.env.INSTALL_PACKAGE);
|
const INSTALL_PACKAGE = Boolean(process.env.INSTALL_PACKAGE);
|
||||||
|
const SKIP_TESTS_WITH_NEW_SYNTAX = process.versions.node.startsWith("12.");
|
||||||
|
|
||||||
let PRETTIER_DIR = isProduction
|
let PRETTIER_DIR = isProduction
|
||||||
? path.join(PROJECT_ROOT, "dist")
|
? path.join(PROJECT_ROOT, "dist")
|
||||||
@@ -26,16 +27,27 @@ if (!isProduction) {
|
|||||||
"<rootDir>/tests/integration/__tests__/bundle.js"
|
"<rootDir>/tests/integration/__tests__/bundle.js"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
if (SKIP_TESTS_WITH_NEW_SYNTAX) {
|
||||||
|
testPathIgnorePatterns.push(
|
||||||
|
"<rootDir>/tests/integration/__tests__/help-options.js"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
const config = {
|
const config = {
|
||||||
projects: [
|
projects: [
|
||||||
"<rootDir>/jest-format-test.config.mjs",
|
"<rootDir>/jest-format-test.config.mjs",
|
||||||
isProduction && "<rootDir>/jest-integration-test.config.mjs",
|
isProduction && "<rootDir>/jest-integration-test.config.mjs",
|
||||||
].filter(Boolean),
|
].filter(Boolean),
|
||||||
|
setupFiles: ["<rootDir>/tests/config/setup.js"],
|
||||||
snapshotSerializers: [
|
snapshotSerializers: [
|
||||||
"jest-snapshot-serializer-raw",
|
"jest-snapshot-serializer-raw",
|
||||||
"jest-snapshot-serializer-ansi",
|
"jest-snapshot-serializer-ansi",
|
||||||
],
|
],
|
||||||
|
snapshotFormat: {
|
||||||
|
escapeString: false,
|
||||||
|
},
|
||||||
|
testRegex: "jsfmt\\.spec\\.js$|__tests__/.*\\.js$",
|
||||||
testPathIgnorePatterns,
|
testPathIgnorePatterns,
|
||||||
collectCoverage: ENABLE_CODE_COVERAGE,
|
collectCoverage: ENABLE_CODE_COVERAGE,
|
||||||
collectCoverageFrom: ["<rootDir>/src/**/*.js", "<rootDir>/bin/**/*.js"],
|
collectCoverageFrom: ["<rootDir>/src/**/*.js", "<rootDir>/bin/**/*.js"],
|
||||||
|
|||||||
+11
-26
@@ -24,10 +24,10 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@angular/compiler": "12.2.16",
|
"@angular/compiler": "12.2.16",
|
||||||
"@babel/code-frame": "7.16.7",
|
"@babel/code-frame": "7.16.7",
|
||||||
"@babel/parser": "7.17.8",
|
"@babel/parser": "7.17.9",
|
||||||
"@glimmer/syntax": "0.84.1",
|
"@glimmer/syntax": "0.84.2",
|
||||||
"@iarna/toml": "2.2.5",
|
"@iarna/toml": "2.2.5",
|
||||||
"@typescript-eslint/typescript-estree": "5.17.0",
|
"@typescript-eslint/typescript-estree": "5.20.0",
|
||||||
"acorn": "8.7.0",
|
"acorn": "8.7.0",
|
||||||
"acorn-jsx": "5.3.2",
|
"acorn-jsx": "5.3.2",
|
||||||
"angular-estree-parser": "2.5.0",
|
"angular-estree-parser": "2.5.0",
|
||||||
@@ -38,7 +38,7 @@
|
|||||||
"ci-info": "3.3.0",
|
"ci-info": "3.3.0",
|
||||||
"cjk-regex": "2.0.1",
|
"cjk-regex": "2.0.1",
|
||||||
"cosmiconfig": "7.0.1",
|
"cosmiconfig": "7.0.1",
|
||||||
"css-units-list": "0.0.5",
|
"css-units-list": "1.1.0",
|
||||||
"dashify": "2.0.0",
|
"dashify": "2.0.0",
|
||||||
"diff": "5.0.0",
|
"diff": "5.0.0",
|
||||||
"editorconfig": "0.15.3",
|
"editorconfig": "0.15.3",
|
||||||
@@ -49,7 +49,7 @@
|
|||||||
"fast-glob": "3.2.11",
|
"fast-glob": "3.2.11",
|
||||||
"fast-json-stable-stringify": "2.1.0",
|
"fast-json-stable-stringify": "2.1.0",
|
||||||
"find-parent-dir": "0.3.1",
|
"find-parent-dir": "0.3.1",
|
||||||
"flow-parser": "0.175.0",
|
"flow-parser": "0.176.3",
|
||||||
"get-stdin": "8.0.0",
|
"get-stdin": "8.0.0",
|
||||||
"graphql": "15.6.1",
|
"graphql": "15.6.1",
|
||||||
"html-element-attributes": "3.1.0",
|
"html-element-attributes": "3.1.0",
|
||||||
@@ -62,7 +62,6 @@
|
|||||||
"leven": "4.0.0",
|
"leven": "4.0.0",
|
||||||
"lines-and-columns": "2.0.3",
|
"lines-and-columns": "2.0.3",
|
||||||
"linguist-languages": "7.15.0",
|
"linguist-languages": "7.15.0",
|
||||||
"lodash-es": "4.17.21",
|
|
||||||
"mem": "9.0.2",
|
"mem": "9.0.2",
|
||||||
"meriyah": "4.2.1",
|
"meriyah": "4.2.1",
|
||||||
"micromatch": "4.0.5",
|
"micromatch": "4.0.5",
|
||||||
@@ -82,7 +81,7 @@
|
|||||||
"remark-math": "3.0.1",
|
"remark-math": "3.0.1",
|
||||||
"remark-parse": "8.0.3",
|
"remark-parse": "8.0.3",
|
||||||
"resolve": "1.22.0",
|
"resolve": "1.22.0",
|
||||||
"semver": "7.3.5",
|
"semver": "7.3.7",
|
||||||
"string-width": "5.0.1",
|
"string-width": "5.0.1",
|
||||||
"strip-ansi": "7.0.1",
|
"strip-ansi": "7.0.1",
|
||||||
"typescript": "4.6.3",
|
"typescript": "4.6.3",
|
||||||
@@ -93,34 +92,20 @@
|
|||||||
"yaml-unist-parser": "1.3.1"
|
"yaml-unist-parser": "1.3.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/core": "7.17.8",
|
"@babel/core": "7.17.9",
|
||||||
"@babel/preset-env": "7.16.11",
|
"@babel/preset-env": "7.16.11",
|
||||||
"@babel/types": "7.17.0",
|
"@babel/types": "7.17.0",
|
||||||
"@esbuild-plugins/node-modules-polyfill": "0.1.4",
|
"@esbuild-plugins/node-modules-polyfill": "0.1.4",
|
||||||
"@glimmer/reference": "0.84.1",
|
"@glimmer/reference": "0.84.2",
|
||||||
"@jest/globals": "27.4.2",
|
"@jest/globals": "27.4.2",
|
||||||
"@types/estree": "0.0.51",
|
"@types/estree": "0.0.51",
|
||||||
"@types/jest": "27.4.1",
|
"@types/jest": "27.4.1",
|
||||||
"@typescript-eslint/eslint-plugin": "5.17.0",
|
"@typescript-eslint/eslint-plugin": "5.20.0",
|
||||||
"babel-jest": "27.5.1",
|
"babel-jest": "27.5.1",
|
||||||
"benchmark": "2.1.4",
|
"benchmark": "2.1.4",
|
||||||
"browserslist-to-esbuild": "1.1.1",
|
"browserslist-to-esbuild": "1.1.1",
|
||||||
"cross-env": "7.0.3",
|
"core-js": "3.22.2",
|
||||||
"cspell": "5.19.5",
|
|
||||||
"enquirer": "2.3.6",
|
|
||||||
"esbuild": "0.14.30",
|
|
||||||
"esbuild-visualizer": "0.3.1",
|
|
||||||
"eslint": "8.12.0",
|
|
||||||
"eslint-config-prettier": "8.5.0",
|
|
||||||
"eslint-formatter-friendly": "7.0.0",
|
|
||||||
"eslint-plugin-compat": "4.0.2",
|
|
||||||
"eslint-plugin-import": "2.25.4",
|
|
||||||
"eslint-plugin-jest": "26.1.3",
|
|
||||||
"eslint-plugin-prettier-internal-rules": "2.0.1",
|
|
||||||
"eslint-plugin-react": "7.29.4",
|
|
||||||
"eslint-plugin-regexp": "1.6.0",
|
|
||||||
"eslint-plugin-unicorn": "42.0.0",
|
"eslint-plugin-unicorn": "42.0.0",
|
||||||
"esm-utils": "3.0.0",
|
|
||||||
"execa": "6.1.0",
|
"execa": "6.1.0",
|
||||||
"jest": "27.5.1",
|
"jest": "27.5.1",
|
||||||
"jest-light-runner": "0.1.1",
|
"jest-light-runner": "0.1.1",
|
||||||
@@ -134,7 +119,7 @@
|
|||||||
"prettier": "2.6.2",
|
"prettier": "2.6.2",
|
||||||
"pretty-bytes": "6.0.0",
|
"pretty-bytes": "6.0.0",
|
||||||
"rimraf": "3.0.2",
|
"rimraf": "3.0.2",
|
||||||
"rollup-plugin-license": "2.6.1",
|
"rollup-plugin-license": "2.7.0",
|
||||||
"snapshot-diff": "0.9.0",
|
"snapshot-diff": "0.9.0",
|
||||||
"tempy": "2.0.0"
|
"tempy": "2.0.0"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
"minimist": "1.2.6",
|
"minimist": "1.2.6",
|
||||||
"node-fetch": "3.2.3",
|
"node-fetch": "3.2.3",
|
||||||
"outdent": "0.8.0",
|
"outdent": "0.8.0",
|
||||||
"semver": "7.3.5",
|
"semver": "7.3.7",
|
||||||
"string-width": "5.1.2"
|
"string-width": "5.1.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|||||||
@@ -2261,10 +2261,10 @@ saxes@^5.0.1:
|
|||||||
dependencies:
|
dependencies:
|
||||||
xmlchars "^2.2.0"
|
xmlchars "^2.2.0"
|
||||||
|
|
||||||
semver@7.3.5, semver@^7.3.2:
|
semver@7.3.7, semver@^7.3.2:
|
||||||
version "7.3.5"
|
version "7.3.7"
|
||||||
resolved "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz"
|
resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.7.tgz#12c5b649afdbf9049707796e22a4028814ce523f"
|
||||||
integrity sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==
|
integrity sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g==
|
||||||
dependencies:
|
dependencies:
|
||||||
lru-cache "^6.0.0"
|
lru-cache "^6.0.0"
|
||||||
|
|
||||||
|
|||||||
+42
-4
@@ -101,6 +101,16 @@ function listDifferent(context, input, options, filename) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getPerformanceTestFlag(context) {
|
||||||
|
if (context.argv.debugBenchmark) {
|
||||||
|
return "--debug-benchmark";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (context.argv.debugRepeat > 0) {
|
||||||
|
return "--debug-repeat";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async function format(context, input, opt) {
|
async function format(context, input, opt) {
|
||||||
if (!opt.parser && !opt.filepath) {
|
if (!opt.parser && !opt.filepath) {
|
||||||
throw new errors.UndefinedParserError(
|
throw new errors.UndefinedParserError(
|
||||||
@@ -266,7 +276,17 @@ async function formatStdin(context) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
writeOutput(context, await format(context, input, options), options);
|
const formatted = await format(context, input, options);
|
||||||
|
|
||||||
|
const performanceTestFlag = getPerformanceTestFlag(context);
|
||||||
|
if (performanceTestFlag) {
|
||||||
|
context.logger.log(
|
||||||
|
`'${performanceTestFlag}' option found, skipped print code to screen.`
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
writeOutput(context, formatted, options);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
handleError(context, relativeFilepath || "stdin", error);
|
handleError(context, relativeFilepath || "stdin", error);
|
||||||
}
|
}
|
||||||
@@ -279,7 +299,7 @@ async function formatFiles(context) {
|
|||||||
|
|
||||||
let numberOfUnformattedFilesFound = 0;
|
let numberOfUnformattedFilesFound = 0;
|
||||||
|
|
||||||
if (context.argv.check) {
|
if (context.argv.check && !getPerformanceTestFlag(context)) {
|
||||||
context.logger.log("Checking formatting...");
|
context.logger.log("Checking formatting...");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -368,6 +388,14 @@ async function formatFiles(context) {
|
|||||||
printedFilename.clear();
|
printedFilename.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const performanceTestFlag = getPerformanceTestFlag(context);
|
||||||
|
if (performanceTestFlag) {
|
||||||
|
context.logger.log(
|
||||||
|
`'${performanceTestFlag}' option found, skipped print code or write files.`
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (context.argv.write) {
|
if (context.argv.write) {
|
||||||
// Don't write the file if it won't change in order not to invalidate
|
// Don't write the file if it won't change in order not to invalidate
|
||||||
// mtime based caches.
|
// mtime based caches.
|
||||||
@@ -416,11 +444,21 @@ async function formatFiles(context) {
|
|||||||
if (context.argv.check) {
|
if (context.argv.check) {
|
||||||
if (numberOfUnformattedFilesFound === 0) {
|
if (numberOfUnformattedFilesFound === 0) {
|
||||||
context.logger.log("All matched files use Prettier code style!");
|
context.logger.log("All matched files use Prettier code style!");
|
||||||
|
} else if (numberOfUnformattedFilesFound === 1) {
|
||||||
|
context.logger.warn(
|
||||||
|
context.argv.write
|
||||||
|
? "Code style issues fixed in the above file."
|
||||||
|
: "Code style issues found in the above file. Forgot to run Prettier?"
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
context.logger.warn(
|
context.logger.warn(
|
||||||
context.argv.write
|
context.argv.write
|
||||||
? "Code style issues fixed in the above file(s)."
|
? "Code style issues found in " +
|
||||||
: "Code style issues found in the above file(s). Forgot to run Prettier?"
|
numberOfUnformattedFilesFound +
|
||||||
|
" files."
|
||||||
|
: "Code style issues found in " +
|
||||||
|
numberOfUnformattedFilesFound +
|
||||||
|
" files. Forgot to run Prettier?"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,8 @@
|
|||||||
import { partition } from "lodash-es";
|
import prettierInteral from "../prettier-internal.js";
|
||||||
|
|
||||||
|
const {
|
||||||
|
utils: { partition },
|
||||||
|
} = prettierInteral
|
||||||
|
|
||||||
export default function createMinimistOptions(detailedOptions) {
|
export default function createMinimistOptions(detailedOptions) {
|
||||||
const [boolean, string] = partition(
|
const [boolean, string] = partition(
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { pick } from "lodash-es";
|
|
||||||
import camelCase from "camelcase";
|
import camelCase from "camelcase";
|
||||||
|
import { pick } from "../utils.js";
|
||||||
import getContextOptions from "./get-context-options.js";
|
import getContextOptions from "./get-context-options.js";
|
||||||
import minimist from "./minimist.js";
|
import minimist from "./minimist.js";
|
||||||
import createMinimistOptions from "./create-minimist-options.js";
|
import createMinimistOptions from "./create-minimist-options.js";
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
import { groupBy } from "lodash-es";
|
|
||||||
import camelCase from "camelcase";
|
import camelCase from "camelcase";
|
||||||
import * as constant from "./constant.js";
|
import * as constant from "./constant.js";
|
||||||
|
import { groupBy } from "./utils.js";
|
||||||
|
|
||||||
const OPTION_USAGE_THRESHOLD = 25;
|
const OPTION_USAGE_THRESHOLD = 25;
|
||||||
const CHOICE_USAGE_MARGIN = 3;
|
const CHOICE_USAGE_MARGIN = 3;
|
||||||
|
|||||||
+36
-1
@@ -1,4 +1,39 @@
|
|||||||
// eslint-disable-next-line no-console
|
// eslint-disable-next-line no-console
|
||||||
const printToScreen = console.log.bind(console);
|
const printToScreen = console.log.bind(console);
|
||||||
|
|
||||||
export { printToScreen };
|
/**
|
||||||
|
* @template Obj
|
||||||
|
* @template Key
|
||||||
|
* @param {Array<Obj>} array
|
||||||
|
* @param {(value: Obj) => Key} iteratee
|
||||||
|
* @returns {{[p in Key]: T}}
|
||||||
|
*/
|
||||||
|
function groupBy(array, iteratee) {
|
||||||
|
const result = Object.create(null);
|
||||||
|
|
||||||
|
for (const value of array) {
|
||||||
|
const key = iteratee(value);
|
||||||
|
|
||||||
|
if (Array.isArray(result[key])) {
|
||||||
|
result[key].push(value);
|
||||||
|
} else {
|
||||||
|
result[key] = [value];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @template Obj
|
||||||
|
* @template {keyof Obj} Keys
|
||||||
|
* @param {Obj} object
|
||||||
|
* @param {Array<Keys>} keys
|
||||||
|
* @returns {{[key in Keys]: Obj[key]}}
|
||||||
|
*/
|
||||||
|
function pick(object, keys) {
|
||||||
|
const entries = keys.map((key) => [key, object[key]]);
|
||||||
|
return Object.fromEntries(entries);
|
||||||
|
}
|
||||||
|
|
||||||
|
export { printToScreen, groupBy, pick };
|
||||||
@@ -4,7 +4,7 @@ import * as config from "../config/resolve-config.js";
|
|||||||
import createIgnorer from "./create-ignorer.js";
|
import createIgnorer from "./create-ignorer.js";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {{ ignorePath?: string, withNodeModules?: boolean, plugins: object }} FileInfoOptions
|
* @typedef {{ ignorePath?: string, withNodeModules?: boolean, plugins: object, resolveConfig?: boolean }} FileInfoOptions
|
||||||
* @typedef {{ ignored: boolean, inferredParser: string | null }} FileInfoResult
|
* @typedef {{ ignored: boolean, inferredParser: string | null }} FileInfoResult
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
@@ -2,9 +2,10 @@ import { createRequire } from "node:module";
|
|||||||
import fs from "node:fs";
|
import fs from "node:fs";
|
||||||
import path from "node:path";
|
import path from "node:path";
|
||||||
import { fileURLToPath } from "node:url";
|
import { fileURLToPath } from "node:url";
|
||||||
import { uniqBy, partition } from "lodash-es";
|
|
||||||
import fastGlob from "fast-glob";
|
import fastGlob from "fast-glob";
|
||||||
import mem, { memClear } from "mem";
|
import mem, { memClear } from "mem";
|
||||||
|
import partition from "../utils/partition.js"
|
||||||
|
import uniqByKey from "../utils/uniq-by-key.js"
|
||||||
import thirdParty from "./third-party.cjs";
|
import thirdParty from "./third-party.cjs";
|
||||||
import resolve from "./resolve.js";
|
import resolve from "./resolve.js";
|
||||||
|
|
||||||
@@ -92,7 +93,7 @@ function load(plugins, pluginSearchDirs) {
|
|||||||
);
|
);
|
||||||
|
|
||||||
const externalPlugins = [
|
const externalPlugins = [
|
||||||
...uniqBy(
|
...uniqByKey(
|
||||||
[...externalManualLoadPluginInfos, ...externalAutoLoadPluginInfos],
|
[...externalManualLoadPluginInfos, ...externalAutoLoadPluginInfos],
|
||||||
"requirePath"
|
"requirePath"
|
||||||
).map((externalPluginInfo) => ({
|
).map((externalPluginInfo) => ({
|
||||||
|
|||||||
@@ -3,19 +3,22 @@ import path from "node:path";
|
|||||||
import micromatch from "micromatch";
|
import micromatch from "micromatch";
|
||||||
import mem, { memClear } from "mem";
|
import mem, { memClear } from "mem";
|
||||||
import thirdParty from "../common/third-party.cjs";
|
import thirdParty from "../common/third-party.cjs";
|
||||||
|
|
||||||
import loadToml from "../utils/load-toml.js";
|
import loadToml from "../utils/load-toml.js";
|
||||||
import loadJson5 from "../utils/load-json5.js";
|
import loadJson5 from "../utils/load-json5.js";
|
||||||
import resolve from "../common/resolve.js";
|
import resolve from "../common/resolve.js";
|
||||||
|
import partition from "../utils/partition.js";
|
||||||
import * as resolveEditorConfig from "./resolve-config-editorconfig.js";
|
import * as resolveEditorConfig from "./resolve-config-editorconfig.js";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {import("cosmiconfig/dist/Explorer").Explorer} Explorer
|
* @typedef {ReturnType<import("cosmiconfig").cosmiconfig>} Explorer
|
||||||
* @typedef {{sync: boolean; cache: boolean }} Options
|
* @typedef {ReturnType<import("cosmiconfig").cosmiconfigSync>} SyncExplorer
|
||||||
|
* @typedef {{sync?: boolean; cache?: boolean }} Options
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {(opts: Options) => Explorer}
|
* @template {Options} Opts
|
||||||
|
* @param {Opts} opts
|
||||||
|
* @return {Opts["sync"] extends true ? SyncExplorer : Explorer}
|
||||||
*/
|
*/
|
||||||
const getExplorerMemoized = mem(
|
const getExplorerMemoized = mem(
|
||||||
(opts) => {
|
(opts) => {
|
||||||
@@ -67,8 +70,9 @@ const getExplorerMemoized = mem(
|
|||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {Options} opts
|
* @template {Options} Opts
|
||||||
* @return {Explorer}
|
* @param {Opts} opts
|
||||||
|
* @return {Opts["sync"] extends true ? SyncExplorer : Explorer}
|
||||||
*/
|
*/
|
||||||
function getExplorer(opts) {
|
function getExplorer(opts) {
|
||||||
// Normalize opts before passing to a memoized function
|
// Normalize opts before passing to a memoized function
|
||||||
@@ -85,6 +89,7 @@ function _resolveConfig(filePath, opts, sync) {
|
|||||||
};
|
};
|
||||||
const { load, search } = getExplorer(loadOpts);
|
const { load, search } = getExplorer(loadOpts);
|
||||||
const loadEditorConfig = resolveEditorConfig.getLoadFunction(loadOpts);
|
const loadEditorConfig = resolveEditorConfig.getLoadFunction(loadOpts);
|
||||||
|
/** @type {[any, any]} */
|
||||||
const arr = [
|
const arr = [
|
||||||
opts.config ? load(opts.config) : search(filePath),
|
opts.config ? load(opts.config) : search(filePath),
|
||||||
loadEditorConfig(filePath),
|
loadEditorConfig(filePath),
|
||||||
@@ -169,15 +174,10 @@ function pathMatchesGlobs(filePath, patterns, excludedPatterns) {
|
|||||||
const patternList = Array.isArray(patterns) ? patterns : [patterns];
|
const patternList = Array.isArray(patterns) ? patterns : [patterns];
|
||||||
// micromatch always matches against basename when the option is enabled
|
// micromatch always matches against basename when the option is enabled
|
||||||
// use only patterns without slashes with it to match minimatch behavior
|
// use only patterns without slashes with it to match minimatch behavior
|
||||||
const withSlashes = [];
|
const [withSlashes, withoutSlashes] = partition(patternList, (pattern) =>
|
||||||
const withoutSlashes = [];
|
pattern.includes("/")
|
||||||
for (const pattern of patternList) {
|
);
|
||||||
if (pattern.includes("/")) {
|
|
||||||
withSlashes.push(pattern);
|
|
||||||
} else {
|
|
||||||
withoutSlashes.push(pattern);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return (
|
return (
|
||||||
micromatch.isMatch(filePath, withoutSlashes, {
|
micromatch.isMatch(filePath, withoutSlashes, {
|
||||||
ignore: excludedPatterns,
|
ignore: excludedPatterns,
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ import * as optionsModule from "./main/options.js";
|
|||||||
import * as optionsNormalizer from "./main/options-normalizer.js";
|
import * as optionsNormalizer from "./main/options-normalizer.js";
|
||||||
import arrayify from "./utils/arrayify.js";
|
import arrayify from "./utils/arrayify.js";
|
||||||
import getLast from "./utils/get-last.js";
|
import getLast from "./utils/get-last.js";
|
||||||
|
import partition from "./utils/partition.js";
|
||||||
import { isNonEmptyArray } from "./common/util.js";
|
import { isNonEmptyArray } from "./common/util.js";
|
||||||
|
|
||||||
const require = createRequire(import.meta.url);
|
const require = createRequire(import.meta.url);
|
||||||
@@ -45,6 +46,11 @@ function _withPlugins(
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {*} fn
|
||||||
|
* @param {*} optsArgIdx
|
||||||
|
* @returns {*}
|
||||||
|
*/
|
||||||
function withPlugins(fn, optsArgIdx) {
|
function withPlugins(fn, optsArgIdx) {
|
||||||
const resultingFn = _withPlugins(fn, optsArgIdx);
|
const resultingFn = _withPlugins(fn, optsArgIdx);
|
||||||
if (fn.sync) {
|
if (fn.sync) {
|
||||||
@@ -97,6 +103,7 @@ const prettier = {
|
|||||||
arrayify,
|
arrayify,
|
||||||
getLast,
|
getLast,
|
||||||
isNonEmptyArray,
|
isNonEmptyArray,
|
||||||
|
partition,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -125,13 +125,15 @@ function genericPrint(path, options, print) {
|
|||||||
}
|
}
|
||||||
case "StringValue": {
|
case "StringValue": {
|
||||||
if (node.block) {
|
if (node.block) {
|
||||||
return [
|
const lines = node.value.replace(/"""/g, "\\$&").split("\n");
|
||||||
'"""',
|
if (lines.length === 1) {
|
||||||
|
lines[0] = lines[0].trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
return join(
|
||||||
hardline,
|
hardline,
|
||||||
join(hardline, node.value.replace(/"""/g, "\\$&").split("\n")),
|
['"""', ...(lines.length > 0 ? lines : []), '"""'].filter(Boolean)
|
||||||
hardline,
|
);
|
||||||
'"""',
|
|
||||||
];
|
|
||||||
}
|
}
|
||||||
return [
|
return [
|
||||||
'"',
|
'"',
|
||||||
@@ -572,15 +574,19 @@ function printInterfaces(path, options, print) {
|
|||||||
return parts;
|
return parts;
|
||||||
}
|
}
|
||||||
|
|
||||||
function clean(/*node, newNode , parent*/) {}
|
function clean(node, newNode /* , parent */) {
|
||||||
|
// We print single line `""" string """` as multiple line string,
|
||||||
|
// and the parser ignores space in multiple line string
|
||||||
|
if (node.kind === "StringValue" && node.block && !node.value.includes("\n")) {
|
||||||
|
newNode.value = newNode.value.trim();
|
||||||
|
}
|
||||||
|
}
|
||||||
clean.ignoredProperties = new Set(["loc", "comments"]);
|
clean.ignoredProperties = new Set(["loc", "comments"]);
|
||||||
|
|
||||||
function hasPrettierIgnore(path) {
|
function hasPrettierIgnore(path) {
|
||||||
const node = path.getValue();
|
const node = path.getValue();
|
||||||
return (
|
return node?.comments?.some(
|
||||||
node &&
|
(comment) => comment.value.trim() === "prettier-ignore"
|
||||||
Array.isArray(node.comments) &&
|
|
||||||
node.comments.some((comment) => comment.value.trim() === "prettier-ignore")
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ function addBackslash(/* options*/) {
|
|||||||
name: "addBackslash",
|
name: "addBackslash",
|
||||||
visitor: {
|
visitor: {
|
||||||
All(node) {
|
All(node) {
|
||||||
const childrenOrBody = node.children || node.body;
|
const childrenOrBody = node.children ?? node.body;
|
||||||
if (childrenOrBody) {
|
if (childrenOrBody) {
|
||||||
for (let i = 0; i < childrenOrBody.length - 1; i++) {
|
for (let i = 0; i < childrenOrBody.length - 1; i++) {
|
||||||
if (
|
if (
|
||||||
|
|||||||
@@ -735,14 +735,14 @@ function needsOppositeQuote(path) {
|
|||||||
/* SubExpression print helpers */
|
/* SubExpression print helpers */
|
||||||
|
|
||||||
function printSubExpressionPathAndParams(path, print) {
|
function printSubExpressionPathAndParams(path, print) {
|
||||||
const p = printPath(path, print);
|
const printed = printPath(path, print);
|
||||||
const params = printParams(path, print);
|
const params = printParams(path, print);
|
||||||
|
|
||||||
if (!params) {
|
if (!params) {
|
||||||
return p;
|
return printed;
|
||||||
}
|
}
|
||||||
|
|
||||||
return indent([p, line, group(params)]);
|
return indent([printed, line, group(params)]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* misc. print helpers */
|
/* misc. print helpers */
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ function isGlimmerComponent(node) {
|
|||||||
return (
|
return (
|
||||||
isNodeOfSomeType(node, ["ElementNode"]) &&
|
isNodeOfSomeType(node, ["ElementNode"]) &&
|
||||||
typeof node.tag === "string" &&
|
typeof node.tag === "string" &&
|
||||||
node.tag[0] !== ":" &&
|
!node.tag.startsWith(":") &&
|
||||||
(isUppercase(node.tag[0]) || node.tag.includes("."))
|
(isUppercase(node.tag[0]) || node.tag.includes("."))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -38,9 +38,9 @@ function isGlimmerComponent(node) {
|
|||||||
const voidTags = new Set(htmlVoidElements);
|
const voidTags = new Set(htmlVoidElements);
|
||||||
function isVoid(node) {
|
function isVoid(node) {
|
||||||
return (
|
return (
|
||||||
|
voidTags.has(node.tag) ||
|
||||||
(isGlimmerComponent(node) &&
|
(isGlimmerComponent(node) &&
|
||||||
node.children.every((node) => isWhitespaceNode(node))) ||
|
node.children.every((node) => isWhitespaceNode(node)))
|
||||||
voidTags.has(node.tag)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -69,9 +69,9 @@ function isNextNodeOfSomeType(path, types) {
|
|||||||
|
|
||||||
function getSiblingNode(path, offset) {
|
function getSiblingNode(path, offset) {
|
||||||
const node = path.getValue();
|
const node = path.getValue();
|
||||||
const parentNode = path.getParentNode(0) || {};
|
const parentNode = path.getParentNode(0) ?? {};
|
||||||
const children =
|
const children =
|
||||||
parentNode.children || parentNode.body || parentNode.parts || [];
|
parentNode.children ?? parentNode.body ?? parentNode.parts ?? [];
|
||||||
const index = children.indexOf(node);
|
const index = children.indexOf(node);
|
||||||
return index !== -1 && children[index + offset];
|
return index !== -1 && children[index + offset];
|
||||||
}
|
}
|
||||||
|
|||||||
+56
-62
@@ -6,38 +6,45 @@ const NODES_KEYS = {
|
|||||||
children: true,
|
children: true,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const NON_ENUMERABLE_PROPERTIES = new Set(["parent"]);
|
||||||
|
|
||||||
// TODO: typechecking is problematic for this class because of this issue:
|
// TODO: typechecking is problematic for this class because of this issue:
|
||||||
// https://github.com/microsoft/TypeScript/issues/26811
|
// https://github.com/microsoft/TypeScript/issues/26811
|
||||||
|
|
||||||
class Node {
|
class Node {
|
||||||
constructor(props = {}) {
|
constructor(nodeOrProperties = {}) {
|
||||||
for (const [key, value] of Object.entries(props)) {
|
for (const property of new Set([
|
||||||
if (key in NODES_KEYS) {
|
...NON_ENUMERABLE_PROPERTIES,
|
||||||
this._setNodes(key, value);
|
...Object.keys(nodeOrProperties),
|
||||||
} else {
|
])) {
|
||||||
this[key] = value;
|
this.setProperty(property, nodeOrProperties[property]);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_setNodes(key, nodes) {
|
setProperty(property, value) {
|
||||||
if (nodes !== this[key]) {
|
if (this[property] === value) {
|
||||||
this[key] = cloneAndUpdateNodes(nodes, this);
|
return;
|
||||||
if (key === "attrs") {
|
|
||||||
setNonEnumerableProperty(
|
|
||||||
this,
|
|
||||||
"attrMap",
|
|
||||||
Object.fromEntries(
|
|
||||||
this[key].map((attr) => [attr.fullName, attr.value])
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (property in NODES_KEYS) {
|
||||||
|
value = value.map((node) => this.createChild(node));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!NON_ENUMERABLE_PROPERTIES.has(property)) {
|
||||||
|
this[property] = value;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Object.defineProperty(this, property, {
|
||||||
|
value,
|
||||||
|
enumerable: false,
|
||||||
|
configurable: true,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
map(fn) {
|
map(fn) {
|
||||||
/** @type{any} */
|
/** @type{any} */
|
||||||
let newNode = null;
|
let newNode;
|
||||||
|
|
||||||
for (const NODES_KEY in NODES_KEYS) {
|
for (const NODES_KEY in NODES_KEYS) {
|
||||||
const nodes = this[NODES_KEY];
|
const nodes = this[NODES_KEY];
|
||||||
@@ -48,7 +55,7 @@ class Node {
|
|||||||
// @ts-expect-error
|
// @ts-expect-error
|
||||||
newNode = new Node({ parent: this.parent });
|
newNode = new Node({ parent: this.parent });
|
||||||
}
|
}
|
||||||
newNode._setNodes(NODES_KEY, mappedNodes);
|
newNode.setProperty(NODES_KEY, mappedNodes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -76,15 +83,27 @@ class Node {
|
|||||||
fn(this);
|
fn(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
createChild(nodeOrProperties) {
|
||||||
|
const node =
|
||||||
|
nodeOrProperties instanceof Node
|
||||||
|
? nodeOrProperties.clone()
|
||||||
|
: new Node(nodeOrProperties);
|
||||||
|
node.setProperty("parent", this);
|
||||||
|
return node;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {Node} [target]
|
* @param {Node} [target]
|
||||||
* @param {Object} [node]
|
* @param {Object} [node]
|
||||||
*/
|
*/
|
||||||
insertChildBefore(target, node) {
|
insertChildBefore(target, node) {
|
||||||
const newNode = new Node({ ...node, parent: this });
|
|
||||||
|
|
||||||
// @ts-expect-error
|
// @ts-expect-error
|
||||||
this.children.splice(this.children.indexOf(target), 0, newNode);
|
this.children.splice(
|
||||||
|
// @ts-expect-error
|
||||||
|
this.children.indexOf(target),
|
||||||
|
0,
|
||||||
|
this.createChild(node)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -100,49 +119,32 @@ class Node {
|
|||||||
* @param {Object} [node]
|
* @param {Object} [node]
|
||||||
*/
|
*/
|
||||||
replaceChild(target, node) {
|
replaceChild(target, node) {
|
||||||
const newNode = new Node({ ...node, parent: this });
|
|
||||||
|
|
||||||
// @ts-expect-error
|
// @ts-expect-error
|
||||||
this.children[this.children.indexOf(target)] = newNode;
|
this.children[this.children.indexOf(target)] = this.createChild(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
clone() {
|
clone() {
|
||||||
return new Node(this);
|
return new Node(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {Array} [children]
|
|
||||||
*/
|
|
||||||
setChildren(children) {
|
|
||||||
this._setNodes("children", children);
|
|
||||||
}
|
|
||||||
|
|
||||||
get firstChild() {
|
get firstChild() {
|
||||||
// @ts-expect-error
|
// @ts-expect-error
|
||||||
return isNonEmptyArray(this.children) ? this.children[0] : null;
|
return this.children?.[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
get lastChild() {
|
get lastChild() {
|
||||||
// @ts-expect-error
|
// @ts-expect-error
|
||||||
return isNonEmptyArray(this.children) ? getLast(this.children) : null;
|
return this.children?.[this.children.length - 1];
|
||||||
}
|
}
|
||||||
|
|
||||||
get prev() {
|
get prev() {
|
||||||
// @ts-expect-error
|
// @ts-expect-error
|
||||||
if (!this.parent) {
|
return this.parent?.children[this.parent.children.indexOf(this) - 1];
|
||||||
return null;
|
|
||||||
}
|
|
||||||
// @ts-expect-error
|
|
||||||
return this.parent.children[this.parent.children.indexOf(this) - 1];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
get next() {
|
get next() {
|
||||||
// @ts-expect-error
|
// @ts-expect-error
|
||||||
if (!this.parent) {
|
return this.parent?.children[this.parent.children.indexOf(this) + 1];
|
||||||
return null;
|
|
||||||
}
|
|
||||||
// @ts-expect-error
|
|
||||||
return this.parent.children[this.parent.children.indexOf(this) + 1];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// for element and attribute
|
// for element and attribute
|
||||||
@@ -150,10 +152,18 @@ class Node {
|
|||||||
// @ts-expect-error
|
// @ts-expect-error
|
||||||
return this.hasExplicitNamespace ? this.fullName : this.name;
|
return this.hasExplicitNamespace ? this.fullName : this.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
get fullName() {
|
get fullName() {
|
||||||
// @ts-expect-error
|
// @ts-expect-error
|
||||||
return this.namespace ? this.namespace + ":" + this.name : this.name;
|
return this.namespace ? this.namespace + ":" + this.name : this.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get attrMap() {
|
||||||
|
return Object.fromEntries(
|
||||||
|
// @ts-expect-error
|
||||||
|
this.attrs.map((attr) => [attr.fullName, attr.value])
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function mapNodesIfChanged(nodes, fn) {
|
function mapNodesIfChanged(nodes, fn) {
|
||||||
@@ -163,20 +173,4 @@ function mapNodesIfChanged(nodes, fn) {
|
|||||||
: nodes;
|
: nodes;
|
||||||
}
|
}
|
||||||
|
|
||||||
function cloneAndUpdateNodes(nodes, parent) {
|
|
||||||
const siblings = nodes.map((node) =>
|
|
||||||
node instanceof Node ? node.clone() : new Node({ ...node, parent })
|
|
||||||
);
|
|
||||||
|
|
||||||
for (const sibling of siblings) {
|
|
||||||
sibling.parent = parent;
|
|
||||||
}
|
|
||||||
|
|
||||||
return siblings;
|
|
||||||
}
|
|
||||||
|
|
||||||
function setNonEnumerableProperty(obj, key, value) {
|
|
||||||
Object.defineProperty(obj, key, { value, enumerable: false });
|
|
||||||
}
|
|
||||||
|
|
||||||
export { Node };
|
export { Node };
|
||||||
@@ -6,7 +6,6 @@ const ignoredProperties = new Set([
|
|||||||
"endSourceSpan",
|
"endSourceSpan",
|
||||||
"nameSpan",
|
"nameSpan",
|
||||||
"valueSpan",
|
"valueSpan",
|
||||||
"parent",
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
function clean(ast, newNode) {
|
function clean(ast, newNode) {
|
||||||
|
|||||||
@@ -127,11 +127,14 @@ function printEmbeddedAttributeValue(node, htmlTextToDoc, options) {
|
|||||||
|
|
||||||
if (isKeyMatched(vueEventBindingPatterns)) {
|
if (isKeyMatched(vueEventBindingPatterns)) {
|
||||||
const value = getValue();
|
const value = getValue();
|
||||||
|
const parser = isVueEventBindingExpression(value)
|
||||||
|
? "__js_expression"
|
||||||
|
: options.__should_parse_vue_template_with_ts
|
||||||
|
? "__vue_ts_event_binding"
|
||||||
|
: "__vue_event_binding";
|
||||||
return printMaybeHug(
|
return printMaybeHug(
|
||||||
attributeTextToDoc(value, {
|
attributeTextToDoc(value, {
|
||||||
parser: isVueEventBindingExpression(value)
|
parser,
|
||||||
? "__js_expression"
|
|
||||||
: "__vue_event_binding",
|
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -318,7 +321,9 @@ function embed(path, print, textToDoc, options) {
|
|||||||
textToDocOptions.parser = "__ng_interpolation";
|
textToDocOptions.parser = "__ng_interpolation";
|
||||||
textToDocOptions.trailingComma = "none";
|
textToDocOptions.trailingComma = "none";
|
||||||
} else if (options.parser === "vue") {
|
} else if (options.parser === "vue") {
|
||||||
textToDocOptions.parser = "__vue_expression";
|
textToDocOptions.parser = options.__should_parse_vue_template_with_ts
|
||||||
|
? "__vue_ts_expression"
|
||||||
|
: "__vue_expression";
|
||||||
} else {
|
} else {
|
||||||
textToDocOptions.parser = "__js_expression";
|
textToDocOptions.parser = "__js_expression";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import {
|
|||||||
isLeadingSpaceSensitiveNode,
|
isLeadingSpaceSensitiveNode,
|
||||||
isTrailingSpaceSensitiveNode,
|
isTrailingSpaceSensitiveNode,
|
||||||
isWhitespaceSensitiveNode,
|
isWhitespaceSensitiveNode,
|
||||||
|
isVueScriptTag,
|
||||||
} from "./utils/index.js";
|
} from "./utils/index.js";
|
||||||
|
|
||||||
const PREPROCESS_PIPELINE = [
|
const PREPROCESS_PIPELINE = [
|
||||||
@@ -23,6 +24,7 @@ const PREPROCESS_PIPELINE = [
|
|||||||
addHasHtmComponentClosingTag,
|
addHasHtmComponentClosingTag,
|
||||||
addIsSpaceSensitive,
|
addIsSpaceSensitive,
|
||||||
mergeSimpleElementIntoText,
|
mergeSimpleElementIntoText,
|
||||||
|
markTsScript,
|
||||||
];
|
];
|
||||||
|
|
||||||
function preprocess(ast, options) {
|
function preprocess(ast, options) {
|
||||||
@@ -404,4 +406,19 @@ function addIsSpaceSensitive(ast, options) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function markTsScript(ast, options) {
|
||||||
|
if (options.parser === "vue") {
|
||||||
|
const vueScriptTag = ast.children.find((child) =>
|
||||||
|
isVueScriptTag(child, options)
|
||||||
|
);
|
||||||
|
if (!vueScriptTag) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const { lang } = vueScriptTag.attrMap;
|
||||||
|
if (lang === "ts" || lang === "typescript") {
|
||||||
|
options.__should_parse_vue_template_with_ts = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export default preprocess;
|
export default preprocess;
|
||||||
@@ -635,6 +635,11 @@ function getTextValueParts(node, value = node.value) {
|
|||||||
: getDocParts(join(line, splitByHtmlWhitespace(value)));
|
: getDocParts(join(line, splitByHtmlWhitespace(value)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function isVueScriptTag(node, options) {
|
||||||
|
return isVueSfcBlock(node, options) && node.name === "script";
|
||||||
|
}
|
||||||
|
|
||||||
export {
|
export {
|
||||||
htmlTrim,
|
htmlTrim,
|
||||||
htmlTrimPreserveIndentation,
|
htmlTrimPreserveIndentation,
|
||||||
@@ -654,6 +659,7 @@ export {
|
|||||||
inferScriptParser,
|
inferScriptParser,
|
||||||
isVueCustomBlock,
|
isVueCustomBlock,
|
||||||
isVueNonHtmlBlock,
|
isVueNonHtmlBlock,
|
||||||
|
isVueScriptTag,
|
||||||
isVueSlotAttribute,
|
isVueSlotAttribute,
|
||||||
isVueSfcBindingsAttribute,
|
isVueSfcBindingsAttribute,
|
||||||
isDanglingSpaceSensitiveNode,
|
isDanglingSpaceSensitiveNode,
|
||||||
|
|||||||
@@ -175,15 +175,13 @@ function clean(ast, newObj, parent) {
|
|||||||
// we will not trim the comment value and we will expect exactly one space on
|
// we will not trim the comment value and we will expect exactly one space on
|
||||||
// either side of the GraphQL string
|
// either side of the GraphQL string
|
||||||
// Also see ./embed.js
|
// Also see ./embed.js
|
||||||
const hasLanguageComment =
|
const hasLanguageComment = ast.leadingComments?.some(
|
||||||
ast.leadingComments &&
|
(comment) =>
|
||||||
ast.leadingComments.some(
|
isBlockComment(comment) &&
|
||||||
(comment) =>
|
["GraphQL", "HTML"].some(
|
||||||
isBlockComment(comment) &&
|
(languageName) => comment.value === ` ${languageName} `
|
||||||
["GraphQL", "HTML"].some(
|
)
|
||||||
(languageName) => comment.value === ` ${languageName} `
|
);
|
||||||
)
|
|
||||||
);
|
|
||||||
if (
|
if (
|
||||||
hasLanguageComment ||
|
hasLanguageComment ||
|
||||||
(parent.type === "CallExpression" && parent.callee.name === "graphql") ||
|
(parent.type === "CallExpression" && parent.callee.name === "graphql") ||
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ const languages = [
|
|||||||
since: "1.13.0",
|
since: "1.13.0",
|
||||||
parsers: ["json-stringify"],
|
parsers: ["json-stringify"],
|
||||||
vscodeLanguageIds: ["json"],
|
vscodeLanguageIds: ["json"],
|
||||||
extensions: [], // .json file defaults to json instead of json-stringify
|
extensions: [".importmap"], // .json file defaults to json instead of json-stringify
|
||||||
filenames: ["package.json", "package-lock.json", "composer.json"],
|
filenames: ["package.json", "package-lock.json", "composer.json"],
|
||||||
})),
|
})),
|
||||||
createLanguage(require("linguist-languages/data/JSON.json"), (data) => ({
|
createLanguage(require("linguist-languages/data/JSON.json"), (data) => ({
|
||||||
|
|||||||
@@ -171,6 +171,11 @@ const parseEstree = createParse(
|
|||||||
);
|
);
|
||||||
const parseExpression = createParse("parseExpression", appendPlugins(["jsx"]));
|
const parseExpression = createParse("parseExpression", appendPlugins(["jsx"]));
|
||||||
|
|
||||||
|
const parseTSExpression = createParse(
|
||||||
|
"parseExpression",
|
||||||
|
appendPlugins(["typescript"])
|
||||||
|
);
|
||||||
|
|
||||||
// Error codes are defined in
|
// Error codes are defined in
|
||||||
// - https://github.com/babel/babel/blob/v7.14.0/packages/babel-parser/src/parser/error-message.js
|
// - https://github.com/babel/babel/blob/v7.14.0/packages/babel-parser/src/parser/error-message.js
|
||||||
// - https://github.com/babel/babel/blob/v7.14.0/packages/babel-parser/src/plugins/typescript/index.js#L69-L153
|
// - https://github.com/babel/babel/blob/v7.14.0/packages/babel-parser/src/plugins/typescript/index.js#L69-L153
|
||||||
@@ -229,21 +234,27 @@ const allowedMessageCodes = new Set([
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
const babel = createParser(parse);
|
const babel = createParser(parse);
|
||||||
|
const babelTs = createParser(parseTypeScript);
|
||||||
const babelExpression = createParser(parseExpression);
|
const babelExpression = createParser(parseExpression);
|
||||||
|
const babelTSExpression = createParser(parseTSExpression);
|
||||||
|
|
||||||
// Export as a plugin so we can reuse the same bundle for UMD loading
|
// Export as a plugin so we can reuse the same bundle for UMD loading
|
||||||
const parser = {
|
const parser = {
|
||||||
parsers: {
|
parsers: {
|
||||||
babel,
|
babel,
|
||||||
"babel-flow": createParser(parseFlow),
|
"babel-flow": createParser(parseFlow),
|
||||||
"babel-ts": createParser(parseTypeScript),
|
"babel-ts": babelTs,
|
||||||
...jsonParsers,
|
...jsonParsers,
|
||||||
/** @internal */
|
/** @internal */
|
||||||
__js_expression: babelExpression,
|
__js_expression: babelExpression,
|
||||||
/** for vue filter */
|
/** for vue filter */
|
||||||
__vue_expression: babelExpression,
|
__vue_expression: babelExpression,
|
||||||
|
/** for vue filter written in TS */
|
||||||
|
__vue_ts_expression: babelTSExpression,
|
||||||
/** for vue event binding to handle semicolon */
|
/** for vue event binding to handle semicolon */
|
||||||
__vue_event_binding: babel,
|
__vue_event_binding: babel,
|
||||||
|
/** for vue event binding written in TS to handle semicolon */
|
||||||
|
__vue_ts_event_binding: babelTs,
|
||||||
/** verify that we can print this AST */
|
/** verify that we can print this AST */
|
||||||
__babel_estree: createParser(parseEstree),
|
__babel_estree: createParser(parseEstree),
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -31,9 +31,15 @@ const parsers = {
|
|||||||
get __vue_expression() {
|
get __vue_expression() {
|
||||||
return babel.parsers.__vue_expression;
|
return babel.parsers.__vue_expression;
|
||||||
},
|
},
|
||||||
|
get __vue_ts_expression() {
|
||||||
|
return require("./babel.js").parsers.__vue_ts_expression;
|
||||||
|
},
|
||||||
get __vue_event_binding() {
|
get __vue_event_binding() {
|
||||||
return babel.parsers.__vue_event_binding;
|
return babel.parsers.__vue_event_binding;
|
||||||
},
|
},
|
||||||
|
get __vue_ts_event_binding() {
|
||||||
|
return require("./babel.js").parsers.__vue_ts_event_binding;
|
||||||
|
},
|
||||||
// JS - Flow
|
// JS - Flow
|
||||||
get flow() {
|
get flow() {
|
||||||
return flow.parsers.flow;
|
return flow.parsers.flow;
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ function preprocess(ast, options) {
|
|||||||
case "json-stringify":
|
case "json-stringify":
|
||||||
case "__js_expression":
|
case "__js_expression":
|
||||||
case "__vue_expression":
|
case "__vue_expression":
|
||||||
|
case "__vue_ts_expression":
|
||||||
return {
|
return {
|
||||||
...ast,
|
...ast,
|
||||||
type: options.parser.startsWith("__") ? "JsExpressionRoot" : "JsonRoot",
|
type: options.parser.startsWith("__") ? "JsExpressionRoot" : "JsonRoot",
|
||||||
|
|||||||
@@ -218,7 +218,10 @@ function printPathNoParens(path, options, print, args) {
|
|||||||
return [printDirective(node.expression, options), semi];
|
return [printDirective(node.expression, options), semi];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (options.parser === "__vue_event_binding") {
|
if (
|
||||||
|
options.parser === "__vue_event_binding" ||
|
||||||
|
options.parser === "__vue_ts_event_binding"
|
||||||
|
) {
|
||||||
const parent = path.getParentNode();
|
const parent = path.getParentNode();
|
||||||
if (
|
if (
|
||||||
parent.type === "Program" &&
|
parent.type === "Program" &&
|
||||||
|
|||||||
+95
-130
@@ -53,10 +53,8 @@ function hasFlowShorthandAnnotationComment(node) {
|
|||||||
// Syntax example: const r = new (window.Request /*: Class<Request> */)("");
|
// Syntax example: const r = new (window.Request /*: Class<Request> */)("");
|
||||||
|
|
||||||
return (
|
return (
|
||||||
node.extra &&
|
node.extra?.parenthesized &&
|
||||||
node.extra.parenthesized &&
|
isBlockComment(node.trailingComments?.[0]) &&
|
||||||
isNonEmptyArray(node.trailingComments) &&
|
|
||||||
isBlockComment(node.trailingComments[0]) &&
|
|
||||||
FLOW_SHORTHAND_ANNOTATION.test(node.trailingComments[0].value)
|
FLOW_SHORTHAND_ANNOTATION.test(node.trailingComments[0].value)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -66,10 +64,9 @@ function hasFlowShorthandAnnotationComment(node) {
|
|||||||
* @returns {boolean}
|
* @returns {boolean}
|
||||||
*/
|
*/
|
||||||
function hasFlowAnnotationComment(comments) {
|
function hasFlowAnnotationComment(comments) {
|
||||||
|
const firstComment = comments?.[0];
|
||||||
return (
|
return (
|
||||||
isNonEmptyArray(comments) &&
|
isBlockComment(firstComment) && FLOW_ANNOTATION.test(firstComment.value)
|
||||||
isBlockComment(comments[0]) &&
|
|
||||||
FLOW_ANNOTATION.test(comments[0].value)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -118,12 +115,12 @@ function getLeftSide(node) {
|
|||||||
return node.expressions[0];
|
return node.expressions[0];
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
node.left ||
|
node.left ??
|
||||||
node.test ||
|
node.test ??
|
||||||
node.callee ||
|
node.callee ??
|
||||||
node.object ||
|
node.object ??
|
||||||
node.tag ||
|
node.tag ??
|
||||||
node.argument ||
|
node.argument ??
|
||||||
node.expression
|
node.expression
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -156,37 +153,36 @@ function getLeftSidePathName(path, node) {
|
|||||||
throw new Error("Unexpected node has no left side.");
|
throw new Error("Unexpected node has no left side.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function createTypeCheckFunction(types) {
|
||||||
|
types = new Set(types);
|
||||||
|
return (node) => types.has(node?.type);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {Comment} comment
|
* @param {Comment} comment
|
||||||
* @returns {boolean}
|
* @returns {boolean}
|
||||||
*/
|
*/
|
||||||
function isLineComment(comment) {
|
const isLineComment = createTypeCheckFunction([
|
||||||
return (
|
"Line",
|
||||||
comment.type === "Line" ||
|
"CommentLine",
|
||||||
comment.type === "CommentLine" ||
|
// `meriyah` has `SingleLine`, `HashbangComment`, `HTMLOpen`, and `HTMLClose`
|
||||||
// `meriyah` has `SingleLine`, `HashbangComment`, `HTMLOpen`, and `HTMLClose`
|
"SingleLine",
|
||||||
comment.type === "SingleLine" ||
|
"HashbangComment",
|
||||||
comment.type === "HashbangComment" ||
|
"HTMLOpen",
|
||||||
comment.type === "HTMLOpen" ||
|
"HTMLClose",
|
||||||
comment.type === "HTMLClose"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
const exportDeclarationTypes = new Set([
|
|
||||||
"ExportDefaultDeclaration",
|
|
||||||
"ExportDefaultSpecifier",
|
|
||||||
"DeclareExportDeclaration",
|
|
||||||
"ExportNamedDeclaration",
|
|
||||||
"ExportAllDeclaration",
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {Node} node
|
* @param {Node} node
|
||||||
* @returns {boolean}
|
* @returns {boolean}
|
||||||
*/
|
*/
|
||||||
function isExportDeclaration(node) {
|
const isExportDeclaration = createTypeCheckFunction([
|
||||||
return node && exportDeclarationTypes.has(node.type);
|
"ExportDefaultDeclaration",
|
||||||
}
|
"ExportDefaultSpecifier",
|
||||||
|
"DeclareExportDeclaration",
|
||||||
|
"ExportNamedDeclaration",
|
||||||
|
"ExportAllDeclaration",
|
||||||
|
]);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {AstPath} path
|
* @param {AstPath} path
|
||||||
@@ -205,22 +201,20 @@ function getParentExportDeclaration(path) {
|
|||||||
* @param {Node} node
|
* @param {Node} node
|
||||||
* @returns {boolean}
|
* @returns {boolean}
|
||||||
*/
|
*/
|
||||||
function isLiteral(node) {
|
const isLiteral = createTypeCheckFunction([
|
||||||
return (
|
"BooleanLiteral",
|
||||||
node.type === "BooleanLiteral" ||
|
"DirectiveLiteral",
|
||||||
node.type === "DirectiveLiteral" ||
|
"Literal",
|
||||||
node.type === "Literal" ||
|
"NullLiteral",
|
||||||
node.type === "NullLiteral" ||
|
"NumericLiteral",
|
||||||
node.type === "NumericLiteral" ||
|
"BigIntLiteral",
|
||||||
node.type === "BigIntLiteral" ||
|
"DecimalLiteral",
|
||||||
node.type === "DecimalLiteral" ||
|
"RegExpLiteral",
|
||||||
node.type === "RegExpLiteral" ||
|
"StringLiteral",
|
||||||
node.type === "StringLiteral" ||
|
"TemplateLiteral",
|
||||||
node.type === "TemplateLiteral" ||
|
"TSTypeLiteral",
|
||||||
node.type === "TSTypeLiteral" ||
|
"JSXText",
|
||||||
node.type === "JSXText"
|
]);
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {Node} node
|
* @param {Node} node
|
||||||
@@ -256,24 +250,20 @@ function isStringLiteral(node) {
|
|||||||
* @param {Node} node
|
* @param {Node} node
|
||||||
* @returns {boolean}
|
* @returns {boolean}
|
||||||
*/
|
*/
|
||||||
function isObjectType(node) {
|
const isObjectType = createTypeCheckFunction([
|
||||||
return (
|
"ObjectTypeAnnotation",
|
||||||
node.type === "ObjectTypeAnnotation" ||
|
"TSTypeLiteral",
|
||||||
node.type === "TSTypeLiteral" ||
|
"TSMappedType",
|
||||||
node.type === "TSMappedType"
|
]);
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {Node} node
|
* @param {Node} node
|
||||||
* @returns {boolean}
|
* @returns {boolean}
|
||||||
*/
|
*/
|
||||||
function isFunctionOrArrowExpression(node) {
|
const isFunctionOrArrowExpression = createTypeCheckFunction([
|
||||||
return (
|
"FunctionExpression",
|
||||||
node.type === "FunctionExpression" ||
|
"ArrowFunctionExpression",
|
||||||
node.type === "ArrowFunctionExpression"
|
]);
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {Node} node
|
* @param {Node} node
|
||||||
@@ -287,14 +277,6 @@ function isFunctionOrArrowExpressionWithBody(node) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {Node} node
|
|
||||||
* @returns {boolean}
|
|
||||||
*/
|
|
||||||
function isTemplateLiteral(node) {
|
|
||||||
return node.type === "TemplateLiteral";
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Note: `inject` is used in AngularJS 1.x, `async` and `fakeAsync` in
|
* Note: `inject` is used in AngularJS 1.x, `async` and `fakeAsync` in
|
||||||
* Angular 2+, although `async` is deprecated and replaced by `waitForAsync`
|
* Angular 2+, although `async` is deprecated and replaced by `waitForAsync`
|
||||||
@@ -317,9 +299,7 @@ function isAngularTestWrapper(node) {
|
|||||||
* @param {Node} node
|
* @param {Node} node
|
||||||
* @returns {boolean}
|
* @returns {boolean}
|
||||||
*/
|
*/
|
||||||
function isJsxNode(node) {
|
const isJsxNode = createTypeCheckFunction(["JSXElement", "JSXFragment"]);
|
||||||
return node.type === "JSXElement" || node.type === "JSXFragment";
|
|
||||||
}
|
|
||||||
|
|
||||||
function isTheOnlyJsxElementInMarkdown(options, path) {
|
function isTheOnlyJsxElementInMarkdown(options, path) {
|
||||||
if (options.parentParser !== "markdown" && options.parentParser !== "mdx") {
|
if (options.parentParser !== "markdown" && options.parentParser !== "mdx") {
|
||||||
@@ -376,19 +356,15 @@ function isTypeAnnotationAFunction(node) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const binaryishNodeTypes = new Set([
|
|
||||||
"BinaryExpression",
|
|
||||||
"LogicalExpression",
|
|
||||||
"NGPipeExpression",
|
|
||||||
]);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {Node} node
|
* @param {Node} node
|
||||||
* @returns {boolean}
|
* @returns {boolean}
|
||||||
*/
|
*/
|
||||||
function isBinaryish(node) {
|
const isBinaryish = createTypeCheckFunction([
|
||||||
return binaryishNodeTypes.has(node.type);
|
"BinaryExpression",
|
||||||
}
|
"LogicalExpression",
|
||||||
|
"NGPipeExpression",
|
||||||
|
]);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {Node} node
|
* @param {Node} node
|
||||||
@@ -517,7 +493,7 @@ function isTestCall(node, parent) {
|
|||||||
((node.callee.type === "Identifier" &&
|
((node.callee.type === "Identifier" &&
|
||||||
unitTestRe.test(node.callee.name)) ||
|
unitTestRe.test(node.callee.name)) ||
|
||||||
isSkipOrOnlyBlock(node)) &&
|
isSkipOrOnlyBlock(node)) &&
|
||||||
(isTemplateLiteral(node.arguments[0]) ||
|
(node.arguments[0].type === "TemplateLiteral" ||
|
||||||
isStringLiteral(node.arguments[0]))
|
isStringLiteral(node.arguments[0]))
|
||||||
) {
|
) {
|
||||||
// it("name", () => { ... }, 2500)
|
// it("name", () => { ... }, 2500)
|
||||||
@@ -540,24 +516,19 @@ function isTestCall(node, parent) {
|
|||||||
* @param {Node} node
|
* @param {Node} node
|
||||||
* @returns {boolean}
|
* @returns {boolean}
|
||||||
*/
|
*/
|
||||||
function isCallExpression(node) {
|
const isCallExpression = createTypeCheckFunction([
|
||||||
return (
|
"CallExpression",
|
||||||
node &&
|
"OptionalCallExpression",
|
||||||
(node.type === "CallExpression" || node.type === "OptionalCallExpression")
|
]);
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {Node} node
|
* @param {Node} node
|
||||||
* @returns {boolean}
|
* @returns {boolean}
|
||||||
*/
|
*/
|
||||||
function isMemberExpression(node) {
|
const isMemberExpression = createTypeCheckFunction([
|
||||||
return (
|
"MemberExpression",
|
||||||
node &&
|
"OptionalMemberExpression",
|
||||||
(node.type === "MemberExpression" ||
|
]);
|
||||||
node.type === "OptionalMemberExpression")
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -621,12 +592,8 @@ function isSimpleTemplateLiteral(node) {
|
|||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
function getTypeScriptMappedTypeModifier(tokenNode, keyword) {
|
function getTypeScriptMappedTypeModifier(tokenNode, keyword) {
|
||||||
if (tokenNode === "+") {
|
if (tokenNode === "+" || tokenNode === "-") {
|
||||||
return "+" + keyword;
|
return tokenNode + keyword;
|
||||||
}
|
|
||||||
|
|
||||||
if (tokenNode === "-") {
|
|
||||||
return "-" + keyword;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return keyword;
|
return keyword;
|
||||||
@@ -919,7 +886,7 @@ function isSimpleCallArgument(node, depth) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function rawText(node) {
|
function rawText(node) {
|
||||||
return node.extra ? node.extra.raw : node.raw;
|
return node.extra?.raw ?? node.raw;
|
||||||
}
|
}
|
||||||
|
|
||||||
function identity(x) {
|
function identity(x) {
|
||||||
@@ -1072,29 +1039,27 @@ function shouldFlatten(parentOp, nodeOp) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
const PRECEDENCE = {};
|
const PRECEDENCE = new Map(
|
||||||
for (const [i, tier] of [
|
[
|
||||||
["|>"],
|
["|>"],
|
||||||
["??"],
|
["??"],
|
||||||
["||"],
|
["||"],
|
||||||
["&&"],
|
["&&"],
|
||||||
["|"],
|
["|"],
|
||||||
["^"],
|
["^"],
|
||||||
["&"],
|
["&"],
|
||||||
["==", "===", "!=", "!=="],
|
["==", "===", "!=", "!=="],
|
||||||
["<", ">", "<=", ">=", "in", "instanceof"],
|
["<", ">", "<=", ">=", "in", "instanceof"],
|
||||||
[">>", "<<", ">>>"],
|
[">>", "<<", ">>>"],
|
||||||
["+", "-"],
|
["+", "-"],
|
||||||
["*", "/", "%"],
|
["*", "/", "%"],
|
||||||
["**"],
|
["**"],
|
||||||
].entries()) {
|
].flatMap((operators, index) =>
|
||||||
for (const op of tier) {
|
operators.map((operator) => [operator, index])
|
||||||
PRECEDENCE[op] = i;
|
)
|
||||||
}
|
);
|
||||||
}
|
function getPrecedence(operator) {
|
||||||
|
return PRECEDENCE.get(operator);
|
||||||
function getPrecedence(op) {
|
|
||||||
return PRECEDENCE[op];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getLeftMost(node) {
|
function getLeftMost(node) {
|
||||||
@@ -1118,7 +1083,7 @@ function hasRestParameter(node) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
const parameters = getFunctionParameters(node);
|
const parameters = getFunctionParameters(node);
|
||||||
return parameters.length > 0 && getLast(parameters).type === "RestElement";
|
return getLast(parameters)?.type === "RestElement";
|
||||||
}
|
}
|
||||||
|
|
||||||
const functionParametersCache = new WeakMap();
|
const functionParametersCache = new WeakMap();
|
||||||
@@ -1256,7 +1221,7 @@ const getCommentTestFunction = (flags, fn) => {
|
|||||||
* @returns {boolean}
|
* @returns {boolean}
|
||||||
*/
|
*/
|
||||||
function hasComment(node, flags, fn) {
|
function hasComment(node, flags, fn) {
|
||||||
if (!node || !isNonEmptyArray(node.comments)) {
|
if (!isNonEmptyArray(node?.comments)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
const test = getCommentTestFunction(flags, fn);
|
const test = getCommentTestFunction(flags, fn);
|
||||||
@@ -1270,7 +1235,7 @@ function hasComment(node, flags, fn) {
|
|||||||
* @returns {Comment[]}
|
* @returns {Comment[]}
|
||||||
*/
|
*/
|
||||||
function getComments(node, flags, fn) {
|
function getComments(node, flags, fn) {
|
||||||
if (!node || !Array.isArray(node.comments)) {
|
if (!Array.isArray(node?.comments)) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
const test = getCommentTestFunction(flags, fn);
|
const test = getCommentTestFunction(flags, fn);
|
||||||
|
|||||||
@@ -2,17 +2,16 @@
|
|||||||
* @typedef {import("../types/estree").Comment} Comment
|
* @typedef {import("../types/estree").Comment} Comment
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
const BLOCK_COMMENT_TYPES = new Set([
|
||||||
|
"Block",
|
||||||
|
"CommentBlock",
|
||||||
|
// `meriyah`
|
||||||
|
"MultiLine",
|
||||||
|
]);
|
||||||
/**
|
/**
|
||||||
* @param {Comment} comment
|
* @param {Comment} comment
|
||||||
* @returns {boolean}
|
* @returns {boolean}
|
||||||
*/
|
*/
|
||||||
function isBlockComment(comment) {
|
const isBlockComment = (comment) => BLOCK_COMMENT_TYPES.has(comment?.type);
|
||||||
return (
|
|
||||||
comment.type === "Block" ||
|
|
||||||
comment.type === "CommentBlock" ||
|
|
||||||
// `meriyah`
|
|
||||||
comment.type === "MultiLine"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
export default isBlockComment;
|
export default isBlockComment;
|
||||||
@@ -13,7 +13,7 @@ function startWithPragma(text) {
|
|||||||
"m"
|
"m"
|
||||||
);
|
);
|
||||||
const matched = text.match(regex);
|
const matched = text.match(regex);
|
||||||
return matched && matched.index === 0;
|
return matched?.index === 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
const hasPragma = (text) =>
|
const hasPragma = (text) =>
|
||||||
|
|||||||
@@ -782,7 +782,7 @@ function isPrettierIgnore(node) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return match ? (match[1] ? match[1] : "next") : false;
|
return match ? match[1] || "next" : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function shouldPrePrintHardline(node, data) {
|
function shouldPrePrintHardline(node, data) {
|
||||||
@@ -804,21 +804,19 @@ function shouldPrePrintDoubleHardline(node, data) {
|
|||||||
data.parentNode.type === "listItem" && !data.parentNode.loose;
|
data.parentNode.type === "listItem" && !data.parentNode.loose;
|
||||||
|
|
||||||
const isPrevNodeLooseListItem =
|
const isPrevNodeLooseListItem =
|
||||||
data.prevNode && data.prevNode.type === "listItem" && data.prevNode.loose;
|
data.prevNode?.type === "listItem" && data.prevNode.loose;
|
||||||
|
|
||||||
const isPrevNodePrettierIgnore = isPrettierIgnore(data.prevNode) === "next";
|
const isPrevNodePrettierIgnore = isPrettierIgnore(data.prevNode) === "next";
|
||||||
|
|
||||||
const isBlockHtmlWithoutBlankLineBetweenPrevHtml =
|
const isBlockHtmlWithoutBlankLineBetweenPrevHtml =
|
||||||
node.type === "html" &&
|
node.type === "html" &&
|
||||||
data.prevNode &&
|
data.prevNode?.type === "html" &&
|
||||||
data.prevNode.type === "html" &&
|
|
||||||
data.prevNode.position.end.line + 1 === node.position.start.line;
|
data.prevNode.position.end.line + 1 === node.position.start.line;
|
||||||
|
|
||||||
const isHtmlDirectAfterListItem =
|
const isHtmlDirectAfterListItem =
|
||||||
node.type === "html" &&
|
node.type === "html" &&
|
||||||
data.parentNode.type === "listItem" &&
|
data.parentNode.type === "listItem" &&
|
||||||
data.prevNode &&
|
data.prevNode?.type === "paragraph" &&
|
||||||
data.prevNode.type === "paragraph" &&
|
|
||||||
data.prevNode.position.end.line + 1 === node.position.start.line;
|
data.prevNode.position.end.line + 1 === node.position.start.line;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -219,15 +219,11 @@ function mapAst(ast, handler) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function isAutolink(node) {
|
function isAutolink(node) {
|
||||||
if (!node || node.type !== "link" || node.children.length !== 1) {
|
if (node?.type !== "link" || node.children.length !== 1) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
const child = node.children[0];
|
const [child] = node.children;
|
||||||
return (
|
return locStart(node) === locStart(child) && locEnd(node) === locEnd(child);
|
||||||
child &&
|
|
||||||
locStart(node) === locStart(child) &&
|
|
||||||
locEnd(node) === locEnd(child)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export {
|
export {
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ function parse(text) {
|
|||||||
|
|
||||||
return root;
|
return root;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (error && error.position) {
|
if (error?.position) {
|
||||||
throw createError(error.message, error.position);
|
throw createError(error.message, error.position);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -329,7 +329,7 @@ function printNode(node, parentNode, path, options, print) {
|
|||||||
case "sequence":
|
case "sequence":
|
||||||
return join(hardline, path.map(print, "children"));
|
return join(hardline, path.map(print, "children"));
|
||||||
case "sequenceItem":
|
case "sequenceItem":
|
||||||
return ["- ", alignWithSpaces(2, !node.content ? "" : print("content"))];
|
return ["- ", alignWithSpaces(2, node.content ? print("content") : "")];
|
||||||
case "mappingKey":
|
case "mappingKey":
|
||||||
case "mappingValue":
|
case "mappingValue":
|
||||||
return !node.content ? "" : print("content");
|
return !node.content ? "" : print("content");
|
||||||
|
|||||||
@@ -136,23 +136,23 @@ function hasComments(node) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function hasLeadingComments(node) {
|
function hasLeadingComments(node) {
|
||||||
return node && isNonEmptyArray(node.leadingComments);
|
return isNonEmptyArray(node?.leadingComments);
|
||||||
}
|
}
|
||||||
|
|
||||||
function hasMiddleComments(node) {
|
function hasMiddleComments(node) {
|
||||||
return node && isNonEmptyArray(node.middleComments);
|
return isNonEmptyArray(node?.middleComments);
|
||||||
}
|
}
|
||||||
|
|
||||||
function hasIndicatorComment(node) {
|
function hasIndicatorComment(node) {
|
||||||
return node && node.indicatorComment;
|
return node?.indicatorComment;
|
||||||
}
|
}
|
||||||
|
|
||||||
function hasTrailingComment(node) {
|
function hasTrailingComment(node) {
|
||||||
return node && node.trailingComment;
|
return node?.trailingComment;
|
||||||
}
|
}
|
||||||
|
|
||||||
function hasEndComments(node) {
|
function hasEndComments(node) {
|
||||||
return node && isNonEmptyArray(node.endComments);
|
return isNonEmptyArray(node?.endComments);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -200,7 +200,8 @@ function attach(comments, ast, text, options) {
|
|||||||
options.parser === "json" ||
|
options.parser === "json" ||
|
||||||
options.parser === "json5" ||
|
options.parser === "json5" ||
|
||||||
options.parser === "__js_expression" ||
|
options.parser === "__js_expression" ||
|
||||||
options.parser === "__vue_expression"
|
options.parser === "__vue_expression" ||
|
||||||
|
options.parser === "__vue_ts_expression"
|
||||||
) {
|
) {
|
||||||
if (locStart(comment) - locStart(ast) <= 0) {
|
if (locStart(comment) - locStart(ast) <= 0) {
|
||||||
addLeadingComment(ast, comment);
|
addLeadingComment(ast, comment);
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ const CATEGORY_SPECIAL = "Special";
|
|||||||
* @typedef {Object} OptionInfo
|
* @typedef {Object} OptionInfo
|
||||||
* @property {string} [since] - available since version
|
* @property {string} [since] - available since version
|
||||||
* @property {string} category
|
* @property {string} category
|
||||||
* @property {'int' | 'boolean' | 'choice' | 'path'} type
|
* @property {'int' | 'boolean' | 'choice' | 'path' | 'string' | 'flag'} type
|
||||||
* @property {boolean} [array] - indicate it's an array of the specified type
|
* @property {boolean} [array] - indicate it's an array of the specified type
|
||||||
* @property {OptionValueInfo} [default]
|
* @property {OptionValueInfo} [default]
|
||||||
* @property {OptionRangeInfo} [range] - for type int
|
* @property {OptionRangeInfo} [range] - for type int
|
||||||
|
|||||||
@@ -50,7 +50,9 @@ function textToDoc(
|
|||||||
const astComments = ast.comments;
|
const astComments = ast.comments;
|
||||||
delete ast.comments;
|
delete ast.comments;
|
||||||
attach(astComments, ast, text, nextOptions);
|
attach(astComments, ast, text, nextOptions);
|
||||||
|
// @ts-expect-error -- Casting to `unique symbol` isn't allowed in JSDoc comment
|
||||||
nextOptions[Symbol.for("comments")] = astComments || [];
|
nextOptions[Symbol.for("comments")] = astComments || [];
|
||||||
|
// @ts-expect-error -- Casting to `unique symbol` isn't allowed in JSDoc comment
|
||||||
nextOptions[Symbol.for("tokens")] = ast.tokens || [];
|
nextOptions[Symbol.for("tokens")] = ast.tokens || [];
|
||||||
|
|
||||||
const doc = printAstToDoc(ast, nextOptions);
|
const doc = printAstToDoc(ast, nextOptions);
|
||||||
|
|||||||
@@ -1,6 +1,10 @@
|
|||||||
import vnopts from "vnopts";
|
import vnopts from "vnopts";
|
||||||
import getLast from "../utils/get-last.js";
|
import getLast from "../utils/get-last.js";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @typedef {import("./support").NamedOptionInfo} NamedOptionInfo
|
||||||
|
*/
|
||||||
|
|
||||||
const cliDescriptor = {
|
const cliDescriptor = {
|
||||||
key: (key) => (key.length === 1 ? `-${key}` : `--${key}`),
|
key: (key) => (key.length === 1 ? `-${key}` : `--${key}`),
|
||||||
value: (value) => vnopts.apiDescriptor.value(value),
|
value: (value) => vnopts.apiDescriptor.value(value),
|
||||||
@@ -53,15 +57,20 @@ const getFlagSchema = ({ colorsModule, levenshteinDistance }) =>
|
|||||||
|
|
||||||
let hasDeprecationWarned;
|
let hasDeprecationWarned;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {*} options
|
||||||
|
* @param {*} optionInfos
|
||||||
|
* @param {{ logger?: false; isCLI?: boolean; passThrough?: boolean; colorsModule?: any; levenshteinDistance?: any }} param2
|
||||||
|
*/
|
||||||
function normalizeOptions(
|
function normalizeOptions(
|
||||||
options,
|
options,
|
||||||
optionInfos,
|
optionInfos,
|
||||||
{
|
{
|
||||||
logger,
|
logger = false,
|
||||||
isCLI = false,
|
isCLI = false,
|
||||||
passThrough = false,
|
passThrough = false,
|
||||||
colorsModule,
|
colorsModule = null,
|
||||||
levenshteinDistance,
|
levenshteinDistance = null,
|
||||||
} = {}
|
} = {}
|
||||||
) {
|
) {
|
||||||
const unknown = !passThrough
|
const unknown = !passThrough
|
||||||
@@ -93,12 +102,14 @@ function normalizeOptions(
|
|||||||
const shouldSuppressDuplicateDeprecationWarnings = logger !== false;
|
const shouldSuppressDuplicateDeprecationWarnings = logger !== false;
|
||||||
|
|
||||||
if (shouldSuppressDuplicateDeprecationWarnings && hasDeprecationWarned) {
|
if (shouldSuppressDuplicateDeprecationWarnings && hasDeprecationWarned) {
|
||||||
|
// @ts-expect-error
|
||||||
normalizer._hasDeprecationWarned = hasDeprecationWarned;
|
normalizer._hasDeprecationWarned = hasDeprecationWarned;
|
||||||
}
|
}
|
||||||
|
|
||||||
const normalized = normalizer.normalize(options);
|
const normalized = normalizer.normalize(options);
|
||||||
|
|
||||||
if (shouldSuppressDuplicateDeprecationWarnings) {
|
if (shouldSuppressDuplicateDeprecationWarnings) {
|
||||||
|
// @ts-expect-error
|
||||||
hasDeprecationWarned = normalizer._hasDeprecationWarned;
|
hasDeprecationWarned = normalizer._hasDeprecationWarned;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -132,6 +143,7 @@ function optionInfosToSchemas(
|
|||||||
if (optionInfo.alias && isCLI) {
|
if (optionInfo.alias && isCLI) {
|
||||||
schemas.push(
|
schemas.push(
|
||||||
vnopts.AliasSchema.create({
|
vnopts.AliasSchema.create({
|
||||||
|
// @ts-expect-error
|
||||||
name: optionInfo.alias,
|
name: optionInfo.alias,
|
||||||
sourceName: optionInfo.name,
|
sourceName: optionInfo.name,
|
||||||
})
|
})
|
||||||
@@ -142,6 +154,11 @@ function optionInfosToSchemas(
|
|||||||
return schemas;
|
return schemas;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {NamedOptionInfo} optionInfo
|
||||||
|
* @param {any} param1
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
function optionInfoToSchema(
|
function optionInfoToSchema(
|
||||||
optionInfo,
|
optionInfo,
|
||||||
{ isCLI, optionInfos, colorsModule, levenshteinDistance }
|
{ isCLI, optionInfos, colorsModule, levenshteinDistance }
|
||||||
@@ -150,6 +167,7 @@ function optionInfoToSchema(
|
|||||||
|
|
||||||
if (name === "plugin-search-dir" || name === "pluginSearchDirs") {
|
if (name === "plugin-search-dir" || name === "pluginSearchDirs") {
|
||||||
return vnopts.AnySchema.create({
|
return vnopts.AnySchema.create({
|
||||||
|
// @ts-expect-error
|
||||||
name,
|
name,
|
||||||
preprocess(value) {
|
preprocess(value) {
|
||||||
if (value === false) {
|
if (value === false) {
|
||||||
@@ -158,6 +176,9 @@ function optionInfoToSchema(
|
|||||||
value = Array.isArray(value) ? value : [value];
|
value = Array.isArray(value) ? value : [value];
|
||||||
return value;
|
return value;
|
||||||
},
|
},
|
||||||
|
/**
|
||||||
|
* @param {Array<unknown> | false} value
|
||||||
|
*/
|
||||||
validate(value) {
|
validate(value) {
|
||||||
if (value === false) {
|
if (value === false) {
|
||||||
return true;
|
return true;
|
||||||
@@ -258,6 +279,7 @@ function optionInfoToSchema(
|
|||||||
? vnopts.ArraySchema.create({
|
? vnopts.ArraySchema.create({
|
||||||
...(isCLI ? { preprocess: (v) => (Array.isArray(v) ? v : [v]) } : {}),
|
...(isCLI ? { preprocess: (v) => (Array.isArray(v) ? v : [v]) } : {}),
|
||||||
...handlers,
|
...handlers,
|
||||||
|
// @ts-expect-error
|
||||||
valueSchema: SchemaConstructor.create(parameters),
|
valueSchema: SchemaConstructor.create(parameters),
|
||||||
})
|
})
|
||||||
: SchemaConstructor.create({ ...parameters, ...handlers });
|
: SchemaConstructor.create({ ...parameters, ...handlers });
|
||||||
|
|||||||
@@ -9,6 +9,11 @@ const require = createRequire(import.meta.url);
|
|||||||
|
|
||||||
const currentVersion = require("../../package.json").version;
|
const currentVersion = require("../../package.json").version;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @typedef {import("./core-options").OptionInfo} OptionInfo
|
||||||
|
* @typedef {{ name: string; pluginDefaults: Array<any> } & OptionInfo} NamedOptionInfo
|
||||||
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Strings in `plugins` and `pluginSearchDirs` are handled by a wrapped version
|
* Strings in `plugins` and `pluginSearchDirs` are handled by a wrapped version
|
||||||
* of this function created by `withPlugins`. Don't pass them here directly.
|
* of this function created by `withPlugins`. Don't pass them here directly.
|
||||||
@@ -18,6 +23,7 @@ const currentVersion = require("../../package.json").version;
|
|||||||
* @param {boolean=} param0.showUnreleased
|
* @param {boolean=} param0.showUnreleased
|
||||||
* @param {boolean=} param0.showDeprecated
|
* @param {boolean=} param0.showDeprecated
|
||||||
* @param {boolean=} param0.showInternal
|
* @param {boolean=} param0.showInternal
|
||||||
|
* @return {{ languages: Array<any>, options: Array<NamedOptionInfo> }}
|
||||||
*/
|
*/
|
||||||
function getSupportInfo({
|
function getSupportInfo({
|
||||||
plugins = [],
|
plugins = [],
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @template Element
|
||||||
|
* @param {Array<Element>} array
|
||||||
|
* @param {(value: Element) => boolean} predicate
|
||||||
|
* @returns {[Array<Element>, Array<Element>]}
|
||||||
|
*/
|
||||||
|
function partition(array, predicate) {
|
||||||
|
/** @type {[Array<Element>, Array<Element>]} */
|
||||||
|
const result = [[], []];
|
||||||
|
|
||||||
|
for (const value of array) {
|
||||||
|
result[predicate(value) ? 0 : 1].push(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = partition;
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @template {object} Element
|
||||||
|
* @param {Array<Element>} array
|
||||||
|
* @param {string | number | symbol} key
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
function uniqByKey(array, key) {
|
||||||
|
const result = [];
|
||||||
|
const seen = new Set();
|
||||||
|
|
||||||
|
for (const element of array) {
|
||||||
|
const value = element[key];
|
||||||
|
if (!seen.has(value)) {
|
||||||
|
seen.add(value);
|
||||||
|
result.push(element);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = uniqByKey;
|
||||||
@@ -1,5 +1,82 @@
|
|||||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||||
|
|
||||||
|
exports[`description.graphql format 1`] = `
|
||||||
|
====================================options=====================================
|
||||||
|
parsers: ["graphql"]
|
||||||
|
printWidth: 80
|
||||||
|
| printWidth
|
||||||
|
=====================================input======================================
|
||||||
|
""" Customer """
|
||||||
|
type Person {name: String}
|
||||||
|
|
||||||
|
""" Customer """
|
||||||
|
type Person {name: String}
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
Customer
|
||||||
|
|
||||||
|
|
||||||
|
"""
|
||||||
|
type Person {name: String}
|
||||||
|
|
||||||
|
""""""
|
||||||
|
type Person {name: String}
|
||||||
|
|
||||||
|
""" """
|
||||||
|
type Person {name: String}
|
||||||
|
|
||||||
|
"""
|
||||||
|
1
|
||||||
|
2
|
||||||
|
"""
|
||||||
|
type Person {name: String}
|
||||||
|
|
||||||
|
=====================================output=====================================
|
||||||
|
"""
|
||||||
|
Customer
|
||||||
|
"""
|
||||||
|
type Person {
|
||||||
|
name: String
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
Customer
|
||||||
|
"""
|
||||||
|
type Person {
|
||||||
|
name: String
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
Customer
|
||||||
|
"""
|
||||||
|
type Person {
|
||||||
|
name: String
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
"""
|
||||||
|
type Person {
|
||||||
|
name: String
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
"""
|
||||||
|
type Person {
|
||||||
|
name: String
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
1
|
||||||
|
2
|
||||||
|
"""
|
||||||
|
type Person {
|
||||||
|
name: String
|
||||||
|
}
|
||||||
|
|
||||||
|
================================================================================
|
||||||
|
`;
|
||||||
|
|
||||||
exports[`string.graphql format 1`] = `
|
exports[`string.graphql format 1`] = `
|
||||||
====================================options=====================================
|
====================================options=====================================
|
||||||
parsers: ["graphql"]
|
parsers: ["graphql"]
|
||||||
@@ -59,6 +136,14 @@ one: string
|
|||||||
foo(input: {multiline: "ab\\ncd"}) { id }
|
foo(input: {multiline: "ab\\ncd"}) { id }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
foo(input: {multiline: """ foo """}) { id }
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
foo(input: {multiline: """ """}) { id }
|
||||||
|
}
|
||||||
|
|
||||||
=====================================output=====================================
|
=====================================output=====================================
|
||||||
query X($a: Int) @relay(meta: "{\\"lowPri\\": true}") {
|
query X($a: Int) @relay(meta: "{\\"lowPri\\": true}") {
|
||||||
a
|
a
|
||||||
@@ -129,5 +214,28 @@ input Input {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
foo(
|
||||||
|
input: {
|
||||||
|
multiline: """
|
||||||
|
foo
|
||||||
|
"""
|
||||||
|
}
|
||||||
|
) {
|
||||||
|
id
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
foo(
|
||||||
|
input: {
|
||||||
|
multiline: """
|
||||||
|
"""
|
||||||
|
}
|
||||||
|
) {
|
||||||
|
id
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
`;
|
`;
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
""" Customer """
|
||||||
|
type Person {name: String}
|
||||||
|
|
||||||
|
""" Customer """
|
||||||
|
type Person {name: String}
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
Customer
|
||||||
|
|
||||||
|
|
||||||
|
"""
|
||||||
|
type Person {name: String}
|
||||||
|
|
||||||
|
""""""
|
||||||
|
type Person {name: String}
|
||||||
|
|
||||||
|
""" """
|
||||||
|
type Person {name: String}
|
||||||
|
|
||||||
|
"""
|
||||||
|
1
|
||||||
|
2
|
||||||
|
"""
|
||||||
|
type Person {name: String}
|
||||||
@@ -50,3 +50,11 @@ one: string
|
|||||||
{
|
{
|
||||||
foo(input: {multiline: "ab\ncd"}) { id }
|
foo(input: {multiline: "ab\ncd"}) { id }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
foo(input: {multiline: """ foo """}) { id }
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
foo(input: {multiline: """ """}) { id }
|
||||||
|
}
|
||||||
@@ -1017,9 +1017,9 @@ exports[`function-sent.js [acorn] format 1`] = `
|
|||||||
"Unexpected token (4:33)
|
"Unexpected token (4:33)
|
||||||
2 |
|
2 |
|
||||||
3 | function* generator() {
|
3 | function* generator() {
|
||||||
> 4 | console.log(\\"Sent\\", function.sent);
|
> 4 | console.log("Sent", function.sent);
|
||||||
| ^
|
| ^
|
||||||
5 | console.log(\\"Yield\\", yield);
|
5 | console.log("Yield", yield);
|
||||||
6 | }
|
6 | }
|
||||||
7 |"
|
7 |"
|
||||||
`;
|
`;
|
||||||
@@ -1028,9 +1028,9 @@ exports[`function-sent.js [espree] format 1`] = `
|
|||||||
"Unexpected token . (4:33)
|
"Unexpected token . (4:33)
|
||||||
2 |
|
2 |
|
||||||
3 | function* generator() {
|
3 | function* generator() {
|
||||||
> 4 | console.log(\\"Sent\\", function.sent);
|
> 4 | console.log("Sent", function.sent);
|
||||||
| ^
|
| ^
|
||||||
5 | console.log(\\"Yield\\", yield);
|
5 | console.log("Yield", yield);
|
||||||
6 | }
|
6 | }
|
||||||
7 |"
|
7 |"
|
||||||
`;
|
`;
|
||||||
@@ -1039,9 +1039,9 @@ exports[`function-sent.js [meriyah] format 1`] = `
|
|||||||
"Expected '(' (4:33)
|
"Expected '(' (4:33)
|
||||||
2 |
|
2 |
|
||||||
3 | function* generator() {
|
3 | function* generator() {
|
||||||
> 4 | console.log(\\"Sent\\", function.sent);
|
> 4 | console.log("Sent", function.sent);
|
||||||
| ^
|
| ^
|
||||||
5 | console.log(\\"Yield\\", yield);
|
5 | console.log("Yield", yield);
|
||||||
6 | }
|
6 | }
|
||||||
7 |"
|
7 |"
|
||||||
`;
|
`;
|
||||||
@@ -1080,21 +1080,21 @@ iterator.next(2); // Logs "Yield 2"
|
|||||||
|
|
||||||
exports[`import-assertions-dynamic.js [acorn] format 1`] = `
|
exports[`import-assertions-dynamic.js [acorn] format 1`] = `
|
||||||
"Unexpected token (1:20)
|
"Unexpected token (1:20)
|
||||||
> 1 | import(\\"./foo.json\\", { assert: { type: \\"json\\" } });
|
> 1 | import("./foo.json", { assert: { type: "json" } });
|
||||||
| ^
|
| ^
|
||||||
2 |"
|
2 |"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`import-assertions-dynamic.js [espree] format 1`] = `
|
exports[`import-assertions-dynamic.js [espree] format 1`] = `
|
||||||
"Unexpected token , (1:20)
|
"Unexpected token , (1:20)
|
||||||
> 1 | import(\\"./foo.json\\", { assert: { type: \\"json\\" } });
|
> 1 | import("./foo.json", { assert: { type: "json" } });
|
||||||
| ^
|
| ^
|
||||||
2 |"
|
2 |"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`import-assertions-dynamic.js [meriyah] format 1`] = `
|
exports[`import-assertions-dynamic.js [meriyah] format 1`] = `
|
||||||
"Expected ')' (1:20)
|
"Expected ')' (1:20)
|
||||||
> 1 | import(\\"./foo.json\\", { assert: { type: \\"json\\" } });
|
> 1 | import("./foo.json", { assert: { type: "json" } });
|
||||||
| ^
|
| ^
|
||||||
2 |"
|
2 |"
|
||||||
`;
|
`;
|
||||||
@@ -1115,21 +1115,21 @@ import("./foo.json", { assert: { type: "json" } });
|
|||||||
|
|
||||||
exports[`import-assertions-static.js [acorn] format 1`] = `
|
exports[`import-assertions-static.js [acorn] format 1`] = `
|
||||||
"Unexpected token (1:31)
|
"Unexpected token (1:31)
|
||||||
> 1 | import json from \\"./foo.json\\" assert { type: \\"json\\" };
|
> 1 | import json from "./foo.json" assert { type: "json" };
|
||||||
| ^
|
| ^
|
||||||
2 |"
|
2 |"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`import-assertions-static.js [espree] format 1`] = `
|
exports[`import-assertions-static.js [espree] format 1`] = `
|
||||||
"Unexpected token assert (1:31)
|
"Unexpected token assert (1:31)
|
||||||
> 1 | import json from \\"./foo.json\\" assert { type: \\"json\\" };
|
> 1 | import json from "./foo.json" assert { type: "json" };
|
||||||
| ^
|
| ^
|
||||||
2 |"
|
2 |"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`import-assertions-static.js [meriyah] format 1`] = `
|
exports[`import-assertions-static.js [meriyah] format 1`] = `
|
||||||
"Unexpected token: 'identifier' (1:36)
|
"Unexpected token: 'identifier' (1:36)
|
||||||
> 1 | import json from \\"./foo.json\\" assert { type: \\"json\\" };
|
> 1 | import json from "./foo.json" assert { type: "json" };
|
||||||
| ^
|
| ^
|
||||||
2 |"
|
2 |"
|
||||||
`;
|
`;
|
||||||
@@ -1297,9 +1297,9 @@ let m = module {
|
|||||||
|
|
||||||
exports[`module-string-names.js [meriyah] format 1`] = `
|
exports[`module-string-names.js [meriyah] format 1`] = `
|
||||||
"Expected '}' (1:13)
|
"Expected '}' (1:13)
|
||||||
> 1 | import { \\"😄\\" as smile } from \\"./emojis.js\\";
|
> 1 | import { "😄" as smile } from "./emojis.js";
|
||||||
| ^
|
| ^
|
||||||
2 | export { smile as \\"😄\\" } from \\"./emojis.js\\";
|
2 | export { smile as "😄" } from "./emojis.js";
|
||||||
3 |"
|
3 |"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
@@ -1884,9 +1884,9 @@ return list |> take(prefix.length, %) |> equals(%, prefix);
|
|||||||
|
|
||||||
exports[`pipeline-operator-minimal.js [acorn] format 1`] = `
|
exports[`pipeline-operator-minimal.js [acorn] format 1`] = `
|
||||||
"Identifier 'result' has already been declared (7:5)
|
"Identifier 'result' has already been declared (7:5)
|
||||||
5 | result //=> \\"Hello, hello!\\"
|
5 | result //=> "Hello, hello!"
|
||||||
6 |
|
6 |
|
||||||
> 7 | let result = \\"hello\\"
|
> 7 | let result = "hello"
|
||||||
| ^
|
| ^
|
||||||
8 | |> doubleSay
|
8 | |> doubleSay
|
||||||
9 | |> capitalize
|
9 | |> capitalize
|
||||||
@@ -1895,9 +1895,9 @@ exports[`pipeline-operator-minimal.js [acorn] format 1`] = `
|
|||||||
|
|
||||||
exports[`pipeline-operator-minimal.js [espree] format 1`] = `
|
exports[`pipeline-operator-minimal.js [espree] format 1`] = `
|
||||||
"Identifier 'result' has already been declared (7:5)
|
"Identifier 'result' has already been declared (7:5)
|
||||||
5 | result //=> \\"Hello, hello!\\"
|
5 | result //=> "Hello, hello!"
|
||||||
6 |
|
6 |
|
||||||
> 7 | let result = \\"hello\\"
|
> 7 | let result = "hello"
|
||||||
| ^
|
| ^
|
||||||
8 | |> doubleSay
|
8 | |> doubleSay
|
||||||
9 | |> capitalize
|
9 | |> capitalize
|
||||||
@@ -1907,7 +1907,7 @@ exports[`pipeline-operator-minimal.js [espree] format 1`] = `
|
|||||||
exports[`pipeline-operator-minimal.js [meriyah] format 1`] = `
|
exports[`pipeline-operator-minimal.js [meriyah] format 1`] = `
|
||||||
"Unexpected token: '>' (8:4)
|
"Unexpected token: '>' (8:4)
|
||||||
6 |
|
6 |
|
||||||
7 | let result = \\"hello\\"
|
7 | let result = "hello"
|
||||||
> 8 | |> doubleSay
|
> 8 | |> doubleSay
|
||||||
| ^
|
| ^
|
||||||
9 | |> capitalize
|
9 | |> capitalize
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ exports[`null-arguments-item.js [__babel_estree] format 1`] = `
|
|||||||
> 1 | foor('a', , 'b');
|
> 1 | foor('a', , 'b');
|
||||||
| ^
|
| ^
|
||||||
2 | foo('looooooooooooooooooooooooooooooooooooooooooooooong', , 'looooooooooooooooooooooooooooooooooooooooooooooong');
|
2 | foo('looooooooooooooooooooooooooooooooooooooooooooooong', , 'looooooooooooooooooooooooooooooooooooooooooooooong');
|
||||||
3 | foo(\\"a\\",
|
3 | foo("a",
|
||||||
4 | //1"
|
4 | //1"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
@@ -14,7 +14,7 @@ exports[`null-arguments-item.js [acorn] format 1`] = `
|
|||||||
> 1 | foor('a', , 'b');
|
> 1 | foor('a', , 'b');
|
||||||
| ^
|
| ^
|
||||||
2 | foo('looooooooooooooooooooooooooooooooooooooooooooooong', , 'looooooooooooooooooooooooooooooooooooooooooooooong');
|
2 | foo('looooooooooooooooooooooooooooooooooooooooooooooong', , 'looooooooooooooooooooooooooooooooooooooooooooooong');
|
||||||
3 | foo(\\"a\\",
|
3 | foo("a",
|
||||||
4 | //1"
|
4 | //1"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
@@ -23,7 +23,7 @@ exports[`null-arguments-item.js [babel] format 1`] = `
|
|||||||
> 1 | foor('a', , 'b');
|
> 1 | foor('a', , 'b');
|
||||||
| ^
|
| ^
|
||||||
2 | foo('looooooooooooooooooooooooooooooooooooooooooooooong', , 'looooooooooooooooooooooooooooooooooooooooooooooong');
|
2 | foo('looooooooooooooooooooooooooooooooooooooooooooooong', , 'looooooooooooooooooooooooooooooooooooooooooooooong');
|
||||||
3 | foo(\\"a\\",
|
3 | foo("a",
|
||||||
4 | //1"
|
4 | //1"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
@@ -32,7 +32,7 @@ exports[`null-arguments-item.js [espree] format 1`] = `
|
|||||||
> 1 | foor('a', , 'b');
|
> 1 | foor('a', , 'b');
|
||||||
| ^
|
| ^
|
||||||
2 | foo('looooooooooooooooooooooooooooooooooooooooooooooong', , 'looooooooooooooooooooooooooooooooooooooooooooooong');
|
2 | foo('looooooooooooooooooooooooooooooooooooooooooooooong', , 'looooooooooooooooooooooooooooooooooooooooooooooong');
|
||||||
3 | foo(\\"a\\",
|
3 | foo("a",
|
||||||
4 | //1"
|
4 | //1"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
@@ -41,6 +41,6 @@ exports[`null-arguments-item.js [meriyah] format 1`] = `
|
|||||||
> 1 | foor('a', , 'b');
|
> 1 | foor('a', , 'b');
|
||||||
| ^
|
| ^
|
||||||
2 | foo('looooooooooooooooooooooooooooooooooooooooooooooong', , 'looooooooooooooooooooooooooooooooooooooooooooooong');
|
2 | foo('looooooooooooooooooooooooooooooooooooooooooooooong', , 'looooooooooooooooooooooooooooooooooooooooooooooong');
|
||||||
3 | foo(\\"a\\",
|
3 | foo("a",
|
||||||
4 | //1"
|
4 | //1"
|
||||||
`;
|
`;
|
||||||
@@ -15,7 +15,7 @@ exports[`example.js [espree] format 1`] = `
|
|||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`example.js [meriyah] format 1`] = `
|
exports[`example.js [meriyah] format 1`] = `
|
||||||
"Calls to super must be in the \\"constructor\\" method of a class expression or class declaration that has a superclass (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();
|
> 1 | super();
|
||||||
| ^
|
| ^
|
||||||
2 |"
|
2 |"
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ class Foo {
|
|||||||
exports[`computed.js [acorn] format 1`] = `
|
exports[`computed.js [acorn] format 1`] = `
|
||||||
"Unexpected token (2:12)
|
"Unexpected token (2:12)
|
||||||
1 | class Foo {
|
1 | class Foo {
|
||||||
> 2 | accessor [\\"bar\\"];
|
> 2 | accessor ["bar"];
|
||||||
| ^
|
| ^
|
||||||
3 | }
|
3 | }
|
||||||
4 |"
|
4 |"
|
||||||
@@ -85,7 +85,7 @@ exports[`computed.js [acorn] format 1`] = `
|
|||||||
exports[`computed.js [espree] format 1`] = `
|
exports[`computed.js [espree] format 1`] = `
|
||||||
"Unexpected token [ (2:12)
|
"Unexpected token [ (2:12)
|
||||||
1 | class Foo {
|
1 | class Foo {
|
||||||
> 2 | accessor [\\"bar\\"];
|
> 2 | accessor ["bar"];
|
||||||
| ^
|
| ^
|
||||||
3 | }
|
3 | }
|
||||||
4 |"
|
4 |"
|
||||||
@@ -94,7 +94,7 @@ exports[`computed.js [espree] format 1`] = `
|
|||||||
exports[`computed.js - {"semi":false} [acorn] format 1`] = `
|
exports[`computed.js - {"semi":false} [acorn] format 1`] = `
|
||||||
"Unexpected token (2:12)
|
"Unexpected token (2:12)
|
||||||
1 | class Foo {
|
1 | class Foo {
|
||||||
> 2 | accessor [\\"bar\\"];
|
> 2 | accessor ["bar"];
|
||||||
| ^
|
| ^
|
||||||
3 | }
|
3 | }
|
||||||
4 |"
|
4 |"
|
||||||
@@ -103,7 +103,7 @@ exports[`computed.js - {"semi":false} [acorn] format 1`] = `
|
|||||||
exports[`computed.js - {"semi":false} [espree] format 1`] = `
|
exports[`computed.js - {"semi":false} [espree] format 1`] = `
|
||||||
"Unexpected token [ (2:12)
|
"Unexpected token [ (2:12)
|
||||||
1 | class Foo {
|
1 | class Foo {
|
||||||
> 2 | accessor [\\"bar\\"];
|
> 2 | accessor ["bar"];
|
||||||
| ^
|
| ^
|
||||||
3 | }
|
3 | }
|
||||||
4 |"
|
4 |"
|
||||||
@@ -410,7 +410,7 @@ class Foo {
|
|||||||
exports[`static-computed.js [acorn] format 1`] = `
|
exports[`static-computed.js [acorn] format 1`] = `
|
||||||
"Unexpected token (2:19)
|
"Unexpected token (2:19)
|
||||||
1 | class Foo {
|
1 | class Foo {
|
||||||
> 2 | static accessor [\\"bar\\"];
|
> 2 | static accessor ["bar"];
|
||||||
| ^
|
| ^
|
||||||
3 | }
|
3 | }
|
||||||
4 |"
|
4 |"
|
||||||
@@ -419,7 +419,7 @@ exports[`static-computed.js [acorn] format 1`] = `
|
|||||||
exports[`static-computed.js [espree] format 1`] = `
|
exports[`static-computed.js [espree] format 1`] = `
|
||||||
"Unexpected token [ (2:19)
|
"Unexpected token [ (2:19)
|
||||||
1 | class Foo {
|
1 | class Foo {
|
||||||
> 2 | static accessor [\\"bar\\"];
|
> 2 | static accessor ["bar"];
|
||||||
| ^
|
| ^
|
||||||
3 | }
|
3 | }
|
||||||
4 |"
|
4 |"
|
||||||
@@ -428,7 +428,7 @@ exports[`static-computed.js [espree] format 1`] = `
|
|||||||
exports[`static-computed.js - {"semi":false} [acorn] format 1`] = `
|
exports[`static-computed.js - {"semi":false} [acorn] format 1`] = `
|
||||||
"Unexpected token (2:19)
|
"Unexpected token (2:19)
|
||||||
1 | class Foo {
|
1 | class Foo {
|
||||||
> 2 | static accessor [\\"bar\\"];
|
> 2 | static accessor ["bar"];
|
||||||
| ^
|
| ^
|
||||||
3 | }
|
3 | }
|
||||||
4 |"
|
4 |"
|
||||||
@@ -437,7 +437,7 @@ exports[`static-computed.js - {"semi":false} [acorn] format 1`] = `
|
|||||||
exports[`static-computed.js - {"semi":false} [espree] format 1`] = `
|
exports[`static-computed.js - {"semi":false} [espree] format 1`] = `
|
||||||
"Unexpected token [ (2:19)
|
"Unexpected token [ (2:19)
|
||||||
1 | class Foo {
|
1 | class Foo {
|
||||||
> 2 | static accessor [\\"bar\\"];
|
> 2 | static accessor ["bar"];
|
||||||
| ^
|
| ^
|
||||||
3 | }
|
3 | }
|
||||||
4 |"
|
4 |"
|
||||||
@@ -638,7 +638,7 @@ class Foo {
|
|||||||
exports[`with-semicolon-1.js [acorn] format 1`] = `
|
exports[`with-semicolon-1.js [acorn] format 1`] = `
|
||||||
"Unexpected token (2:12)
|
"Unexpected token (2:12)
|
||||||
1 | class C {
|
1 | class C {
|
||||||
> 2 | accessor clicked = \\"value\\";
|
> 2 | accessor clicked = "value";
|
||||||
| ^
|
| ^
|
||||||
3 | [foo]() {}
|
3 | [foo]() {}
|
||||||
4 | }
|
4 | }
|
||||||
@@ -648,7 +648,7 @@ exports[`with-semicolon-1.js [acorn] format 1`] = `
|
|||||||
exports[`with-semicolon-1.js [espree] format 1`] = `
|
exports[`with-semicolon-1.js [espree] format 1`] = `
|
||||||
"Unexpected token clicked (2:12)
|
"Unexpected token clicked (2:12)
|
||||||
1 | class C {
|
1 | class C {
|
||||||
> 2 | accessor clicked = \\"value\\";
|
> 2 | accessor clicked = "value";
|
||||||
| ^
|
| ^
|
||||||
3 | [foo]() {}
|
3 | [foo]() {}
|
||||||
4 | }
|
4 | }
|
||||||
@@ -658,7 +658,7 @@ exports[`with-semicolon-1.js [espree] format 1`] = `
|
|||||||
exports[`with-semicolon-1.js - {"semi":false} [acorn] format 1`] = `
|
exports[`with-semicolon-1.js - {"semi":false} [acorn] format 1`] = `
|
||||||
"Unexpected token (2:12)
|
"Unexpected token (2:12)
|
||||||
1 | class C {
|
1 | class C {
|
||||||
> 2 | accessor clicked = \\"value\\";
|
> 2 | accessor clicked = "value";
|
||||||
| ^
|
| ^
|
||||||
3 | [foo]() {}
|
3 | [foo]() {}
|
||||||
4 | }
|
4 | }
|
||||||
@@ -668,7 +668,7 @@ exports[`with-semicolon-1.js - {"semi":false} [acorn] format 1`] = `
|
|||||||
exports[`with-semicolon-1.js - {"semi":false} [espree] format 1`] = `
|
exports[`with-semicolon-1.js - {"semi":false} [espree] format 1`] = `
|
||||||
"Unexpected token clicked (2:12)
|
"Unexpected token clicked (2:12)
|
||||||
1 | class C {
|
1 | class C {
|
||||||
> 2 | accessor clicked = \\"value\\";
|
> 2 | accessor clicked = "value";
|
||||||
| ^
|
| ^
|
||||||
3 | [foo]() {}
|
3 | [foo]() {}
|
||||||
4 | }
|
4 | }
|
||||||
@@ -719,7 +719,7 @@ class C {
|
|||||||
exports[`with-semicolon-2.js [acorn] format 1`] = `
|
exports[`with-semicolon-2.js [acorn] format 1`] = `
|
||||||
"Unexpected token (2:12)
|
"Unexpected token (2:12)
|
||||||
1 | class C {
|
1 | class C {
|
||||||
> 2 | accessor clicked = \\"value\\";
|
> 2 | accessor clicked = "value";
|
||||||
| ^
|
| ^
|
||||||
3 | *foo() {}
|
3 | *foo() {}
|
||||||
4 | }
|
4 | }
|
||||||
@@ -729,7 +729,7 @@ exports[`with-semicolon-2.js [acorn] format 1`] = `
|
|||||||
exports[`with-semicolon-2.js [espree] format 1`] = `
|
exports[`with-semicolon-2.js [espree] format 1`] = `
|
||||||
"Unexpected token clicked (2:12)
|
"Unexpected token clicked (2:12)
|
||||||
1 | class C {
|
1 | class C {
|
||||||
> 2 | accessor clicked = \\"value\\";
|
> 2 | accessor clicked = "value";
|
||||||
| ^
|
| ^
|
||||||
3 | *foo() {}
|
3 | *foo() {}
|
||||||
4 | }
|
4 | }
|
||||||
@@ -739,7 +739,7 @@ exports[`with-semicolon-2.js [espree] format 1`] = `
|
|||||||
exports[`with-semicolon-2.js - {"semi":false} [acorn] format 1`] = `
|
exports[`with-semicolon-2.js - {"semi":false} [acorn] format 1`] = `
|
||||||
"Unexpected token (2:12)
|
"Unexpected token (2:12)
|
||||||
1 | class C {
|
1 | class C {
|
||||||
> 2 | accessor clicked = \\"value\\";
|
> 2 | accessor clicked = "value";
|
||||||
| ^
|
| ^
|
||||||
3 | *foo() {}
|
3 | *foo() {}
|
||||||
4 | }
|
4 | }
|
||||||
@@ -749,7 +749,7 @@ exports[`with-semicolon-2.js - {"semi":false} [acorn] format 1`] = `
|
|||||||
exports[`with-semicolon-2.js - {"semi":false} [espree] format 1`] = `
|
exports[`with-semicolon-2.js - {"semi":false} [espree] format 1`] = `
|
||||||
"Unexpected token clicked (2:12)
|
"Unexpected token clicked (2:12)
|
||||||
1 | class C {
|
1 | class C {
|
||||||
> 2 | accessor clicked = \\"value\\";
|
> 2 | accessor clicked = "value";
|
||||||
| ^
|
| ^
|
||||||
3 | *foo() {}
|
3 | *foo() {}
|
||||||
4 | }
|
4 | }
|
||||||
|
|||||||
@@ -166,22 +166,22 @@ exports[`methods.js [acorn] format 1`] = `
|
|||||||
"Unexpected character '@' (3:3)
|
"Unexpected character '@' (3:3)
|
||||||
1 |
|
1 |
|
||||||
2 | class Yo {
|
2 | class Yo {
|
||||||
> 3 | @foo(\\"hello\\")
|
> 3 | @foo("hello")
|
||||||
| ^
|
| ^
|
||||||
4 | async plop() {}
|
4 | async plop() {}
|
||||||
5 |
|
5 |
|
||||||
6 | @anotherDecoratorWithALongName(\\"and a very long string as a first argument\\")"
|
6 | @anotherDecoratorWithALongName("and a very long string as a first argument")"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`methods.js [espree] format 1`] = `
|
exports[`methods.js [espree] format 1`] = `
|
||||||
"Unexpected character '@' (3:3)
|
"Unexpected character '@' (3:3)
|
||||||
1 |
|
1 |
|
||||||
2 | class Yo {
|
2 | class Yo {
|
||||||
> 3 | @foo(\\"hello\\")
|
> 3 | @foo("hello")
|
||||||
| ^
|
| ^
|
||||||
4 | async plop() {}
|
4 | async plop() {}
|
||||||
5 |
|
5 |
|
||||||
6 | @anotherDecoratorWithALongName(\\"and a very long string as a first argument\\")"
|
6 | @anotherDecoratorWithALongName("and a very long string as a first argument")"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`methods.js format 1`] = `
|
exports[`methods.js format 1`] = `
|
||||||
@@ -266,7 +266,7 @@ export default class MyComponent {
|
|||||||
|
|
||||||
exports[`mobx.js [acorn] format 1`] = `
|
exports[`mobx.js [acorn] format 1`] = `
|
||||||
"Unexpected character '@' (3:1)
|
"Unexpected character '@' (3:1)
|
||||||
1 | import {observable} from \\"mobx\\";
|
1 | import {observable} from "mobx";
|
||||||
2 |
|
2 |
|
||||||
> 3 | @observer class OrderLine {
|
> 3 | @observer class OrderLine {
|
||||||
| ^
|
| ^
|
||||||
@@ -277,7 +277,7 @@ exports[`mobx.js [acorn] format 1`] = `
|
|||||||
|
|
||||||
exports[`mobx.js [espree] format 1`] = `
|
exports[`mobx.js [espree] format 1`] = `
|
||||||
"Unexpected character '@' (3:1)
|
"Unexpected character '@' (3:1)
|
||||||
1 | import {observable} from \\"mobx\\";
|
1 | import {observable} from "mobx";
|
||||||
2 |
|
2 |
|
||||||
> 3 | @observer class OrderLine {
|
> 3 | @observer class OrderLine {
|
||||||
| ^
|
| ^
|
||||||
|
|||||||
@@ -6,9 +6,9 @@ exports[`call-arguments.js [acorn] format 1`] = `
|
|||||||
2 | expect(
|
2 | expect(
|
||||||
> 3 | do {
|
> 3 | do {
|
||||||
| ^
|
| ^
|
||||||
4 | var bar = \\"foo\\";
|
4 | var bar = "foo";
|
||||||
5 | if (!bar) throw new Error(
|
5 | if (!bar) throw new Error(
|
||||||
6 | \\"unreachable\\""
|
6 | "unreachable""
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`call-arguments.js [espree] format 1`] = `
|
exports[`call-arguments.js [espree] format 1`] = `
|
||||||
@@ -17,9 +17,9 @@ exports[`call-arguments.js [espree] format 1`] = `
|
|||||||
2 | expect(
|
2 | expect(
|
||||||
> 3 | do {
|
> 3 | do {
|
||||||
| ^
|
| ^
|
||||||
4 | var bar = \\"foo\\";
|
4 | var bar = "foo";
|
||||||
5 | if (!bar) throw new Error(
|
5 | if (!bar) throw new Error(
|
||||||
6 | \\"unreachable\\""
|
6 | "unreachable""
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`call-arguments.js [meriyah] format 1`] = `
|
exports[`call-arguments.js [meriyah] format 1`] = `
|
||||||
@@ -28,9 +28,9 @@ exports[`call-arguments.js [meriyah] format 1`] = `
|
|||||||
2 | expect(
|
2 | expect(
|
||||||
> 3 | do {
|
> 3 | do {
|
||||||
| ^
|
| ^
|
||||||
4 | var bar = \\"foo\\";
|
4 | var bar = "foo";
|
||||||
5 | if (!bar) throw new Error(
|
5 | if (!bar) throw new Error(
|
||||||
6 | \\"unreachable\\""
|
6 | "unreachable""
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`call-arguments.js format 1`] = `
|
exports[`call-arguments.js format 1`] = `
|
||||||
|
|||||||
@@ -2,28 +2,28 @@
|
|||||||
|
|
||||||
exports[`assertions.js [acorn] format 1`] = `
|
exports[`assertions.js [acorn] format 1`] = `
|
||||||
"Unexpected token (1:20)
|
"Unexpected token (1:20)
|
||||||
> 1 | import(\\"./foo.json\\", { assert: { type: \\"json\\" } });
|
> 1 | import("./foo.json", { assert: { type: "json" } });
|
||||||
| ^
|
| ^
|
||||||
2 |"
|
2 |"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`assertions.js [espree] format 1`] = `
|
exports[`assertions.js [espree] format 1`] = `
|
||||||
"Unexpected token , (1:20)
|
"Unexpected token , (1:20)
|
||||||
> 1 | import(\\"./foo.json\\", { assert: { type: \\"json\\" } });
|
> 1 | import("./foo.json", { assert: { type: "json" } });
|
||||||
| ^
|
| ^
|
||||||
2 |"
|
2 |"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`assertions.js [flow] format 1`] = `
|
exports[`assertions.js [flow] format 1`] = `
|
||||||
"Unexpected token \`,\`, expected the token \`)\` (1:20)
|
"Unexpected token \`,\`, expected the token \`)\` (1:20)
|
||||||
> 1 | import(\\"./foo.json\\", { assert: { type: \\"json\\" } });
|
> 1 | import("./foo.json", { assert: { type: "json" } });
|
||||||
| ^
|
| ^
|
||||||
2 |"
|
2 |"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`assertions.js [meriyah] format 1`] = `
|
exports[`assertions.js [meriyah] format 1`] = `
|
||||||
"Expected ')' (1:20)
|
"Expected ')' (1:20)
|
||||||
> 1 | import(\\"./foo.json\\", { assert: { type: \\"json\\" } });
|
> 1 | import("./foo.json", { assert: { type: "json" } });
|
||||||
| ^
|
| ^
|
||||||
2 |"
|
2 |"
|
||||||
`;
|
`;
|
||||||
|
|||||||
@@ -2,22 +2,22 @@
|
|||||||
|
|
||||||
exports[`default-escaped.js [acorn] format 1`] = `
|
exports[`default-escaped.js [acorn] format 1`] = `
|
||||||
"Unexpected token (2:8)
|
"Unexpected token (2:8)
|
||||||
1 | // export asyn\\\\u{63} from \\"async\\";
|
1 | // export asyn\\u{63} from "async";
|
||||||
> 2 | export n\\\\u{63} from \\"async\\";
|
> 2 | export n\\u{63} from "async";
|
||||||
| ^"
|
| ^"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`default-escaped.js [espree] format 1`] = `
|
exports[`default-escaped.js [espree] format 1`] = `
|
||||||
"Unexpected token n\\\\u{63} (2:8)
|
"Unexpected token n\\u{63} (2:8)
|
||||||
1 | // export asyn\\\\u{63} from \\"async\\";
|
1 | // export asyn\\u{63} from "async";
|
||||||
> 2 | export n\\\\u{63} from \\"async\\";
|
> 2 | export n\\u{63} from "async";
|
||||||
| ^"
|
| ^"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`default-escaped.js [meriyah] format 1`] = `
|
exports[`default-escaped.js [meriyah] format 1`] = `
|
||||||
"Unexpected token: 'identifier' (2:12)
|
"Unexpected token: 'identifier' (2:12)
|
||||||
1 | // export asyn\\\\u{63} from \\"async\\";
|
1 | // export asyn\\u{63} from "async";
|
||||||
> 2 | export n\\\\u{63} from \\"async\\";
|
> 2 | export n\\u{63} from "async";
|
||||||
| ^"
|
| ^"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
|||||||
@@ -81,14 +81,14 @@ export * as "foo" from "foo";
|
|||||||
|
|
||||||
exports[`export-star-as-string2.js [flow] format 1`] = `
|
exports[`export-star-as-string2.js [flow] format 1`] = `
|
||||||
"Unexpected string, expected an identifier (1:13)
|
"Unexpected string, expected an identifier (1:13)
|
||||||
> 1 | export * as \\"foo\\" from 'foo'
|
> 1 | export * as "foo" from 'foo'
|
||||||
| ^^^^^
|
| ^^^^^
|
||||||
2 |"
|
2 |"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`export-star-as-string2.js [typescript] format 1`] = `
|
exports[`export-star-as-string2.js [typescript] format 1`] = `
|
||||||
"Identifier expected. (1:13)
|
"Identifier expected. (1:13)
|
||||||
> 1 | export * as \\"foo\\" from 'foo'
|
> 1 | export * as "foo" from 'foo'
|
||||||
| ^
|
| ^
|
||||||
2 |"
|
2 |"
|
||||||
`;
|
`;
|
||||||
|
|||||||
@@ -2,34 +2,34 @@
|
|||||||
|
|
||||||
exports[`test.js [acorn] format 1`] = `
|
exports[`test.js [acorn] format 1`] = `
|
||||||
"Unexpected token (3:8)
|
"Unexpected token (3:8)
|
||||||
1 | export { value1, value2 as value2_renamed, value3, value4 as value4_renamed, value5 } from \\"exports\\";
|
1 | export { value1, value2 as value2_renamed, value3, value4 as value4_renamed, value5 } from "exports";
|
||||||
2 |
|
2 |
|
||||||
> 3 | export a,{b} from \\"./baz\\";
|
> 3 | export a,{b} from "./baz";
|
||||||
| ^
|
| ^
|
||||||
4 |
|
4 |
|
||||||
5 | export * as ns from \\"mod\\";
|
5 | export * as ns from "mod";
|
||||||
6 |"
|
6 |"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`test.js [espree] format 1`] = `
|
exports[`test.js [espree] format 1`] = `
|
||||||
"Unexpected token a (3:8)
|
"Unexpected token a (3:8)
|
||||||
1 | export { value1, value2 as value2_renamed, value3, value4 as value4_renamed, value5 } from \\"exports\\";
|
1 | export { value1, value2 as value2_renamed, value3, value4 as value4_renamed, value5 } from "exports";
|
||||||
2 |
|
2 |
|
||||||
> 3 | export a,{b} from \\"./baz\\";
|
> 3 | export a,{b} from "./baz";
|
||||||
| ^
|
| ^
|
||||||
4 |
|
4 |
|
||||||
5 | export * as ns from \\"mod\\";
|
5 | export * as ns from "mod";
|
||||||
6 |"
|
6 |"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`test.js [meriyah] format 1`] = `
|
exports[`test.js [meriyah] format 1`] = `
|
||||||
"Unexpected token: 'identifier' (3:8)
|
"Unexpected token: 'identifier' (3:8)
|
||||||
1 | export { value1, value2 as value2_renamed, value3, value4 as value4_renamed, value5 } from \\"exports\\";
|
1 | export { value1, value2 as value2_renamed, value3, value4 as value4_renamed, value5 } from "exports";
|
||||||
2 |
|
2 |
|
||||||
> 3 | export a,{b} from \\"./baz\\";
|
> 3 | export a,{b} from "./baz";
|
||||||
| ^
|
| ^
|
||||||
4 |
|
4 |
|
||||||
5 | export * as ns from \\"mod\\";
|
5 | export * as ns from "mod";
|
||||||
6 |"
|
6 |"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
|||||||
@@ -2,21 +2,21 @@
|
|||||||
|
|
||||||
exports[`dynamic-import.js [acorn] format 1`] = `
|
exports[`dynamic-import.js [acorn] format 1`] = `
|
||||||
"Unexpected token (1:20)
|
"Unexpected token (1:20)
|
||||||
> 1 | import(\\"./foo.json\\", { assert: { type: \\"json\\" } });
|
> 1 | import("./foo.json", { assert: { type: "json" } });
|
||||||
| ^
|
| ^
|
||||||
2 |"
|
2 |"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`dynamic-import.js [espree] format 1`] = `
|
exports[`dynamic-import.js [espree] format 1`] = `
|
||||||
"Unexpected token , (1:20)
|
"Unexpected token , (1:20)
|
||||||
> 1 | import(\\"./foo.json\\", { assert: { type: \\"json\\" } });
|
> 1 | import("./foo.json", { assert: { type: "json" } });
|
||||||
| ^
|
| ^
|
||||||
2 |"
|
2 |"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`dynamic-import.js [meriyah] format 1`] = `
|
exports[`dynamic-import.js [meriyah] format 1`] = `
|
||||||
"Expected ')' (1:20)
|
"Expected ')' (1:20)
|
||||||
> 1 | import(\\"./foo.json\\", { assert: { type: \\"json\\" } });
|
> 1 | import("./foo.json", { assert: { type: "json" } });
|
||||||
| ^
|
| ^
|
||||||
2 |"
|
2 |"
|
||||||
`;
|
`;
|
||||||
@@ -37,32 +37,32 @@ import("./foo.json", { assert: { type: "json" } });
|
|||||||
|
|
||||||
exports[`empty.js [acorn] format 1`] = `
|
exports[`empty.js [acorn] format 1`] = `
|
||||||
"Unexpected token (2:33)
|
"Unexpected token (2:33)
|
||||||
1 | export * as foo from \\"foo.json\\"
|
1 | export * as foo from "foo.json"
|
||||||
> 2 | export * as bar from \\"bar.json\\" assert { }
|
> 2 | export * as bar from "bar.json" assert { }
|
||||||
| ^
|
| ^
|
||||||
3 | export * as baz from \\"baz.json\\" assert { /* comment */ }
|
3 | export * as baz from "baz.json" assert { /* comment */ }
|
||||||
4 |
|
4 |
|
||||||
5 | import * as foo from \\"foo.json\\""
|
5 | import * as foo from "foo.json""
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`empty.js [espree] format 1`] = `
|
exports[`empty.js [espree] format 1`] = `
|
||||||
"Unexpected token assert (2:33)
|
"Unexpected token assert (2:33)
|
||||||
1 | export * as foo from \\"foo.json\\"
|
1 | export * as foo from "foo.json"
|
||||||
> 2 | export * as bar from \\"bar.json\\" assert { }
|
> 2 | export * as bar from "bar.json" assert { }
|
||||||
| ^
|
| ^
|
||||||
3 | export * as baz from \\"baz.json\\" assert { /* comment */ }
|
3 | export * as baz from "baz.json" assert { /* comment */ }
|
||||||
4 |
|
4 |
|
||||||
5 | import * as foo from \\"foo.json\\""
|
5 | import * as foo from "foo.json""
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`empty.js [meriyah] format 1`] = `
|
exports[`empty.js [meriyah] format 1`] = `
|
||||||
"Unexpected token: 'identifier' (2:38)
|
"Unexpected token: 'identifier' (2:38)
|
||||||
1 | export * as foo from \\"foo.json\\"
|
1 | export * as foo from "foo.json"
|
||||||
> 2 | export * as bar from \\"bar.json\\" assert { }
|
> 2 | export * as bar from "bar.json" assert { }
|
||||||
| ^
|
| ^
|
||||||
3 | export * as baz from \\"baz.json\\" assert { /* comment */ }
|
3 | export * as baz from "baz.json" assert { /* comment */ }
|
||||||
4 |
|
4 |
|
||||||
5 | import * as foo from \\"foo.json\\""
|
5 | import * as foo from "foo.json""
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`empty.js format 1`] = `
|
exports[`empty.js format 1`] = `
|
||||||
@@ -92,21 +92,21 @@ import * as baz from "baz.json" /* comment */;
|
|||||||
|
|
||||||
exports[`multi-types.js [acorn] format 1`] = `
|
exports[`multi-types.js [acorn] format 1`] = `
|
||||||
"Unexpected token (1:31)
|
"Unexpected token (1:31)
|
||||||
> 1 | import json from \\"./foo.json\\" assert { type: \\"json\\", type: \\"bar\\" };
|
> 1 | import json from "./foo.json" assert { type: "json", type: "bar" };
|
||||||
| ^
|
| ^
|
||||||
2 |"
|
2 |"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`multi-types.js [espree] format 1`] = `
|
exports[`multi-types.js [espree] format 1`] = `
|
||||||
"Unexpected token assert (1:31)
|
"Unexpected token assert (1:31)
|
||||||
> 1 | import json from \\"./foo.json\\" assert { type: \\"json\\", type: \\"bar\\" };
|
> 1 | import json from "./foo.json" assert { type: "json", type: "bar" };
|
||||||
| ^
|
| ^
|
||||||
2 |"
|
2 |"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`multi-types.js [meriyah] format 1`] = `
|
exports[`multi-types.js [meriyah] format 1`] = `
|
||||||
"Unexpected token: 'identifier' (1:36)
|
"Unexpected token: 'identifier' (1:36)
|
||||||
> 1 | import json from \\"./foo.json\\" assert { type: \\"json\\", type: \\"bar\\" };
|
> 1 | import json from "./foo.json" assert { type: "json", type: "bar" };
|
||||||
| ^
|
| ^
|
||||||
2 |"
|
2 |"
|
||||||
`;
|
`;
|
||||||
@@ -127,21 +127,21 @@ import json from "./foo.json" assert { type: "json", type: "bar" };
|
|||||||
|
|
||||||
exports[`non-type.js [acorn] format 1`] = `
|
exports[`non-type.js [acorn] format 1`] = `
|
||||||
"Unexpected token (1:28)
|
"Unexpected token (1:28)
|
||||||
> 1 | import foo from \\"foo.json\\" assert { lazy: \\"true\\" };
|
> 1 | import foo from "foo.json" assert { lazy: "true" };
|
||||||
| ^
|
| ^
|
||||||
2 |"
|
2 |"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`non-type.js [espree] format 1`] = `
|
exports[`non-type.js [espree] format 1`] = `
|
||||||
"Unexpected token assert (1:28)
|
"Unexpected token assert (1:28)
|
||||||
> 1 | import foo from \\"foo.json\\" assert { lazy: \\"true\\" };
|
> 1 | import foo from "foo.json" assert { lazy: "true" };
|
||||||
| ^
|
| ^
|
||||||
2 |"
|
2 |"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`non-type.js [meriyah] format 1`] = `
|
exports[`non-type.js [meriyah] format 1`] = `
|
||||||
"Unexpected token: 'identifier' (1:33)
|
"Unexpected token: 'identifier' (1:33)
|
||||||
> 1 | import foo from \\"foo.json\\" assert { lazy: \\"true\\" };
|
> 1 | import foo from "foo.json" assert { lazy: "true" };
|
||||||
| ^
|
| ^
|
||||||
2 |"
|
2 |"
|
||||||
`;
|
`;
|
||||||
@@ -178,28 +178,28 @@ assert({ type: "json" });
|
|||||||
|
|
||||||
exports[`re-export.js [acorn] format 1`] = `
|
exports[`re-export.js [acorn] format 1`] = `
|
||||||
"Unexpected token (1:33)
|
"Unexpected token (1:33)
|
||||||
> 1 | export { foo2 } from \\"foo.json\\" assert { type: \\"json\\" };
|
> 1 | export { foo2 } from "foo.json" assert { type: "json" };
|
||||||
| ^
|
| ^
|
||||||
2 | export * from \\"foo.json\\" assert { type: \\"json\\" };
|
2 | export * from "foo.json" assert { type: "json" };
|
||||||
3 | export * as foo3 from \\"foo.json\\" assert { type: \\"json\\" };
|
3 | export * as foo3 from "foo.json" assert { type: "json" };
|
||||||
4 |"
|
4 |"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`re-export.js [espree] format 1`] = `
|
exports[`re-export.js [espree] format 1`] = `
|
||||||
"Unexpected token assert (1:33)
|
"Unexpected token assert (1:33)
|
||||||
> 1 | export { foo2 } from \\"foo.json\\" assert { type: \\"json\\" };
|
> 1 | export { foo2 } from "foo.json" assert { type: "json" };
|
||||||
| ^
|
| ^
|
||||||
2 | export * from \\"foo.json\\" assert { type: \\"json\\" };
|
2 | export * from "foo.json" assert { type: "json" };
|
||||||
3 | export * as foo3 from \\"foo.json\\" assert { type: \\"json\\" };
|
3 | export * as foo3 from "foo.json" assert { type: "json" };
|
||||||
4 |"
|
4 |"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`re-export.js [meriyah] format 1`] = `
|
exports[`re-export.js [meriyah] format 1`] = `
|
||||||
"Unexpected token: 'identifier' (1:38)
|
"Unexpected token: 'identifier' (1:38)
|
||||||
> 1 | export { foo2 } from \\"foo.json\\" assert { type: \\"json\\" };
|
> 1 | export { foo2 } from "foo.json" assert { type: "json" };
|
||||||
| ^
|
| ^
|
||||||
2 | export * from \\"foo.json\\" assert { type: \\"json\\" };
|
2 | export * from "foo.json" assert { type: "json" };
|
||||||
3 | export * as foo3 from \\"foo.json\\" assert { type: \\"json\\" };
|
3 | export * as foo3 from "foo.json" assert { type: "json" };
|
||||||
4 |"
|
4 |"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
@@ -223,21 +223,21 @@ export * as foo3 from "foo.json" assert { type: "json" };
|
|||||||
|
|
||||||
exports[`static-import.js [acorn] format 1`] = `
|
exports[`static-import.js [acorn] format 1`] = `
|
||||||
"Unexpected token (1:31)
|
"Unexpected token (1:31)
|
||||||
> 1 | import json from \\"./foo.json\\" assert { type: \\"json\\" };
|
> 1 | import json from "./foo.json" assert { type: "json" };
|
||||||
| ^
|
| ^
|
||||||
2 |"
|
2 |"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`static-import.js [espree] format 1`] = `
|
exports[`static-import.js [espree] format 1`] = `
|
||||||
"Unexpected token assert (1:31)
|
"Unexpected token assert (1:31)
|
||||||
> 1 | import json from \\"./foo.json\\" assert { type: \\"json\\" };
|
> 1 | import json from "./foo.json" assert { type: "json" };
|
||||||
| ^
|
| ^
|
||||||
2 |"
|
2 |"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`static-import.js [meriyah] format 1`] = `
|
exports[`static-import.js [meriyah] format 1`] = `
|
||||||
"Unexpected token: 'identifier' (1:36)
|
"Unexpected token: 'identifier' (1:36)
|
||||||
> 1 | import json from \\"./foo.json\\" assert { type: \\"json\\" };
|
> 1 | import json from "./foo.json" assert { type: "json" };
|
||||||
| ^
|
| ^
|
||||||
2 |"
|
2 |"
|
||||||
`;
|
`;
|
||||||
@@ -258,21 +258,21 @@ import json from "./foo.json" assert { type: "json" };
|
|||||||
|
|
||||||
exports[`without-from.js [acorn] format 1`] = `
|
exports[`without-from.js [acorn] format 1`] = `
|
||||||
"Unexpected token (1:14)
|
"Unexpected token (1:14)
|
||||||
> 1 | import \\"foo\\" assert { type: \\"json\\" }
|
> 1 | import "foo" assert { type: "json" }
|
||||||
| ^
|
| ^
|
||||||
2 |"
|
2 |"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`without-from.js [espree] format 1`] = `
|
exports[`without-from.js [espree] format 1`] = `
|
||||||
"Unexpected token assert (1:14)
|
"Unexpected token assert (1:14)
|
||||||
> 1 | import \\"foo\\" assert { type: \\"json\\" }
|
> 1 | import "foo" assert { type: "json" }
|
||||||
| ^
|
| ^
|
||||||
2 |"
|
2 |"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`without-from.js [meriyah] format 1`] = `
|
exports[`without-from.js [meriyah] format 1`] = `
|
||||||
"Unexpected token: 'identifier' (1:19)
|
"Unexpected token: 'identifier' (1:19)
|
||||||
> 1 | import \\"foo\\" assert { type: \\"json\\" }
|
> 1 | import "foo" assert { type: "json" }
|
||||||
| ^
|
| ^
|
||||||
2 |"
|
2 |"
|
||||||
`;
|
`;
|
||||||
|
|||||||
+12
-12
@@ -2,21 +2,21 @@
|
|||||||
|
|
||||||
exports[`dynamic-import.js - {"bracketSpacing":false} [acorn] format 1`] = `
|
exports[`dynamic-import.js - {"bracketSpacing":false} [acorn] format 1`] = `
|
||||||
"Unexpected token (1:20)
|
"Unexpected token (1:20)
|
||||||
> 1 | import(\\"./foo.json\\", { assert: { type: \\"json\\" } });
|
> 1 | import("./foo.json", { assert: { type: "json" } });
|
||||||
| ^
|
| ^
|
||||||
2 |"
|
2 |"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`dynamic-import.js - {"bracketSpacing":false} [espree] format 1`] = `
|
exports[`dynamic-import.js - {"bracketSpacing":false} [espree] format 1`] = `
|
||||||
"Unexpected token , (1:20)
|
"Unexpected token , (1:20)
|
||||||
> 1 | import(\\"./foo.json\\", { assert: { type: \\"json\\" } });
|
> 1 | import("./foo.json", { assert: { type: "json" } });
|
||||||
| ^
|
| ^
|
||||||
2 |"
|
2 |"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`dynamic-import.js - {"bracketSpacing":false} [meriyah] format 1`] = `
|
exports[`dynamic-import.js - {"bracketSpacing":false} [meriyah] format 1`] = `
|
||||||
"Expected ')' (1:20)
|
"Expected ')' (1:20)
|
||||||
> 1 | import(\\"./foo.json\\", { assert: { type: \\"json\\" } });
|
> 1 | import("./foo.json", { assert: { type: "json" } });
|
||||||
| ^
|
| ^
|
||||||
2 |"
|
2 |"
|
||||||
`;
|
`;
|
||||||
@@ -38,19 +38,19 @@ import("./foo.json", {assert: {type: "json"}});
|
|||||||
|
|
||||||
exports[`empty.js - {"bracketSpacing":false} [acorn] format 1`] = `
|
exports[`empty.js - {"bracketSpacing":false} [acorn] format 1`] = `
|
||||||
"Unexpected token (1:33)
|
"Unexpected token (1:33)
|
||||||
> 1 | export * as bar from \\"bar.json\\" assert { }
|
> 1 | export * as bar from "bar.json" assert { }
|
||||||
| ^"
|
| ^"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`empty.js - {"bracketSpacing":false} [espree] format 1`] = `
|
exports[`empty.js - {"bracketSpacing":false} [espree] format 1`] = `
|
||||||
"Unexpected token assert (1:33)
|
"Unexpected token assert (1:33)
|
||||||
> 1 | export * as bar from \\"bar.json\\" assert { }
|
> 1 | export * as bar from "bar.json" assert { }
|
||||||
| ^"
|
| ^"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`empty.js - {"bracketSpacing":false} [meriyah] format 1`] = `
|
exports[`empty.js - {"bracketSpacing":false} [meriyah] format 1`] = `
|
||||||
"Unexpected token: 'identifier' (1:38)
|
"Unexpected token: 'identifier' (1:38)
|
||||||
> 1 | export * as bar from \\"bar.json\\" assert { }
|
> 1 | export * as bar from "bar.json" assert { }
|
||||||
| ^"
|
| ^"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
@@ -70,21 +70,21 @@ export * as bar from "bar.json";
|
|||||||
|
|
||||||
exports[`re-export.js - {"bracketSpacing":false} [acorn] format 1`] = `
|
exports[`re-export.js - {"bracketSpacing":false} [acorn] format 1`] = `
|
||||||
"Unexpected token (1:33)
|
"Unexpected token (1:33)
|
||||||
> 1 | export { foo2 } from \\"foo.json\\" assert { type: \\"json\\" };
|
> 1 | export { foo2 } from "foo.json" assert { type: "json" };
|
||||||
| ^
|
| ^
|
||||||
2 |"
|
2 |"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`re-export.js - {"bracketSpacing":false} [espree] format 1`] = `
|
exports[`re-export.js - {"bracketSpacing":false} [espree] format 1`] = `
|
||||||
"Unexpected token assert (1:33)
|
"Unexpected token assert (1:33)
|
||||||
> 1 | export { foo2 } from \\"foo.json\\" assert { type: \\"json\\" };
|
> 1 | export { foo2 } from "foo.json" assert { type: "json" };
|
||||||
| ^
|
| ^
|
||||||
2 |"
|
2 |"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`re-export.js - {"bracketSpacing":false} [meriyah] format 1`] = `
|
exports[`re-export.js - {"bracketSpacing":false} [meriyah] format 1`] = `
|
||||||
"Unexpected token: 'identifier' (1:38)
|
"Unexpected token: 'identifier' (1:38)
|
||||||
> 1 | export { foo2 } from \\"foo.json\\" assert { type: \\"json\\" };
|
> 1 | export { foo2 } from "foo.json" assert { type: "json" };
|
||||||
| ^
|
| ^
|
||||||
2 |"
|
2 |"
|
||||||
`;
|
`;
|
||||||
@@ -106,21 +106,21 @@ export {foo2} from "foo.json" assert {type: "json"};
|
|||||||
|
|
||||||
exports[`static-import.js - {"bracketSpacing":false} [acorn] format 1`] = `
|
exports[`static-import.js - {"bracketSpacing":false} [acorn] format 1`] = `
|
||||||
"Unexpected token (1:31)
|
"Unexpected token (1:31)
|
||||||
> 1 | import json from \\"./foo.json\\" assert { type: \\"json\\" };
|
> 1 | import json from "./foo.json" assert { type: "json" };
|
||||||
| ^
|
| ^
|
||||||
2 |"
|
2 |"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`static-import.js - {"bracketSpacing":false} [espree] format 1`] = `
|
exports[`static-import.js - {"bracketSpacing":false} [espree] format 1`] = `
|
||||||
"Unexpected token assert (1:31)
|
"Unexpected token assert (1:31)
|
||||||
> 1 | import json from \\"./foo.json\\" assert { type: \\"json\\" };
|
> 1 | import json from "./foo.json" assert { type: "json" };
|
||||||
| ^
|
| ^
|
||||||
2 |"
|
2 |"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`static-import.js - {"bracketSpacing":false} [meriyah] format 1`] = `
|
exports[`static-import.js - {"bracketSpacing":false} [meriyah] format 1`] = `
|
||||||
"Unexpected token: 'identifier' (1:36)
|
"Unexpected token: 'identifier' (1:36)
|
||||||
> 1 | import json from \\"./foo.json\\" assert { type: \\"json\\" };
|
> 1 | import json from "./foo.json" assert { type: "json" };
|
||||||
| ^
|
| ^
|
||||||
2 |"
|
2 |"
|
||||||
`;
|
`;
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ exports[`comments.js [acorn] format 1`] = `
|
|||||||
> 1 | const m = /*A1*/ module /*A2*/ { /*A3*/
|
> 1 | const m = /*A1*/ module /*A2*/ { /*A3*/
|
||||||
| ^
|
| ^
|
||||||
2 | /*A4*/
|
2 | /*A4*/
|
||||||
3 | export const foo = \\"foo\\";
|
3 | export const foo = "foo";
|
||||||
4 | export { foo }; /*A5*/"
|
4 | export { foo }; /*A5*/"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
@@ -14,7 +14,7 @@ exports[`comments.js [espree] format 1`] = `
|
|||||||
> 1 | const m = /*A1*/ module /*A2*/ { /*A3*/
|
> 1 | const m = /*A1*/ module /*A2*/ { /*A3*/
|
||||||
| ^
|
| ^
|
||||||
2 | /*A4*/
|
2 | /*A4*/
|
||||||
3 | export const foo = \\"foo\\";
|
3 | export const foo = "foo";
|
||||||
4 | export { foo }; /*A5*/"
|
4 | export { foo }; /*A5*/"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
@@ -23,7 +23,7 @@ exports[`comments.js [meriyah] format 1`] = `
|
|||||||
> 1 | const m = /*A1*/ module /*A2*/ { /*A3*/
|
> 1 | const m = /*A1*/ module /*A2*/ { /*A3*/
|
||||||
| ^
|
| ^
|
||||||
2 | /*A4*/
|
2 | /*A4*/
|
||||||
3 | export const foo = \\"foo\\";
|
3 | export const foo = "foo";
|
||||||
4 | export { foo }; /*A5*/"
|
4 | export { foo }; /*A5*/"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
@@ -211,7 +211,7 @@ exports[`range.js [acorn] format 1`] = `
|
|||||||
| ^
|
| ^
|
||||||
2 | };
|
2 | };
|
||||||
3 |
|
3 |
|
||||||
4 | foo(module { export let foo = \\"foo\\"; })"
|
4 | foo(module { export let foo = "foo"; })"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`range.js [espree] format 1`] = `
|
exports[`range.js [espree] format 1`] = `
|
||||||
@@ -220,7 +220,7 @@ exports[`range.js [espree] format 1`] = `
|
|||||||
| ^
|
| ^
|
||||||
2 | };
|
2 | };
|
||||||
3 |
|
3 |
|
||||||
4 | foo(module { export let foo = \\"foo\\"; })"
|
4 | foo(module { export let foo = "foo"; })"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`range.js [meriyah] format 1`] = `
|
exports[`range.js [meriyah] format 1`] = `
|
||||||
@@ -229,7 +229,7 @@ exports[`range.js [meriyah] format 1`] = `
|
|||||||
| ^
|
| ^
|
||||||
2 | };
|
2 | };
|
||||||
3 |
|
3 |
|
||||||
4 | foo(module { export let foo = \\"foo\\"; })"
|
4 | foo(module { export let foo = "foo"; })"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`range.js format 1`] = `
|
exports[`range.js format 1`] = `
|
||||||
|
|||||||
@@ -2,11 +2,11 @@
|
|||||||
|
|
||||||
exports[`module-string-names-export.js [meriyah] format 1`] = `
|
exports[`module-string-names-export.js [meriyah] format 1`] = `
|
||||||
"Only a identifier can be used to indicate alias (1:26)
|
"Only a identifier can be used to indicate alias (1:26)
|
||||||
> 1 | export { smile as \\"smile1\\" } from \\"./emojis.js\\";
|
> 1 | export { smile as "smile1" } from "./emojis.js";
|
||||||
| ^
|
| ^
|
||||||
2 | export { \\"smile\\" as smile2 } from \\"./emojis.js\\";
|
2 | export { "smile" as smile2 } from "./emojis.js";
|
||||||
3 | export { \\"smile\\" as \\"smile3\\" } from \\"./emojis.js\\";
|
3 | export { "smile" as "smile3" } from "./emojis.js";
|
||||||
4 | export { foo1, bar as \\"foo2\\" } from \\"./emojis.js\\";"
|
4 | export { foo1, bar as "foo2" } from "./emojis.js";"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`module-string-names-export.js format 1`] = `
|
exports[`module-string-names-export.js format 1`] = `
|
||||||
@@ -38,10 +38,10 @@ export { "smile4" } from "./emojis.js";
|
|||||||
|
|
||||||
exports[`module-string-names-import.js [meriyah] format 1`] = `
|
exports[`module-string-names-import.js [meriyah] format 1`] = `
|
||||||
"Expected '}' (1:18)
|
"Expected '}' (1:18)
|
||||||
> 1 | import { \\"default\\" as quotation1 } from \\"Confucius\\";
|
> 1 | import { "default" as quotation1 } from "Confucius";
|
||||||
| ^
|
| ^
|
||||||
2 | import { \\"foo\\" as bar, \\"default\\" as qux } from \\"module-a\\";
|
2 | import { "foo" as bar, "default" as qux } from "module-a";
|
||||||
3 | import { \\"學而時習之,不亦說乎?\\" as quotation2 } from \\"Confucius\\";
|
3 | import { "學而時習之,不亦說乎?" as quotation2 } from "Confucius";
|
||||||
4 |"
|
4 |"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
|||||||
@@ -2,53 +2,53 @@
|
|||||||
|
|
||||||
exports[`text.js [acorn] format 1`] = `
|
exports[`text.js [acorn] format 1`] = `
|
||||||
"Bad escape sequence in untagged template literal (6:18)
|
"Bad escape sequence in untagged template literal (6:18)
|
||||||
4 | foo = markdown\`\\\\u{prettier}\\\\u{0065}\`;
|
4 | foo = markdown\`\\u{prettier}\\u{0065}\`;
|
||||||
5 | foo = css\`\\\\u{prettier}\\\\u{0065}\`;
|
5 | foo = css\`\\u{prettier}\\u{0065}\`;
|
||||||
> 6 | foo = /* HTML */\`\\\\u{prettier}\\\\u{0065}\`;
|
> 6 | foo = /* HTML */\`\\u{prettier}\\u{0065}\`;
|
||||||
| ^
|
| ^
|
||||||
7 | foo = /* GraphQL */\`\\\\u{prettier}\\\\u{0065}\`;
|
7 | foo = /* GraphQL */\`\\u{prettier}\\u{0065}\`;
|
||||||
8 |
|
8 |
|
||||||
9 | foo = foo\`\\\\u{prettier}\${foo}pr\\\\u{0065}ttier\`;"
|
9 | foo = foo\`\\u{prettier}\${foo}pr\\u{0065}ttier\`;"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`text.js [espree] format 1`] = `
|
exports[`text.js [espree] format 1`] = `
|
||||||
"Bad escape sequence in untagged template literal (6:18)
|
"Bad escape sequence in untagged template literal (6:18)
|
||||||
4 | foo = markdown\`\\\\u{prettier}\\\\u{0065}\`;
|
4 | foo = markdown\`\\u{prettier}\\u{0065}\`;
|
||||||
5 | foo = css\`\\\\u{prettier}\\\\u{0065}\`;
|
5 | foo = css\`\\u{prettier}\\u{0065}\`;
|
||||||
> 6 | foo = /* HTML */\`\\\\u{prettier}\\\\u{0065}\`;
|
> 6 | foo = /* HTML */\`\\u{prettier}\\u{0065}\`;
|
||||||
| ^
|
| ^
|
||||||
7 | foo = /* GraphQL */\`\\\\u{prettier}\\\\u{0065}\`;
|
7 | foo = /* GraphQL */\`\\u{prettier}\\u{0065}\`;
|
||||||
8 |
|
8 |
|
||||||
9 | foo = foo\`\\\\u{prettier}\${foo}pr\\\\u{0065}ttier\`;"
|
9 | foo = foo\`\\u{prettier}\${foo}pr\\u{0065}ttier\`;"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`text.js [flow] format 1`] = `
|
exports[`text.js [flow] format 1`] = `
|
||||||
"Unexpected token ILLEGAL (1:12)
|
"Unexpected token ILLEGAL (1:12)
|
||||||
> 1 | foo = foo\`\\\\u{prettier}\\\\u{0065}\`;
|
> 1 | foo = foo\`\\u{prettier}\\u{0065}\`;
|
||||||
| ^
|
| ^
|
||||||
2 | foo = html\`\\\\u{prettier}\\\\u{0065}\`;
|
2 | foo = html\`\\u{prettier}\\u{0065}\`;
|
||||||
3 | foo = graphql\`\\\\u{prettier}\\\\u{0065}\`;
|
3 | foo = graphql\`\\u{prettier}\\u{0065}\`;
|
||||||
4 | foo = markdown\`\\\\u{prettier}\\\\u{0065}\`;"
|
4 | foo = markdown\`\\u{prettier}\\u{0065}\`;"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`text.js [meriyah] format 1`] = `
|
exports[`text.js [meriyah] format 1`] = `
|
||||||
"Invalid hexadecimal escape sequence (6:20)
|
"Invalid hexadecimal escape sequence (6:20)
|
||||||
4 | foo = markdown\`\\\\u{prettier}\\\\u{0065}\`;
|
4 | foo = markdown\`\\u{prettier}\\u{0065}\`;
|
||||||
5 | foo = css\`\\\\u{prettier}\\\\u{0065}\`;
|
5 | foo = css\`\\u{prettier}\\u{0065}\`;
|
||||||
> 6 | foo = /* HTML */\`\\\\u{prettier}\\\\u{0065}\`;
|
> 6 | foo = /* HTML */\`\\u{prettier}\\u{0065}\`;
|
||||||
| ^
|
| ^
|
||||||
7 | foo = /* GraphQL */\`\\\\u{prettier}\\\\u{0065}\`;
|
7 | foo = /* GraphQL */\`\\u{prettier}\\u{0065}\`;
|
||||||
8 |
|
8 |
|
||||||
9 | foo = foo\`\\\\u{prettier}\${foo}pr\\\\u{0065}ttier\`;"
|
9 | foo = foo\`\\u{prettier}\${foo}pr\\u{0065}ttier\`;"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`text.js [typescript] format 1`] = `
|
exports[`text.js [typescript] format 1`] = `
|
||||||
"Hexadecimal digit expected. (1:14)
|
"Hexadecimal digit expected. (1:14)
|
||||||
> 1 | foo = foo\`\\\\u{prettier}\\\\u{0065}\`;
|
> 1 | foo = foo\`\\u{prettier}\\u{0065}\`;
|
||||||
| ^
|
| ^
|
||||||
2 | foo = html\`\\\\u{prettier}\\\\u{0065}\`;
|
2 | foo = html\`\\u{prettier}\\u{0065}\`;
|
||||||
3 | foo = graphql\`\\\\u{prettier}\\\\u{0065}\`;
|
3 | foo = graphql\`\\u{prettier}\\u{0065}\`;
|
||||||
4 | foo = markdown\`\\\\u{prettier}\\\\u{0065}\`;"
|
4 | foo = markdown\`\\u{prettier}\\u{0065}\`;"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`text.js format 1`] = `
|
exports[`text.js format 1`] = `
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
exports[`computed.js [acorn] format 1`] = `
|
exports[`computed.js [acorn] format 1`] = `
|
||||||
"Unexpected character '{' (2:9)
|
"Unexpected character '{' (2:9)
|
||||||
1 | const key = \\"a\\";
|
1 | const key = "a";
|
||||||
> 2 | assert(#{ [key]: 1 } === #{ a: 1 })
|
> 2 | assert(#{ [key]: 1 } === #{ a: 1 })
|
||||||
| ^
|
| ^
|
||||||
3 | assert(#{ [key.toUpperCase()]: 1 } === #{ A: 1 })
|
3 | assert(#{ [key.toUpperCase()]: 1 } === #{ A: 1 })
|
||||||
@@ -12,7 +12,7 @@ exports[`computed.js [acorn] format 1`] = `
|
|||||||
|
|
||||||
exports[`computed.js [espree] format 1`] = `
|
exports[`computed.js [espree] format 1`] = `
|
||||||
"Unexpected character '{' (2:9)
|
"Unexpected character '{' (2:9)
|
||||||
1 | const key = \\"a\\";
|
1 | const key = "a";
|
||||||
> 2 | assert(#{ [key]: 1 } === #{ a: 1 })
|
> 2 | assert(#{ [key]: 1 } === #{ a: 1 })
|
||||||
| ^
|
| ^
|
||||||
3 | assert(#{ [key.toUpperCase()]: 1 } === #{ A: 1 })
|
3 | assert(#{ [key.toUpperCase()]: 1 } === #{ A: 1 })
|
||||||
@@ -22,7 +22,7 @@ exports[`computed.js [espree] format 1`] = `
|
|||||||
|
|
||||||
exports[`computed.js [meriyah] format 1`] = `
|
exports[`computed.js [meriyah] format 1`] = `
|
||||||
"'#' not followed by identifier (2:8)
|
"'#' not followed by identifier (2:8)
|
||||||
1 | const key = \\"a\\";
|
1 | const key = "a";
|
||||||
> 2 | assert(#{ [key]: 1 } === #{ a: 1 })
|
> 2 | assert(#{ [key]: 1 } === #{ a: 1 })
|
||||||
| ^
|
| ^
|
||||||
3 | assert(#{ [key.toUpperCase()]: 1 } === #{ A: 1 })
|
3 | assert(#{ [key.toUpperCase()]: 1 } === #{ A: 1 })
|
||||||
@@ -190,7 +190,7 @@ assert(record1.d?.a === undefined);
|
|||||||
|
|
||||||
exports[`shorthand.js [acorn] format 1`] = `
|
exports[`shorthand.js [acorn] format 1`] = `
|
||||||
"Unexpected character '{' (2:17)
|
"Unexpected character '{' (2:17)
|
||||||
1 | const url = \\"https://github.com/tc39/proposal-record-tuple\\";
|
1 | const url = "https://github.com/tc39/proposal-record-tuple";
|
||||||
> 2 | const record = #{ url }
|
> 2 | const record = #{ url }
|
||||||
| ^
|
| ^
|
||||||
3 | console.log(record.url) // https://github.com/tc39/proposal-record-tuple
|
3 | console.log(record.url) // https://github.com/tc39/proposal-record-tuple
|
||||||
@@ -199,7 +199,7 @@ exports[`shorthand.js [acorn] format 1`] = `
|
|||||||
|
|
||||||
exports[`shorthand.js [espree] format 1`] = `
|
exports[`shorthand.js [espree] format 1`] = `
|
||||||
"Unexpected character '{' (2:17)
|
"Unexpected character '{' (2:17)
|
||||||
1 | const url = \\"https://github.com/tc39/proposal-record-tuple\\";
|
1 | const url = "https://github.com/tc39/proposal-record-tuple";
|
||||||
> 2 | const record = #{ url }
|
> 2 | const record = #{ url }
|
||||||
| ^
|
| ^
|
||||||
3 | console.log(record.url) // https://github.com/tc39/proposal-record-tuple
|
3 | console.log(record.url) // https://github.com/tc39/proposal-record-tuple
|
||||||
@@ -208,7 +208,7 @@ exports[`shorthand.js [espree] format 1`] = `
|
|||||||
|
|
||||||
exports[`shorthand.js [meriyah] format 1`] = `
|
exports[`shorthand.js [meriyah] format 1`] = `
|
||||||
"'#' not followed by identifier (2:16)
|
"'#' not followed by identifier (2:16)
|
||||||
1 | const url = \\"https://github.com/tc39/proposal-record-tuple\\";
|
1 | const url = "https://github.com/tc39/proposal-record-tuple";
|
||||||
> 2 | const record = #{ url }
|
> 2 | const record = #{ url }
|
||||||
| ^
|
| ^
|
||||||
3 | console.log(record.url) // https://github.com/tc39/proposal-record-tuple
|
3 | console.log(record.url) // https://github.com/tc39/proposal-record-tuple
|
||||||
@@ -235,28 +235,28 @@ console.log(record.url); // https://github.com/tc39/proposal-record-tuple
|
|||||||
|
|
||||||
exports[`spread.js [acorn] format 1`] = `
|
exports[`spread.js [acorn] format 1`] = `
|
||||||
"Unexpected character '{' (1:19)
|
"Unexpected character '{' (1:19)
|
||||||
> 1 | const formData = #{ title: \\"Implement all the things\\" }
|
> 1 | const formData = #{ title: "Implement all the things" }
|
||||||
| ^
|
| ^
|
||||||
2 | const taskNow = #{ id: 42, status: \\"WIP\\", ...formData }
|
2 | const taskNow = #{ id: 42, status: "WIP", ...formData }
|
||||||
3 | const taskLater = #{ ...taskNow, status: \\"DONE\\" }
|
3 | const taskLater = #{ ...taskNow, status: "DONE" }
|
||||||
4 |"
|
4 |"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`spread.js [espree] format 1`] = `
|
exports[`spread.js [espree] format 1`] = `
|
||||||
"Unexpected character '{' (1:19)
|
"Unexpected character '{' (1:19)
|
||||||
> 1 | const formData = #{ title: \\"Implement all the things\\" }
|
> 1 | const formData = #{ title: "Implement all the things" }
|
||||||
| ^
|
| ^
|
||||||
2 | const taskNow = #{ id: 42, status: \\"WIP\\", ...formData }
|
2 | const taskNow = #{ id: 42, status: "WIP", ...formData }
|
||||||
3 | const taskLater = #{ ...taskNow, status: \\"DONE\\" }
|
3 | const taskLater = #{ ...taskNow, status: "DONE" }
|
||||||
4 |"
|
4 |"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`spread.js [meriyah] format 1`] = `
|
exports[`spread.js [meriyah] format 1`] = `
|
||||||
"'#' not followed by identifier (1:18)
|
"'#' not followed by identifier (1:18)
|
||||||
> 1 | const formData = #{ title: \\"Implement all the things\\" }
|
> 1 | const formData = #{ title: "Implement all the things" }
|
||||||
| ^
|
| ^
|
||||||
2 | const taskNow = #{ id: 42, status: \\"WIP\\", ...formData }
|
2 | const taskNow = #{ id: 42, status: "WIP", ...formData }
|
||||||
3 | const taskLater = #{ ...taskNow, status: \\"DONE\\" }
|
3 | const taskLater = #{ ...taskNow, status: "DONE" }
|
||||||
4 |"
|
4 |"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
|||||||
@@ -4,44 +4,44 @@ exports[`non-octal-eight-and-nine.js [acorn] format 1`] = `
|
|||||||
"Invalid escape sequence (3:3)
|
"Invalid escape sequence (3:3)
|
||||||
1 | // https://github.com/babel/babel/pull/11852
|
1 | // https://github.com/babel/babel/pull/11852
|
||||||
2 |
|
2 |
|
||||||
> 3 | \\"\\\\8\\",\\"\\\\9\\";
|
> 3 | "\\8","\\9";
|
||||||
| ^
|
| ^
|
||||||
4 | () => {
|
4 | () => {
|
||||||
5 | \\"use strict\\";
|
5 | "use strict";
|
||||||
6 | \\"\\\\8\\", \\"\\\\9\\";"
|
6 | "\\8", "\\9";"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`non-octal-eight-and-nine.js [espree] format 1`] = `
|
exports[`non-octal-eight-and-nine.js [espree] format 1`] = `
|
||||||
"Invalid escape sequence (3:3)
|
"Invalid escape sequence (3:3)
|
||||||
1 | // https://github.com/babel/babel/pull/11852
|
1 | // https://github.com/babel/babel/pull/11852
|
||||||
2 |
|
2 |
|
||||||
> 3 | \\"\\\\8\\",\\"\\\\9\\";
|
> 3 | "\\8","\\9";
|
||||||
| ^
|
| ^
|
||||||
4 | () => {
|
4 | () => {
|
||||||
5 | \\"use strict\\";
|
5 | "use strict";
|
||||||
6 | \\"\\\\8\\", \\"\\\\9\\";"
|
6 | "\\8", "\\9";"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`non-octal-eight-and-nine.js - {"trailingComma":"all"} [acorn] format 1`] = `
|
exports[`non-octal-eight-and-nine.js - {"trailingComma":"all"} [acorn] format 1`] = `
|
||||||
"Invalid escape sequence (3:3)
|
"Invalid escape sequence (3:3)
|
||||||
1 | // https://github.com/babel/babel/pull/11852
|
1 | // https://github.com/babel/babel/pull/11852
|
||||||
2 |
|
2 |
|
||||||
> 3 | \\"\\\\8\\",\\"\\\\9\\";
|
> 3 | "\\8","\\9";
|
||||||
| ^
|
| ^
|
||||||
4 | () => {
|
4 | () => {
|
||||||
5 | \\"use strict\\";
|
5 | "use strict";
|
||||||
6 | \\"\\\\8\\", \\"\\\\9\\";"
|
6 | "\\8", "\\9";"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`non-octal-eight-and-nine.js - {"trailingComma":"all"} [espree] format 1`] = `
|
exports[`non-octal-eight-and-nine.js - {"trailingComma":"all"} [espree] format 1`] = `
|
||||||
"Invalid escape sequence (3:3)
|
"Invalid escape sequence (3:3)
|
||||||
1 | // https://github.com/babel/babel/pull/11852
|
1 | // https://github.com/babel/babel/pull/11852
|
||||||
2 |
|
2 |
|
||||||
> 3 | \\"\\\\8\\",\\"\\\\9\\";
|
> 3 | "\\8","\\9";
|
||||||
| ^
|
| ^
|
||||||
4 | () => {
|
4 | () => {
|
||||||
5 | \\"use strict\\";
|
5 | "use strict";
|
||||||
6 | \\"\\\\8\\", \\"\\\\9\\";"
|
6 | "\\8", "\\9";"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`non-octal-eight-and-nine.js - {"trailingComma":"all"} format 1`] = `
|
exports[`non-octal-eight-and-nine.js - {"trailingComma":"all"} format 1`] = `
|
||||||
|
|||||||
@@ -2,29 +2,29 @@
|
|||||||
|
|
||||||
exports[`throw_expression.js [acorn] format 1`] = `
|
exports[`throw_expression.js [acorn] format 1`] = `
|
||||||
"Unexpected token (1:26)
|
"Unexpected token (1:26)
|
||||||
> 1 | function save(filename = throw new TypeError(\\"Argument required\\")) {}
|
> 1 | function save(filename = throw new TypeError("Argument required")) {}
|
||||||
| ^
|
| ^
|
||||||
2 |
|
2 |
|
||||||
3 | lint(ast, {
|
3 | lint(ast, {
|
||||||
4 | with: () => throw new Error(\\"avoid using 'with' statements.\\")"
|
4 | with: () => throw new Error("avoid using 'with' statements.")"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`throw_expression.js [espree] format 1`] = `
|
exports[`throw_expression.js [espree] format 1`] = `
|
||||||
"Unexpected token throw (1:26)
|
"Unexpected token throw (1:26)
|
||||||
> 1 | function save(filename = throw new TypeError(\\"Argument required\\")) {}
|
> 1 | function save(filename = throw new TypeError("Argument required")) {}
|
||||||
| ^
|
| ^
|
||||||
2 |
|
2 |
|
||||||
3 | lint(ast, {
|
3 | lint(ast, {
|
||||||
4 | with: () => throw new Error(\\"avoid using 'with' statements.\\")"
|
4 | with: () => throw new Error("avoid using 'with' statements.")"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`throw_expression.js [meriyah] format 1`] = `
|
exports[`throw_expression.js [meriyah] format 1`] = `
|
||||||
"Unexpected token: 'throw' (1:30)
|
"Unexpected token: 'throw' (1:30)
|
||||||
> 1 | function save(filename = throw new TypeError(\\"Argument required\\")) {}
|
> 1 | function save(filename = throw new TypeError("Argument required")) {}
|
||||||
| ^
|
| ^
|
||||||
2 |
|
2 |
|
||||||
3 | lint(ast, {
|
3 | lint(ast, {
|
||||||
4 | with: () => throw new Error(\\"avoid using 'with' statements.\\")"
|
4 | with: () => throw new Error("avoid using 'with' statements.")"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`throw_expression.js format 1`] = `
|
exports[`throw_expression.js format 1`] = `
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
exports[`trailing.js [acorn] format 1`] = `
|
exports[`trailing.js [acorn] format 1`] = `
|
||||||
"Unexpected token (1:8)
|
"Unexpected token (1:8)
|
||||||
> 1 | export type Result<T, V> = | { kind: \\"not-test-editor1\\" } | { kind: \\"not-test-editor2\\" };
|
> 1 | export type Result<T, V> = | { kind: "not-test-editor1" } | { kind: "not-test-editor2" };
|
||||||
| ^
|
| ^
|
||||||
2 |
|
2 |
|
||||||
3 | // Note: there are trailing whitespace in this file
|
3 | // Note: there are trailing whitespace in this file
|
||||||
@@ -11,7 +11,7 @@ exports[`trailing.js [acorn] format 1`] = `
|
|||||||
|
|
||||||
exports[`trailing.js [espree] format 1`] = `
|
exports[`trailing.js [espree] format 1`] = `
|
||||||
"Unexpected token type (1:8)
|
"Unexpected token type (1:8)
|
||||||
> 1 | export type Result<T, V> = | { kind: \\"not-test-editor1\\" } | { kind: \\"not-test-editor2\\" };
|
> 1 | export type Result<T, V> = | { kind: "not-test-editor1" } | { kind: "not-test-editor2" };
|
||||||
| ^
|
| ^
|
||||||
2 |
|
2 |
|
||||||
3 | // Note: there are trailing whitespace in this file
|
3 | // Note: there are trailing whitespace in this file
|
||||||
@@ -20,7 +20,7 @@ exports[`trailing.js [espree] format 1`] = `
|
|||||||
|
|
||||||
exports[`trailing.js [meriyah] format 1`] = `
|
exports[`trailing.js [meriyah] format 1`] = `
|
||||||
"Unexpected token: 'identifier' (1:11)
|
"Unexpected token: 'identifier' (1:11)
|
||||||
> 1 | export type Result<T, V> = | { kind: \\"not-test-editor1\\" } | { kind: \\"not-test-editor2\\" };
|
> 1 | export type Result<T, V> = | { kind: "not-test-editor1" } | { kind: "not-test-editor2" };
|
||||||
| ^
|
| ^
|
||||||
2 |
|
2 |
|
||||||
3 | // Note: there are trailing whitespace in this file
|
3 | // Note: there are trailing whitespace in this file
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ exports[`parenthesized-decorators-tagged-template.ts [babel-ts] format 1`] = `
|
|||||||
1 | class Test {
|
1 | class Test {
|
||||||
> 2 | @foo\`bar\`
|
> 2 | @foo\`bar\`
|
||||||
| ^
|
| ^
|
||||||
3 | text: string = \\"text\\"
|
3 | text: string = "text"
|
||||||
4 | }
|
4 | }
|
||||||
5 |"
|
5 |"
|
||||||
`;
|
`;
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||||
|
|
||||||
exports[`snippet: #0 [missing-comments] format 1`] = `"Comment \\"comment\\" was not printed. Please report this error!"`;
|
exports[`snippet: #0 [missing-comments] format 1`] = `"Comment "comment" was not printed. Please report this error!"`;
|
||||||
@@ -10,7 +10,7 @@ exports[`async-arrow-invalid.js [flow] format 1`] = `
|
|||||||
|
|
||||||
exports[`default-escaped.js [flow] format 1`] = `
|
exports[`default-escaped.js [flow] format 1`] = `
|
||||||
"Unexpected identifier, expected the token \`{\` (1:8)
|
"Unexpected identifier, expected the token \`{\` (1:8)
|
||||||
> 1 | export asyn\\\\u{63} from \\"async\\";
|
> 1 | export asyn\\u{63} from "async";
|
||||||
| ^^^^^^^^^^
|
| ^^^^^^^^^^
|
||||||
2 |"
|
2 |"
|
||||||
`;
|
`;
|
||||||
@@ -31,14 +31,14 @@ exports[`function-async.js [flow] format 1`] = `
|
|||||||
|
|
||||||
exports[`module-attributes-dynamic.js [flow] format 1`] = `
|
exports[`module-attributes-dynamic.js [flow] format 1`] = `
|
||||||
"Unexpected token \`,\`, expected the token \`)\` (1:18)
|
"Unexpected token \`,\`, expected the token \`)\` (1:18)
|
||||||
> 1 | import(\\"foo.json\\", { with: { type: \\"json\\" } })
|
> 1 | import("foo.json", { with: { type: "json" } })
|
||||||
| ^
|
| ^
|
||||||
2 |"
|
2 |"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`module-attributes-static.js [flow] format 1`] = `
|
exports[`module-attributes-static.js [flow] format 1`] = `
|
||||||
"Unexpected token \`with\`, expected the token \`;\` (1:28)
|
"Unexpected token \`with\`, expected the token \`;\` (1:28)
|
||||||
> 1 | import foo from \\"foo.json\\" with type: \\"json\\";
|
> 1 | import foo from "foo.json" with type: "json";
|
||||||
| ^^^^
|
| ^^^^
|
||||||
2 |"
|
2 |"
|
||||||
`;
|
`;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||||
|
|
||||||
exports[`type-interfaces.graphql [graphql] format 1`] = `
|
exports[`type-interfaces.graphql [graphql] format 1`] = `
|
||||||
"Syntax Error: Unexpected \\"|\\". (5:21)
|
"Syntax Error: Unexpected "|". (5:21)
|
||||||
3 | # which will break seperator detection added in #7305
|
3 | # which will break seperator detection added in #7305
|
||||||
4 |
|
4 |
|
||||||
> 5 | type A implements A | B {
|
> 5 | type A implements A | B {
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ exports[`snippet: #0 [acorn] format 1`] = `
|
|||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`snippet: #0 [babel] format 1`] = `
|
exports[`snippet: #0 [babel] format 1`] = `
|
||||||
"Unexpected token, expected \\"(\\" (1:5)
|
"Unexpected token, expected "(" (1:5)
|
||||||
> 1 | for each (a in b) {}
|
> 1 | for each (a in b) {}
|
||||||
| ^"
|
| ^"
|
||||||
`;
|
`;
|
||||||
@@ -19,7 +19,7 @@ exports[`snippet: #0 [babel] format 2`] = `
|
|||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`snippet: #0 [babel-flow] format 1`] = `
|
exports[`snippet: #0 [babel-flow] format 1`] = `
|
||||||
"Unexpected token, expected \\"(\\" (1:5)
|
"Unexpected token, expected "(" (1:5)
|
||||||
> 1 | for each (a in b) {}
|
> 1 | for each (a in b) {}
|
||||||
| ^"
|
| ^"
|
||||||
`;
|
`;
|
||||||
@@ -31,7 +31,7 @@ exports[`snippet: #0 [babel-flow] format 2`] = `
|
|||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`snippet: #0 [babel-ts] format 1`] = `
|
exports[`snippet: #0 [babel-ts] format 1`] = `
|
||||||
"Unexpected token, expected \\"(\\" (1:5)
|
"Unexpected token, expected "(" (1:5)
|
||||||
> 1 | for each (a in b) {}
|
> 1 | for each (a in b) {}
|
||||||
| ^"
|
| ^"
|
||||||
`;
|
`;
|
||||||
|
|||||||
@@ -13,42 +13,42 @@ exports[`html-like-comments.js [babel] format 1`] = `
|
|||||||
|
|
||||||
exports[`import-assertions-for-export-without-from.js [babel] format 1`] = `
|
exports[`import-assertions-for-export-without-from.js [babel] format 1`] = `
|
||||||
"Missing semicolon. (1:15)
|
"Missing semicolon. (1:15)
|
||||||
> 1 | export { foo } assert { type: \\"json\\" };
|
> 1 | export { foo } assert { type: "json" };
|
||||||
| ^
|
| ^
|
||||||
2 |"
|
2 |"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`import-assertions-with-parens.js [babel] format 1`] = `
|
exports[`import-assertions-with-parens.js [babel] format 1`] = `
|
||||||
"Unexpected token (1:19)
|
"Unexpected token (1:19)
|
||||||
> 1 | import \\"x\\" assert ({type: 'json'});
|
> 1 | import "x" assert ({type: 'json'});
|
||||||
| ^
|
| ^
|
||||||
2 |"
|
2 |"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`invalid-escape-in-identifier.js [babel] format 1`] = `
|
exports[`invalid-escape-in-identifier.js [babel] format 1`] = `
|
||||||
"Invalid Unicode escape. (1:7)
|
"Invalid Unicode escape. (1:7)
|
||||||
> 1 | const \\\\u{20} = 1
|
> 1 | const \\u{20} = 1
|
||||||
| ^
|
| ^
|
||||||
2 | const \\\\u{3000} = 1
|
2 | const \\u{3000} = 1
|
||||||
3 |"
|
3 |"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`invalid-escape-in-identifier-2.js [babel] format 1`] = `
|
exports[`invalid-escape-in-identifier-2.js [babel] format 1`] = `
|
||||||
"Expecting Unicode escape sequence \\\\uXXXX. (1:3)
|
"Expecting Unicode escape sequence \\uXXXX. (1:3)
|
||||||
> 1 | a\\\\ = a
|
> 1 | a\\ = a
|
||||||
| ^
|
| ^
|
||||||
2 |"
|
2 |"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`module-attributes.js [babel] format 1`] = `
|
exports[`module-attributes.js [babel] format 1`] = `
|
||||||
"Unexpected token, expected \\"(\\" (1:33)
|
"Unexpected token, expected "(" (1:33)
|
||||||
> 1 | import foo from \\"foo.json\\" with type: \\"json\\";
|
> 1 | import foo from "foo.json" with type: "json";
|
||||||
| ^
|
| ^
|
||||||
2 |"
|
2 |"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`no-for-in-init-concise-binary-in.js [babel] format 1`] = `
|
exports[`no-for-in-init-concise-binary-in.js [babel] format 1`] = `
|
||||||
"Unexpected token, expected \\")\\" (3:18)
|
"Unexpected token, expected ")" (3:18)
|
||||||
1 | // https://github.com/babel/babel/pull/11931
|
1 | // https://github.com/babel/babel/pull/11931
|
||||||
2 |
|
2 |
|
||||||
> 3 | for (() => x in y;;);
|
> 3 | for (() => x in y;;);
|
||||||
@@ -64,7 +64,7 @@ exports[`partial-template-strings.js [babel] format 1`] = `
|
|||||||
| ^
|
| ^
|
||||||
7 | name_not_found: \`'\${?}' not found.\`
|
7 | name_not_found: \`'\${?}' not found.\`
|
||||||
8 | };
|
8 | };
|
||||||
9 | Diagnostics.name_not_found(\\"foo\\"); // \\"'foo' not found.\\""
|
9 | Diagnostics.name_not_found("foo"); // "'foo' not found.""
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`snippet: #0 [babel] format 1`] = `
|
exports[`snippet: #0 [babel] format 1`] = `
|
||||||
|
|||||||
@@ -155,7 +155,7 @@ exports[`snippet: #4 [acorn] format 1`] = `
|
|||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`snippet: #4 [babel] format 1`] = `
|
exports[`snippet: #4 [babel] format 1`] = `
|
||||||
"Unexpected token, expected \\",\\" (1:22)
|
"Unexpected token, expected "," (1:22)
|
||||||
> 1 | async (a) => (await a!) ** 6;
|
> 1 | async (a) => (await a!) ** 6;
|
||||||
| ^"
|
| ^"
|
||||||
`;
|
`;
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ exports[`snippet: #0 [flow] format 1`] = `
|
|||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`snippet: #0 [meriyah] format 1`] = `
|
exports[`snippet: #0 [meriyah] format 1`] = `
|
||||||
"Identifier \\"let\\" disallowed as left-hand side expression in strict mode (1:9)
|
"Identifier "let" disallowed as left-hand side expression in strict mode (1:9)
|
||||||
> 1 | for (let.foo of []);
|
> 1 | for (let.foo of []);
|
||||||
| ^"
|
| ^"
|
||||||
`;
|
`;
|
||||||
@@ -91,7 +91,7 @@ exports[`snippet: #1 [flow] format 1`] = `
|
|||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`snippet: #1 [meriyah] format 1`] = `
|
exports[`snippet: #1 [meriyah] format 1`] = `
|
||||||
"Identifier \\"let\\" disallowed as left-hand side expression in strict mode (1:9)
|
"Identifier "let" disallowed as left-hand side expression in strict mode (1:9)
|
||||||
> 1 | for (let().bar of []);
|
> 1 | for (let().bar of []);
|
||||||
| ^"
|
| ^"
|
||||||
`;
|
`;
|
||||||
@@ -127,7 +127,7 @@ exports[`snippet: #2 [flow] format 1`] = `
|
|||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`snippet: #2 [meriyah] format 1`] = `
|
exports[`snippet: #2 [meriyah] format 1`] = `
|
||||||
"Identifier \\"let\\" disallowed as left-hand side expression in strict mode (1:10)
|
"Identifier "let" disallowed as left-hand side expression in strict mode (1:10)
|
||||||
> 1 | for (let\`\`.bar of []);
|
> 1 | for (let\`\`.bar of []);
|
||||||
| ^"
|
| ^"
|
||||||
`;
|
`;
|
||||||
|
|||||||
@@ -14,12 +14,12 @@ exports[`snippet: #0 [meriyah] format 1`] = `
|
|||||||
|
|
||||||
exports[`snippet: #1 [espree] format 1`] = `
|
exports[`snippet: #1 [espree] format 1`] = `
|
||||||
"The keyword 'interface' is reserved (1:8)
|
"The keyword 'interface' is reserved (1:8)
|
||||||
> 1 | import interface from \\"foo\\";
|
> 1 | import interface from "foo";
|
||||||
| ^"
|
| ^"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`snippet: #1 [meriyah] format 1`] = `
|
exports[`snippet: #1 [meriyah] format 1`] = `
|
||||||
"Unexpected strict mode reserved word (1:16)
|
"Unexpected strict mode reserved word (1:16)
|
||||||
> 1 | import interface from \\"foo\\";
|
> 1 | import interface from "foo";
|
||||||
| ^"
|
| ^"
|
||||||
`;
|
`;
|
||||||
@@ -20,91 +20,91 @@ exports[`snippet: #0 [json5] format 1`] = `
|
|||||||
|
|
||||||
exports[`snippet: #1 [json] format 1`] = `
|
exports[`snippet: #1 [json] format 1`] = `
|
||||||
"Computed key is not allowed in JSON. (1:3)
|
"Computed key is not allowed in JSON. (1:3)
|
||||||
> 1 | {[\\"foo\\"]:\\"bar\\"}
|
> 1 | {["foo"]:"bar"}
|
||||||
| ^^^^^"
|
| ^^^^^"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`snippet: #1 [json-stringify] format 1`] = `
|
exports[`snippet: #1 [json-stringify] format 1`] = `
|
||||||
"Computed key is not allowed in JSON. (1:3)
|
"Computed key is not allowed in JSON. (1:3)
|
||||||
> 1 | {[\\"foo\\"]:\\"bar\\"}
|
> 1 | {["foo"]:"bar"}
|
||||||
| ^^^^^"
|
| ^^^^^"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`snippet: #1 [json5] format 1`] = `
|
exports[`snippet: #1 [json5] format 1`] = `
|
||||||
"Computed key is not allowed in JSON. (1:3)
|
"Computed key is not allowed in JSON. (1:3)
|
||||||
> 1 | {[\\"foo\\"]:\\"bar\\"}
|
> 1 | {["foo"]:"bar"}
|
||||||
| ^^^^^"
|
| ^^^^^"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`snippet: #2 [json] format 1`] = `
|
exports[`snippet: #2 [json] format 1`] = `
|
||||||
"Operator '~' is not allowed in JSON. (1:9)
|
"Operator '~' is not allowed in JSON. (1:9)
|
||||||
> 1 | {\\"foo\\": ~1}
|
> 1 | {"foo": ~1}
|
||||||
| ^^"
|
| ^^"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`snippet: #2 [json-stringify] format 1`] = `
|
exports[`snippet: #2 [json-stringify] format 1`] = `
|
||||||
"Operator '~' is not allowed in JSON. (1:9)
|
"Operator '~' is not allowed in JSON. (1:9)
|
||||||
> 1 | {\\"foo\\": ~1}
|
> 1 | {"foo": ~1}
|
||||||
| ^^"
|
| ^^"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`snippet: #2 [json5] format 1`] = `
|
exports[`snippet: #2 [json5] format 1`] = `
|
||||||
"Operator '~' is not allowed in JSON. (1:9)
|
"Operator '~' is not allowed in JSON. (1:9)
|
||||||
> 1 | {\\"foo\\": ~1}
|
> 1 | {"foo": ~1}
|
||||||
| ^^"
|
| ^^"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`snippet: #3 [json] format 1`] = `
|
exports[`snippet: #3 [json] format 1`] = `
|
||||||
"'LogicalExpression' is not allowed in JSON. (1:9)
|
"'LogicalExpression' is not allowed in JSON. (1:9)
|
||||||
> 1 | {\\"foo\\": false || \\"bar\\"}
|
> 1 | {"foo": false || "bar"}
|
||||||
| ^^^^^^^^^^^^^^"
|
| ^^^^^^^^^^^^^^"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`snippet: #3 [json-stringify] format 1`] = `
|
exports[`snippet: #3 [json-stringify] format 1`] = `
|
||||||
"'LogicalExpression' is not allowed in JSON. (1:9)
|
"'LogicalExpression' is not allowed in JSON. (1:9)
|
||||||
> 1 | {\\"foo\\": false || \\"bar\\"}
|
> 1 | {"foo": false || "bar"}
|
||||||
| ^^^^^^^^^^^^^^"
|
| ^^^^^^^^^^^^^^"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`snippet: #3 [json5] format 1`] = `
|
exports[`snippet: #3 [json5] format 1`] = `
|
||||||
"'LogicalExpression' is not allowed in JSON. (1:9)
|
"'LogicalExpression' is not allowed in JSON. (1:9)
|
||||||
> 1 | {\\"foo\\": false || \\"bar\\"}
|
> 1 | {"foo": false || "bar"}
|
||||||
| ^^^^^^^^^^^^^^"
|
| ^^^^^^^^^^^^^^"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`snippet: #4 [json] format 1`] = `
|
exports[`snippet: #4 [json] format 1`] = `
|
||||||
"'ArrowFunctionExpression' is not allowed in JSON. (1:9)
|
"'ArrowFunctionExpression' is not allowed in JSON. (1:9)
|
||||||
> 1 | {\\"foo\\": () => {}}
|
> 1 | {"foo": () => {}}
|
||||||
| ^^^^^^^^"
|
| ^^^^^^^^"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`snippet: #4 [json-stringify] format 1`] = `
|
exports[`snippet: #4 [json-stringify] format 1`] = `
|
||||||
"'ArrowFunctionExpression' is not allowed in JSON. (1:9)
|
"'ArrowFunctionExpression' is not allowed in JSON. (1:9)
|
||||||
> 1 | {\\"foo\\": () => {}}
|
> 1 | {"foo": () => {}}
|
||||||
| ^^^^^^^^"
|
| ^^^^^^^^"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`snippet: #4 [json5] format 1`] = `
|
exports[`snippet: #4 [json5] format 1`] = `
|
||||||
"'ArrowFunctionExpression' is not allowed in JSON. (1:9)
|
"'ArrowFunctionExpression' is not allowed in JSON. (1:9)
|
||||||
> 1 | {\\"foo\\": () => {}}
|
> 1 | {"foo": () => {}}
|
||||||
| ^^^^^^^^"
|
| ^^^^^^^^"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`snippet: #5 [json] format 1`] = `
|
exports[`snippet: #5 [json] format 1`] = `
|
||||||
"Expecting Unicode escape sequence \\\\uXXXX. (1:10)
|
"Expecting Unicode escape sequence \\uXXXX. (1:10)
|
||||||
> 1 | packages\\\\the-hub\\\\cypress\\\\fixtures\\\\gridConfiguration.json
|
> 1 | packages\\the-hub\\cypress\\fixtures\\gridConfiguration.json
|
||||||
| ^"
|
| ^"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`snippet: #5 [json-stringify] format 1`] = `
|
exports[`snippet: #5 [json-stringify] format 1`] = `
|
||||||
"Expecting Unicode escape sequence \\\\uXXXX. (1:10)
|
"Expecting Unicode escape sequence \\uXXXX. (1:10)
|
||||||
> 1 | packages\\\\the-hub\\\\cypress\\\\fixtures\\\\gridConfiguration.json
|
> 1 | packages\\the-hub\\cypress\\fixtures\\gridConfiguration.json
|
||||||
| ^"
|
| ^"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`snippet: #5 [json5] format 1`] = `
|
exports[`snippet: #5 [json5] format 1`] = `
|
||||||
"Expecting Unicode escape sequence \\\\uXXXX. (1:10)
|
"Expecting Unicode escape sequence \\uXXXX. (1:10)
|
||||||
> 1 | packages\\\\the-hub\\\\cypress\\\\fixtures\\\\gridConfiguration.json
|
> 1 | packages\\the-hub\\cypress\\fixtures\\gridConfiguration.json
|
||||||
| ^"
|
| ^"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
@@ -401,21 +401,21 @@ exports[`snippet: #21 [json5] format 1`] = `
|
|||||||
|
|
||||||
exports[`snippet: #22 [json] format 1`] = `
|
exports[`snippet: #22 [json] format 1`] = `
|
||||||
"Unexpected token (2:1)
|
"Unexpected token (2:1)
|
||||||
1 | \\"use strict\\"
|
1 | "use strict"
|
||||||
> 2 | {}
|
> 2 | {}
|
||||||
| ^"
|
| ^"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`snippet: #22 [json-stringify] format 1`] = `
|
exports[`snippet: #22 [json-stringify] format 1`] = `
|
||||||
"Unexpected token (2:1)
|
"Unexpected token (2:1)
|
||||||
1 | \\"use strict\\"
|
1 | "use strict"
|
||||||
> 2 | {}
|
> 2 | {}
|
||||||
| ^"
|
| ^"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`snippet: #22 [json5] format 1`] = `
|
exports[`snippet: #22 [json5] format 1`] = `
|
||||||
"Unexpected token (2:1)
|
"Unexpected token (2:1)
|
||||||
1 | \\"use strict\\"
|
1 | "use strict"
|
||||||
> 2 | {}
|
> 2 | {}
|
||||||
| ^"
|
| ^"
|
||||||
`;
|
`;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
exports[`snippet: #0 [json-stringify] format 1`] = `
|
exports[`snippet: #0 [json-stringify] format 1`] = `
|
||||||
"Comment is not allowed in JSON. (1:1)
|
"Comment is not allowed in JSON. (1:1)
|
||||||
> 1 | /* comment */{\\"foo\\": 1}
|
> 1 | /* comment */{"foo": 1}
|
||||||
| ^^^^^^^^^^^^^"
|
| ^^^^^^^^^^^^^"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
@@ -10,11 +10,11 @@ exports[`snippet: #1 [json-stringify] format 1`] = `
|
|||||||
"Comment is not allowed in JSON. (1:1)
|
"Comment is not allowed in JSON. (1:1)
|
||||||
> 1 | // comment
|
> 1 | // comment
|
||||||
| ^^^^^^^^^^
|
| ^^^^^^^^^^
|
||||||
2 | {\\"foo\\": 1}"
|
2 | {"foo": 1}"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`snippet: #2 [json-stringify] format 1`] = `
|
exports[`snippet: #2 [json-stringify] format 1`] = `
|
||||||
"Comment is not allowed in JSON. (1:9)
|
"Comment is not allowed in JSON. (1:9)
|
||||||
> 1 | {\\"foo\\": /* comment */ 1}
|
> 1 | {"foo": /* comment */ 1}
|
||||||
| ^^^^^^^^^^^^^"
|
| ^^^^^^^^^^^^^"
|
||||||
`;
|
`;
|
||||||
@@ -14,7 +14,7 @@ exports[`inline-comment.less [less] format 1`] = `
|
|||||||
exports[`open-double-quote.less [less] format 1`] = `
|
exports[`open-double-quote.less [less] format 1`] = `
|
||||||
"CssSyntaxError: Unclosed string (2:17)
|
"CssSyntaxError: Unclosed string (2:17)
|
||||||
1 | a {
|
1 | a {
|
||||||
> 2 | background: url(\\"
|
> 2 | background: url("
|
||||||
| ^
|
| ^
|
||||||
3 | }
|
3 | }
|
||||||
4 |"
|
4 |"
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
exports[`default-escaped.ts [typescript] format 1`] = `
|
exports[`default-escaped.ts [typescript] format 1`] = `
|
||||||
"Declaration or statement expected. (1:1)
|
"Declaration or statement expected. (1:1)
|
||||||
> 1 | export asyn\\\\u{63} from \\"async\\";
|
> 1 | export asyn\\u{63} from "async";
|
||||||
| ^
|
| ^
|
||||||
2 |"
|
2 |"
|
||||||
`;
|
`;
|
||||||
@@ -25,7 +25,7 @@ exports[`invalid-jsx-1.ts [typescript] format 1`] = `
|
|||||||
|
|
||||||
exports[`module-attributes-static.ts [typescript] format 1`] = `
|
exports[`module-attributes-static.ts [typescript] format 1`] = `
|
||||||
"';' expected. (1:28)
|
"';' expected. (1:28)
|
||||||
> 1 | import foo from \\"foo.json\\" with type: \\"json\\";
|
> 1 | import foo from "foo.json" with type: "json";
|
||||||
| ^
|
| ^
|
||||||
2 |"
|
2 |"
|
||||||
`;
|
`;
|
||||||
@@ -52,25 +52,25 @@ exports[`snippet: #1 [typescript] format 1`] = `
|
|||||||
|
|
||||||
exports[`snippet: #2 [typescript] format 1`] = `
|
exports[`snippet: #2 [typescript] format 1`] = `
|
||||||
"':' expected. (1:21)
|
"':' expected. (1:21)
|
||||||
> 1 | let x3 = <div>{\\"foo\\"}}</div>;
|
> 1 | let x3 = <div>{"foo"}}</div>;
|
||||||
| ^"
|
| ^"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`snippet: #3 [typescript] format 1`] = `
|
exports[`snippet: #3 [typescript] format 1`] = `
|
||||||
"':' expected. (1:21)
|
"':' expected. (1:21)
|
||||||
> 1 | let x4 = <div>{\\"foo\\"}></div>;
|
> 1 | let x4 = <div>{"foo"}></div>;
|
||||||
| ^"
|
| ^"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`snippet: #4 [typescript] format 1`] = `
|
exports[`snippet: #4 [typescript] format 1`] = `
|
||||||
"Expression expected. (1:15)
|
"Expression expected. (1:15)
|
||||||
> 1 | let x5 = <div>}{\\"foo\\"}</div>;
|
> 1 | let x5 = <div>}{"foo"}</div>;
|
||||||
| ^"
|
| ^"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`snippet: #5 [typescript] format 1`] = `
|
exports[`snippet: #5 [typescript] format 1`] = `
|
||||||
"Expression expected. (1:15)
|
"Expression expected. (1:15)
|
||||||
> 1 | let x6 = <div>>{\\"foo\\"}</div>;
|
> 1 | let x6 = <div>>{"foo"}</div>;
|
||||||
| ^"
|
| ^"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||||
|
|
||||||
exports[`unclosed_tag.vue [vue] format 1`] = `
|
exports[`unclosed_tag.vue [vue] format 1`] = `
|
||||||
"Unexpected character \\"EOF\\" (2:1)
|
"Unexpected character "EOF" (2:1)
|
||||||
1 | <div
|
1 | <div
|
||||||
> 2 |
|
> 2 |
|
||||||
| ^"
|
| ^"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`unclosed_tag_in_template.vue [vue] format 1`] = `
|
exports[`unclosed_tag_in_template.vue [vue] format 1`] = `
|
||||||
"Unexpected character \\"/\\" (4:2)
|
"Unexpected character "/" (4:2)
|
||||||
2 | <p>Templates are formatted as well...
|
2 | <p>Templates are formatted as well...
|
||||||
3 | </
|
3 | </
|
||||||
> 4 | </template>
|
> 4 | </template>
|
||||||
@@ -17,12 +17,12 @@ exports[`unclosed_tag_in_template.vue [vue] format 1`] = `
|
|||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`upper-case.html [vue] format 1`] = `
|
exports[`upper-case.html [vue] format 1`] = `
|
||||||
"Void elements do not have end tags \\"Input\\" (8:21)
|
"Void elements do not have end tags "Input" (8:21)
|
||||||
6 | <div id=\\"app\\">
|
6 | <div id="app">
|
||||||
7 | <!-- when vue parse use for html, Input should not treat as component -->
|
7 | <!-- when vue parse use for html, Input should not treat as component -->
|
||||||
> 8 | <Input>{{value}}</Input>
|
> 8 | <Input>{{value}}</Input>
|
||||||
| ^^^^^^^^
|
| ^^^^^^^^
|
||||||
9 | </div>
|
9 | </div>
|
||||||
10 | </body>
|
10 | </body>
|
||||||
11 | <script src=\\"https://unpkg.com/vue/dist/vue.js\\"></script>"
|
11 | <script src="https://unpkg.com/vue/dist/vue.js"></script>"
|
||||||
`;
|
`;
|
||||||
@@ -117,6 +117,29 @@ printWidth: 80
|
|||||||
================================================================================
|
================================================================================
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
exports[`test.importmap format 1`] = `
|
||||||
|
====================================options=====================================
|
||||||
|
parsers: []
|
||||||
|
printWidth: 80
|
||||||
|
| printWidth
|
||||||
|
=====================================input======================================
|
||||||
|
{"imports": {
|
||||||
|
"prettier": "https://unpkg.com/prettier@2.6.2/esm/standalone.mjs",
|
||||||
|
"prettier/": "https://unpkg.com/prettier@2.6.2/"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
=====================================output=====================================
|
||||||
|
{
|
||||||
|
"imports": {
|
||||||
|
"prettier": "https://unpkg.com/prettier@2.6.2/esm/standalone.mjs",
|
||||||
|
"prettier/": "https://unpkg.com/prettier@2.6.2/"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
================================================================================
|
||||||
|
`;
|
||||||
|
|
||||||
exports[`test.js format 1`] = `
|
exports[`test.js format 1`] = `
|
||||||
====================================options=====================================
|
====================================options=====================================
|
||||||
parsers: []
|
parsers: []
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
{"imports": {
|
||||||
|
"prettier": "https://unpkg.com/prettier@2.6.2/esm/standalone.mjs",
|
||||||
|
"prettier/": "https://unpkg.com/prettier@2.6.2/"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -35,7 +35,7 @@ abstract class Bar {
|
|||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`constructor.ts [babel-ts] format 1`] = `
|
exports[`constructor.ts [babel-ts] format 1`] = `
|
||||||
"Unexpected token, expected \\",\\" (2:22)
|
"Unexpected token, expected "," (2:22)
|
||||||
1 | class foo {
|
1 | class foo {
|
||||||
> 2 | constructor(static a: number) {}
|
> 2 | constructor(static a: number) {}
|
||||||
| ^
|
| ^
|
||||||
@@ -351,7 +351,7 @@ interface AudioBufferList {
|
|||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`methods.ts [babel-ts] format 1`] = `
|
exports[`methods.ts [babel-ts] format 1`] = `
|
||||||
"Unexpected token, expected \\";\\" (6:10)
|
"Unexpected token, expected ";" (6:10)
|
||||||
4 |
|
4 |
|
||||||
5 | interface Iterable<T> {
|
5 | interface Iterable<T> {
|
||||||
> 6 | export [Symbol.iterator](): Iterator<T>;
|
> 6 | export [Symbol.iterator](): Iterator<T>;
|
||||||
|
|||||||
@@ -442,7 +442,7 @@ const;
|
|||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`errorOnInitializerInInterfaceProperty.ts [babel-ts] format 1`] = `
|
exports[`errorOnInitializerInInterfaceProperty.ts [babel-ts] format 1`] = `
|
||||||
"Unexpected token, expected \\";\\" (2:17)
|
"Unexpected token, expected ";" (2:17)
|
||||||
1 | interface Foo {
|
1 | interface Foo {
|
||||||
> 2 | bar: number = 5;
|
> 2 | bar: number = 5;
|
||||||
| ^
|
| ^
|
||||||
|
|||||||
@@ -153,7 +153,7 @@ class f7<> {
|
|||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`index-signature.ts [babel-ts] format 1`] = `
|
exports[`index-signature.ts [babel-ts] format 1`] = `
|
||||||
"Unexpected token, expected \\"]\\" (4:13)
|
"Unexpected token, expected "]" (4:13)
|
||||||
2 |
|
2 |
|
||||||
3 | type TwoParams = {
|
3 | type TwoParams = {
|
||||||
> 4 | [a: string, b: string]: string;
|
> 4 | [a: string, b: string]: string;
|
||||||
@@ -164,7 +164,7 @@ exports[`index-signature.ts [babel-ts] format 1`] = `
|
|||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`index-signature.ts - {"trailingComma":"all"} [babel-ts] format 1`] = `
|
exports[`index-signature.ts - {"trailingComma":"all"} [babel-ts] format 1`] = `
|
||||||
"Unexpected token, expected \\"]\\" (4:13)
|
"Unexpected token, expected "]" (4:13)
|
||||||
2 |
|
2 |
|
||||||
3 | type TwoParams = {
|
3 | type TwoParams = {
|
||||||
> 4 | [a: string, b: string]: string;
|
> 4 | [a: string, b: string]: string;
|
||||||
@@ -238,7 +238,7 @@ type TooLongSingleParam = {
|
|||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`index-signature.ts - {"trailingComma":"es5"} [babel-ts] format 1`] = `
|
exports[`index-signature.ts - {"trailingComma":"es5"} [babel-ts] format 1`] = `
|
||||||
"Unexpected token, expected \\"]\\" (4:13)
|
"Unexpected token, expected "]" (4:13)
|
||||||
2 |
|
2 |
|
||||||
3 | type TwoParams = {
|
3 | type TwoParams = {
|
||||||
> 4 | [a: string, b: string]: string;
|
> 4 | [a: string, b: string]: string;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||||
|
|
||||||
exports[`keywords.ts [babel-ts] format 1`] = `
|
exports[`keywords.ts [babel-ts] format 1`] = `
|
||||||
"Unexpected token, expected \\"{\\" (9:12)
|
"Unexpected token, expected "{" (9:12)
|
||||||
7 |
|
7 |
|
||||||
8 | // Apparently this parses :P
|
8 | // Apparently this parses :P
|
||||||
> 9 | export private public protected static readonly abstract async enum X { }
|
> 9 | export private public protected static readonly abstract async enum X { }
|
||||||
@@ -196,7 +196,7 @@ class G {
|
|||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`module.ts [babel-ts] format 1`] = `
|
exports[`module.ts [babel-ts] format 1`] = `
|
||||||
"Unexpected token, expected \\"{\\" (7:10)
|
"Unexpected token, expected "{" (7:10)
|
||||||
5 |
|
5 |
|
||||||
6 | // Apparently this parses :P
|
6 | // Apparently this parses :P
|
||||||
> 7 | export private public protected static readonly abstract async enum X { }
|
> 7 | export private public protected static readonly abstract async enum X { }
|
||||||
|
|||||||
@@ -0,0 +1,43 @@
|
|||||||
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||||
|
|
||||||
|
exports[`basic.vue format 1`] = `
|
||||||
|
====================================options=====================================
|
||||||
|
parsers: ["vue"]
|
||||||
|
printWidth: 80
|
||||||
|
| printWidth
|
||||||
|
=====================================input======================================
|
||||||
|
<script setup lang="ts">
|
||||||
|
let x = 1;
|
||||||
|
function log(...args) {
|
||||||
|
console.log(...args);
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div @click="if (x === 1 as number) { log('hello') } else { log('nonhello') };">{{ x }}</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
=====================================output=====================================
|
||||||
|
<script setup lang="ts">
|
||||||
|
let x = 1;
|
||||||
|
function log(...args) {
|
||||||
|
console.log(...args);
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div
|
||||||
|
@click="
|
||||||
|
if (x === (1 as number)) {
|
||||||
|
log('hello');
|
||||||
|
} else {
|
||||||
|
log('nonhello');
|
||||||
|
}
|
||||||
|
"
|
||||||
|
>
|
||||||
|
{{ x }}
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
================================================================================
|
||||||
|
`;
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
let x = 1;
|
||||||
|
function log(...args) {
|
||||||
|
console.log(...args);
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div @click="if (x === 1 as number) { log('hello') } else { log('nonhello') };">{{ x }}</div>
|
||||||
|
</template>
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
run_spec(__dirname, ["vue"]);
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||||
|
|
||||||
|
exports[`basic.vue format 1`] = `
|
||||||
|
====================================options=====================================
|
||||||
|
parsers: ["vue"]
|
||||||
|
printWidth: 80
|
||||||
|
| printWidth
|
||||||
|
=====================================input======================================
|
||||||
|
<template>
|
||||||
|
<p v-if="isFolder(file)">{{ ( file as mymodule.Folder ).deadline }}</p>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts"></script>
|
||||||
|
|
||||||
|
=====================================output=====================================
|
||||||
|
<template>
|
||||||
|
<p v-if="isFolder(file)">{{ (file as mymodule.Folder).deadline }}</p>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts"></script>
|
||||||
|
|
||||||
|
================================================================================
|
||||||
|
`;
|
||||||
|
|
||||||
|
exports[`not-working-with-non-ts-script.vue format 1`] = `
|
||||||
|
====================================options=====================================
|
||||||
|
parsers: ["vue"]
|
||||||
|
printWidth: 80
|
||||||
|
| printWidth
|
||||||
|
=====================================input======================================
|
||||||
|
<template>
|
||||||
|
<p v-if="isFolder(file)">{{ ( file as mymodule.Folder ).deadline }}</p>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script></script>
|
||||||
|
|
||||||
|
=====================================output=====================================
|
||||||
|
<template>
|
||||||
|
<p v-if="isFolder(file)">{{ ( file as mymodule.Folder ).deadline }}</p>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script></script>
|
||||||
|
|
||||||
|
================================================================================
|
||||||
|
`;
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
<template>
|
||||||
|
<p v-if="isFolder(file)">{{ ( file as mymodule.Folder ).deadline }}</p>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts"></script>
|
||||||
Loaded 100 of 142 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user