forked from rome/tools
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(rome_js_parser): EcmaScript @decorators rome#4252
export default
- Loading branch information
1 parent
e2ce865
commit 6ac9407
Showing
81 changed files
with
2,377 additions
and
570 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
86 changes: 86 additions & 0 deletions
86
crates/rome_js_formatter/tests/specs/prettier/js/decorators/classes.js.snap.new
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,86 @@ | ||
--- | ||
source: crates/rome_formatter_test/src/snapshot_builder.rs | ||
assertion_line: 212 | ||
info: js/decorators/classes.js | ||
--- | ||
|
||
# Input | ||
|
||
```js | ||
@deco class Foo {} | ||
|
||
@deco export class Bar {} | ||
|
||
@deco export default class Baz {} | ||
|
||
const foo = @deco class { | ||
// | ||
}; | ||
|
||
const bar = | ||
@deco | ||
class { | ||
// | ||
}; | ||
|
||
``` | ||
|
||
|
||
# Prettier differences | ||
|
||
```diff | ||
--- Prettier | ||
+++ Rome | ||
@@ -7,18 +7,12 @@ | ||
@deco | ||
export default class Baz {} | ||
|
||
-const foo = | ||
- ( | ||
- @deco | ||
- class { | ||
- // | ||
- } | ||
- ); | ||
+const foo = @deco | ||
+class { | ||
+ // | ||
+}; | ||
|
||
-const bar = | ||
- ( | ||
- @deco | ||
- class { | ||
- // | ||
- } | ||
- ); | ||
+const bar = @deco | ||
+class { | ||
+ // | ||
+}; | ||
``` | ||
|
||
# Output | ||
|
||
```js | ||
@deco | ||
class Foo {} | ||
|
||
@deco | ||
export class Bar {} | ||
|
||
@deco | ||
export default class Baz {} | ||
|
||
const foo = @deco | ||
class { | ||
// | ||
}; | ||
|
||
const bar = @deco | ||
class { | ||
// | ||
}; | ||
``` | ||
|
||
|
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
43 changes: 43 additions & 0 deletions
43
crates/rome_js_formatter/tests/specs/prettier/js/decorators/redux.js.snap.new
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,43 @@ | ||
--- | ||
source: crates/rome_formatter_test/src/snapshot_builder.rs | ||
assertion_line: 212 | ||
info: js/decorators/redux.js | ||
--- | ||
|
||
# Input | ||
|
||
```js | ||
@connect(mapStateToProps, mapDispatchToProps) | ||
export class MyApp extends React.Component {} | ||
|
||
@connect(state => ({ todos: state.todos })) | ||
export class Home extends React.Component {} | ||
|
||
``` | ||
|
||
|
||
# Prettier differences | ||
|
||
```diff | ||
--- Prettier | ||
+++ Rome | ||
@@ -1,5 +1,5 @@ | ||
@connect(mapStateToProps, mapDispatchToProps) | ||
export class MyApp extends React.Component {} | ||
|
||
-@connect((state) => ({ todos: state.todos })) | ||
+@connect(state => ({ todos: state.todos })) | ||
export class Home extends React.Component {} | ||
``` | ||
|
||
# Output | ||
|
||
```js | ||
@connect(mapStateToProps, mapDispatchToProps) | ||
export class MyApp extends React.Component {} | ||
|
||
@connect(state => ({ todos: state.todos })) | ||
export class Home extends React.Component {} | ||
``` | ||
|
||
|
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
Oops, something went wrong.