You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/rules/README.md
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -353,7 +353,7 @@ For example:
353
353
|[vue/no-v-text](./no-v-text.md)| disallow use of v-text ||
354
354
|[vue/padding-line-between-blocks](./padding-line-between-blocks.md)| require or disallow padding lines between blocks |:wrench:|
355
355
|[vue/prefer-separate-static-class](./prefer-separate-static-class.md)| require static class names in template to be in a separate `class` attribute |:wrench:|
356
-
|[vue/prefer-true-attribute-shorthand](./prefer-true-attribute-shorthand.md)| require shorthand form attribute when `v-bind` value is `true`.|:bulb:|
356
+
|[vue/prefer-true-attribute-shorthand](./prefer-true-attribute-shorthand.md)| require shorthand form attribute when `v-bind` value is `true`|:bulb:|
357
357
|[vue/require-direct-export](./require-direct-export.md)| require the component to be directly exported ||
358
358
|[vue/require-emit-validator](./require-emit-validator.md)| require type definitions in emits |:bulb:|
359
359
|[vue/require-expose](./require-expose.md)| require declare public properties using `expose`|:bulb:|
Copy file name to clipboardExpand all lines: docs/rules/prefer-true-attribute-shorthand.md
+30-14Lines changed: 30 additions & 14 deletions
Original file line number
Diff line number
Diff line change
@@ -2,11 +2,11 @@
2
2
pageClass: rule-details
3
3
sidebarDepth: 0
4
4
title: vue/prefer-true-attribute-shorthand
5
-
description: require shorthand form attribute when `v-bind` value is `true`.
5
+
description: require shorthand form attribute when `v-bind` value is `true`
6
6
---
7
7
# vue/prefer-true-attribute-shorthand
8
8
9
-
> require shorthand form attribute when `v-bind` value is `true`.
9
+
> require shorthand form attribute when `v-bind` value is `true`
10
10
11
11
-:exclamation: <badgetext="This rule has not been released yet."vertical="middle"type="error"> ***This rule has not been released yet.*** </badge>
12
12
-:bulb: Some problems reported by this rule are manually fixable by editor [suggestions](https://eslint.org/docs/developer-guide/working-with-rules#providing-suggestions).
@@ -31,32 +31,48 @@ description: require shorthand form attribute when `v-bind` value is `true`.
31
31
32
32
</eslint-code-block>
33
33
34
-
However, those two representations are not always equivalent.
35
-
This case will be occurred if the definition of a prop includes `String`:
34
+
::: warning Warning
35
+
The shorthand form is not always equivalent! If a prop accepts multiple types, but Boolean is not the first one, a shorthand prop won't pass `true`.
Those two calls will introduce different render result. See [this demo](https://sfc.vuejs.org/#eyJBcHAudnVlIjoiPHNjcmlwdCBzZXR1cD5cbmltcG9ydCBNeUNvbXBvbmVudCBmcm9tICcuL015Q29tcG9uZW50LnZ1ZSdcbjwvc2NyaXB0PlxuXG48dGVtcGxhdGU+XG4gIDxNeUNvbXBvbmVudCBhIGIvPlxuICA8TXlDb21wb25lbnQgOmE9XCJ0cnVlXCIgOmI9XCJ0cnVlXCIvPlxuPC90ZW1wbGF0ZT4iLCJpbXBvcnQtbWFwLmpzb24iOiJ7XG4gIFwiaW1wb3J0c1wiOiB7XG4gICAgXCJ2dWVcIjogXCJodHRwczovL3NmYy52dWVqcy5vcmcvdnVlLnJ1bnRpbWUuZXNtLWJyb3dzZXIuanNcIlxuICB9XG59IiwiTXlDb21wb25lbnQudnVlIjoiPHNjcmlwdD5cbmV4cG9ydCBkZWZhdWx0IHtcbiAgcHJvcHM6IHtcbiAgICBhOiBCb29sZWFuLFxuICAgIGI6IFtTdHJpbmcsIEJvb2xlYW5dXG4gIH1cbn1cbjwvc2NyaXB0PlxuXG48dGVtcGxhdGU+XG4gIDxwcmU+XG5hOiB7e2F9fVxuYjoge3tifX1cbiAgPC9wcmU+XG48L3RlbXBsYXRlPiJ9).
75
+
Those two calls will introduce different render result. See [this demo](https://sfc.vuejs.org/#eyJBcHAudnVlIjoiPHNjcmlwdCBzZXR1cD5cbmltcG9ydCBNeUNvbXBvbmVudCBmcm9tICcuL015Q29tcG9uZW50LnZ1ZSdcbjwvc2NyaXB0PlxuXG48dGVtcGxhdGU+XG4gIFNob3J0aGFuZCBmb3JtOlxuICA8TXlDb21wb25lbnQgYm9vbCBib29sLW9yLXN0cmluZyBzdHJpbmctb3ItYm9vbCAvPlxuICBcbiAgTG9uZ2hhbmQgZm9ybTpcbiAgPE15Q29tcG9uZW50IDpib29sPVwidHJ1ZVwiIDpib29sLW9yLXN0cmluZz1cInRydWVcIiA6c3RyaW5nLW9yLWJvb2w9XCJ0cnVlXCIgLz5cbjwvdGVtcGxhdGU+IiwiaW1wb3J0LW1hcC5qc29uIjoie1xuICBcImltcG9ydHNcIjoge1xuICAgIFwidnVlXCI6IFwiaHR0cHM6Ly9zZmMudnVlanMub3JnL3Z1ZS5ydW50aW1lLmVzbS1icm93c2VyLmpzXCJcbiAgfVxufSIsIk15Q29tcG9uZW50LnZ1ZSI6IjxzY3JpcHQ+XG5leHBvcnQgZGVmYXVsdCB7XG4gIHByb3BzOiB7XG4gICAgYm9vbDogQm9vbGVhbixcbiAgICBib29sT3JTdHJpbmc6IFtCb29sZWFuLCBTdHJpbmddLFxuICAgIHN0cmluZ09yQm9vbDogW1N0cmluZywgQm9vbGVhbl0sXG4gIH1cbn1cbjwvc2NyaXB0PlxuXG48dGVtcGxhdGU+XG4gIDxwcmU+XG5ib29sOiB7e2Jvb2x9fSAoe3sgdHlwZW9mIGJvb2wgfX0pXG5ib29sT3JTdHJpbmc6IHt7Ym9vbE9yU3RyaW5nfX0gKHt7IHR5cGVvZiBib29sT3JTdHJpbmcgfX0pXG5zdHJpbmdPckJvb2w6IHt7c3RyaW5nT3JCb29sfX0gKHt7IHR5cGVvZiBzdHJpbmdPckJvb2wgfX0pXG4gIDwvcHJlPlxuPC90ZW1wbGF0ZT4ifQ==).
0 commit comments