Add formatting for i18n attributes. (#6695)
* Add formatting for i18n attributes. Previously, Prettier would largely ignore i18n attributes, not even wrapping their content, which wasn't ideal since i18n descriptive text can sometimes get long. After this, Prettier will auto-wrap the contents of i18n attributes once they exceed the line length. Fixes #5875.
This commit is contained in:
1 parent
7eb4431350
commit
4e46f92b86
4 files changed
+311
No files matched your search
@@ -182,6 +182,15 @@ printWidth: 80
|
||||
{{ valid }}
|
||||
|
||||
baz'
|
||||
i18n="Normal i18n text"
|
||||
i18n="This is a very long internationalization description text, exceeding the configured print width, but could easily be formatted"
|
||||
i18n-test="Attribute i18n text"
|
||||
i18n-test="This is a very long internationalization description text, exceeding the configured print width, but could easily be formatted"
|
||||
i18n="This is a very long internationalization description text, exceeding the configured print width, but could easily be formatted" i18n="This is yet another very long internationalization description text, exceeding the configured print width, but could easily be formatted"
|
||||
i18n="@@customId"
|
||||
i18n="Some description@@customIdWithDescription"
|
||||
i18n="some meaning|Some description@@customIdWithDescription"
|
||||
i18n="some meaning|Some very long internationalization description text exceeding the configured print width@@customIdWithDescription"
|
||||
></div>
|
||||
|
||||
=====================================output=====================================
|
||||
@@ -308,6 +317,31 @@ printWidth: 80
|
||||
{{ valid }}
|
||||
|
||||
baz"
|
||||
i18n="Normal i18n text"
|
||||
i18n="
|
||||
This is a very long internationalization description text, exceeding the
|
||||
configured print width, but could easily be formatted
|
||||
"
|
||||
i18n-test="Attribute i18n text"
|
||||
i18n-test="
|
||||
This is a very long internationalization description text, exceeding the
|
||||
configured print width, but could easily be formatted
|
||||
"
|
||||
i18n="
|
||||
This is a very long internationalization description text, exceeding the
|
||||
configured print width, but could easily be formatted
|
||||
"
|
||||
i18n="
|
||||
This is yet another very long internationalization description text,
|
||||
exceeding the configured print width, but could easily be formatted
|
||||
"
|
||||
i18n="@@customId"
|
||||
i18n="Some description@@customIdWithDescription"
|
||||
i18n="some meaning|Some description@@customIdWithDescription"
|
||||
i18n="
|
||||
some meaning|Some very long internationalization description text exceeding
|
||||
the configured print width@@customIdWithDescription
|
||||
"
|
||||
></div>
|
||||
|
||||
================================================================================
|
||||
@@ -420,6 +454,15 @@ trailingComma: "es5"
|
||||
{{ valid }}
|
||||
|
||||
baz'
|
||||
i18n="Normal i18n text"
|
||||
i18n="This is a very long internationalization description text, exceeding the configured print width, but could easily be formatted"
|
||||
i18n-test="Attribute i18n text"
|
||||
i18n-test="This is a very long internationalization description text, exceeding the configured print width, but could easily be formatted"
|
||||
i18n="This is a very long internationalization description text, exceeding the configured print width, but could easily be formatted" i18n="This is yet another very long internationalization description text, exceeding the configured print width, but could easily be formatted"
|
||||
i18n="@@customId"
|
||||
i18n="Some description@@customIdWithDescription"
|
||||
i18n="some meaning|Some description@@customIdWithDescription"
|
||||
i18n="some meaning|Some very long internationalization description text exceeding the configured print width@@customIdWithDescription"
|
||||
></div>
|
||||
|
||||
=====================================output=====================================
|
||||
@@ -546,6 +589,31 @@ trailingComma: "es5"
|
||||
{{ valid }}
|
||||
|
||||
baz"
|
||||
i18n="Normal i18n text"
|
||||
i18n="
|
||||
This is a very long internationalization description text, exceeding the
|
||||
configured print width, but could easily be formatted
|
||||
"
|
||||
i18n-test="Attribute i18n text"
|
||||
i18n-test="
|
||||
This is a very long internationalization description text, exceeding the
|
||||
configured print width, but could easily be formatted
|
||||
"
|
||||
i18n="
|
||||
This is a very long internationalization description text, exceeding the
|
||||
configured print width, but could easily be formatted
|
||||
"
|
||||
i18n="
|
||||
This is yet another very long internationalization description text,
|
||||
exceeding the configured print width, but could easily be formatted
|
||||
"
|
||||
i18n="@@customId"
|
||||
i18n="Some description@@customIdWithDescription"
|
||||
i18n="some meaning|Some description@@customIdWithDescription"
|
||||
i18n="
|
||||
some meaning|Some very long internationalization description text exceeding
|
||||
the configured print width@@customIdWithDescription
|
||||
"
|
||||
></div>
|
||||
|
||||
================================================================================
|
||||
@@ -657,6 +725,15 @@ printWidth: 1
|
||||
{{ valid }}
|
||||
|
||||
baz'
|
||||
i18n="Normal i18n text"
|
||||
i18n="This is a very long internationalization description text, exceeding the configured print width, but could easily be formatted"
|
||||
i18n-test="Attribute i18n text"
|
||||
i18n-test="This is a very long internationalization description text, exceeding the configured print width, but could easily be formatted"
|
||||
i18n="This is a very long internationalization description text, exceeding the configured print width, but could easily be formatted" i18n="This is yet another very long internationalization description text, exceeding the configured print width, but could easily be formatted"
|
||||
i18n="@@customId"
|
||||
i18n="Some description@@customIdWithDescription"
|
||||
i18n="some meaning|Some description@@customIdWithDescription"
|
||||
i18n="some meaning|Some very long internationalization description text exceeding the configured print width@@customIdWithDescription"
|
||||
></div>
|
||||
|
||||
=====================================output=====================================
|
||||
@@ -1023,6 +1100,123 @@ printWidth: 1
|
||||
}}
|
||||
|
||||
baz"
|
||||
i18n="
|
||||
Normal
|
||||
i18n
|
||||
text
|
||||
"
|
||||
i18n="
|
||||
This
|
||||
is
|
||||
a
|
||||
very
|
||||
long
|
||||
internationalization
|
||||
description
|
||||
text,
|
||||
exceeding
|
||||
the
|
||||
configured
|
||||
print
|
||||
width,
|
||||
but
|
||||
could
|
||||
easily
|
||||
be
|
||||
formatted
|
||||
"
|
||||
i18n-test="
|
||||
Attribute
|
||||
i18n
|
||||
text
|
||||
"
|
||||
i18n-test="
|
||||
This
|
||||
is
|
||||
a
|
||||
very
|
||||
long
|
||||
internationalization
|
||||
description
|
||||
text,
|
||||
exceeding
|
||||
the
|
||||
configured
|
||||
print
|
||||
width,
|
||||
but
|
||||
could
|
||||
easily
|
||||
be
|
||||
formatted
|
||||
"
|
||||
i18n="
|
||||
This
|
||||
is
|
||||
a
|
||||
very
|
||||
long
|
||||
internationalization
|
||||
description
|
||||
text,
|
||||
exceeding
|
||||
the
|
||||
configured
|
||||
print
|
||||
width,
|
||||
but
|
||||
could
|
||||
easily
|
||||
be
|
||||
formatted
|
||||
"
|
||||
i18n="
|
||||
This
|
||||
is
|
||||
yet
|
||||
another
|
||||
very
|
||||
long
|
||||
internationalization
|
||||
description
|
||||
text,
|
||||
exceeding
|
||||
the
|
||||
configured
|
||||
print
|
||||
width,
|
||||
but
|
||||
could
|
||||
easily
|
||||
be
|
||||
formatted
|
||||
"
|
||||
i18n="
|
||||
@@customId
|
||||
"
|
||||
i18n="
|
||||
Some
|
||||
description@@customIdWithDescription
|
||||
"
|
||||
i18n="
|
||||
some
|
||||
meaning|Some
|
||||
description@@customIdWithDescription
|
||||
"
|
||||
i18n="
|
||||
some
|
||||
meaning|Some
|
||||
very
|
||||
long
|
||||
internationalization
|
||||
description
|
||||
text
|
||||
exceeding
|
||||
the
|
||||
configured
|
||||
print
|
||||
width@@customIdWithDescription
|
||||
"
|
||||
></div>
|
||||
|
||||
================================================================================
|
||||
@@ -1135,6 +1329,15 @@ printWidth: 80
|
||||
{{ valid }}
|
||||
|
||||
baz'
|
||||
i18n="Normal i18n text"
|
||||
i18n="This is a very long internationalization description text, exceeding the configured print width, but could easily be formatted"
|
||||
i18n-test="Attribute i18n text"
|
||||
i18n-test="This is a very long internationalization description text, exceeding the configured print width, but could easily be formatted"
|
||||
i18n="This is a very long internationalization description text, exceeding the configured print width, but could easily be formatted" i18n="This is yet another very long internationalization description text, exceeding the configured print width, but could easily be formatted"
|
||||
i18n="@@customId"
|
||||
i18n="Some description@@customIdWithDescription"
|
||||
i18n="some meaning|Some description@@customIdWithDescription"
|
||||
i18n="some meaning|Some very long internationalization description text exceeding the configured print width@@customIdWithDescription"
|
||||
></div>
|
||||
|
||||
=====================================output=====================================
|
||||
@@ -1261,6 +1464,31 @@ printWidth: 80
|
||||
{{ valid }}
|
||||
|
||||
baz"
|
||||
i18n="Normal i18n text"
|
||||
i18n="
|
||||
This is a very long internationalization description text, exceeding the
|
||||
configured print width, but could easily be formatted
|
||||
"
|
||||
i18n-test="Attribute i18n text"
|
||||
i18n-test="
|
||||
This is a very long internationalization description text, exceeding the
|
||||
configured print width, but could easily be formatted
|
||||
"
|
||||
i18n="
|
||||
This is a very long internationalization description text, exceeding the
|
||||
configured print width, but could easily be formatted
|
||||
"
|
||||
i18n="
|
||||
This is yet another very long internationalization description text,
|
||||
exceeding the configured print width, but could easily be formatted
|
||||
"
|
||||
i18n="@@customId"
|
||||
i18n="Some description@@customIdWithDescription"
|
||||
i18n="some meaning|Some description@@customIdWithDescription"
|
||||
i18n="
|
||||
some meaning|Some very long internationalization description text exceeding
|
||||
the configured print width@@customIdWithDescription
|
||||
"
|
||||
></div>
|
||||
|
||||
================================================================================
|
||||
@@ -1373,6 +1601,15 @@ printWidth: 80
|
||||
{{ valid }}
|
||||
|
||||
baz'
|
||||
i18n="Normal i18n text"
|
||||
i18n="This is a very long internationalization description text, exceeding the configured print width, but could easily be formatted"
|
||||
i18n-test="Attribute i18n text"
|
||||
i18n-test="This is a very long internationalization description text, exceeding the configured print width, but could easily be formatted"
|
||||
i18n="This is a very long internationalization description text, exceeding the configured print width, but could easily be formatted" i18n="This is yet another very long internationalization description text, exceeding the configured print width, but could easily be formatted"
|
||||
i18n="@@customId"
|
||||
i18n="Some description@@customIdWithDescription"
|
||||
i18n="some meaning|Some description@@customIdWithDescription"
|
||||
i18n="some meaning|Some very long internationalization description text exceeding the configured print width@@customIdWithDescription"
|
||||
></div>
|
||||
|
||||
=====================================output=====================================
|
||||
@@ -1499,6 +1736,31 @@ printWidth: 80
|
||||
{{ valid }}
|
||||
|
||||
baz"
|
||||
i18n="Normal i18n text"
|
||||
i18n="
|
||||
This is a very long internationalization description text, exceeding the
|
||||
configured print width, but could easily be formatted
|
||||
"
|
||||
i18n-test="Attribute i18n text"
|
||||
i18n-test="
|
||||
This is a very long internationalization description text, exceeding the
|
||||
configured print width, but could easily be formatted
|
||||
"
|
||||
i18n="
|
||||
This is a very long internationalization description text, exceeding the
|
||||
configured print width, but could easily be formatted
|
||||
"
|
||||
i18n="
|
||||
This is yet another very long internationalization description text,
|
||||
exceeding the configured print width, but could easily be formatted
|
||||
"
|
||||
i18n="@@customId"
|
||||
i18n="Some description@@customIdWithDescription"
|
||||
i18n="some meaning|Some description@@customIdWithDescription"
|
||||
i18n="
|
||||
some meaning|Some very long internationalization description text exceeding
|
||||
the configured print width@@customIdWithDescription
|
||||
"
|
||||
></div>
|
||||
|
||||
================================================================================
|
||||
|
||||
@@ -98,4 +98,13 @@
|
||||
{{ valid }}
|
||||
|
||||
baz'
|
||||
i18n="Normal i18n text"
|
||||
i18n="This is a very long internationalization description text, exceeding the configured print width, but could easily be formatted"
|
||||
i18n-test="Attribute i18n text"
|
||||
i18n-test="This is a very long internationalization description text, exceeding the configured print width, but could easily be formatted"
|
||||
i18n="This is a very long internationalization description text, exceeding the configured print width, but could easily be formatted" i18n="This is yet another very long internationalization description text, exceeding the configured print width, but could easily be formatted"
|
||||
i18n="@@customId"
|
||||
i18n="Some description@@customIdWithDescription"
|
||||
i18n="some meaning|Some description@@customIdWithDescription"
|
||||
i18n="some meaning|Some very long internationalization description text exceeding the configured print width@@customIdWithDescription"
|
||||
></div>
|
||||
Reference in new issue
Block a user