Skip to content

Commit b104289

Browse files
committed
updated custom-event-name-casing readme with ignores options
1 parent 574d218 commit b104289

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

docs/rules/custom-event-name-casing.md

+31
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,37 @@ export default {
5959
```
6060
- `ignores` (`string[]`) ... The event names to ignore. Sets the event name to allow. For example, custom event names, Vue components event with special name, or Vue library component event name. You can set the regexp by writing it like `"/^name/"` or `click:row` or `fooBar`.
6161

62+
### `"ignores": ["fooBar", "/^[a-z]+(?:-[a-z]+)*:[a-z]+(?:-[a-z]+)*$/u"]`
63+
64+
<eslint-code-block :rules="{'vue/custom-event-name-casing': ['error', {ignores:'/^[a-z]+(?:-[a-z]+)*:[a-z]+(?:-[a-z]+)*$/u'}]}">
65+
66+
```vue
67+
<template>
68+
<!-- ✓ GOOD -->
69+
<button @click="$emit('click:row')" />
70+
<button @click="$emit('fooBar')" />
71+
72+
<!-- ✗ BAD -->
73+
<button @click="$emit('myEvent')" />
74+
</template>
75+
<script>
76+
export default {
77+
methods: {
78+
onClick () {
79+
/* ✓ GOOD */
80+
this.$emit('click:row')
81+
this.$emit('fooBar')
82+
83+
/* ✗ BAD */
84+
this.$emit('myEvent')
85+
}
86+
}
87+
}
88+
</script>
89+
```
90+
91+
</eslint-code-block>
92+
6293

6394
## :books: Further Reading
6495

0 commit comments

Comments
 (0)