Merge branch 'main' into next
# Conflicts: # scripts/vendors/vendor-meta.json # src/cli/options/get-options-for-file.js # src/cli/options/parse-cli-arguments.js # src/language-js/print/class.js # src/language-js/print/type-annotation.js # src/language-js/printer-estree.js # src/main/options-normalizer.js # vendors/tempy.js
This commit is contained in:
commit
b11044e58c
44 files changed
+2892
-275
No files matched your search
@@ -56,7 +56,28 @@ const espreeDisabledTests = new Set(
|
||||
].map((directory) => path.join(__dirname, "../format/js", directory))
|
||||
);
|
||||
const acornDisabledTests = espreeDisabledTests;
|
||||
const meriyahDisabledTests = espreeDisabledTests;
|
||||
const meriyahDisabledTests = new Set([
|
||||
...espreeDisabledTests,
|
||||
// Meriyah does not support decorator auto accessors syntax.
|
||||
// But meriyah can parse it as an ordinary class property.
|
||||
// So meriyah does not throw parsing error for it.
|
||||
...[
|
||||
"basic.js",
|
||||
"computed.js",
|
||||
"private.js",
|
||||
"static-computed.js",
|
||||
"static-private.js",
|
||||
"static.js",
|
||||
"with-semicolon-1.js",
|
||||
"with-semicolon-2.js",
|
||||
].map((filename) =>
|
||||
path.join(__dirname, "../format/js/decorator-auto-accessors", filename)
|
||||
),
|
||||
path.join(
|
||||
__dirname,
|
||||
"../format/js/babel-plugins/decorator-auto-accessors.js"
|
||||
),
|
||||
]);
|
||||
|
||||
const isUnstable = (filename, options) => {
|
||||
const testFunction = unstableTests.get(filename);
|
||||
@@ -217,6 +238,13 @@ function runSpec(fixtures, parsers, options) {
|
||||
: format(code, formatOptions);
|
||||
|
||||
for (const currentParser of allParsers) {
|
||||
if (
|
||||
(currentParser === "espree" && espreeDisabledTests.has(filename)) ||
|
||||
(currentParser === "meriyah" && meriyahDisabledTests.has(filename)) ||
|
||||
(currentParser === "acorn" && acornDisabledTests.has(filename))
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
runTest({
|
||||
parsers,
|
||||
name,
|
||||
|
||||
@@ -534,6 +534,42 @@ typeof 1m === "decimal128";
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`decorator-auto-accessors.js [acorn] format 1`] = `
|
||||
"Unexpected token (2:12)
|
||||
1 | class C extends HTMLElement {
|
||||
> 2 | accessor clicked = false;
|
||||
| ^
|
||||
3 | }
|
||||
4 |"
|
||||
`;
|
||||
|
||||
exports[`decorator-auto-accessors.js [espree] format 1`] = `
|
||||
"Unexpected token clicked (2:12)
|
||||
1 | class C extends HTMLElement {
|
||||
> 2 | accessor clicked = false;
|
||||
| ^
|
||||
3 | }
|
||||
4 |"
|
||||
`;
|
||||
|
||||
exports[`decorator-auto-accessors.js format 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["babel", "babel-ts", "babel-flow"]
|
||||
printWidth: 80
|
||||
| printWidth
|
||||
=====================================input======================================
|
||||
class C extends HTMLElement {
|
||||
accessor clicked = false;
|
||||
}
|
||||
|
||||
=====================================output=====================================
|
||||
class C extends HTMLElement {
|
||||
accessor clicked = false;
|
||||
}
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`decorators.js [acorn] format 1`] = `
|
||||
"Unexpected character '@' (3:1)
|
||||
1 | // https://babeljs.io/docs/en/babel-plugin-proposal-decorators
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
class C extends HTMLElement {
|
||||
accessor clicked = false;
|
||||
}
|
||||
@@ -26,6 +26,7 @@ run_spec(import.meta, ["babel", "babel-ts", "babel-flow"], {
|
||||
"module-blocks.js",
|
||||
"async-do-expressions.js",
|
||||
"regex-v-flag.js",
|
||||
"decorator-auto-accessors.js",
|
||||
],
|
||||
espree: [
|
||||
"decimal.js",
|
||||
@@ -50,6 +51,7 @@ run_spec(import.meta, ["babel", "babel-ts", "babel-flow"], {
|
||||
"module-blocks.js",
|
||||
"async-do-expressions.js",
|
||||
"regex-v-flag.js",
|
||||
"decorator-auto-accessors.js",
|
||||
],
|
||||
meriyah: [
|
||||
"decimal.js",
|
||||
|
||||
@@ -0,0 +1,798 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`basic.js [acorn] format 1`] = `
|
||||
"Unexpected token (2:12)
|
||||
1 | class Foo {
|
||||
> 2 | accessor bar;
|
||||
| ^
|
||||
3 | }
|
||||
4 |"
|
||||
`;
|
||||
|
||||
exports[`basic.js [espree] format 1`] = `
|
||||
"Unexpected token bar (2:12)
|
||||
1 | class Foo {
|
||||
> 2 | accessor bar;
|
||||
| ^
|
||||
3 | }
|
||||
4 |"
|
||||
`;
|
||||
|
||||
exports[`basic.js - {"semi":false} [acorn] format 1`] = `
|
||||
"Unexpected token (2:12)
|
||||
1 | class Foo {
|
||||
> 2 | accessor bar;
|
||||
| ^
|
||||
3 | }
|
||||
4 |"
|
||||
`;
|
||||
|
||||
exports[`basic.js - {"semi":false} [espree] format 1`] = `
|
||||
"Unexpected token bar (2:12)
|
||||
1 | class Foo {
|
||||
> 2 | accessor bar;
|
||||
| ^
|
||||
3 | }
|
||||
4 |"
|
||||
`;
|
||||
|
||||
exports[`basic.js - {"semi":false} format 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["babel", "babel-ts", "babel-flow"]
|
||||
printWidth: 80
|
||||
semi: false
|
||||
| printWidth
|
||||
=====================================input======================================
|
||||
class Foo {
|
||||
accessor bar;
|
||||
}
|
||||
|
||||
=====================================output=====================================
|
||||
class Foo {
|
||||
accessor bar
|
||||
}
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`basic.js format 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["babel", "babel-ts", "babel-flow"]
|
||||
printWidth: 80
|
||||
| printWidth
|
||||
=====================================input======================================
|
||||
class Foo {
|
||||
accessor bar;
|
||||
}
|
||||
|
||||
=====================================output=====================================
|
||||
class Foo {
|
||||
accessor bar;
|
||||
}
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`computed.js [acorn] format 1`] = `
|
||||
"Unexpected token (2:12)
|
||||
1 | class Foo {
|
||||
> 2 | accessor [\\"bar\\"];
|
||||
| ^
|
||||
3 | }
|
||||
4 |"
|
||||
`;
|
||||
|
||||
exports[`computed.js [espree] format 1`] = `
|
||||
"Unexpected token [ (2:12)
|
||||
1 | class Foo {
|
||||
> 2 | accessor [\\"bar\\"];
|
||||
| ^
|
||||
3 | }
|
||||
4 |"
|
||||
`;
|
||||
|
||||
exports[`computed.js - {"semi":false} [acorn] format 1`] = `
|
||||
"Unexpected token (2:12)
|
||||
1 | class Foo {
|
||||
> 2 | accessor [\\"bar\\"];
|
||||
| ^
|
||||
3 | }
|
||||
4 |"
|
||||
`;
|
||||
|
||||
exports[`computed.js - {"semi":false} [espree] format 1`] = `
|
||||
"Unexpected token [ (2:12)
|
||||
1 | class Foo {
|
||||
> 2 | accessor [\\"bar\\"];
|
||||
| ^
|
||||
3 | }
|
||||
4 |"
|
||||
`;
|
||||
|
||||
exports[`computed.js - {"semi":false} format 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["babel", "babel-ts", "babel-flow"]
|
||||
printWidth: 80
|
||||
semi: false
|
||||
| printWidth
|
||||
=====================================input======================================
|
||||
class Foo {
|
||||
accessor ["bar"];
|
||||
}
|
||||
|
||||
=====================================output=====================================
|
||||
class Foo {
|
||||
accessor ["bar"]
|
||||
}
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`computed.js format 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["babel", "babel-ts", "babel-flow"]
|
||||
printWidth: 80
|
||||
| printWidth
|
||||
=====================================input======================================
|
||||
class Foo {
|
||||
accessor ["bar"];
|
||||
}
|
||||
|
||||
=====================================output=====================================
|
||||
class Foo {
|
||||
accessor ["bar"];
|
||||
}
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`computed-with-newline.js - {"semi":false} format 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["babel", "babel-ts", "babel-flow"]
|
||||
printWidth: 80
|
||||
semi: false
|
||||
| printWidth
|
||||
=====================================input======================================
|
||||
class Foo {
|
||||
accessor
|
||||
["bar"];
|
||||
}
|
||||
|
||||
=====================================output=====================================
|
||||
class Foo {
|
||||
accessor;
|
||||
["bar"]
|
||||
}
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`computed-with-newline.js format 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["babel", "babel-ts", "babel-flow"]
|
||||
printWidth: 80
|
||||
| printWidth
|
||||
=====================================input======================================
|
||||
class Foo {
|
||||
accessor
|
||||
["bar"];
|
||||
}
|
||||
|
||||
=====================================output=====================================
|
||||
class Foo {
|
||||
accessor;
|
||||
["bar"];
|
||||
}
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`not-accessor-method.js - {"semi":false} format 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["babel", "babel-ts", "babel-flow"]
|
||||
printWidth: 80
|
||||
semi: false
|
||||
| printWidth
|
||||
=====================================input======================================
|
||||
class Foo {
|
||||
accessor() {}
|
||||
}
|
||||
|
||||
=====================================output=====================================
|
||||
class Foo {
|
||||
accessor() {}
|
||||
}
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`not-accessor-method.js format 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["babel", "babel-ts", "babel-flow"]
|
||||
printWidth: 80
|
||||
| printWidth
|
||||
=====================================input======================================
|
||||
class Foo {
|
||||
accessor() {}
|
||||
}
|
||||
|
||||
=====================================output=====================================
|
||||
class Foo {
|
||||
accessor() {}
|
||||
}
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`not-accessor-property.js - {"semi":false} format 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["babel", "babel-ts", "babel-flow"]
|
||||
printWidth: 80
|
||||
semi: false
|
||||
| printWidth
|
||||
=====================================input======================================
|
||||
class Foo {
|
||||
accessor = 123;
|
||||
}
|
||||
|
||||
=====================================output=====================================
|
||||
class Foo {
|
||||
accessor = 123
|
||||
}
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`not-accessor-property.js format 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["babel", "babel-ts", "babel-flow"]
|
||||
printWidth: 80
|
||||
| printWidth
|
||||
=====================================input======================================
|
||||
class Foo {
|
||||
accessor = 123;
|
||||
}
|
||||
|
||||
=====================================output=====================================
|
||||
class Foo {
|
||||
accessor = 123;
|
||||
}
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`private.js [acorn] format 1`] = `
|
||||
"Unexpected token (2:12)
|
||||
1 | class Foo {
|
||||
> 2 | accessor #bar;
|
||||
| ^
|
||||
3 | }
|
||||
4 |"
|
||||
`;
|
||||
|
||||
exports[`private.js [espree] format 1`] = `
|
||||
"Unexpected token #bar (2:12)
|
||||
1 | class Foo {
|
||||
> 2 | accessor #bar;
|
||||
| ^
|
||||
3 | }
|
||||
4 |"
|
||||
`;
|
||||
|
||||
exports[`private.js - {"semi":false} [acorn] format 1`] = `
|
||||
"Unexpected token (2:12)
|
||||
1 | class Foo {
|
||||
> 2 | accessor #bar;
|
||||
| ^
|
||||
3 | }
|
||||
4 |"
|
||||
`;
|
||||
|
||||
exports[`private.js - {"semi":false} [espree] format 1`] = `
|
||||
"Unexpected token #bar (2:12)
|
||||
1 | class Foo {
|
||||
> 2 | accessor #bar;
|
||||
| ^
|
||||
3 | }
|
||||
4 |"
|
||||
`;
|
||||
|
||||
exports[`private.js - {"semi":false} format 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["babel", "babel-ts", "babel-flow"]
|
||||
printWidth: 80
|
||||
semi: false
|
||||
| printWidth
|
||||
=====================================input======================================
|
||||
class Foo {
|
||||
accessor #bar;
|
||||
}
|
||||
|
||||
=====================================output=====================================
|
||||
class Foo {
|
||||
accessor #bar
|
||||
}
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`private.js format 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["babel", "babel-ts", "babel-flow"]
|
||||
printWidth: 80
|
||||
| printWidth
|
||||
=====================================input======================================
|
||||
class Foo {
|
||||
accessor #bar;
|
||||
}
|
||||
|
||||
=====================================output=====================================
|
||||
class Foo {
|
||||
accessor #bar;
|
||||
}
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`static.js [acorn] format 1`] = `
|
||||
"Unexpected token (2:19)
|
||||
1 | class Foo {
|
||||
> 2 | static accessor bar;
|
||||
| ^
|
||||
3 | }
|
||||
4 |"
|
||||
`;
|
||||
|
||||
exports[`static.js [espree] format 1`] = `
|
||||
"Unexpected token bar (2:19)
|
||||
1 | class Foo {
|
||||
> 2 | static accessor bar;
|
||||
| ^
|
||||
3 | }
|
||||
4 |"
|
||||
`;
|
||||
|
||||
exports[`static.js - {"semi":false} [acorn] format 1`] = `
|
||||
"Unexpected token (2:19)
|
||||
1 | class Foo {
|
||||
> 2 | static accessor bar;
|
||||
| ^
|
||||
3 | }
|
||||
4 |"
|
||||
`;
|
||||
|
||||
exports[`static.js - {"semi":false} [espree] format 1`] = `
|
||||
"Unexpected token bar (2:19)
|
||||
1 | class Foo {
|
||||
> 2 | static accessor bar;
|
||||
| ^
|
||||
3 | }
|
||||
4 |"
|
||||
`;
|
||||
|
||||
exports[`static.js - {"semi":false} format 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["babel", "babel-ts", "babel-flow"]
|
||||
printWidth: 80
|
||||
semi: false
|
||||
| printWidth
|
||||
=====================================input======================================
|
||||
class Foo {
|
||||
static accessor bar;
|
||||
}
|
||||
|
||||
=====================================output=====================================
|
||||
class Foo {
|
||||
static accessor bar
|
||||
}
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`static.js format 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["babel", "babel-ts", "babel-flow"]
|
||||
printWidth: 80
|
||||
| printWidth
|
||||
=====================================input======================================
|
||||
class Foo {
|
||||
static accessor bar;
|
||||
}
|
||||
|
||||
=====================================output=====================================
|
||||
class Foo {
|
||||
static accessor bar;
|
||||
}
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`static-computed.js [acorn] format 1`] = `
|
||||
"Unexpected token (2:19)
|
||||
1 | class Foo {
|
||||
> 2 | static accessor [\\"bar\\"];
|
||||
| ^
|
||||
3 | }
|
||||
4 |"
|
||||
`;
|
||||
|
||||
exports[`static-computed.js [espree] format 1`] = `
|
||||
"Unexpected token [ (2:19)
|
||||
1 | class Foo {
|
||||
> 2 | static accessor [\\"bar\\"];
|
||||
| ^
|
||||
3 | }
|
||||
4 |"
|
||||
`;
|
||||
|
||||
exports[`static-computed.js - {"semi":false} [acorn] format 1`] = `
|
||||
"Unexpected token (2:19)
|
||||
1 | class Foo {
|
||||
> 2 | static accessor [\\"bar\\"];
|
||||
| ^
|
||||
3 | }
|
||||
4 |"
|
||||
`;
|
||||
|
||||
exports[`static-computed.js - {"semi":false} [espree] format 1`] = `
|
||||
"Unexpected token [ (2:19)
|
||||
1 | class Foo {
|
||||
> 2 | static accessor [\\"bar\\"];
|
||||
| ^
|
||||
3 | }
|
||||
4 |"
|
||||
`;
|
||||
|
||||
exports[`static-computed.js - {"semi":false} format 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["babel", "babel-ts", "babel-flow"]
|
||||
printWidth: 80
|
||||
semi: false
|
||||
| printWidth
|
||||
=====================================input======================================
|
||||
class Foo {
|
||||
static accessor ["bar"];
|
||||
}
|
||||
|
||||
=====================================output=====================================
|
||||
class Foo {
|
||||
static accessor ["bar"]
|
||||
}
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`static-computed.js format 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["babel", "babel-ts", "babel-flow"]
|
||||
printWidth: 80
|
||||
| printWidth
|
||||
=====================================input======================================
|
||||
class Foo {
|
||||
static accessor ["bar"];
|
||||
}
|
||||
|
||||
=====================================output=====================================
|
||||
class Foo {
|
||||
static accessor ["bar"];
|
||||
}
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`static-private.js [acorn] format 1`] = `
|
||||
"Unexpected token (2:19)
|
||||
1 | class Foo {
|
||||
> 2 | static accessor #bar;
|
||||
| ^
|
||||
3 | }
|
||||
4 |"
|
||||
`;
|
||||
|
||||
exports[`static-private.js [espree] format 1`] = `
|
||||
"Unexpected token #bar (2:19)
|
||||
1 | class Foo {
|
||||
> 2 | static accessor #bar;
|
||||
| ^
|
||||
3 | }
|
||||
4 |"
|
||||
`;
|
||||
|
||||
exports[`static-private.js - {"semi":false} [acorn] format 1`] = `
|
||||
"Unexpected token (2:19)
|
||||
1 | class Foo {
|
||||
> 2 | static accessor #bar;
|
||||
| ^
|
||||
3 | }
|
||||
4 |"
|
||||
`;
|
||||
|
||||
exports[`static-private.js - {"semi":false} [espree] format 1`] = `
|
||||
"Unexpected token #bar (2:19)
|
||||
1 | class Foo {
|
||||
> 2 | static accessor #bar;
|
||||
| ^
|
||||
3 | }
|
||||
4 |"
|
||||
`;
|
||||
|
||||
exports[`static-private.js - {"semi":false} format 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["babel", "babel-ts", "babel-flow"]
|
||||
printWidth: 80
|
||||
semi: false
|
||||
| printWidth
|
||||
=====================================input======================================
|
||||
class Foo {
|
||||
static accessor #bar;
|
||||
}
|
||||
|
||||
=====================================output=====================================
|
||||
class Foo {
|
||||
static accessor #bar
|
||||
}
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`static-private.js format 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["babel", "babel-ts", "babel-flow"]
|
||||
printWidth: 80
|
||||
| printWidth
|
||||
=====================================input======================================
|
||||
class Foo {
|
||||
static accessor #bar;
|
||||
}
|
||||
|
||||
=====================================output=====================================
|
||||
class Foo {
|
||||
static accessor #bar;
|
||||
}
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`static-with-newline.js - {"semi":false} format 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["babel", "babel-ts", "babel-flow"]
|
||||
printWidth: 80
|
||||
semi: false
|
||||
| printWidth
|
||||
=====================================input======================================
|
||||
class Foo {
|
||||
static accessor
|
||||
bar;
|
||||
}
|
||||
|
||||
=====================================output=====================================
|
||||
class Foo {
|
||||
static accessor
|
||||
bar
|
||||
}
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`static-with-newline.js format 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["babel", "babel-ts", "babel-flow"]
|
||||
printWidth: 80
|
||||
| printWidth
|
||||
=====================================input======================================
|
||||
class Foo {
|
||||
static accessor
|
||||
bar;
|
||||
}
|
||||
|
||||
=====================================output=====================================
|
||||
class Foo {
|
||||
static accessor;
|
||||
bar;
|
||||
}
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`with-newline.js - {"semi":false} format 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["babel", "babel-ts", "babel-flow"]
|
||||
printWidth: 80
|
||||
semi: false
|
||||
| printWidth
|
||||
=====================================input======================================
|
||||
class Foo {
|
||||
accessor
|
||||
bar;
|
||||
}
|
||||
|
||||
=====================================output=====================================
|
||||
class Foo {
|
||||
accessor
|
||||
bar
|
||||
}
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`with-newline.js format 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["babel", "babel-ts", "babel-flow"]
|
||||
printWidth: 80
|
||||
| printWidth
|
||||
=====================================input======================================
|
||||
class Foo {
|
||||
accessor
|
||||
bar;
|
||||
}
|
||||
|
||||
=====================================output=====================================
|
||||
class Foo {
|
||||
accessor;
|
||||
bar;
|
||||
}
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`with-semicolon-1.js [acorn] format 1`] = `
|
||||
"Unexpected token (2:12)
|
||||
1 | class C {
|
||||
> 2 | accessor clicked = \\"value\\";
|
||||
| ^
|
||||
3 | [foo]() {}
|
||||
4 | }
|
||||
5 | "
|
||||
`;
|
||||
|
||||
exports[`with-semicolon-1.js [espree] format 1`] = `
|
||||
"Unexpected token clicked (2:12)
|
||||
1 | class C {
|
||||
> 2 | accessor clicked = \\"value\\";
|
||||
| ^
|
||||
3 | [foo]() {}
|
||||
4 | }
|
||||
5 | "
|
||||
`;
|
||||
|
||||
exports[`with-semicolon-1.js - {"semi":false} [acorn] format 1`] = `
|
||||
"Unexpected token (2:12)
|
||||
1 | class C {
|
||||
> 2 | accessor clicked = \\"value\\";
|
||||
| ^
|
||||
3 | [foo]() {}
|
||||
4 | }
|
||||
5 | "
|
||||
`;
|
||||
|
||||
exports[`with-semicolon-1.js - {"semi":false} [espree] format 1`] = `
|
||||
"Unexpected token clicked (2:12)
|
||||
1 | class C {
|
||||
> 2 | accessor clicked = \\"value\\";
|
||||
| ^
|
||||
3 | [foo]() {}
|
||||
4 | }
|
||||
5 | "
|
||||
`;
|
||||
|
||||
exports[`with-semicolon-1.js - {"semi":false} format 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["babel", "babel-ts", "babel-flow"]
|
||||
printWidth: 80
|
||||
semi: false
|
||||
| printWidth
|
||||
=====================================input======================================
|
||||
class C {
|
||||
accessor clicked = "value";
|
||||
[foo]() {}
|
||||
}
|
||||
|
||||
=====================================output=====================================
|
||||
class C {
|
||||
accessor clicked = "value";
|
||||
[foo]() {}
|
||||
}
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`with-semicolon-1.js format 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["babel", "babel-ts", "babel-flow"]
|
||||
printWidth: 80
|
||||
| printWidth
|
||||
=====================================input======================================
|
||||
class C {
|
||||
accessor clicked = "value";
|
||||
[foo]() {}
|
||||
}
|
||||
|
||||
=====================================output=====================================
|
||||
class C {
|
||||
accessor clicked = "value";
|
||||
[foo]() {}
|
||||
}
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`with-semicolon-2.js [acorn] format 1`] = `
|
||||
"Unexpected token (2:12)
|
||||
1 | class C {
|
||||
> 2 | accessor clicked = \\"value\\";
|
||||
| ^
|
||||
3 | *foo() {}
|
||||
4 | }
|
||||
5 |"
|
||||
`;
|
||||
|
||||
exports[`with-semicolon-2.js [espree] format 1`] = `
|
||||
"Unexpected token clicked (2:12)
|
||||
1 | class C {
|
||||
> 2 | accessor clicked = \\"value\\";
|
||||
| ^
|
||||
3 | *foo() {}
|
||||
4 | }
|
||||
5 |"
|
||||
`;
|
||||
|
||||
exports[`with-semicolon-2.js - {"semi":false} [acorn] format 1`] = `
|
||||
"Unexpected token (2:12)
|
||||
1 | class C {
|
||||
> 2 | accessor clicked = \\"value\\";
|
||||
| ^
|
||||
3 | *foo() {}
|
||||
4 | }
|
||||
5 |"
|
||||
`;
|
||||
|
||||
exports[`with-semicolon-2.js - {"semi":false} [espree] format 1`] = `
|
||||
"Unexpected token clicked (2:12)
|
||||
1 | class C {
|
||||
> 2 | accessor clicked = \\"value\\";
|
||||
| ^
|
||||
3 | *foo() {}
|
||||
4 | }
|
||||
5 |"
|
||||
`;
|
||||
|
||||
exports[`with-semicolon-2.js - {"semi":false} format 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["babel", "babel-ts", "babel-flow"]
|
||||
printWidth: 80
|
||||
semi: false
|
||||
| printWidth
|
||||
=====================================input======================================
|
||||
class C {
|
||||
accessor clicked = "value";
|
||||
*foo() {}
|
||||
}
|
||||
|
||||
=====================================output=====================================
|
||||
class C {
|
||||
accessor clicked = "value";
|
||||
*foo() {}
|
||||
}
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`with-semicolon-2.js format 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["babel", "babel-ts", "babel-flow"]
|
||||
printWidth: 80
|
||||
| printWidth
|
||||
=====================================input======================================
|
||||
class C {
|
||||
accessor clicked = "value";
|
||||
*foo() {}
|
||||
}
|
||||
|
||||
=====================================output=====================================
|
||||
class C {
|
||||
accessor clicked = "value";
|
||||
*foo() {}
|
||||
}
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
@@ -0,0 +1,3 @@
|
||||
class Foo {
|
||||
accessor bar;
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
class Foo {
|
||||
accessor
|
||||
["bar"];
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
class Foo {
|
||||
accessor ["bar"];
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
const parsers = ["babel", "babel-ts", "babel-flow"];
|
||||
const errors = {
|
||||
espree: [
|
||||
"basic.js",
|
||||
"computed.js",
|
||||
"private.js",
|
||||
"static-computed.js",
|
||||
"static-private.js",
|
||||
"static.js",
|
||||
"with-semicolon-1.js",
|
||||
"with-semicolon-2.js",
|
||||
],
|
||||
acorn: [
|
||||
"basic.js",
|
||||
"computed.js",
|
||||
"private.js",
|
||||
"static-computed.js",
|
||||
"static-private.js",
|
||||
"static.js",
|
||||
"with-semicolon-1.js",
|
||||
"with-semicolon-2.js",
|
||||
],
|
||||
};
|
||||
run_spec(import.meta, parsers, { errors });
|
||||
run_spec(import.meta, parsers, { errors, semi: false });
|
||||
@@ -0,0 +1,3 @@
|
||||
class Foo {
|
||||
accessor() {}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
class Foo {
|
||||
accessor = 123;
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
class Foo {
|
||||
accessor #bar;
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
class Foo {
|
||||
static accessor ["bar"];
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
class Foo {
|
||||
static accessor #bar;
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
class Foo {
|
||||
static accessor
|
||||
bar;
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
class Foo {
|
||||
static accessor bar;
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
class Foo {
|
||||
accessor
|
||||
bar;
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
class C {
|
||||
accessor clicked = "value";
|
||||
[foo]() {}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
class C {
|
||||
accessor clicked = "value";
|
||||
*foo() {}
|
||||
}
|
||||
@@ -41,3 +41,39 @@ var y!: MyComponent;
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`without-annotation.ts format 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["typescript"]
|
||||
printWidth: 80
|
||||
| printWidth
|
||||
=====================================input======================================
|
||||
class Foo {
|
||||
a!
|
||||
#b!
|
||||
static c!
|
||||
[d]! = 1
|
||||
'e'!
|
||||
}
|
||||
|
||||
let a! = x
|
||||
const b!
|
||||
var c/* */! = x
|
||||
export const d!
|
||||
|
||||
=====================================output=====================================
|
||||
class Foo {
|
||||
a!;
|
||||
#b!;
|
||||
static c!;
|
||||
[d]! = 1;
|
||||
"e"!;
|
||||
}
|
||||
|
||||
let a! = x;
|
||||
const b!;
|
||||
var c! /* */ = x;
|
||||
export const d!;
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
@@ -0,0 +1,12 @@
|
||||
class Foo {
|
||||
a!
|
||||
#b!
|
||||
static c!
|
||||
[d]! = 1
|
||||
'e'!
|
||||
}
|
||||
|
||||
let a! = x
|
||||
const b!
|
||||
var c/* */! = x
|
||||
export const d!
|
||||
@@ -1,91 +1,5 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`no-trailing-comma-after-rest.ts - {"trailingComma":"all"} format 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["typescript"]
|
||||
printWidth: 80
|
||||
trailingComma: "all"
|
||||
| printWidth
|
||||
=====================================input======================================
|
||||
type ValidateArgs = [
|
||||
{
|
||||
[key: string]: any;
|
||||
},
|
||||
string,
|
||||
string,
|
||||
...string[],
|
||||
];
|
||||
|
||||
=====================================output=====================================
|
||||
type ValidateArgs = [
|
||||
{
|
||||
[key: string]: any;
|
||||
},
|
||||
string,
|
||||
string,
|
||||
...string[]
|
||||
];
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`no-trailing-comma-after-rest.ts - {"trailingComma":"none"} format 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["typescript"]
|
||||
printWidth: 80
|
||||
trailingComma: "none"
|
||||
| printWidth
|
||||
=====================================input======================================
|
||||
type ValidateArgs = [
|
||||
{
|
||||
[key: string]: any;
|
||||
},
|
||||
string,
|
||||
string,
|
||||
...string[],
|
||||
];
|
||||
|
||||
=====================================output=====================================
|
||||
type ValidateArgs = [
|
||||
{
|
||||
[key: string]: any;
|
||||
},
|
||||
string,
|
||||
string,
|
||||
...string[]
|
||||
];
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`no-trailing-comma-after-rest.ts format 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["typescript"]
|
||||
printWidth: 80
|
||||
| printWidth
|
||||
=====================================input======================================
|
||||
type ValidateArgs = [
|
||||
{
|
||||
[key: string]: any;
|
||||
},
|
||||
string,
|
||||
string,
|
||||
...string[],
|
||||
];
|
||||
|
||||
=====================================output=====================================
|
||||
type ValidateArgs = [
|
||||
{
|
||||
[key: string]: any;
|
||||
},
|
||||
string,
|
||||
string,
|
||||
...string[]
|
||||
];
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`trailing-comma.ts - {"trailingComma":"all"} format 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["typescript"]
|
||||
@@ -273,6 +187,92 @@ type Foo =
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`trailing-comma-trailing-rest.ts - {"trailingComma":"all"} format 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["typescript"]
|
||||
printWidth: 80
|
||||
trailingComma: "all"
|
||||
| printWidth
|
||||
=====================================input======================================
|
||||
type ValidateArgs = [
|
||||
{
|
||||
[key: string]: any;
|
||||
},
|
||||
string,
|
||||
string,
|
||||
...string[],
|
||||
];
|
||||
|
||||
=====================================output=====================================
|
||||
type ValidateArgs = [
|
||||
{
|
||||
[key: string]: any;
|
||||
},
|
||||
string,
|
||||
string,
|
||||
...string[],
|
||||
];
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`trailing-comma-trailing-rest.ts - {"trailingComma":"none"} format 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["typescript"]
|
||||
printWidth: 80
|
||||
trailingComma: "none"
|
||||
| printWidth
|
||||
=====================================input======================================
|
||||
type ValidateArgs = [
|
||||
{
|
||||
[key: string]: any;
|
||||
},
|
||||
string,
|
||||
string,
|
||||
...string[],
|
||||
];
|
||||
|
||||
=====================================output=====================================
|
||||
type ValidateArgs = [
|
||||
{
|
||||
[key: string]: any;
|
||||
},
|
||||
string,
|
||||
string,
|
||||
...string[]
|
||||
];
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`trailing-comma-trailing-rest.ts format 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["typescript"]
|
||||
printWidth: 80
|
||||
| printWidth
|
||||
=====================================input======================================
|
||||
type ValidateArgs = [
|
||||
{
|
||||
[key: string]: any;
|
||||
},
|
||||
string,
|
||||
string,
|
||||
...string[],
|
||||
];
|
||||
|
||||
=====================================output=====================================
|
||||
type ValidateArgs = [
|
||||
{
|
||||
[key: string]: any;
|
||||
},
|
||||
string,
|
||||
string,
|
||||
...string[]
|
||||
];
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`tuple.ts - {"trailingComma":"all"} format 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["typescript"]
|
||||
|
||||
Reference in new issue
Block a user