forked from prettier/prettier
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow multiple decorators on same getter/setter (prettier#14584)
- Loading branch information
Showing
4 changed files
with
43 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#### Allow multiple decorators on same getter/setter (#14584 by @fisker) | ||
|
||
<!-- prettier-ignore --> | ||
```ts | ||
// Input | ||
class A { | ||
@decorator() | ||
get foo () {} | ||
|
||
@decorator() | ||
set foo (value) {} | ||
} | ||
|
||
// Prettier stable | ||
SyntaxError: Decorators cannot be applied to multiple get/set accessors of the same name. (5:3) | ||
3 | get foo () {} | ||
4 | | ||
> 5 | @decorator() | ||
| ^^^^^^^^^^^^ | ||
6 | set foo (value) {} | ||
7 | } | ||
|
||
// Prettier main | ||
class A { | ||
@decorator() | ||
get foo() {} | ||
|
||
@decorator() | ||
set foo(value) {} | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
run_spec(__dirname, ["typescript"], { | ||
errors: { typescript: ["abstract-method.ts", "accessor.ts"] }, | ||
errors: { typescript: ["abstract-method.ts"] }, | ||
}); |