Merge branch 'main' into next
# Conflicts: # package.json # src/cli/index.js # tests/config/install-prettier.js # tests/format/yaml/block-literal/jsfmt.spec.js # tests/integration/__tests__/file-info.js # yarn.lock
This commit is contained in:
commit
52c9a20e2c
101 files changed
+15303
-1469
No files matched your search
@@ -42,6 +42,9 @@ module.exports = {
|
||||
"error",
|
||||
// `!foo === bar` and `!foo !== bar`
|
||||
'BinaryExpression[operator=/^[!=]==$/] > UnaryExpression.left[operator="!"]',
|
||||
// `(() => (foo ? bar : baz))()`
|
||||
// TODO: Remove this when https://github.com/sindresorhus/eslint-plugin-unicorn/issues/1730 get implemented
|
||||
'CallExpression[callee.type="ArrowFunctionExpression"][callee.body.type="ConditionalExpression"]',
|
||||
],
|
||||
"no-return-await": "error",
|
||||
"no-unneeded-ternary": "error",
|
||||
|
||||
@@ -10,7 +10,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ !github.event.issue.pull_request && startsWith(github.event.comment.body, 'Duplicate of ') }}
|
||||
steps:
|
||||
- uses: actions-cool/issues-helper@v2.5.0
|
||||
- uses: actions-cool/issues-helper@v3
|
||||
with:
|
||||
actions: "mark-duplicate"
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
@@ -37,7 +37,7 @@ jobs:
|
||||
# It should be the last step
|
||||
- name: Check Sizes
|
||||
if: ${{ github.event_name == 'pull_request' && startsWith(github.head_ref, 'dependabot/npm_and_yarn/') }}
|
||||
uses: preactjs/compressed-size-action@2.3.0
|
||||
uses: preactjs/compressed-size-action@2.4.0
|
||||
with:
|
||||
repo-token: "${{ secrets.GITHUB_TOKEN }}"
|
||||
pattern: "./dist/**/*"
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
#### Add `--no-plugin-search` to turn off plugin autoloading (#10274 by @fisker)
|
||||
|
||||
To turn off plugin autoloading, use `--no-plugin-search` when using Prettier CLI or add `{ pluginSearchDirs: false }` to options in `prettier.format()` or to the config file.
|
||||
|
||||
<!-- prettier-ignore -->
|
||||
```cli
|
||||
// Prettier stable
|
||||
$ prettier . --plugin-search-dir=a-dir-without-plugins
|
||||
|
||||
// Prettier main
|
||||
$ prettier . --no-plugin-search
|
||||
```
|
||||
@@ -0,0 +1,3 @@
|
||||
#### Infer parser for `.swcrc` (#12320 by @sosukesuzuki)
|
||||
|
||||
A [`.swcrc`](https://swc.rs/docs/configuration/swcrc) is handled using `json` parser.
|
||||
@@ -0,0 +1,16 @@
|
||||
#### Support Unicode Set Notation proposal (#12241 by @fisker)
|
||||
|
||||
Support [Stage 3 proposal Unicode Set Notation](https://github.com/tc39/proposal-regexp-set-notation/) via [Babel 7.17.0](https://babeljs.io/blog/2022/02/02/7.17.0).
|
||||
|
||||
See [the release blog post of Babel v7.17.0](https://babeljs.io/blog/2022/02/02/7.17.0#regexp-set-notation-and-properties-of-strings-14125httpsgithubcombabelbabelpull14125) and [the README of this proposal](https://github.com/tc39/proposal-regexp-set-notation/) for details.
|
||||
|
||||
<!-- prettier-ignore -->
|
||||
```jsx
|
||||
// Examples
|
||||
|
||||
/[\p{Decimal_Number}--[0-9]]/v; // Non-ASCII decimal digits
|
||||
|
||||
"Did you see the 👩🏿❤️💋👩🏾 emoji?".match(/\p{RGI_Emoji}/v). // ["👩🏿❤️💋👩🏾"]
|
||||
|
||||
/[\r\n\q{\r\n|NEWLINE}]/v; // Matches \r, \n, \r\n or NEWLINE
|
||||
```
|
||||
@@ -0,0 +1,15 @@
|
||||
#### Support destructuring private proposal (#12276 by @sosukesuzuki)
|
||||
|
||||
Support [Stage 2 TC39 proposal destructuring private fields](https://github.com/tc39/proposal-destructuring-private) via [Babel 7.17](https://babeljs.io/blog/2022/02/02/7.17.0).
|
||||
|
||||
<!-- prettier-ignore -->
|
||||
```jsx
|
||||
// Example
|
||||
class Foo {
|
||||
constructor() {
|
||||
console.log(this.#x); // => 1
|
||||
const { #x: x } = this;
|
||||
console.log(x); // => 1
|
||||
}
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,15 @@
|
||||
#### Fix unexpected deletion of block-literal lines which starts with U+3000 (#12305 by @Quramy)
|
||||
|
||||
<!-- prettier-ignore -->
|
||||
```yaml
|
||||
# Input
|
||||
block_with_ideographic_space: |
|
||||
line-content # This line starts with U+3000
|
||||
|
||||
# Prettier stable
|
||||
block_with_ideographic_space: |
|
||||
|
||||
// Prettier main
|
||||
block_with_ideographic_space: |
|
||||
line-content # This line starts with U+3000
|
||||
```
|
||||
@@ -309,6 +309,7 @@
|
||||
"suchipi",
|
||||
"supertypes",
|
||||
"Supprimer",
|
||||
"swcrc",
|
||||
"templating",
|
||||
"tempy",
|
||||
"testname",
|
||||
|
||||
@@ -200,3 +200,7 @@ $ prettier "**/*" --write --ignore-unknown
|
||||
## `--no-error-on-unmatched-pattern`
|
||||
|
||||
Prevent errors when pattern is unmatched.
|
||||
|
||||
## `--no-plugin-search`
|
||||
|
||||
Disable plugin autoloading.
|
||||
+1
-1
@@ -46,7 +46,7 @@ The paths that are provided to `pluginSearchDirs` will be searched for `@prettie
|
||||
|
||||
Strings provided to `plugins` are ultimately passed to `require()`, so you can provide a module/package name, a path, or anything else `require()` takes. (`pluginSearchDirs` works the same way. That is, valid plugin paths that it finds are passed to `require()`.)
|
||||
|
||||
Providing at least one path to `--plugin-search-dir`/`pluginSearchDirs` turns off plugin autoloading in the default directory (i.e. `node_modules` above `prettier` binary).
|
||||
To turn off plugin autoloading, use `--no-plugin-search` when using Prettier CLI or add `{ pluginSearchDirs: false }` to options in `prettier.format()` or to the config file.
|
||||
|
||||
## Official Plugins
|
||||
|
||||
|
||||
+20
-20
@@ -25,10 +25,10 @@
|
||||
"dependencies": {
|
||||
"@angular/compiler": "12.2.16",
|
||||
"@babel/code-frame": "7.16.7",
|
||||
"@babel/parser": "7.17.0",
|
||||
"@glimmer/syntax": "0.83.1",
|
||||
"@babel/parser": "7.17.3",
|
||||
"@glimmer/syntax": "0.84.0",
|
||||
"@iarna/toml": "2.2.5",
|
||||
"@typescript-eslint/typescript-estree": "5.10.2",
|
||||
"@typescript-eslint/typescript-estree": "5.12.0",
|
||||
"acorn": "8.7.0",
|
||||
"acorn-jsx": "5.3.2",
|
||||
"angular-estree-parser": "2.5.0",
|
||||
@@ -44,7 +44,7 @@
|
||||
"editorconfig": "0.15.3",
|
||||
"editorconfig-to-prettier": "0.2.0",
|
||||
"escape-string-regexp": "4.0.0",
|
||||
"espree": "9.3.0",
|
||||
"espree": "9.3.1",
|
||||
"esutils": "2.0.3",
|
||||
"fast-glob": "3.2.11",
|
||||
"fast-json-stable-stringify": "2.1.0",
|
||||
@@ -57,7 +57,7 @@
|
||||
"html-tag-names": "1.1.5",
|
||||
"html-void-elements": "2.0.1",
|
||||
"ignore": "5.2.0",
|
||||
"jest-docblock": "27.5.0",
|
||||
"jest-docblock": "27.5.1",
|
||||
"json5": "2.2.0",
|
||||
"leven": "3.1.0",
|
||||
"lines-and-columns": "2.0.3",
|
||||
@@ -65,7 +65,7 @@
|
||||
"lodash": "4.17.21",
|
||||
"mem": "9.0.2",
|
||||
"meriyah": "4.2.0",
|
||||
"minimatch": "3.0.4",
|
||||
"micromatch": "4.0.4",
|
||||
"minimist": "1.2.5",
|
||||
"n-readlines": "1.0.1",
|
||||
"outdent": "0.8.0",
|
||||
@@ -93,39 +93,39 @@
|
||||
"yaml-unist-parser": "1.3.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "7.17.0",
|
||||
"@babel/core": "7.17.5",
|
||||
"@babel/preset-env": "7.16.11",
|
||||
"@babel/types": "7.17.0",
|
||||
"@esbuild-plugins/node-modules-polyfill": "0.1.4",
|
||||
"@glimmer/reference": "0.83.1",
|
||||
"@glimmer/reference": "0.84.0",
|
||||
"@jest/globals": "27.4.2",
|
||||
"@prettier/jest-light-runner": "file:./tests/config/jest-light-runner",
|
||||
"@types/estree": "0.0.50",
|
||||
"@types/estree": "0.0.51",
|
||||
"@types/jest": "27.4.0",
|
||||
"@typescript-eslint/eslint-plugin": "5.10.2",
|
||||
"babel-jest": "27.5.0",
|
||||
"@typescript-eslint/eslint-plugin": "5.12.0",
|
||||
"babel-jest": "27.5.1",
|
||||
"benchmark": "2.1.4",
|
||||
"browserslist-to-esbuild": "1.1.1",
|
||||
"builtin-modules": "3.2.0",
|
||||
"cross-env": "7.0.3",
|
||||
"cspell": "5.18.3",
|
||||
"cspell": "5.18.5",
|
||||
"enquirer": "2.3.6",
|
||||
"esbuild": "0.14.18",
|
||||
"esbuild": "0.14.23",
|
||||
"esbuild-plugin-text-replace": "1.2.0",
|
||||
"esbuild-visualizer": "0.3.1",
|
||||
"eslint": "8.8.0",
|
||||
"eslint-config-prettier": "8.3.0",
|
||||
"eslint": "8.9.0",
|
||||
"eslint-config-prettier": "8.4.0",
|
||||
"eslint-formatter-friendly": "7.0.0",
|
||||
"eslint-plugin-compat": "4.0.2",
|
||||
"eslint-plugin-import": "2.25.4",
|
||||
"eslint-plugin-jest": "26.0.0",
|
||||
"eslint-plugin-jest": "26.1.1",
|
||||
"eslint-plugin-prettier-internal-rules": "2.0.1",
|
||||
"eslint-plugin-react": "7.28.0",
|
||||
"eslint-plugin-regexp": "1.5.1",
|
||||
"eslint-plugin-unicorn": "40.1.0",
|
||||
"eslint-plugin-unicorn": "41.0.0",
|
||||
"esm-utils": "3.0.0",
|
||||
"execa": "6.0.0",
|
||||
"jest": "27.5.0",
|
||||
"execa": "6.1.0",
|
||||
"jest": "27.5.1",
|
||||
"jest-snapshot-serializer-ansi": "1.0.0",
|
||||
"jest-snapshot-serializer-raw": "1.2.0",
|
||||
"jest-watch-typeahead": "1.0.0",
|
||||
@@ -135,7 +135,7 @@
|
||||
"path-browserify": "1.0.1",
|
||||
"prettier": "2.5.1",
|
||||
"pretty-bytes": "5.6.0",
|
||||
"read-pkg-up": "9.0.0",
|
||||
"read-pkg-up": "9.1.0",
|
||||
"rimraf": "3.0.2",
|
||||
"rollup-plugin-license": "2.6.1",
|
||||
"snapshot-diff": "0.9.0",
|
||||
|
||||
@@ -179,18 +179,22 @@ async function preparePackage() {
|
||||
|
||||
async function run(params) {
|
||||
params.files = params.file ? new Set([params.file].flat()) : params.file;
|
||||
delete params.file;
|
||||
|
||||
params.saveAs = params["save-as"];
|
||||
delete params["save-as"];
|
||||
|
||||
params.printSize = params["print-size"];
|
||||
delete params["print-size"];
|
||||
|
||||
params.compareSize = params["compare-size"];
|
||||
delete params["compare-size"];
|
||||
|
||||
if (params.report === "") {
|
||||
params.report = ["html"];
|
||||
}
|
||||
params.reports = params.report ? [params.report].flat() : params.report;
|
||||
|
||||
delete params.file;
|
||||
delete params.report;
|
||||
delete params["save-as"];
|
||||
delete params["print-size"];
|
||||
|
||||
if (params.saveAs && !(params.files && params.files.size === 1)) {
|
||||
throw new Error("'--save-as' can only use together with one '--file' flag");
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
"string-width": "5.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@jest/globals": "27.5.0",
|
||||
"jest": "27.5.0"
|
||||
"@jest/globals": "27.5.1",
|
||||
"jest": "27.5.1"
|
||||
}
|
||||
}
|
||||
+411
-372
File diff suppressed because it is too large.
Load diff
Vendored
+9
-9
@@ -23,31 +23,31 @@ So we will put the files bundled with Pure ESM Packages as CommonJS Modules unde
|
||||
### `/scripts/vendors/bundle-vendors.mjs`
|
||||
|
||||
```
|
||||
node ./scripts/vendors/bundle-vendors.mjs
|
||||
yarn vendors:bundle
|
||||
```
|
||||
|
||||
This script do the following 4 things:
|
||||
|
||||
**1. Bundle ESM Packages to CommonJS**
|
||||
|
||||
This bundles listed packages in `vendors.mjs` into `/vendors/*.js` as CommonJS.
|
||||
Bundles listed packages in `vendors.mjs` into `/vendors/*.js` as CommonJS.
|
||||
|
||||
**2. Update `package.json`**
|
||||
**2. Lock vendor versions**
|
||||
|
||||
This updates [`"imports"` in `package.json`](https://nodejs.org/api/packages.html#imports) to enables aliases to resolve packages put in `/vendors/*.js`.
|
||||
Locks versions of packages to `vendor-meta.json`. It is used to validate by `validate-vendor-versions.mjs`.
|
||||
|
||||
**3. Lock ESM Packages version to `vendor-versions.json`**
|
||||
**3. Save vendors license info**
|
||||
|
||||
This locks versions of packages that is bundled to `vendor-versions.json`. It is used to validate by `validate-vendor-versions.mjs`.
|
||||
Saves vendors licenses info to `vendor-meta.json`.
|
||||
|
||||
**4. Generate `/vendors/types.d.ts`**
|
||||
**4. Generate `/vendors/*.d.ts`**
|
||||
|
||||
This Generates a minimal type definition file that satisfies `lint:typecheck`.
|
||||
Generates a definition files that satisfies `lint:typecheck` for each vendors.
|
||||
|
||||
### `/scripts/vendors/validate-vendor-versions.mjs`
|
||||
|
||||
```
|
||||
node ./scripts/vendors/validate-vendor-versions.mjs
|
||||
yarn vendors:validate
|
||||
```
|
||||
|
||||
This script compares the version of packages locked in `vendor-versions.json` with the version of packages actually installed, and fails if they are different.
|
||||
|
||||
Vendored
+19
-10
@@ -48,6 +48,24 @@ async function cleanExistsBundledJS() {
|
||||
}
|
||||
}
|
||||
|
||||
async function generateDts(vendor) {
|
||||
const hasDefault = await import(vendor).then((module) =>
|
||||
Boolean(module.default)
|
||||
);
|
||||
await fs.writeFile(
|
||||
path.join(vendorsDir, `${vendor}.d.ts`),
|
||||
[
|
||||
"// This file is generated automatically.",
|
||||
hasDefault ? `export {default} from "${vendor}";` : null,
|
||||
`export * from "${vendor}";`,
|
||||
"",
|
||||
]
|
||||
.filter((line) => line !== null)
|
||||
.join("\n"),
|
||||
"utf-8"
|
||||
);
|
||||
}
|
||||
|
||||
async function bundle(vendor, options) {
|
||||
const outfile = getVendorFilePath(vendor);
|
||||
if (await fileExists(outfile)) {
|
||||
@@ -74,16 +92,7 @@ async function bundle(vendor, options) {
|
||||
};
|
||||
await esbuild.build(esbuildOption);
|
||||
|
||||
await fs.writeFile(
|
||||
path.join(vendorsDir, `${vendor}.d.ts`),
|
||||
[
|
||||
"// This file is generated automatically.",
|
||||
`export {default} from "${vendor}";`,
|
||||
`export * from "${vendor}";`,
|
||||
"",
|
||||
].join("\n"),
|
||||
"utf-8"
|
||||
);
|
||||
await generateDts(vendor);
|
||||
}
|
||||
|
||||
async function main() {
|
||||
|
||||
Vendored
+1329
-4
File diff suppressed because it is too large.
Load diff
Vendored
+1
-1
@@ -1,3 +1,3 @@
|
||||
const vendors = ["string-width", "mem"];
|
||||
const vendors = ["string-width", "mem", "execa", "tempy"];
|
||||
|
||||
export default vendors;
|
||||
@@ -202,6 +202,10 @@ const options = {
|
||||
default: "log",
|
||||
choices: ["silent", "error", "warn", "log", "debug"],
|
||||
},
|
||||
"plugin-search": {
|
||||
type: "boolean",
|
||||
oppositeDescription: "Disable plugin autoloading.",
|
||||
},
|
||||
"support-info": {
|
||||
type: "boolean",
|
||||
description: "Print support information as JSON.",
|
||||
|
||||
@@ -7,6 +7,10 @@ import { createDetailedUsage, createUsage } from "./usage.js";
|
||||
import { formatStdin, formatFiles } from "./format.js";
|
||||
import logFileInfoOrDie from "./file-info.js";
|
||||
import logResolvedConfigPathOrDie from "./find-config-path.js";
|
||||
import prettierInternal from "./prettier-internal.js";
|
||||
const {
|
||||
utils: { isNonEmptyArray },
|
||||
} = prettierInternal;
|
||||
|
||||
async function run(rawArguments) {
|
||||
// Create a default level logger, so we can log errors during `logLevel` parsing
|
||||
@@ -34,6 +38,18 @@ async function main(rawArguments, logger) {
|
||||
|
||||
logger.debug(`normalized argv: ${JSON.stringify(context.argv)}`);
|
||||
|
||||
if (context.argv.pluginSearch === false) {
|
||||
const rawPluginSearchDirs = context.argv.__raw["plugin-search-dir"];
|
||||
if (
|
||||
typeof rawPluginSearchDirs === "string" ||
|
||||
isNonEmptyArray(rawPluginSearchDirs)
|
||||
) {
|
||||
throw new Error(
|
||||
"Cannot use --no-plugin-search and --plugin-search-dir together."
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (context.argv.check && context.argv.listDifferent) {
|
||||
throw new Error("Cannot use --check and --list-different together.");
|
||||
}
|
||||
|
||||
@@ -15,6 +15,10 @@ function parseArgv(rawArguments, detailedOptions, logger, keys) {
|
||||
let argv = minimist(rawArguments, minimistOptions);
|
||||
|
||||
if (keys) {
|
||||
if (keys.includes("plugin-search-dir") && !keys.includes("plugin-search")) {
|
||||
keys.push("plugin-search");
|
||||
}
|
||||
|
||||
detailedOptions = detailedOptions.filter((option) =>
|
||||
keys.includes(option.name)
|
||||
);
|
||||
@@ -26,7 +30,8 @@ function parseArgv(rawArguments, detailedOptions, logger, keys) {
|
||||
colorsModule: chalk,
|
||||
});
|
||||
|
||||
return Object.fromEntries(
|
||||
return {
|
||||
...Object.fromEntries(
|
||||
Object.entries(normalized).map(([key, value]) => {
|
||||
const option = detailedOptions.find(({ name }) => name === key) || {};
|
||||
// If the flag is a prettier option, use the option name
|
||||
@@ -35,10 +40,17 @@ function parseArgv(rawArguments, detailedOptions, logger, keys) {
|
||||
// `--ignore-unknown` -> `ignoreUnknown`
|
||||
return [option.forwardToApi || camelCase(key), value];
|
||||
})
|
||||
);
|
||||
),
|
||||
get __raw() {
|
||||
return argv;
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
const detailedOptionsWithoutPlugins = getContextOptions().detailedOptions;
|
||||
const detailedOptionsWithoutPlugins = getContextOptions(
|
||||
[],
|
||||
false
|
||||
).detailedOptions;
|
||||
function parseArgvWithoutPlugins(rawArguments, logger, keys) {
|
||||
return parseArgv(
|
||||
rawArguments,
|
||||
|
||||
@@ -21,9 +21,11 @@ function load(plugins, pluginSearchDirs) {
|
||||
plugins = [];
|
||||
}
|
||||
|
||||
if (!pluginSearchDirs) {
|
||||
if (pluginSearchDirs === false) {
|
||||
pluginSearchDirs = [];
|
||||
}
|
||||
} else {
|
||||
pluginSearchDirs = pluginSearchDirs || [];
|
||||
|
||||
// unless pluginSearchDirs are provided, auto-load plugins from node_modules that are parent to Prettier
|
||||
if (pluginSearchDirs.length === 0) {
|
||||
const autoLoadDir = thirdParty.findParentDir(__dirname, "node_modules");
|
||||
@@ -31,6 +33,7 @@ function load(plugins, pluginSearchDirs) {
|
||||
pluginSearchDirs = [autoLoadDir];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const [externalPluginNames, externalPluginInstances] = partition(
|
||||
plugins,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"use strict";
|
||||
|
||||
const path = require("path");
|
||||
const minimatch = require("minimatch");
|
||||
const micromatch = require("micromatch");
|
||||
const thirdParty = require("../common/third-party.js");
|
||||
|
||||
const loadToml = require("../utils/load-toml.js");
|
||||
@@ -165,18 +165,30 @@ function mergeOverrides(configResult, filePath) {
|
||||
}
|
||||
|
||||
// Based on eslint: https://github.com/eslint/eslint/blob/master/lib/config/config-ops.js
|
||||
function pathMatchesGlobs(filePath, patterns, excludedPatterns = []) {
|
||||
function pathMatchesGlobs(filePath, patterns, excludedPatterns) {
|
||||
const patternList = Array.isArray(patterns) ? patterns : [patterns];
|
||||
const excludedPatternList = Array.isArray(excludedPatterns)
|
||||
? excludedPatterns
|
||||
: [excludedPatterns];
|
||||
const opts = { matchBase: true, dot: true };
|
||||
|
||||
// micromatch always matches against basename when the option is enabled
|
||||
// use only patterns without slashes with it to match minimatch behavior
|
||||
const withSlashes = [];
|
||||
const withoutSlashes = [];
|
||||
for (const pattern of patternList) {
|
||||
if (pattern.includes("/")) {
|
||||
withSlashes.push(pattern);
|
||||
} else {
|
||||
withoutSlashes.push(pattern);
|
||||
}
|
||||
}
|
||||
return (
|
||||
patternList.some((pattern) => minimatch(filePath, pattern, opts)) &&
|
||||
!excludedPatternList.some((excludedPattern) =>
|
||||
minimatch(filePath, excludedPattern, opts)
|
||||
)
|
||||
micromatch.isMatch(filePath, withoutSlashes, {
|
||||
ignore: excludedPatterns,
|
||||
basename: true,
|
||||
dot: true,
|
||||
}) ||
|
||||
micromatch.isMatch(filePath, withSlashes, {
|
||||
ignore: excludedPatterns,
|
||||
basename: false,
|
||||
dot: true,
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -80,6 +80,7 @@ const prettier = {
|
||||
utils: {
|
||||
arrayify: require("./utils/arrayify.js"),
|
||||
getLast: require("./utils/get-last.js"),
|
||||
isNonEmptyArray: require("./common/util.js").isNonEmptyArray,
|
||||
},
|
||||
},
|
||||
|
||||
|
||||
@@ -103,7 +103,7 @@ const languages = [
|
||||
since: "1.5.0",
|
||||
parsers: ["json"],
|
||||
vscodeLanguageIds: ["jsonc"],
|
||||
filenames: [...data.filenames, ".eslintrc"],
|
||||
filenames: [...data.filenames, ".eslintrc", ".swcrc"],
|
||||
})
|
||||
),
|
||||
createLanguage(require("linguist-languages/data/JSON5.json"), () => ({
|
||||
|
||||
@@ -39,6 +39,7 @@ const parseOptions = {
|
||||
"moduleBlocks",
|
||||
"asyncDoExpressions",
|
||||
"regexpUnicodeSets",
|
||||
"destructuringPrivate",
|
||||
],
|
||||
tokens: true,
|
||||
ranges: true,
|
||||
|
||||
@@ -60,8 +60,21 @@ function parseWithOptions(text, module) {
|
||||
}
|
||||
|
||||
function createParseError(error) {
|
||||
// throw the error for `module` parsing
|
||||
const { message, line, column } = error;
|
||||
let { message, line, column } = error;
|
||||
|
||||
const matches = (
|
||||
message.match(/^\[(?<line>\d+):(?<column>\d+)]: (?<message>.*)$/) || {}
|
||||
).groups;
|
||||
|
||||
if (matches) {
|
||||
message = matches.message;
|
||||
|
||||
/* istanbul ignore next */
|
||||
if (typeof line !== "number") {
|
||||
line = Number(matches.line);
|
||||
column = Number(matches.column);
|
||||
}
|
||||
}
|
||||
|
||||
/* istanbul ignore next */
|
||||
if (typeof line !== "number") {
|
||||
|
||||
@@ -251,12 +251,15 @@ function getBlockValueLineContents(
|
||||
// exclude open line `>` or `|`
|
||||
.match(/^[^\n]*\n(.*)$/s)[1];
|
||||
|
||||
const leadingSpaceCount =
|
||||
node.indent === null
|
||||
? ((match) => (match ? match[1].length : Number.POSITIVE_INFINITY))(
|
||||
content.match(/^( *)\S/m)
|
||||
)
|
||||
: node.indent - 1 + parentIndent;
|
||||
let leadingSpaceCount;
|
||||
if (node.indent === null) {
|
||||
const matches = content.match(/^(?<leadingSpace> *)[^\n\r ]/m);
|
||||
leadingSpaceCount = matches
|
||||
? matches.groups.leadingSpace.length
|
||||
: Number.POSITIVE_INFINITY;
|
||||
} else {
|
||||
leadingSpaceCount = node.indent - 1 + parentIndent;
|
||||
}
|
||||
|
||||
const rawLineContents = content
|
||||
.split("\n")
|
||||
|
||||
@@ -94,6 +94,10 @@ function normalizeOptions(
|
||||
hasDeprecationWarned = normalizer._hasDeprecationWarned;
|
||||
}
|
||||
|
||||
if (isCLI && normalized["plugin-search"] === false) {
|
||||
normalized["plugin-search-dir"] = false;
|
||||
}
|
||||
|
||||
return normalized;
|
||||
}
|
||||
|
||||
@@ -123,8 +127,32 @@ function optionInfosToSchemas(optionInfos, { isCLI, colorsModule }) {
|
||||
}
|
||||
|
||||
function optionInfoToSchema(optionInfo, { isCLI, optionInfos, colorsModule }) {
|
||||
const { name } = optionInfo;
|
||||
|
||||
if (name === "plugin-search-dir" || name === "pluginSearchDirs") {
|
||||
return vnopts.AnySchema.create({
|
||||
name,
|
||||
preprocess(value) {
|
||||
if (value === false) {
|
||||
return value;
|
||||
}
|
||||
value = Array.isArray(value) ? value : [value];
|
||||
return value;
|
||||
},
|
||||
validate(value) {
|
||||
if (value === false) {
|
||||
return true;
|
||||
}
|
||||
return value.every((dir) => typeof dir === "string");
|
||||
},
|
||||
expected() {
|
||||
return "false or paths to plugin search dir";
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
const parameters = { name };
|
||||
let SchemaConstructor;
|
||||
const parameters = { name: optionInfo.name };
|
||||
const handlers = {};
|
||||
|
||||
switch (optionInfo.type) {
|
||||
|
||||
@@ -19,7 +19,7 @@ exports[`arrows-bind.js [espree] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`arrows-bind.js [meriyah] format 1`] = `
|
||||
"[1:9]: Expected ')' (1:9)
|
||||
"Expected ')' (1:9)
|
||||
> 1 | a => ({}::b()\`\`[''].c++ && 0 ? 0 : 0);
|
||||
| ^
|
||||
2 | (a => b)::c;
|
||||
|
||||
@@ -17,7 +17,7 @@ exports[`newline-before-arrow.js [espree] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`newline-before-arrow.js [meriyah] format 1`] = `
|
||||
"[2:2]: No line break is allowed after '=>' (2:2)
|
||||
"No line break is allowed after '=>' (2:2)
|
||||
1 | async x
|
||||
> 2 | => x
|
||||
| ^
|
||||
|
||||
@@ -19,7 +19,7 @@ exports[`async-do-expressions.js [espree] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`async-do-expressions.js [meriyah] format 1`] = `
|
||||
"[1:8]: Unexpected token: 'do' (1:8)
|
||||
"Unexpected token: 'do' (1:8)
|
||||
> 1 | async do {
|
||||
| ^
|
||||
2 | 1;
|
||||
|
||||
@@ -15,7 +15,7 @@ exports[`async-do-expressions.js [espree] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`async-do-expressions.js [meriyah] format 1`] = `
|
||||
"[1:8]: Unexpected token: 'do' (1:8)
|
||||
"Unexpected token: 'do' (1:8)
|
||||
> 1 | async do { await requestAPI().json() };
|
||||
| ^
|
||||
2 |"
|
||||
@@ -394,7 +394,7 @@ console.log(Bork.staticFunction()); // > "babelIsCool"
|
||||
`;
|
||||
|
||||
exports[`class-static-block.js [meriyah] format 1`] = `
|
||||
"[4:10]: Unexpected token: '{' (4:10)
|
||||
"Unexpected token: '{' (4:10)
|
||||
2 | static #x = 42;
|
||||
3 | static y;
|
||||
> 4 | static {
|
||||
@@ -461,7 +461,7 @@ exports[`decimal.js [espree] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`decimal.js [meriyah] format 1`] = `
|
||||
"[3:3]: No identifiers allowed directly after numeric literal (3:3)
|
||||
"No identifiers allowed directly after numeric literal (3:3)
|
||||
1 | // https://github.com/babel/babel/pull/11640
|
||||
2 |
|
||||
> 3 | 100m;
|
||||
@@ -626,6 +626,75 @@ function enumerable(value) {
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`destructuring-private.js [acorn] format 1`] = `
|
||||
"Unexpected token (5:13)
|
||||
3 | constructor() {
|
||||
4 | console.log(this.#x); // => 1
|
||||
> 5 | const { #x: x } = this;
|
||||
| ^
|
||||
6 | console.log(x); // => 1
|
||||
7 | }
|
||||
8 | equals({ #x: otherX }) {"
|
||||
`;
|
||||
|
||||
exports[`destructuring-private.js [espree] format 1`] = `
|
||||
"Unexpected token #x (5:13)
|
||||
3 | constructor() {
|
||||
4 | console.log(this.#x); // => 1
|
||||
> 5 | const { #x: x } = this;
|
||||
| ^
|
||||
6 | console.log(x); // => 1
|
||||
7 | }
|
||||
8 | equals({ #x: otherX }) {"
|
||||
`;
|
||||
|
||||
exports[`destructuring-private.js [meriyah] format 1`] = `
|
||||
"Unexpected token: 'PrivateField' (5:13)
|
||||
3 | constructor() {
|
||||
4 | console.log(this.#x); // => 1
|
||||
> 5 | const { #x: x } = this;
|
||||
| ^
|
||||
6 | console.log(x); // => 1
|
||||
7 | }
|
||||
8 | equals({ #x: otherX }) {"
|
||||
`;
|
||||
|
||||
exports[`destructuring-private.js format 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["babel", "babel-ts", "babel-flow"]
|
||||
printWidth: 80
|
||||
| printWidth
|
||||
=====================================input======================================
|
||||
class Foo {
|
||||
#x = 1;
|
||||
constructor() {
|
||||
console.log(this.#x); // => 1
|
||||
const { #x: x } = this;
|
||||
console.log(x); // => 1
|
||||
}
|
||||
equals({ #x: otherX }) {
|
||||
const { #x: currentX } = this;
|
||||
return currentX === otherX;
|
||||
}
|
||||
}
|
||||
|
||||
=====================================output=====================================
|
||||
class Foo {
|
||||
#x = 1;
|
||||
constructor() {
|
||||
console.log(this.#x); // => 1
|
||||
const { #x: x } = this;
|
||||
console.log(x); // => 1
|
||||
}
|
||||
equals({ #x: otherX }) {
|
||||
const { #x: currentX } = this;
|
||||
return currentX === otherX;
|
||||
}
|
||||
}
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`do-expressions.js [acorn] format 1`] = `
|
||||
"Unexpected token (3:9)
|
||||
1 | // https://babeljs.io/docs/en/babel-plugin-proposal-do-expressions
|
||||
@@ -649,7 +718,7 @@ exports[`do-expressions.js [espree] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`do-expressions.js [meriyah] format 1`] = `
|
||||
"[3:10]: Unexpected token: 'do' (3:10)
|
||||
"Unexpected token: 'do' (3:10)
|
||||
1 | // https://babeljs.io/docs/en/babel-plugin-proposal-do-expressions
|
||||
2 |
|
||||
> 3 | let a = do {
|
||||
@@ -740,7 +809,7 @@ exports[`export-default-from.js [espree] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`export-default-from.js [meriyah] format 1`] = `
|
||||
"[4:8]: Unexpected token: 'identifier' (4:8)
|
||||
"Unexpected token: 'identifier' (4:8)
|
||||
2 |
|
||||
3 |
|
||||
> 4 | export v from 'mod';
|
||||
@@ -804,7 +873,7 @@ exports[`flow.js [espree] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`flow.js [meriyah] format 1`] = `
|
||||
"[3:17]: Expected ')' (3:17)
|
||||
"Expected ')' (3:17)
|
||||
1 | // https://babeljs.io/docs/en/babel-preset-flow
|
||||
2 |
|
||||
> 3 | function foo(one: any, two: number, three?): string {}
|
||||
@@ -853,7 +922,7 @@ exports[`function-bind.js [espree] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`function-bind.js [meriyah] format 1`] = `
|
||||
"[3:5]: Unexpected token: ':' (3:5)
|
||||
"Unexpected token: ':' (3:5)
|
||||
1 | // https://babeljs.io/docs/en/babel-plugin-proposal-function-bind
|
||||
2 |
|
||||
> 3 | obj::func
|
||||
@@ -931,7 +1000,7 @@ exports[`function-sent.js [espree] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`function-sent.js [meriyah] format 1`] = `
|
||||
"[4:33]: Expected '(' (4:33)
|
||||
"Expected '(' (4:33)
|
||||
2 |
|
||||
3 | function* generator() {
|
||||
> 4 | console.log(\\"Sent\\", function.sent);
|
||||
@@ -988,7 +1057,7 @@ exports[`import-assertions-dynamic.js [espree] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`import-assertions-dynamic.js [meriyah] format 1`] = `
|
||||
"[1:20]: Expected ')' (1:20)
|
||||
"Expected ')' (1:20)
|
||||
> 1 | import(\\"./foo.json\\", { assert: { type: \\"json\\" } });
|
||||
| ^
|
||||
2 |"
|
||||
@@ -1023,7 +1092,7 @@ exports[`import-assertions-static.js [espree] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`import-assertions-static.js [meriyah] format 1`] = `
|
||||
"[1:36]: Unexpected token: 'identifier' (1:36)
|
||||
"Unexpected token: 'identifier' (1:36)
|
||||
> 1 | import json from \\"./foo.json\\" assert { type: \\"json\\" };
|
||||
| ^
|
||||
2 |"
|
||||
@@ -1162,7 +1231,7 @@ exports[`module-blocks.js [espree] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`module-blocks.js [meriyah] format 1`] = `
|
||||
"[1:16]: Unexpected token: '{' (1:16)
|
||||
"Unexpected token: '{' (1:16)
|
||||
> 1 | let m = module {
|
||||
| ^
|
||||
2 | export let m = 2;
|
||||
@@ -1191,7 +1260,7 @@ let m = module {
|
||||
`;
|
||||
|
||||
exports[`module-string-names.js [meriyah] format 1`] = `
|
||||
"[1:13]: Expected '}' (1:13)
|
||||
"Expected '}' (1:13)
|
||||
> 1 | import { \\"😄\\" as smile } from \\"./emojis.js\\";
|
||||
| ^
|
||||
2 | export { smile as \\"😄\\" } from \\"./emojis.js\\";
|
||||
@@ -1546,7 +1615,7 @@ exports[`partial-application.js [espree] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`partial-application.js [meriyah] format 1`] = `
|
||||
"[5:23]: Unexpected token: '?' (5:23)
|
||||
"Unexpected token: '?' (5:23)
|
||||
3 | function add(x, y) { return x + y; }
|
||||
4 |
|
||||
> 5 | const addOne = add(1, ?); // apply from the left
|
||||
@@ -1633,7 +1702,7 @@ exports[`pipeline-operator-fsharp.js [espree] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`pipeline-operator-fsharp.js [meriyah] format 1`] = `
|
||||
"[5:4]: Unexpected token: '>' (5:4)
|
||||
"Unexpected token: '>' (5:4)
|
||||
3 |
|
||||
4 | promise
|
||||
> 5 | |> await
|
||||
@@ -1741,7 +1810,7 @@ exports[`pipeline-operator-hack.js [espree] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`pipeline-operator-hack.js [meriyah] format 1`] = `
|
||||
"[5:3]: Unexpected token: '>' (5:3)
|
||||
"Unexpected token: '>' (5:3)
|
||||
3 |
|
||||
4 | return list
|
||||
> 5 | |> take(prefix.length, %)
|
||||
@@ -1800,7 +1869,7 @@ exports[`pipeline-operator-minimal.js [espree] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`pipeline-operator-minimal.js [meriyah] format 1`] = `
|
||||
"[8:4]: Unexpected token: '>' (8:4)
|
||||
"Unexpected token: '>' (8:4)
|
||||
6 |
|
||||
7 | let result = \\"hello\\"
|
||||
> 8 | |> doubleSay
|
||||
@@ -2035,7 +2104,7 @@ exports[`record-tuple-record.js [espree] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`record-tuple-record.js [meriyah] format 1`] = `
|
||||
"[1:17]: '#' not followed by identifier (1:17)
|
||||
"'#' not followed by identifier (1:17)
|
||||
> 1 | const record1 = #{
|
||||
| ^
|
||||
2 | a: 1,
|
||||
@@ -2084,7 +2153,7 @@ exports[`record-tuple-tuple.js [espree] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`record-tuple-tuple.js [meriyah] format 1`] = `
|
||||
"[1:16]: '#' not followed by identifier (1:16)
|
||||
"'#' not followed by identifier (1:16)
|
||||
> 1 | const tuple1 = #[1, 2, 3];
|
||||
| ^
|
||||
2 |"
|
||||
@@ -2119,7 +2188,7 @@ exports[`regex-v-flag.js [espree] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`regex-v-flag.js [meriyah] format 1`] = `
|
||||
"[1:3]: Unexpected regular expression flag (1:3)
|
||||
"Unexpected regular expression flag (1:3)
|
||||
> 1 | /a/v;
|
||||
| ^
|
||||
2 |"
|
||||
@@ -2162,7 +2231,7 @@ exports[`throw-expressions.js [espree] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`throw-expressions.js [meriyah] format 1`] = `
|
||||
"[3:27]: Unexpected token: 'throw' (3:27)
|
||||
"Unexpected token: 'throw' (3:27)
|
||||
1 | // https://babeljs.io/docs/en/babel-plugin-proposal-throw-expressions
|
||||
2 |
|
||||
> 3 | function test(param = throw new Error('required!')) {
|
||||
@@ -2213,7 +2282,7 @@ exports[`typescript.js [espree] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`typescript.js [meriyah] format 1`] = `
|
||||
"[3:8]: Missing initializer in const declaration (3:8)
|
||||
"Missing initializer in const declaration (3:8)
|
||||
1 | // https://babeljs.io/docs/en/babel-preset-typescript
|
||||
2 |
|
||||
> 3 | const x: number = 0;
|
||||
@@ -2262,7 +2331,7 @@ exports[`v8intrinsic.js [espree] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`v8intrinsic.js [meriyah] format 1`] = `
|
||||
"[3:1]: Unexpected token: '%' (3:1)
|
||||
"Unexpected token: '%' (3:1)
|
||||
1 | // https://github.com/babel/babel/pull/10148
|
||||
2 |
|
||||
> 3 | %DebugPrint(foo);
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
class Foo {
|
||||
#x = 1;
|
||||
constructor() {
|
||||
console.log(this.#x); // => 1
|
||||
const { #x: x } = this;
|
||||
console.log(x); // => 1
|
||||
}
|
||||
equals({ #x: otherX }) {
|
||||
const { #x: currentX } = this;
|
||||
return currentX === otherX;
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@ run_spec(import.meta, ["babel", "babel-ts", "babel-flow"], {
|
||||
acorn: [
|
||||
"decimal.js",
|
||||
"decorators.js",
|
||||
"destructuring-private.js",
|
||||
"do-expressions.js",
|
||||
"export-default-from.js",
|
||||
"flow.js",
|
||||
@@ -29,6 +30,7 @@ run_spec(import.meta, ["babel", "babel-ts", "babel-flow"], {
|
||||
espree: [
|
||||
"decimal.js",
|
||||
"decorators.js",
|
||||
"destructuring-private.js",
|
||||
"do-expressions.js",
|
||||
"export-default-from.js",
|
||||
"flow.js",
|
||||
@@ -52,6 +54,7 @@ run_spec(import.meta, ["babel", "babel-ts", "babel-flow"], {
|
||||
meriyah: [
|
||||
"decimal.js",
|
||||
"do-expressions.js",
|
||||
"destructuring-private.js",
|
||||
"export-default-from.js",
|
||||
"flow.js",
|
||||
"function-bind.js",
|
||||
|
||||
@@ -21,7 +21,7 @@ exports[`await.js [espree] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`await.js [meriyah] format 1`] = `
|
||||
"[3:27]: Unexpected token: ':' (3:27)
|
||||
"Unexpected token: ':' (3:27)
|
||||
1 | const doBothThings = async () => {
|
||||
2 | const request = doAsyncThing();
|
||||
> 3 | return (await request)::doSyncThing();
|
||||
@@ -51,7 +51,7 @@ exports[`await.js - {"semi":false} [espree] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`await.js - {"semi":false} [meriyah] format 1`] = `
|
||||
"[3:27]: Unexpected token: ':' (3:27)
|
||||
"Unexpected token: ':' (3:27)
|
||||
1 | const doBothThings = async () => {
|
||||
2 | const request = doAsyncThing();
|
||||
> 3 | return (await request)::doSyncThing();
|
||||
@@ -120,7 +120,7 @@ exports[`bind_parens.js [espree] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`bind_parens.js [meriyah] format 1`] = `
|
||||
"[1:9]: Unexpected token: ':' (1:9)
|
||||
"Unexpected token: ':' (1:9)
|
||||
> 1 | (a || b)::c;
|
||||
| ^
|
||||
2 | a || (b::c);
|
||||
@@ -147,7 +147,7 @@ exports[`bind_parens.js - {"semi":false} [espree] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`bind_parens.js - {"semi":false} [meriyah] format 1`] = `
|
||||
"[1:9]: Unexpected token: ':' (1:9)
|
||||
"Unexpected token: ':' (1:9)
|
||||
> 1 | (a || b)::c;
|
||||
| ^
|
||||
2 | a || (b::c);
|
||||
@@ -339,7 +339,7 @@ exports[`long_name_method.js [espree] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`long_name_method.js [meriyah] format 1`] = `
|
||||
"[3:54]: Unexpected token: ':' (3:54)
|
||||
"Unexpected token: ':' (3:54)
|
||||
1 | class X {
|
||||
2 | constructor() {
|
||||
> 3 | this.testLongNameMethodAndSomethingElseLallala = ::this.testLongNameMethodAndSomethingElseLallala;
|
||||
@@ -372,7 +372,7 @@ exports[`long_name_method.js - {"semi":false} [espree] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`long_name_method.js - {"semi":false} [meriyah] format 1`] = `
|
||||
"[3:54]: Unexpected token: ':' (3:54)
|
||||
"Unexpected token: ':' (3:54)
|
||||
1 | class X {
|
||||
2 | constructor() {
|
||||
> 3 | this.testLongNameMethodAndSomethingElseLallala = ::this.testLongNameMethodAndSomethingElseLallala;
|
||||
@@ -466,7 +466,7 @@ exports[`method_chain.js [espree] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`method_chain.js [meriyah] format 1`] = `
|
||||
"[10:9]: Unexpected token: ':' (10:9)
|
||||
"Unexpected token: ':' (10:9)
|
||||
8 | function test(observable) {
|
||||
9 | return observable
|
||||
> 10 | ::filter(data => data.someTest)
|
||||
@@ -499,7 +499,7 @@ exports[`method_chain.js - {"semi":false} [espree] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`method_chain.js - {"semi":false} [meriyah] format 1`] = `
|
||||
"[10:9]: Unexpected token: ':' (10:9)
|
||||
"Unexpected token: ':' (10:9)
|
||||
8 | function test(observable) {
|
||||
9 | return observable
|
||||
> 10 | ::filter(data => data.someTest)
|
||||
@@ -625,7 +625,7 @@ exports[`short_name_method.js [espree] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`short_name_method.js [meriyah] format 1`] = `
|
||||
"[3:24]: Unexpected token: ':' (3:24)
|
||||
"Unexpected token: ':' (3:24)
|
||||
1 | class X {
|
||||
2 | constructor() {
|
||||
> 3 | this.shortMethod = ::this.shortMethod;
|
||||
@@ -658,7 +658,7 @@ exports[`short_name_method.js - {"semi":false} [espree] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`short_name_method.js - {"semi":false} [meriyah] format 1`] = `
|
||||
"[3:24]: Unexpected token: ':' (3:24)
|
||||
"Unexpected token: ':' (3:24)
|
||||
1 | class X {
|
||||
2 | constructor() {
|
||||
> 3 | this.shortMethod = ::this.shortMethod;
|
||||
@@ -746,7 +746,7 @@ exports[`unary.js [espree] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`unary.js [meriyah] format 1`] = `
|
||||
"[1:3]: Unexpected token: ':' (1:3)
|
||||
"Unexpected token: ':' (1:3)
|
||||
> 1 | !x::y;
|
||||
| ^
|
||||
2 | !(x::y /* foo */);
|
||||
@@ -773,7 +773,7 @@ exports[`unary.js - {"semi":false} [espree] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`unary.js - {"semi":false} [meriyah] format 1`] = `
|
||||
"[1:3]: Unexpected token: ':' (1:3)
|
||||
"Unexpected token: ':' (1:3)
|
||||
> 1 | !x::y;
|
||||
| ^
|
||||
2 | !(x::y /* foo */);
|
||||
|
||||
@@ -37,7 +37,7 @@ exports[`null-arguments-item.js [espree] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`null-arguments-item.js [meriyah] format 1`] = `
|
||||
"[1:11]: Unexpected token: ',' (1:11)
|
||||
"Unexpected token: ',' (1:11)
|
||||
> 1 | foor('a', , 'b');
|
||||
| ^
|
||||
2 | foo('looooooooooooooooooooooooooooooooooooooooooooooong', , 'looooooooooooooooooooooooooooooooooooooooooooooong');
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`class-static-block.js [meriyah] format 1`] = `
|
||||
"[4:10]: Unexpected token: '{' (4:10)
|
||||
"Unexpected token: '{' (4:10)
|
||||
2 | static #x = 42;
|
||||
3 | static y;
|
||||
> 4 | static {
|
||||
@@ -80,7 +80,7 @@ class A2 {
|
||||
`;
|
||||
|
||||
exports[`with-line-breaks.js [meriyah] format 1`] = `
|
||||
"[3:3]: Unexpected token: '{' (3:3)
|
||||
"Unexpected token: '{' (3:3)
|
||||
1 | class Foo {
|
||||
2 | static
|
||||
> 3 | {
|
||||
|
||||
@@ -19,7 +19,7 @@ exports[`optional-chaining.js [espree] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`optional-chaining.js [meriyah] format 1`] = `
|
||||
"[3:13]: Dot property must be an identifier (3:13)
|
||||
"Dot property must be an identifier (3:13)
|
||||
1 | // https://github.com/babel/babel/pull/11669
|
||||
2 |
|
||||
> 3 | delete obj?.#x.a
|
||||
@@ -46,7 +46,7 @@ exports[`optional-chaining.js - {"semi":false} [espree] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`optional-chaining.js - {"semi":false} [meriyah] format 1`] = `
|
||||
"[3:13]: Dot property must be an identifier (3:13)
|
||||
"Dot property must be an identifier (3:13)
|
||||
1 | // https://github.com/babel/babel/pull/11669
|
||||
2 |
|
||||
> 3 | delete obj?.#x.a
|
||||
|
||||
@@ -15,7 +15,7 @@ exports[`example.js [espree] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`example.js [meriyah] format 1`] = `
|
||||
"[1:6]: Calls to super must be in the \\"constructor\\" method of a class expression or class declaration that has a superclass (1:6)
|
||||
"Calls to super must be in the \\"constructor\\" method of a class expression or class declaration that has a superclass (1:6)
|
||||
> 1 | super();
|
||||
| ^
|
||||
2 |"
|
||||
|
||||
@@ -23,7 +23,7 @@ exports[`pipeline_own_line.js [espree] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`pipeline_own_line.js [meriyah] format 1`] = `
|
||||
"[4:3]: Unexpected token: '>' (4:3)
|
||||
"Unexpected token: '>' (4:3)
|
||||
2 | 0
|
||||
3 | // Comment
|
||||
> 4 | |> x
|
||||
|
||||
@@ -21,7 +21,7 @@ exports[`comments.js [espree] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`comments.js [meriyah] format 1`] = `
|
||||
"[4:20]: Unexpected token: ':' (4:20)
|
||||
"Unexpected token: ':' (4:20)
|
||||
2 | @Annotateme()
|
||||
3 | // comment
|
||||
> 4 | static property: Array<string>;
|
||||
|
||||
@@ -19,7 +19,7 @@ exports[`after_export.js [espree] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`after_export.js [meriyah] format 1`] = `
|
||||
"[1:8]: Unexpected token: '@' (1:8)
|
||||
"Unexpected token: '@' (1:8)
|
||||
> 1 | export @decorator class Foo {}
|
||||
| ^
|
||||
2 |
|
||||
|
||||
@@ -287,7 +287,7 @@ exports[`mobx.js [espree] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`mobx.js [meriyah] format 1`] = `
|
||||
"[4:20]: Unexpected token: ':' (4:20)
|
||||
"Unexpected token: ':' (4:20)
|
||||
2 |
|
||||
3 | @observer class OrderLine {
|
||||
> 4 | @observable price:number = 0;
|
||||
@@ -471,7 +471,7 @@ exports[`multiple.js [espree] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`multiple.js [meriyah] format 1`] = `
|
||||
"[2:3]: Unexpected token: '@' (2:3)
|
||||
"Unexpected token: '@' (2:3)
|
||||
1 | const dog = {
|
||||
> 2 | @readonly
|
||||
| ^
|
||||
|
||||
@@ -0,0 +1,395 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`arrow-params.js [acorn] format 1`] = `
|
||||
"Unexpected token (3:11)
|
||||
1 | class C {
|
||||
2 | #x = 1;
|
||||
> 3 | #p = ({ #x: x }) => {}
|
||||
| ^
|
||||
4 | }
|
||||
5 |"
|
||||
`;
|
||||
|
||||
exports[`arrow-params.js [espree] format 1`] = `
|
||||
"Unexpected token #x (3:11)
|
||||
1 | class C {
|
||||
2 | #x = 1;
|
||||
> 3 | #p = ({ #x: x }) => {}
|
||||
| ^
|
||||
4 | }
|
||||
5 |"
|
||||
`;
|
||||
|
||||
exports[`arrow-params.js [meriyah] format 1`] = `
|
||||
"Unexpected token: 'PrivateField' (3:11)
|
||||
1 | class C {
|
||||
2 | #x = 1;
|
||||
> 3 | #p = ({ #x: x }) => {}
|
||||
| ^
|
||||
4 | }
|
||||
5 |"
|
||||
`;
|
||||
|
||||
exports[`arrow-params.js format 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["babel", "babel-flow", "babel-ts"]
|
||||
printWidth: 80
|
||||
| printWidth
|
||||
=====================================input======================================
|
||||
class C {
|
||||
#x = 1;
|
||||
#p = ({ #x: x }) => {}
|
||||
}
|
||||
|
||||
=====================================output=====================================
|
||||
class C {
|
||||
#x = 1;
|
||||
#p = ({ #x: x }) => {};
|
||||
}
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`assignment.js [acorn] format 1`] = `
|
||||
"Unexpected token (5:8)
|
||||
3 | m() {
|
||||
4 | let x;
|
||||
> 5 | ({ #x: x } = this);
|
||||
| ^
|
||||
6 | }
|
||||
7 | }
|
||||
8 |"
|
||||
`;
|
||||
|
||||
exports[`assignment.js [espree] format 1`] = `
|
||||
"Unexpected token #x (5:8)
|
||||
3 | m() {
|
||||
4 | let x;
|
||||
> 5 | ({ #x: x } = this);
|
||||
| ^
|
||||
6 | }
|
||||
7 | }
|
||||
8 |"
|
||||
`;
|
||||
|
||||
exports[`assignment.js [meriyah] format 1`] = `
|
||||
"Unexpected token: 'PrivateField' (5:8)
|
||||
3 | m() {
|
||||
4 | let x;
|
||||
> 5 | ({ #x: x } = this);
|
||||
| ^
|
||||
6 | }
|
||||
7 | }
|
||||
8 |"
|
||||
`;
|
||||
|
||||
exports[`assignment.js format 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["babel", "babel-flow", "babel-ts"]
|
||||
printWidth: 80
|
||||
| printWidth
|
||||
=====================================input======================================
|
||||
class C {
|
||||
#x = 1;
|
||||
m() {
|
||||
let x;
|
||||
({ #x: x } = this);
|
||||
}
|
||||
}
|
||||
|
||||
=====================================output=====================================
|
||||
class C {
|
||||
#x = 1;
|
||||
m() {
|
||||
let x;
|
||||
({ #x: x } = this);
|
||||
}
|
||||
}
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`async-arrow-params.js [acorn] format 1`] = `
|
||||
"Unexpected token (3:17)
|
||||
1 | class C {
|
||||
2 | #x = 1;
|
||||
> 3 | #p = async ({ #x: x }) => {}
|
||||
| ^
|
||||
4 | }
|
||||
5 |"
|
||||
`;
|
||||
|
||||
exports[`async-arrow-params.js [espree] format 1`] = `
|
||||
"Unexpected token #x (3:17)
|
||||
1 | class C {
|
||||
2 | #x = 1;
|
||||
> 3 | #p = async ({ #x: x }) => {}
|
||||
| ^
|
||||
4 | }
|
||||
5 |"
|
||||
`;
|
||||
|
||||
exports[`async-arrow-params.js [meriyah] format 1`] = `
|
||||
"Unexpected token: 'PrivateField' (3:17)
|
||||
1 | class C {
|
||||
2 | #x = 1;
|
||||
> 3 | #p = async ({ #x: x }) => {}
|
||||
| ^
|
||||
4 | }
|
||||
5 |"
|
||||
`;
|
||||
|
||||
exports[`async-arrow-params.js format 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["babel", "babel-flow", "babel-ts"]
|
||||
printWidth: 80
|
||||
| printWidth
|
||||
=====================================input======================================
|
||||
class C {
|
||||
#x = 1;
|
||||
#p = async ({ #x: x }) => {}
|
||||
}
|
||||
|
||||
=====================================output=====================================
|
||||
class C {
|
||||
#x = 1;
|
||||
#p = async ({ #x: x }) => {};
|
||||
}
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`bindings.js [acorn] format 1`] = `
|
||||
"Unexpected token (4:12)
|
||||
2 | #x = 1;
|
||||
3 | m() {
|
||||
> 4 | const {#x: x} = this;
|
||||
| ^
|
||||
5 | }
|
||||
6 | }
|
||||
7 |"
|
||||
`;
|
||||
|
||||
exports[`bindings.js [espree] format 1`] = `
|
||||
"Unexpected token #x (4:12)
|
||||
2 | #x = 1;
|
||||
3 | m() {
|
||||
> 4 | const {#x: x} = this;
|
||||
| ^
|
||||
5 | }
|
||||
6 | }
|
||||
7 |"
|
||||
`;
|
||||
|
||||
exports[`bindings.js [meriyah] format 1`] = `
|
||||
"Unexpected token: 'PrivateField' (4:12)
|
||||
2 | #x = 1;
|
||||
3 | m() {
|
||||
> 4 | const {#x: x} = this;
|
||||
| ^
|
||||
5 | }
|
||||
6 | }
|
||||
7 |"
|
||||
`;
|
||||
|
||||
exports[`bindings.js format 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["babel", "babel-flow", "babel-ts"]
|
||||
printWidth: 80
|
||||
| printWidth
|
||||
=====================================input======================================
|
||||
class C {
|
||||
#x = 1;
|
||||
m() {
|
||||
const {#x: x} = this;
|
||||
}
|
||||
}
|
||||
|
||||
=====================================output=====================================
|
||||
class C {
|
||||
#x = 1;
|
||||
m() {
|
||||
const { #x: x } = this;
|
||||
}
|
||||
}
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`for-lhs.js [acorn] format 1`] = `
|
||||
"Unexpected token (5:11)
|
||||
3 | m() {
|
||||
4 | let x;
|
||||
> 5 | for ({#x: x} of [this]);
|
||||
| ^
|
||||
6 | }
|
||||
7 | }
|
||||
8 |"
|
||||
`;
|
||||
|
||||
exports[`for-lhs.js [espree] format 1`] = `
|
||||
"Unexpected token #x (5:11)
|
||||
3 | m() {
|
||||
4 | let x;
|
||||
> 5 | for ({#x: x} of [this]);
|
||||
| ^
|
||||
6 | }
|
||||
7 | }
|
||||
8 |"
|
||||
`;
|
||||
|
||||
exports[`for-lhs.js [meriyah] format 1`] = `
|
||||
"Unexpected token: 'PrivateField' (5:11)
|
||||
3 | m() {
|
||||
4 | let x;
|
||||
> 5 | for ({#x: x} of [this]);
|
||||
| ^
|
||||
6 | }
|
||||
7 | }
|
||||
8 |"
|
||||
`;
|
||||
|
||||
exports[`for-lhs.js format 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["babel", "babel-flow", "babel-ts"]
|
||||
printWidth: 80
|
||||
| printWidth
|
||||
=====================================input======================================
|
||||
class C {
|
||||
#x = 1;
|
||||
m() {
|
||||
let x;
|
||||
for ({#x: x} of [this]);
|
||||
}
|
||||
}
|
||||
|
||||
=====================================output=====================================
|
||||
class C {
|
||||
#x = 1;
|
||||
m() {
|
||||
let x;
|
||||
for ({ #x: x } of [this]);
|
||||
}
|
||||
}
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`nested-bindings.js [acorn] format 1`] = `
|
||||
"Unexpected token (4:17)
|
||||
2 | #x = 1;
|
||||
3 | m() {
|
||||
> 4 | const {x: { #x: [x] }, y: [...{ #x: y }]} = this;
|
||||
| ^
|
||||
5 | }
|
||||
6 | }
|
||||
7 |"
|
||||
`;
|
||||
|
||||
exports[`nested-bindings.js [espree] format 1`] = `
|
||||
"Unexpected token #x (4:17)
|
||||
2 | #x = 1;
|
||||
3 | m() {
|
||||
> 4 | const {x: { #x: [x] }, y: [...{ #x: y }]} = this;
|
||||
| ^
|
||||
5 | }
|
||||
6 | }
|
||||
7 |"
|
||||
`;
|
||||
|
||||
exports[`nested-bindings.js [meriyah] format 1`] = `
|
||||
"Unexpected token: 'PrivateField' (4:17)
|
||||
2 | #x = 1;
|
||||
3 | m() {
|
||||
> 4 | const {x: { #x: [x] }, y: [...{ #x: y }]} = this;
|
||||
| ^
|
||||
5 | }
|
||||
6 | }
|
||||
7 |"
|
||||
`;
|
||||
|
||||
exports[`nested-bindings.js format 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["babel", "babel-flow", "babel-ts"]
|
||||
printWidth: 80
|
||||
| printWidth
|
||||
=====================================input======================================
|
||||
class C {
|
||||
#x = 1;
|
||||
m() {
|
||||
const {x: { #x: [x] }, y: [...{ #x: y }]} = this;
|
||||
}
|
||||
}
|
||||
|
||||
=====================================output=====================================
|
||||
class C {
|
||||
#x = 1;
|
||||
m() {
|
||||
const {
|
||||
x: {
|
||||
#x: [x],
|
||||
},
|
||||
y: [...{ #x: y }],
|
||||
} = this;
|
||||
}
|
||||
}
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`valid-multiple-bindings.js [acorn] format 1`] = `
|
||||
"Unexpected token (4:12)
|
||||
2 | #x = 1;
|
||||
3 | m() {
|
||||
> 4 | const {#x: x1, #x: x2 = x1 } = this;
|
||||
| ^
|
||||
5 | }
|
||||
6 | }
|
||||
7 |"
|
||||
`;
|
||||
|
||||
exports[`valid-multiple-bindings.js [espree] format 1`] = `
|
||||
"Unexpected token #x (4:12)
|
||||
2 | #x = 1;
|
||||
3 | m() {
|
||||
> 4 | const {#x: x1, #x: x2 = x1 } = this;
|
||||
| ^
|
||||
5 | }
|
||||
6 | }
|
||||
7 |"
|
||||
`;
|
||||
|
||||
exports[`valid-multiple-bindings.js [meriyah] format 1`] = `
|
||||
"Unexpected token: 'PrivateField' (4:12)
|
||||
2 | #x = 1;
|
||||
3 | m() {
|
||||
> 4 | const {#x: x1, #x: x2 = x1 } = this;
|
||||
| ^
|
||||
5 | }
|
||||
6 | }
|
||||
7 |"
|
||||
`;
|
||||
|
||||
exports[`valid-multiple-bindings.js format 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["babel", "babel-flow", "babel-ts"]
|
||||
printWidth: 80
|
||||
| printWidth
|
||||
=====================================input======================================
|
||||
class C {
|
||||
#x = 1;
|
||||
m() {
|
||||
const {#x: x1, #x: x2 = x1 } = this;
|
||||
}
|
||||
}
|
||||
|
||||
=====================================output=====================================
|
||||
class C {
|
||||
#x = 1;
|
||||
m() {
|
||||
const { #x: x1, #x: x2 = x1 } = this;
|
||||
}
|
||||
}
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
@@ -0,0 +1,4 @@
|
||||
class C {
|
||||
#x = 1;
|
||||
#p = ({ #x: x }) => {}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
class C {
|
||||
#x = 1;
|
||||
m() {
|
||||
let x;
|
||||
({ #x: x } = this);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
class C {
|
||||
#x = 1;
|
||||
#p = async ({ #x: x }) => {}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
class C {
|
||||
#x = 1;
|
||||
m() {
|
||||
const {#x: x} = this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
class C {
|
||||
#x = 1;
|
||||
m() {
|
||||
let x;
|
||||
for ({#x: x} of [this]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
run_spec(__dirname, ["babel", "babel-flow", "babel-ts"], {
|
||||
errors: { acorn: true, espree: true, meriyah: true },
|
||||
});
|
||||
@@ -0,0 +1,6 @@
|
||||
class C {
|
||||
#x = 1;
|
||||
m() {
|
||||
const {x: { #x: [x] }, y: [...{ #x: y }]} = this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
class C {
|
||||
#x = 1;
|
||||
m() {
|
||||
const {#x: x1, #x: x2 = x1 } = this;
|
||||
}
|
||||
}
|
||||
@@ -23,7 +23,7 @@ exports[`call-arguments.js [espree] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`call-arguments.js [meriyah] format 1`] = `
|
||||
"[3:4]: Unexpected token: 'do' (3:4)
|
||||
"Unexpected token: 'do' (3:4)
|
||||
1 | // from https://github.com/babel/babel/pull/13122/
|
||||
2 | expect(
|
||||
> 3 | do {
|
||||
@@ -142,7 +142,7 @@ exports[`do.js [espree] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`do.js [meriyah] format 1`] = `
|
||||
"[3:6]: Unexpected token: 'do' (3:6)
|
||||
"Unexpected token: 'do' (3:6)
|
||||
1 | const envSpecific = {
|
||||
2 | domain:
|
||||
> 3 | do {
|
||||
|
||||
@@ -22,7 +22,7 @@ exports[`assertions.js [flow] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`assertions.js [meriyah] format 1`] = `
|
||||
"[1:20]: Expected ')' (1:20)
|
||||
"Expected ')' (1:20)
|
||||
> 1 | import(\\"./foo.json\\", { assert: { type: \\"json\\" } });
|
||||
| ^
|
||||
2 |"
|
||||
|
||||
@@ -15,7 +15,7 @@ exports[`default-escaped.js [espree] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`default-escaped.js [meriyah] format 1`] = `
|
||||
"[2:12]: Unexpected token: 'identifier' (2:12)
|
||||
"Unexpected token: 'identifier' (2:12)
|
||||
1 | // export asyn\\\\u{63} from \\"async\\";
|
||||
> 2 | export n\\\\u{63} from \\"async\\";
|
||||
| ^"
|
||||
|
||||
@@ -21,7 +21,7 @@ exports[`export.js [espree] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`export.js [meriyah] format 1`] = `
|
||||
"[2:8]: Unexpected token: 'identifier' (2:8)
|
||||
"Unexpected token: 'identifier' (2:8)
|
||||
1 | export * as ns from 'mod';
|
||||
> 2 | export v from 'mod';
|
||||
| ^
|
||||
|
||||
@@ -23,7 +23,7 @@ exports[`test.js [espree] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`test.js [meriyah] format 1`] = `
|
||||
"[3:8]: 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\\";
|
||||
2 |
|
||||
> 3 | export a,{b} from \\"./baz\\";
|
||||
|
||||
@@ -15,7 +15,7 @@ exports[`dynamic-import.js [espree] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`dynamic-import.js [meriyah] format 1`] = `
|
||||
"[1:20]: Expected ')' (1:20)
|
||||
"Expected ')' (1:20)
|
||||
> 1 | import(\\"./foo.json\\", { assert: { type: \\"json\\" } });
|
||||
| ^
|
||||
2 |"
|
||||
@@ -56,7 +56,7 @@ exports[`empty.js [espree] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`empty.js [meriyah] format 1`] = `
|
||||
"[2:38]: Unexpected token: 'identifier' (2:38)
|
||||
"Unexpected token: 'identifier' (2:38)
|
||||
1 | export * as foo from \\"foo.json\\"
|
||||
> 2 | export * as bar from \\"bar.json\\" assert { }
|
||||
| ^
|
||||
@@ -105,7 +105,7 @@ exports[`multi-types.js [espree] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`multi-types.js [meriyah] format 1`] = `
|
||||
"[1:36]: Unexpected token: 'identifier' (1:36)
|
||||
"Unexpected token: 'identifier' (1:36)
|
||||
> 1 | import json from \\"./foo.json\\" assert { type: \\"json\\", type: \\"bar\\" };
|
||||
| ^
|
||||
2 |"
|
||||
@@ -140,7 +140,7 @@ exports[`non-type.js [espree] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`non-type.js [meriyah] format 1`] = `
|
||||
"[1:33]: Unexpected token: 'identifier' (1:33)
|
||||
"Unexpected token: 'identifier' (1:33)
|
||||
> 1 | import foo from \\"foo.json\\" assert { lazy: \\"true\\" };
|
||||
| ^
|
||||
2 |"
|
||||
@@ -195,7 +195,7 @@ exports[`re-export.js [espree] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`re-export.js [meriyah] format 1`] = `
|
||||
"[1:38]: Unexpected token: 'identifier' (1:38)
|
||||
"Unexpected token: 'identifier' (1:38)
|
||||
> 1 | export { foo2 } from \\"foo.json\\" assert { type: \\"json\\" };
|
||||
| ^
|
||||
2 | export * from \\"foo.json\\" assert { type: \\"json\\" };
|
||||
@@ -236,7 +236,7 @@ exports[`static-import.js [espree] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`static-import.js [meriyah] format 1`] = `
|
||||
"[1:36]: Unexpected token: 'identifier' (1:36)
|
||||
"Unexpected token: 'identifier' (1:36)
|
||||
> 1 | import json from \\"./foo.json\\" assert { type: \\"json\\" };
|
||||
| ^
|
||||
2 |"
|
||||
@@ -271,7 +271,7 @@ exports[`without-from.js [espree] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`without-from.js [meriyah] format 1`] = `
|
||||
"[1:19]: Unexpected token: 'identifier' (1:19)
|
||||
"Unexpected token: 'identifier' (1:19)
|
||||
> 1 | import \\"foo\\" assert { type: \\"json\\" }
|
||||
| ^
|
||||
2 |"
|
||||
|
||||
@@ -15,7 +15,7 @@ exports[`dynamic-import.js - {"bracketSpacing":false} [espree] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`dynamic-import.js - {"bracketSpacing":false} [meriyah] format 1`] = `
|
||||
"[1:20]: Expected ')' (1:20)
|
||||
"Expected ')' (1:20)
|
||||
> 1 | import(\\"./foo.json\\", { assert: { type: \\"json\\" } });
|
||||
| ^
|
||||
2 |"
|
||||
@@ -49,7 +49,7 @@ exports[`empty.js - {"bracketSpacing":false} [espree] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`empty.js - {"bracketSpacing":false} [meriyah] format 1`] = `
|
||||
"[1:38]: Unexpected token: 'identifier' (1:38)
|
||||
"Unexpected token: 'identifier' (1:38)
|
||||
> 1 | export * as bar from \\"bar.json\\" assert { }
|
||||
| ^"
|
||||
`;
|
||||
@@ -83,7 +83,7 @@ exports[`re-export.js - {"bracketSpacing":false} [espree] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`re-export.js - {"bracketSpacing":false} [meriyah] format 1`] = `
|
||||
"[1:38]: Unexpected token: 'identifier' (1:38)
|
||||
"Unexpected token: 'identifier' (1:38)
|
||||
> 1 | export { foo2 } from \\"foo.json\\" assert { type: \\"json\\" };
|
||||
| ^
|
||||
2 |"
|
||||
@@ -119,7 +119,7 @@ exports[`static-import.js - {"bracketSpacing":false} [espree] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`static-import.js - {"bracketSpacing":false} [meriyah] format 1`] = `
|
||||
"[1:36]: Unexpected token: 'identifier' (1:36)
|
||||
"Unexpected token: 'identifier' (1:36)
|
||||
> 1 | import json from \\"./foo.json\\" assert { type: \\"json\\" };
|
||||
| ^
|
||||
2 |"
|
||||
|
||||
@@ -19,7 +19,7 @@ exports[`comments.js [espree] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`comments.js [meriyah] format 1`] = `
|
||||
"[1:32]: Unexpected token: '{' (1:32)
|
||||
"Unexpected token: '{' (1:32)
|
||||
> 1 | const m = /*A1*/ module /*A2*/ { /*A3*/
|
||||
| ^
|
||||
2 | /*A4*/
|
||||
@@ -80,7 +80,7 @@ exports[`module-blocks.js [espree] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`module-blocks.js [meriyah] format 1`] = `
|
||||
"[1:8]: Unexpected token: '{' (1:8)
|
||||
"Unexpected token: '{' (1:8)
|
||||
> 1 | module { await 3 };
|
||||
| ^
|
||||
2 |
|
||||
@@ -224,7 +224,7 @@ exports[`range.js [espree] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`range.js [meriyah] format 1`] = `
|
||||
"[1:26]: Unexpected token: '{' (1:26)
|
||||
"Unexpected token: '{' (1:26)
|
||||
> 1 | let moduleBlock = module { export let y = 1;
|
||||
| ^
|
||||
2 | };
|
||||
@@ -280,7 +280,7 @@ exports[`worker.js [espree] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`worker.js [meriyah] format 1`] = `
|
||||
"[1:32]: Expected ')' (1:32)
|
||||
"Expected ')' (1:32)
|
||||
> 1 | let worker = new Worker(module {
|
||||
| ^
|
||||
2 | onmessage = function({data}) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`module-string-names-export.js [meriyah] format 1`] = `
|
||||
"[1:26]: 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\\";
|
||||
| ^
|
||||
2 | export { \\"smile\\" as smile2 } from \\"./emojis.js\\";
|
||||
@@ -37,7 +37,7 @@ export { "smile4" } from "./emojis.js";
|
||||
`;
|
||||
|
||||
exports[`module-string-names-import.js [meriyah] format 1`] = `
|
||||
"[1:18]: Expected '}' (1:18)
|
||||
"Expected '}' (1:18)
|
||||
> 1 | import { \\"default\\" as quotation1 } from \\"Confucius\\";
|
||||
| ^
|
||||
2 | import { \\"foo\\" as bar, \\"default\\" as qux } from \\"module-a\\";
|
||||
|
||||
@@ -32,7 +32,7 @@ exports[`text.js [flow] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`text.js [meriyah] format 1`] = `
|
||||
"[6:20]: Invalid hexadecimal escape sequence (6:20)
|
||||
"Invalid hexadecimal escape sequence (6:20)
|
||||
4 | foo = markdown\`\\\\u{prettier}\\\\u{0065}\`;
|
||||
5 | foo = css\`\\\\u{prettier}\\\\u{0065}\`;
|
||||
> 6 | foo = /* HTML */\`\\\\u{prettier}\\\\u{0065}\`;
|
||||
|
||||
@@ -21,7 +21,7 @@ exports[`no-semi.js [espree] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`no-semi.js [meriyah] format 1`] = `
|
||||
"[2:2]: Unexpected token: ':' (2:2)
|
||||
"Unexpected token: ':' (2:2)
|
||||
1 | a
|
||||
> 2 | ;::b.c
|
||||
| ^
|
||||
@@ -51,7 +51,7 @@ exports[`no-semi.js - {"semi":false} [espree] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`no-semi.js - {"semi":false} [meriyah] format 1`] = `
|
||||
"[2:2]: Unexpected token: ':' (2:2)
|
||||
"Unexpected token: ':' (2:2)
|
||||
1 | a
|
||||
> 2 | ;::b.c
|
||||
| ^
|
||||
|
||||
@@ -75,7 +75,7 @@ exports[`expression.js [espree] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`expression.js [meriyah] format 1`] = `
|
||||
"[5:4]: Expected ')' (5:4)
|
||||
"Expected ')' (5:4)
|
||||
3 | a = () => ({}).x;
|
||||
4 | ({} && a, b);
|
||||
> 5 | ({}::b, 0);
|
||||
|
||||
@@ -19,7 +19,7 @@ exports[`test.js [espree] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`test.js [meriyah] format 1`] = `
|
||||
"[1:23]: Unexpected token: '?' (1:23)
|
||||
"Unexpected token: '?' (1:23)
|
||||
> 1 | const addOne = add(1, ?); // apply from the left
|
||||
| ^
|
||||
2 | addOne(2); // 3
|
||||
|
||||
@@ -21,7 +21,7 @@ exports[`block-comments.js [espree] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`block-comments.js [meriyah] format 1`] = `
|
||||
"[2:2]: Unexpected token: '>' (2:2)
|
||||
"Unexpected token: '>' (2:2)
|
||||
1 | bifornCringerMoshedPerplexSawder
|
||||
> 2 | |> foo1
|
||||
| ^
|
||||
@@ -75,7 +75,7 @@ exports[`fsharp_style_pipeline_operator.js [espree] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`fsharp_style_pipeline_operator.js [meriyah] format 1`] = `
|
||||
"[2:4]: Unexpected token: '>' (2:4)
|
||||
"Unexpected token: '>' (2:4)
|
||||
1 | promise
|
||||
> 2 | |> await
|
||||
| ^
|
||||
@@ -198,7 +198,7 @@ exports[`hack_pipeline_operator.js [espree] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`hack_pipeline_operator.js [meriyah] format 1`] = `
|
||||
"[1:4]: Unexpected token: '>' (1:4)
|
||||
"Unexpected token: '>' (1:4)
|
||||
> 1 | a |> await % |> % * 3;
|
||||
| ^
|
||||
2 |
|
||||
@@ -339,7 +339,7 @@ exports[`minimal_pipeline_operator.js [espree] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`minimal_pipeline_operator.js [meriyah] format 1`] = `
|
||||
"[1:4]: Unexpected token: '>' (1:4)
|
||||
"Unexpected token: '>' (1:4)
|
||||
> 1 | a |> b |> c;
|
||||
| ^
|
||||
2 |
|
||||
|
||||
@@ -21,7 +21,7 @@ exports[`computed.js [espree] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`computed.js [meriyah] format 1`] = `
|
||||
"[2:8]: '#' not followed by identifier (2:8)
|
||||
"'#' not followed by identifier (2:8)
|
||||
1 | const key = \\"a\\";
|
||||
> 2 | assert(#{ [key]: 1 } === #{ a: 1 })
|
||||
| ^
|
||||
@@ -79,7 +79,7 @@ exports[`destructuring.js [espree] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`destructuring.js [meriyah] format 1`] = `
|
||||
"[1:18]: '#' not followed by identifier (1:18)
|
||||
"'#' not followed by identifier (1:18)
|
||||
> 1 | const { a, b } = #{ a: 1, b: 2 };
|
||||
| ^
|
||||
2 | assert(a === 1);
|
||||
@@ -136,7 +136,7 @@ exports[`record.js [espree] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`record.js [meriyah] format 1`] = `
|
||||
"[1:17]: '#' not followed by identifier (1:17)
|
||||
"'#' not followed by identifier (1:17)
|
||||
> 1 | const record1 = #{
|
||||
| ^
|
||||
2 | a: 1,
|
||||
@@ -207,7 +207,7 @@ exports[`shorthand.js [espree] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`shorthand.js [meriyah] format 1`] = `
|
||||
"[2:16]: '#' not followed by identifier (2:16)
|
||||
"'#' not followed by identifier (2:16)
|
||||
1 | const url = \\"https://github.com/tc39/proposal-record-tuple\\";
|
||||
> 2 | const record = #{ url }
|
||||
| ^
|
||||
@@ -252,7 +252,7 @@ exports[`spread.js [espree] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`spread.js [meriyah] format 1`] = `
|
||||
"[1:18]: '#' not followed by identifier (1:18)
|
||||
"'#' not followed by identifier (1:18)
|
||||
> 1 | const formData = #{ title: \\"Implement all the things\\" }
|
||||
| ^
|
||||
2 | const taskNow = #{ id: 42, status: \\"WIP\\", ...formData }
|
||||
@@ -303,7 +303,7 @@ exports[`syntax.js [espree] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`syntax.js [meriyah] format 1`] = `
|
||||
"[1:1]: '#' not followed by identifier (1:1)
|
||||
"'#' not followed by identifier (1:1)
|
||||
> 1 | #{}
|
||||
| ^
|
||||
2 | #{ a: 1, b: 2 }
|
||||
|
||||
@@ -8,7 +8,7 @@ exports[`d-flag.js [flow] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`d-flag.js [meriyah] format 1`] = `
|
||||
"[1:3]: Unexpected regular expression flag (1:3)
|
||||
"Unexpected regular expression flag (1:3)
|
||||
> 1 | /./d;
|
||||
| ^
|
||||
2 |"
|
||||
@@ -64,7 +64,7 @@ exports[`v-flag.js [flow] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`v-flag.js [meriyah] format 1`] = `
|
||||
"[1:3]: Unexpected regular expression flag (1:3)
|
||||
"Unexpected regular expression flag (1:3)
|
||||
> 1 | /a/v;
|
||||
| ^
|
||||
2 |"
|
||||
|
||||
@@ -19,7 +19,7 @@ exports[`trailing-commas.js - {"trailingComma":"all"} [espree] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`trailing-commas.js - {"trailingComma":"all"} [meriyah] format 1`] = `
|
||||
"[1:13]: Unexpected token: 'class' (1:13)
|
||||
"Unexpected token: 'class' (1:13)
|
||||
> 1 | declare class C {
|
||||
| ^
|
||||
2 | f(
|
||||
|
||||
@@ -95,7 +95,7 @@ exports[`function-declaration-in-while.js [flow] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`function-declaration-in-while.js [meriyah] format 1`] = `
|
||||
"[1:22]: In strict mode code, functions can only be declared at top level or inside a block (1:22)
|
||||
"In strict mode code, functions can only be declared at top level or inside a block (1:22)
|
||||
> 1 | while (false) function foo(){}
|
||||
| ^
|
||||
2 |"
|
||||
|
||||
@@ -19,7 +19,7 @@ exports[`throw_expression.js [espree] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`throw_expression.js [meriyah] format 1`] = `
|
||||
"[1:30]: Unexpected token: 'throw' (1:30)
|
||||
"Unexpected token: 'throw' (1:30)
|
||||
> 1 | function save(filename = throw new TypeError(\\"Argument required\\")) {}
|
||||
| ^
|
||||
2 |
|
||||
|
||||
@@ -19,7 +19,7 @@ exports[`trailing.js [espree] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`trailing.js [meriyah] format 1`] = `
|
||||
"[1:11]: Unexpected token: 'identifier' (1:11)
|
||||
"Unexpected token: 'identifier' (1:11)
|
||||
> 1 | export type Result<T, V> = | { kind: \\"not-test-editor1\\" } | { kind: \\"not-test-editor2\\" };
|
||||
| ^
|
||||
2 |
|
||||
|
||||
@@ -19,7 +19,7 @@ exports[`destructuring.js [espree] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`destructuring.js [meriyah] format 1`] = `
|
||||
"[1:16]: '#' not followed by identifier (1:16)
|
||||
"'#' not followed by identifier (1:16)
|
||||
> 1 | const [a, b] = #[1, 2];
|
||||
| ^
|
||||
2 | assert(a === 1);
|
||||
@@ -86,7 +86,7 @@ exports[`invalid-tuple-holes.js [espree] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`invalid-tuple-holes.js [meriyah] format 1`] = `
|
||||
"[1:1]: '#' not followed by identifier (1:1)
|
||||
"'#' not followed by identifier (1:1)
|
||||
> 1 | #[,]
|
||||
| ^
|
||||
2 |"
|
||||
@@ -111,7 +111,7 @@ exports[`syntax.js [espree] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`syntax.js [meriyah] format 1`] = `
|
||||
"[1:1]: '#' not followed by identifier (1:1)
|
||||
"'#' not followed by identifier (1:1)
|
||||
> 1 | #[]
|
||||
| ^
|
||||
2 | #[1, 2]
|
||||
@@ -156,7 +156,7 @@ exports[`tuple.js [espree] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`tuple.js [meriyah] format 1`] = `
|
||||
"[1:16]: '#' not followed by identifier (1:16)
|
||||
"'#' not followed by identifier (1:16)
|
||||
> 1 | const tuple1 = #[1, 2, 3];
|
||||
| ^
|
||||
2 |
|
||||
@@ -225,7 +225,7 @@ exports[`tuple-trailing-comma.js [espree] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`tuple-trailing-comma.js [meriyah] format 1`] = `
|
||||
"[1:1]: '#' not followed by identifier (1:1)
|
||||
"'#' not followed by identifier (1:1)
|
||||
> 1 | #[1,]
|
||||
| ^
|
||||
2 |"
|
||||
|
||||
@@ -17,7 +17,7 @@ exports[`avoid-conflicts-to-pipeline.js [espree] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`avoid-conflicts-to-pipeline.js [meriyah] format 1`] = `
|
||||
"[2:16]: Unexpected token: '%' (2:16)
|
||||
"Unexpected token: '%' (2:16)
|
||||
1 | // |>
|
||||
> 2 | const status = %GetOptimizationStatus(fn);
|
||||
| ^
|
||||
@@ -61,7 +61,7 @@ exports[`intrinsic_call.js [espree] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`intrinsic_call.js [meriyah] format 1`] = `
|
||||
"[2:13]: Unexpected token: '%' (2:13)
|
||||
"Unexpected token: '%' (2:13)
|
||||
1 | function doSmth() {
|
||||
> 2 | %DebugPrint
|
||||
| ^
|
||||
|
||||
@@ -61,13 +61,13 @@ exports[`snippet: #0 [flow] format 2`] = `
|
||||
`;
|
||||
|
||||
exports[`snippet: #0 [meriyah] format 1`] = `
|
||||
"[1:8]: Expected '(' (1:8)
|
||||
"Expected '(' (1:8)
|
||||
> 1 | for each (a in b) {}
|
||||
| ^"
|
||||
`;
|
||||
|
||||
exports[`snippet: #0 [meriyah] format 2`] = `
|
||||
"[1:9]: Invalid left-hand side in assignment (1:9)
|
||||
"Invalid left-hand side in assignment (1:9)
|
||||
> 1 | (a = b) = 1
|
||||
| ^"
|
||||
`;
|
||||
@@ -139,13 +139,13 @@ exports[`snippet: #1 [flow] format 2`] = `
|
||||
`;
|
||||
|
||||
exports[`snippet: #1 [meriyah] format 1`] = `
|
||||
"[1:12]: Unexpected strict mode reserved word (1:12)
|
||||
"Unexpected strict mode reserved word (1:12)
|
||||
> 1 | class switch() {}
|
||||
| ^"
|
||||
`;
|
||||
|
||||
exports[`snippet: #1 [meriyah] format 2`] = `
|
||||
"[1:7]: Invalid left-hand side in assignment (1:7)
|
||||
"Invalid left-hand side in assignment (1:7)
|
||||
> 1 | a = 1 = 2
|
||||
| ^"
|
||||
`;
|
||||
@@ -181,7 +181,7 @@ exports[`snippet: #2 [flow] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`snippet: #2 [meriyah] format 1`] = `
|
||||
"[1:9]: Invalid left-hand side in assignment (1:9)
|
||||
"Invalid left-hand side in assignment (1:9)
|
||||
> 1 | (a = 1) = 2
|
||||
| ^"
|
||||
`;
|
||||
@@ -211,7 +211,7 @@ exports[`snippet: #3 [flow] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`snippet: #3 [meriyah] format 1`] = `
|
||||
"[1:10]: Invalid left-hand side in assignment (1:10)
|
||||
"Invalid left-hand side in assignment (1:10)
|
||||
> 1 | (a += b) = 1
|
||||
| ^"
|
||||
`;
|
||||
@@ -241,7 +241,7 @@ exports[`snippet: #4 [flow] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`snippet: #4 [meriyah] format 1`] = `
|
||||
"[1:10]: Invalid left-hand side in assignment (1:10)
|
||||
"Invalid left-hand side in assignment (1:10)
|
||||
> 1 | (a = b) += 1
|
||||
| ^"
|
||||
`;
|
||||
@@ -25,7 +25,7 @@ exports[`snippet: #0 [espree] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`snippet: #0 [meriyah] format 1`] = `
|
||||
"[1:6]: Invalid left-hand side in assignment (1:6)
|
||||
"Invalid left-hand side in assignment (1:6)
|
||||
> 1 | ({}) = x;
|
||||
| ^"
|
||||
`;
|
||||
@@ -51,7 +51,7 @@ exports[`snippet: #0 [flow] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`snippet: #0 [meriyah] format 1`] = `
|
||||
"[2:24]: Await is only valid in async functions (2:24)
|
||||
"Await is only valid in async functions (2:24)
|
||||
1 | async function foo() {
|
||||
> 2 | function bar(x = await 2) {}
|
||||
| ^
|
||||
@@ -83,7 +83,7 @@ exports[`snippet: #1 [flow] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`snippet: #1 [meriyah] format 1`] = `
|
||||
"[1:22]: Await expression not allowed in formal parameter (1:22)
|
||||
"Await expression not allowed in formal parameter (1:22)
|
||||
> 1 | async (x = await 2) => {};
|
||||
| ^"
|
||||
`;
|
||||
@@ -113,7 +113,7 @@ exports[`snippet: #2 [flow] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`snippet: #2 [meriyah] format 1`] = `
|
||||
"[1:25]: Unexpected token: '!' (1:25)
|
||||
"Unexpected token: '!' (1:25)
|
||||
> 1 | f = async (a) => await a! ** 6;
|
||||
| ^"
|
||||
`;
|
||||
@@ -143,7 +143,7 @@ exports[`snippet: #3 [flow] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`snippet: #3 [meriyah] format 1`] = `
|
||||
"[1:14]: Unexpected token: '!' (1:14)
|
||||
"Unexpected token: '!' (1:14)
|
||||
> 1 | f = (a) => +a! ** 6;
|
||||
| ^"
|
||||
`;
|
||||
@@ -173,7 +173,7 @@ exports[`snippet: #4 [flow] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`snippet: #4 [meriyah] format 1`] = `
|
||||
"[1:22]: Expected ')' (1:22)
|
||||
"Expected ')' (1:22)
|
||||
> 1 | async (a) => (await a!) ** 6;
|
||||
| ^"
|
||||
`;
|
||||
@@ -203,7 +203,7 @@ exports[`snippet: #5 [flow] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`snippet: #5 [meriyah] format 1`] = `
|
||||
"[1:7]: Unary expressions as the left operand of an exponentiation expression must be disambiguated with parentheses (1:7)
|
||||
"Unary expressions as the left operand of an exponentiation expression must be disambiguated with parentheses (1:7)
|
||||
> 1 | (-+5 ** 6);
|
||||
| ^"
|
||||
`;
|
||||
@@ -233,7 +233,7 @@ exports[`snippet: #6 [flow] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`snippet: #6 [meriyah] format 1`] = `
|
||||
"[1:26]: Unary expressions as the left operand of an exponentiation expression must be disambiguated with parentheses (1:26)
|
||||
"Unary expressions as the left operand of an exponentiation expression must be disambiguated with parentheses (1:26)
|
||||
> 1 | f = async () => await 5 ** 6;
|
||||
| ^"
|
||||
`;
|
||||
@@ -263,7 +263,7 @@ exports[`snippet: #7 [flow] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`snippet: #7 [meriyah] format 1`] = `
|
||||
"[1:27]: Unary expressions as the left operand of an exponentiation expression must be disambiguated with parentheses (1:27)
|
||||
"Unary expressions as the left operand of an exponentiation expression must be disambiguated with parentheses (1:27)
|
||||
> 1 | f = async () => await -5 ** 6;
|
||||
| ^"
|
||||
`;
|
||||
@@ -293,7 +293,7 @@ exports[`snippet: #8 [flow] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`snippet: #8 [meriyah] format 1`] = `
|
||||
"[1:21]: Invalid shorthand property initializer (1:21)
|
||||
"Invalid shorthand property initializer (1:21)
|
||||
> 1 | async({ foo33 = 1 });
|
||||
| ^"
|
||||
`;
|
||||
@@ -55,7 +55,7 @@ exports[`snippet: #0 [flow] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`snippet: #0 [meriyah] format 1`] = `
|
||||
"[1:9]: 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 []);
|
||||
| ^"
|
||||
`;
|
||||
@@ -91,7 +91,7 @@ exports[`snippet: #1 [flow] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`snippet: #1 [meriyah] format 1`] = `
|
||||
"[1:9]: 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 []);
|
||||
| ^"
|
||||
`;
|
||||
@@ -127,7 +127,7 @@ exports[`snippet: #2 [flow] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`snippet: #2 [meriyah] format 1`] = `
|
||||
"[1:10]: 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 []);
|
||||
| ^"
|
||||
`;
|
||||
|
||||
@@ -37,7 +37,7 @@ exports[`snippet: #0 [flow] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`snippet: #0 [meriyah] format 1`] = `
|
||||
"[1:8]: Unexpected token: ')' (1:8)
|
||||
"Unexpected token: ')' (1:8)
|
||||
> 1 | import();
|
||||
| ^"
|
||||
`;
|
||||
@@ -85,7 +85,7 @@ exports[`snippet: #1 [flow] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`snippet: #1 [meriyah] format 1`] = `
|
||||
"[1:21]: Unexpected token: ')' (1:21)
|
||||
"Unexpected token: ')' (1:21)
|
||||
> 1 | import(/* comment */);
|
||||
| ^"
|
||||
`;
|
||||
@@ -133,7 +133,7 @@ exports[`snippet: #2 [flow] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`snippet: #2 [meriyah] format 1`] = `
|
||||
"[1:11]: Cannot use new with import(...) (1:11)
|
||||
"Cannot use new with import(...) (1:11)
|
||||
> 1 | new import('./a.mjs');
|
||||
| ^"
|
||||
`;
|
||||
@@ -181,7 +181,7 @@ exports[`snippet: #3 [flow] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`snippet: #3 [meriyah] format 1`] = `
|
||||
"[1:11]: Cannot use new with import(...) (1:11)
|
||||
"Cannot use new with import(...) (1:11)
|
||||
> 1 | new import();
|
||||
| ^"
|
||||
`;
|
||||
|
||||
@@ -22,7 +22,7 @@ exports[`invalid-exponent.js [espree] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`invalid-exponent.js [meriyah] format 1`] = `
|
||||
"[1:5]: Non-number found after exponent indicator (1:5)
|
||||
"Non-number found after exponent indicator (1:5)
|
||||
> 1 | 12.3e
|
||||
| ^
|
||||
2 |"
|
||||
|
||||
@@ -28,7 +28,7 @@ exports[`getter-generator.js [espree] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`getter-generator.js [meriyah] format 1`] = `
|
||||
"[2:9]: A getter cannot be a generator (2:9)
|
||||
"A getter cannot be a generator (2:9)
|
||||
1 | ({
|
||||
> 2 | get *iterator() { },
|
||||
| ^
|
||||
@@ -58,7 +58,7 @@ exports[`getter-with-parameter.js [espree] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`getter-with-parameter.js [meriyah] format 1`] = `
|
||||
"[1:10]: Getter functions must have exactly no arguments (1:10)
|
||||
"Getter functions must have exactly no arguments (1:10)
|
||||
> 1 | ({ get x(a){} });
|
||||
| ^
|
||||
2 |"
|
||||
@@ -92,7 +92,7 @@ exports[`setter-generator.js [espree] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`setter-generator.js [meriyah] format 1`] = `
|
||||
"[2:9]: A getter cannot be a generator (2:9)
|
||||
"A getter cannot be a generator (2:9)
|
||||
1 | ({
|
||||
> 2 | set *iterator(iter) { },
|
||||
| ^
|
||||
@@ -122,7 +122,7 @@ exports[`setter-without-parameter.js [espree] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`setter-without-parameter.js [meriyah] format 1`] = `
|
||||
"[1:10]: Setter functions must have exactly one argument (1:10)
|
||||
"Setter functions must have exactly one argument (1:10)
|
||||
> 1 | ({ set x(){} });
|
||||
| ^
|
||||
2 |"
|
||||
|
||||
@@ -19,7 +19,7 @@ exports[`snippet: #0 [espree] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`snippet: #0 [meriyah] format 1`] = `
|
||||
"[1:22]: Invalid optional chain from new expression (1:22)
|
||||
"Invalid optional chain from new expression (1:22)
|
||||
> 1 | const baz3 = new obj?.foo?.bar?.baz(); // baz instance
|
||||
| ^"
|
||||
`;
|
||||
@@ -43,7 +43,7 @@ exports[`snippet: #1 [espree] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`snippet: #1 [meriyah] format 1`] = `
|
||||
"[1:23]: Invalid optional chain from new expression (1:23)
|
||||
"Invalid optional chain from new expression (1:23)
|
||||
> 1 | const safe5 = new obj?.qux?.baz(); // undefined
|
||||
| ^"
|
||||
`;
|
||||
@@ -67,7 +67,7 @@ exports[`snippet: #2 [espree] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`snippet: #2 [meriyah] format 1`] = `
|
||||
"[1:23]: Invalid optional chain from new expression (1:23)
|
||||
"Invalid optional chain from new expression (1:23)
|
||||
> 1 | const safe6 = new obj?.foo.bar.qux?.(); // undefined
|
||||
| ^"
|
||||
`;
|
||||
@@ -91,7 +91,7 @@ exports[`snippet: #3 [espree] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`snippet: #3 [meriyah] format 1`] = `
|
||||
"[1:27]: Invalid optional chain from new expression (1:27)
|
||||
"Invalid optional chain from new expression (1:27)
|
||||
> 1 | const willThrow = new obj?.foo.bar.qux(); // Error: not a constructor
|
||||
| ^"
|
||||
`;
|
||||
@@ -121,7 +121,7 @@ exports[`snippet: #4 [espree] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`snippet: #4 [meriyah] format 1`] = `
|
||||
"[4:10]: Invalid optional chain from new expression (4:10)
|
||||
"Invalid optional chain from new expression (4:10)
|
||||
2 | class Test {
|
||||
3 | }
|
||||
> 4 | new Test?.(); // test instance
|
||||
@@ -147,7 +147,7 @@ exports[`snippet: #5 [espree] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`snippet: #5 [meriyah] format 1`] = `
|
||||
"[1:12]: Invalid optional chain from new expression (1:12)
|
||||
"Invalid optional chain from new expression (1:12)
|
||||
> 1 | new exists?.(); // undefined
|
||||
| ^"
|
||||
`;
|
||||
@@ -19,7 +19,7 @@ exports[`snippet: #0 [espree] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`snippet: #0 [meriyah] format 1`] = `
|
||||
"[1:1]: '#' not followed by identifier (1:1)
|
||||
"'#' not followed by identifier (1:1)
|
||||
> 1 | #{a() {}}
|
||||
| ^"
|
||||
`;
|
||||
@@ -43,7 +43,7 @@ exports[`snippet: #1 [espree] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`snippet: #1 [meriyah] format 1`] = `
|
||||
"[1:1]: '#' not followed by identifier (1:1)
|
||||
"'#' not followed by identifier (1:1)
|
||||
> 1 | #{async b() {}}
|
||||
| ^"
|
||||
`;
|
||||
@@ -67,7 +67,7 @@ exports[`snippet: #2 [espree] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`snippet: #2 [meriyah] format 1`] = `
|
||||
"[1:1]: '#' not followed by identifier (1:1)
|
||||
"'#' not followed by identifier (1:1)
|
||||
> 1 | #{get c() {}}
|
||||
| ^"
|
||||
`;
|
||||
@@ -91,7 +91,7 @@ exports[`snippet: #3 [espree] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`snippet: #3 [meriyah] format 1`] = `
|
||||
"[1:1]: '#' not followed by identifier (1:1)
|
||||
"'#' not followed by identifier (1:1)
|
||||
> 1 | #{set d(_) {}}
|
||||
| ^"
|
||||
`;
|
||||
@@ -115,7 +115,7 @@ exports[`snippet: #4 [espree] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`snippet: #4 [meriyah] format 1`] = `
|
||||
"[1:1]: '#' not followed by identifier (1:1)
|
||||
"'#' not followed by identifier (1:1)
|
||||
> 1 | #{*e() {}}
|
||||
| ^"
|
||||
`;
|
||||
@@ -22,7 +22,7 @@ exports[`invalid-flags.js [espree] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`invalid-flags.js [meriyah] format 1`] = `
|
||||
"[1:5]: Unexpected regular expression flag (1:5)
|
||||
"Unexpected regular expression flag (1:5)
|
||||
> 1 | /a/ugv;
|
||||
| ^
|
||||
2 |"
|
||||
@@ -50,7 +50,7 @@ exports[`invalid-flags2.js [espree] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`invalid-flags2.js [meriyah] format 1`] = `
|
||||
"[1:3]: Unexpected regular expression flag (1:3)
|
||||
"Unexpected regular expression flag (1:3)
|
||||
> 1 | /a/vu;
|
||||
| ^
|
||||
2 |"
|
||||
|
||||
@@ -7,7 +7,7 @@ exports[`snippet: #0 [espree] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`snippet: #0 [meriyah] format 1`] = `
|
||||
"[1:15]: Unexpected strict mode reserved word (1:15)
|
||||
"Unexpected strict mode reserved word (1:15)
|
||||
> 1 | class interface {}
|
||||
| ^"
|
||||
`;
|
||||
@@ -19,7 +19,7 @@ exports[`snippet: #1 [espree] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`snippet: #1 [meriyah] format 1`] = `
|
||||
"[1:16]: Unexpected strict mode reserved word (1:16)
|
||||
"Unexpected strict mode reserved word (1:16)
|
||||
> 1 | import interface from \\"foo\\";
|
||||
| ^"
|
||||
`;
|
||||
@@ -22,7 +22,7 @@ exports[`invalid-const.js [espree] format 1`] = `
|
||||
`;
|
||||
|
||||
exports[`invalid-const.js [meriyah] format 1`] = `
|
||||
"[1:10]: Missing initializer in const declaration (1:10)
|
||||
"Missing initializer in const declaration (1:10)
|
||||
> 1 | const foo;
|
||||
| ^
|
||||
2 |"
|
||||
|
||||
@@ -1,2 +1,19 @@
|
||||
run_spec(import.meta, ["yaml"]);
|
||||
run_spec(import.meta, ["yaml"], { proseWrap: "always" });
|
||||
import { outdent } from "outdent";
|
||||
|
||||
const snippets = [
|
||||
{
|
||||
code: outdent`
|
||||
block_with_ideographic_space: |
|
||||
\u{3000}x
|
||||
`,
|
||||
output: outdent`
|
||||
block_with_ideographic_space: |
|
||||
\u{3000}x
|
||||
`,
|
||||
},
|
||||
].map((test) => ({ ...test, output: test.output + "\n" }));
|
||||
|
||||
run_spec({ importMeta: import.meta, snippets }, ["yaml"]);
|
||||
run_spec({ importMeta: import.meta, snippets }, ["yaml"], {
|
||||
proseWrap: "always",
|
||||
});
|
||||
@@ -153,6 +153,7 @@ Other options:
|
||||
--loglevel <silent|error|warn|log|debug>
|
||||
What level of logs to report.
|
||||
Defaults to log.
|
||||
--no-plugin-search Disable plugin autoloading.
|
||||
--require-pragma Require either '@prettier' or '@format' to be present in the file's first docblock comment
|
||||
in order for it to be formatted.
|
||||
Defaults to false.
|
||||
@@ -322,6 +323,7 @@ Other options:
|
||||
--loglevel <silent|error|warn|log|debug>
|
||||
What level of logs to report.
|
||||
Defaults to log.
|
||||
--no-plugin-search Disable plugin autoloading.
|
||||
--require-pragma Require either '@prettier' or '@format' to be present in the file's first docblock comment
|
||||
in order for it to be formatted.
|
||||
Defaults to false.
|
||||
|
||||
@@ -358,6 +358,17 @@ exports[`show detailed usage with --help no-error-on-unmatched-pattern (stdout)
|
||||
|
||||
exports[`show detailed usage with --help no-error-on-unmatched-pattern (write) 1`] = `Array []`;
|
||||
|
||||
exports[`show detailed usage with --help no-plugin-search (stderr) 1`] = `""`;
|
||||
|
||||
exports[`show detailed usage with --help no-plugin-search (stdout) 1`] = `
|
||||
"--no-plugin-search
|
||||
|
||||
Disable plugin autoloading.
|
||||
"
|
||||
`;
|
||||
|
||||
exports[`show detailed usage with --help no-plugin-search (write) 1`] = `Array []`;
|
||||
|
||||
exports[`show detailed usage with --help no-semi (stderr) 1`] = `""`;
|
||||
|
||||
exports[`show detailed usage with --help no-semi (stdout) 1`] = `
|
||||
|
||||
@@ -512,7 +512,8 @@ exports[`CLI --support-info (stdout) 1`] = `
|
||||
\\"language-configuration.json\\",
|
||||
\\"tsconfig.json\\",
|
||||
\\"tslint.json\\",
|
||||
\\".eslintrc\\"
|
||||
\\".eslintrc\\",
|
||||
\\".swcrc\\"
|
||||
],
|
||||
\\"group\\": \\"JSON\\",
|
||||
\\"linguistLanguageId\\": 423,
|
||||
|
||||
@@ -305,6 +305,14 @@ test("API resolveConfig resolves relative path values based on config filepath",
|
||||
plugins: [path.join(parentDir, "path-to-plugin")],
|
||||
pluginSearchDirs: [path.join(parentDir, "path-to-plugin-search-dir")],
|
||||
});
|
||||
|
||||
expect(
|
||||
prettier.resolveConfig.sync(
|
||||
path.join(__dirname, "../cli/config/plugin-search-dirs/index.js")
|
||||
)
|
||||
).toMatchObject({
|
||||
pluginSearchDirs: false,
|
||||
});
|
||||
});
|
||||
|
||||
test("API resolveConfig de-references to an external module", () => {
|
||||
|
||||
@@ -203,3 +203,70 @@ describe("loads --plugin by bespoke plugin name (assuming it is installed in cwd
|
||||
write: [],
|
||||
});
|
||||
});
|
||||
|
||||
test("--no-plugin-search", async () => {
|
||||
async function getParser(args = []) {
|
||||
const { stdout } = await runPrettier("plugins/automatic", [
|
||||
"--file-info=file.foo",
|
||||
...args,
|
||||
]);
|
||||
return JSON.parse(stdout).inferredParser;
|
||||
}
|
||||
|
||||
expect(await getParser()).toBe("foo");
|
||||
expect(await getParser(["--plugin-search-dir=."])).toBe("foo");
|
||||
expect(await getParser(["--no-plugin-search"])).toBeNull();
|
||||
});
|
||||
|
||||
test("--no-plugin-search still allow use --plugin", async () => {
|
||||
const args = ["file.txt", "--parser=bar"];
|
||||
const { stdout: stdoutWithoutPlugin } = await runPrettier(
|
||||
"plugins/automatic",
|
||||
args
|
||||
);
|
||||
const argsWithPlugin = [...args, "--plugin=./prettier-plugin-bar.js"];
|
||||
const { stdout: stdoutWithPlugin } = await runPrettier(
|
||||
"plugins/automatic",
|
||||
argsWithPlugin
|
||||
);
|
||||
const { stdout: stdoutWithoutPluginAndNoPluginSearch } = await runPrettier(
|
||||
"plugins/automatic",
|
||||
[...args, "--no-plugin-search"]
|
||||
);
|
||||
const { stdout: stdoutWithPluginButNoPluginSearch } = await runPrettier(
|
||||
"plugins/automatic",
|
||||
[...argsWithPlugin, "--no-plugin-search"]
|
||||
);
|
||||
|
||||
expect(stdoutWithoutPlugin).not.toBe(stdoutWithPlugin);
|
||||
expect(stdoutWithoutPluginAndNoPluginSearch).toBe("");
|
||||
expect(stdoutWithPlugin).toBe(stdoutWithPluginButNoPluginSearch);
|
||||
});
|
||||
|
||||
test("--no-plugin-search together with --plugin-search-dir", async () => {
|
||||
const result1 = await runPrettier("plugins/automatic", [
|
||||
"--no-plugin-search",
|
||||
"--plugin-search-dir",
|
||||
]);
|
||||
const result2 = await runPrettier("plugins/automatic", [
|
||||
"--no-plugin-search",
|
||||
"--plugin-search-dir=foo",
|
||||
]);
|
||||
const result3 = await runPrettier("plugins/automatic", [
|
||||
"--no-plugin-search",
|
||||
"--plugin-search-dir=foo",
|
||||
"--plugin-search-dir=bar",
|
||||
]);
|
||||
|
||||
expect(result1).toMatchInlineSnapshot(`
|
||||
Object {
|
||||
"status": 1,
|
||||
"stderr": "[error] Cannot use --no-plugin-search and --plugin-search-dir together.
|
||||
",
|
||||
"stdout": "",
|
||||
"write": Array [],
|
||||
}
|
||||
`);
|
||||
expect(result2).toEqual(result1);
|
||||
expect(result3).toEqual(result1);
|
||||
});
|
||||
@@ -43,4 +43,26 @@ describe("infers parser from filename", () => {
|
||||
prettier.format("let foo = ( x = 1 ) => x", { filepath: "x/y/Jakefile" })
|
||||
).toBe("let foo = (x = 1) => x;\n");
|
||||
});
|
||||
|
||||
test("json from .swcrc", () => {
|
||||
expect(
|
||||
prettier.format(
|
||||
`
|
||||
{
|
||||
"jsc": {
|
||||
// Requires v1.2.50 or upper and requires target to be es2016 or upper.
|
||||
"keepClassNames": false
|
||||
}
|
||||
}
|
||||
`,
|
||||
{ filepath: "/path/to/.swcrc" }
|
||||
)
|
||||
).toBe(`{
|
||||
"jsc": {
|
||||
// Requires v1.2.50 or upper and requires target to be es2016 or upper.
|
||||
"keepClassNames": false
|
||||
}
|
||||
}
|
||||
`);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"pluginSearchDirs": false
|
||||
}
|
||||
Vendored
+2
@@ -0,0 +1,2 @@
|
||||
// This file is generated automatically.
|
||||
export * from "execa";
|
||||
Vendored
+1908
File diff suppressed because it is too large.
Load diff
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
// This file is generated automatically.
|
||||
export {default} from "tempy";
|
||||
export * from "tempy";
|
||||
Vendored
+9911
File diff suppressed because it is too large.
Load diff
Loaded 100 of 101 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user