Skip to content

Commit 2abcaf9

Browse files
committed
docs: update
1 parent 4d8c7a0 commit 2abcaf9

File tree

1 file changed

+27
-1
lines changed

1 file changed

+27
-1
lines changed

docs/rules/prefer-true-attribute-shorthand.md

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,18 @@ Default options is `"always"`.
8181

8282
```json
8383
{
84-
"vue/prefer-true-attribute-shorthand": ["error", "always" | "never"]
84+
"vue/prefer-true-attribute-shorthand": ["error",
85+
"always" | "never",
86+
{
87+
except: []
88+
}
89+
]
8590
}
8691
```
8792

8893
- `"always"` (default) ... requires shorthand form.
8994
- `"never"` ... requires long form.
95+
- `except` (`string[]`) ... specifies a list of attribute names that should be treated differently.
9096

9197
### `"never"`
9298

@@ -105,6 +111,26 @@ Default options is `"always"`.
105111

106112
</eslint-code-block>
107113

114+
### `"never", { 'except': ['value', '/^foo-/'] }`
115+
116+
<eslint-code-block :rules="{'vue/prefer-true-attribute-shorthand': ['error', 'never', { 'except': ['value', '/^foo-/'] }]}">
117+
118+
```vue
119+
<template>
120+
<!-- ✗ BAD -->
121+
<MyComponent show />
122+
<MyComponent :value="true" />
123+
<MyComponent :foo-bar="true" />
124+
125+
<!-- ✓ GOOD -->
126+
<MyComponent :show="true" />
127+
<MyComponent value />
128+
<MyComponent foo-bar />
129+
</template>
130+
```
131+
132+
</eslint-code-block>
133+
108134
## :couple: Related Rules
109135

110136
- [vue/no-boolean-default](./no-boolean-default.md)

0 commit comments

Comments
 (0)