Skip to content

Commit

Permalink
set astroAllowShorthand to default off (#143)
Browse files Browse the repository at this point in the history
* set `astroAllowShorthand` to default off

Shorthand removes attribute keys and breaks Typescript which is used by Astro. It's also uncommon and should be disabled by default, and only opt-in for those that specifically want it.

* Create selfish-cherries-grab.md

* fix tests for shorthand formatting

- shorthand off by default
- comment (and should remove) can format to shorthand because this is covered in the options test

* remove obsolete shorthand tests, update changeset
  • Loading branch information
manigandham authored Mar 28, 2022
1 parent 193296a commit 73e81bd
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 18 deletions.
5 changes: 5 additions & 0 deletions .changeset/selfish-cherries-grab.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'prettier-plugin-astro': patch
---

Set astroAllowShorthand default option to false
2 changes: 1 addition & 1 deletion src/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export const options: Record<keyof PluginOptions, SupportOption> = {
since: '0.0.10',
category: 'Astro',
type: 'boolean',
default: true,
default: false,
description:
'Enable/disable attribute shorthand if attribute name and expression are the same',
},
Expand Down
5 changes: 0 additions & 5 deletions test/fixtures/converts-to-shorthand/input.astro

This file was deleted.

6 changes: 0 additions & 6 deletions test/fixtures/converts-to-shorthand/output.astro

This file was deleted.

2 changes: 1 addition & 1 deletion test/fixtures/style-tag-attributes/output.astro
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
lang="scss"
media={"all and (max-width: 500px)"}
type={type2}
{title}
title={title}
id={10}
anObject={{ prop: "value" }}
>
Expand Down
5 changes: 0 additions & 5 deletions test/tests/other.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,6 @@ test(
'expr-and-html-comment'
);

test(
'converts valid shorthand variables into shorthand',
'converts-to-shorthand'
);

// test.failing('an Astro file with an invalidly unclosed tag is still formatted', Prettier, 'unclosed-tag');

test(
Expand Down

0 comments on commit 73e81bd

Please sign in to comment.