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.
Avoid printing attribute per line in Vue SFC blocks (prettier#12895)
* Avoid print single attribute perline for Vue SFC blocks * Add tests * Add changelog * Fix typo * Add more tests
- Loading branch information
1 parent
81d60b6
commit d0edf20
Showing
5 changed files
with
202 additions
and
2 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,19 @@ | ||
#### Avoid printing attribute per line in Vue SFC blocks (#12895 by @sosukesuzuki) | ||
|
||
<!-- prettier-ignore --> | ||
```vue | ||
<!-- Input (singleAttributePerLine: true) --> | ||
<script lang="ts" setup> | ||
</script> | ||
<!-- Prettier stable --> | ||
<script | ||
lang="ts" | ||
setup | ||
> | ||
</script> | ||
<!-- Prettier main --> | ||
<script lang="ts" setup> | ||
</script> | ||
``` |
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
147 changes: 147 additions & 0 deletions
147
tests/format/vue/single-attribute-per-line/__snapshots__/jsfmt.spec.js.snap
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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<script setup lang="ts"> | ||
console.log("hello") | ||
</script> | ||
|
||
<style scoped lang="scss"> | ||
p { | ||
color: red; | ||
} | ||
</style> | ||
|
||
<unknown-block foo bar="bar" baz long_long_long_long_attribute></unknown-block> | ||
|
||
<script lang="ts" src="./long_long_long_long_long_long_file_path.ts"> | ||
</script> | ||
|
||
<script lang="ts" src="./long_long_long_long_long_long_long_file_path.ts"> | ||
</script> | ||
|
||
<script lang="ts" src="./short"> | ||
</script> | ||
|
||
<template lang="pug" src="./long_long_long_long_long_long_file_path.pug"> | ||
</template> | ||
|
||
<template lang="pug" src="./long_long_long_long_long_long_long_long_file_path.pug"> | ||
</template> | ||
|
||
<template lang="pug" src="./short"> | ||
</template> |