This commit is contained in:
1 parent
94c71e346f
commit
2eaad40bb2
9 files changed
+5
-203
No files matched your search
@@ -1,35 +0,0 @@
|
||||
#### Fix required semicolon in `no-semi` mode (#18852 by @fisker)
|
||||
|
||||
<!-- prettier-ignore -->
|
||||
```tsx
|
||||
// Input
|
||||
declare module "autoprefixer";
|
||||
{
|
||||
alert()
|
||||
}
|
||||
declare function a();
|
||||
{
|
||||
alert()
|
||||
}
|
||||
|
||||
// Prettier stable (--no-semi)
|
||||
declare module "autoprefixer"
|
||||
{
|
||||
alert()
|
||||
}
|
||||
declare function a()
|
||||
{
|
||||
alert()
|
||||
}
|
||||
|
||||
|
||||
// Prettier main (--no-semi)
|
||||
declare module "autoprefixer";
|
||||
{
|
||||
alert();
|
||||
}
|
||||
declare function a();
|
||||
{
|
||||
alert();
|
||||
}
|
||||
```
|
||||
@@ -84,11 +84,9 @@ function printFunction(path, options, print, args) {
|
||||
shouldGroupParameters ? group(parametersDoc) : parametersDoc,
|
||||
returnTypeDoc,
|
||||
]),
|
||||
node.body
|
||||
? [" ", print("body")]
|
||||
: // The semicolon not always needed,
|
||||
// but prevent block statement after been parsed as body
|
||||
";",
|
||||
node.body ? " " : "",
|
||||
print("body"),
|
||||
node.declare || !node.body ? printSemicolon(options) : "",
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { group } from "../../document/index.js";
|
||||
import { printDeclareToken } from "./miscellaneous.js";
|
||||
import { printDeclareToken, printSemicolon } from "./miscellaneous.js";
|
||||
|
||||
/*
|
||||
- `TSModuleDeclaration` (TypeScript)
|
||||
@@ -11,11 +11,7 @@ function printModuleDeclaration(path, options, print) {
|
||||
printDeclareToken(path),
|
||||
node.kind === "global" ? "" : `${node.kind} `,
|
||||
print("id"),
|
||||
node.body
|
||||
? [" ", group(print("body"))]
|
||||
: // The semicolon not always needed,
|
||||
// but prevent block statement after been parsed as body
|
||||
";",
|
||||
node.body ? [" ", group(print("body"))] : printSemicolon(options),
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
|
||||
|
||||
exports[`no-semi.js - {"semi":false} format 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["flow"]
|
||||
semi: false
|
||||
printWidth: 80 (default) |
|
||||
=====================================input======================================
|
||||
declare function foo():void;
|
||||
|
||||
{
|
||||
foo
|
||||
}
|
||||
|
||||
declare hook foo(): Foo;
|
||||
|
||||
{
|
||||
foo
|
||||
}
|
||||
|
||||
=====================================output=====================================
|
||||
declare function foo(): void
|
||||
|
||||
{
|
||||
foo
|
||||
}
|
||||
|
||||
declare hook foo(): Foo
|
||||
|
||||
{
|
||||
foo
|
||||
}
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
@@ -1 +0,0 @@
|
||||
runFormatTest(import.meta, ["flow"], { semi: false });
|
||||
@@ -1,11 +0,0 @@
|
||||
declare function foo():void;
|
||||
|
||||
{
|
||||
foo
|
||||
}
|
||||
|
||||
declare hook foo(): Foo;
|
||||
|
||||
{
|
||||
foo
|
||||
}
|
||||
@@ -1,44 +1,5 @@
|
||||
// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
|
||||
|
||||
exports[`functions.ts - {"semi":false} format 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["typescript"]
|
||||
semi: false
|
||||
printWidth: 80 (default) |
|
||||
=====================================input======================================
|
||||
declare function a():void;
|
||||
|
||||
{
|
||||
foo()
|
||||
}
|
||||
|
||||
|
||||
declare function b():void;
|
||||
|
||||
[foo()]
|
||||
|
||||
|
||||
for(;;) function c();
|
||||
{}
|
||||
|
||||
=====================================output=====================================
|
||||
declare function a(): void;
|
||||
|
||||
{
|
||||
foo()
|
||||
}
|
||||
|
||||
declare function b(): void;
|
||||
|
||||
;[foo()]
|
||||
|
||||
for (;;) function c();
|
||||
{
|
||||
}
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`index-signature.ts - {"semi":false} format 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["typescript"]
|
||||
@@ -92,48 +53,6 @@ interface InlineMultiple {
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`module-declaration.ts - {"semi":false} format 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["typescript"]
|
||||
semi: false
|
||||
printWidth: 80 (default) |
|
||||
=====================================input======================================
|
||||
declare module "foo";
|
||||
|
||||
{
|
||||
foo()
|
||||
}
|
||||
|
||||
declare module "bar" {};
|
||||
|
||||
{
|
||||
foo()
|
||||
}
|
||||
|
||||
declare module "baz";
|
||||
|
||||
[foo()]
|
||||
|
||||
=====================================output=====================================
|
||||
declare module "foo";
|
||||
|
||||
{
|
||||
foo()
|
||||
}
|
||||
|
||||
declare module "bar" {}
|
||||
|
||||
{
|
||||
foo()
|
||||
}
|
||||
|
||||
declare module "baz";
|
||||
|
||||
;[foo()]
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
exports[`type.ts - {"semi":false} format 1`] = `
|
||||
====================================options=====================================
|
||||
parsers: ["typescript"]
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
declare function a():void;
|
||||
|
||||
{
|
||||
foo()
|
||||
}
|
||||
|
||||
|
||||
declare function b():void;
|
||||
|
||||
[foo()]
|
||||
|
||||
|
||||
for(;;) function c();
|
||||
{}
|
||||
@@ -1,15 +0,0 @@
|
||||
declare module "foo";
|
||||
|
||||
{
|
||||
foo()
|
||||
}
|
||||
|
||||
declare module "bar" {};
|
||||
|
||||
{
|
||||
foo()
|
||||
}
|
||||
|
||||
declare module "baz";
|
||||
|
||||
[foo()]
|
||||
Reference in new issue
Block a user