Skip to content

Commit

Permalink
docs: update
Browse files Browse the repository at this point in the history
  • Loading branch information
waynzh committed Nov 16, 2024
1 parent c91086a commit 254e4c5
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 4 deletions.
24 changes: 22 additions & 2 deletions docs/rules/attribute-hyphenation.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ This rule enforces using hyphenated attribute names on custom components in Vue
```json
{
"vue/attribute-hyphenation": ["error", "always" | "never", {
"ignore": []
"ignore": [],
"exclude": []
}]
}
```
Expand All @@ -46,7 +47,8 @@ and all the [SVG attributes](https://developer.mozilla.org/en-US/docs/Web/SVG/At

- `"always"` (default) ... Use hyphenated name.
- `"never"` ... Don't use hyphenated name except the ones that are ignored.
- `"ignore"` ... Array of ignored names
- `"ignore"` ... Array of ignored names.
- `"exclude"` ... Array of exclude tag names.

### `"always"`

Expand Down Expand Up @@ -109,6 +111,24 @@ Don't use hyphenated name but allow custom attributes

</eslint-code-block>

### `"never", { "exclude": ["/^custom-/"] }`

Exclude tags from applying this rule.

<eslint-code-block fix :rules="{'vue/attribute-hyphenation': ['error', 'never', { exclude: ['/^custom-/'] }]}">

```vue
<template>
<!-- ✓ GOOD -->
<custom-component custom-prop="prop" />
<!-- ✗ BAD -->
<my-component custom-prop="prop" />
</template>
```

</eslint-code-block>

## :couple: Related Rules

- [vue/v-on-event-hyphenation](./v-on-event-hyphenation.md)
Expand Down
24 changes: 22 additions & 2 deletions docs/rules/v-on-event-hyphenation.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,16 @@ This rule enforces using hyphenated v-on event names on custom components in Vue
{
"vue/v-on-event-hyphenation": ["error", "always" | "never", {
"autofix": false,
"ignore": []
"ignore": [],
"exclude": []
}]
}
```

- `"always"` (default) ... Use hyphenated name.
- `"never"` ... Don't use hyphenated name.
- `"ignore"` ... Array of ignored names
- `"ignore"` ... Array of ignored names.
- `"exclude"` ... Array of exclude tag names.
- `"autofix"` ... If `true`, enable autofix. If you are using Vue 2, we recommend that you do not use it due to its side effects.

### `"always"`
Expand Down Expand Up @@ -104,6 +106,24 @@ Don't use hyphenated name but allow custom event names

</eslint-code-block>

### `"never", { "exclude": ["/^custom-/"] }`

Exclude tags from applying this rule.

<eslint-code-block fix :rules="{'vue/v-on-event-hyphenation': ['error', 'never', { exclude: ['/^custom-/'], autofix: true }]}">

```vue
<template>
<!-- ✓ GOOD -->
<custom-component v-on:custom-event="handleEvent" />
<!-- ✗ BAD -->
<my-component v-on:custom-event="handleEvent" />
</template>
```

</eslint-code-block>

## :couple: Related Rules

- [vue/custom-event-name-casing](./custom-event-name-casing.md)
Expand Down

0 comments on commit 254e4c5

Please sign in to comment.