Skip to content

Commit

Permalink
updated custom-event-name-casing readme with ignores options
Browse files Browse the repository at this point in the history
  • Loading branch information
devTeaa committed Oct 9, 2020
1 parent 574d218 commit b104289
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions docs/rules/custom-event-name-casing.md
Expand Up @@ -59,6 +59,37 @@ export default {
```
- `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`.

### `"ignores": ["fooBar", "/^[a-z]+(?:-[a-z]+)*:[a-z]+(?:-[a-z]+)*$/u"]`

<eslint-code-block :rules="{'vue/custom-event-name-casing': ['error', {ignores:'/^[a-z]+(?:-[a-z]+)*:[a-z]+(?:-[a-z]+)*$/u'}]}">

```vue
<template>
<!-- ✓ GOOD -->
<button @click="$emit('click:row')" />
<button @click="$emit('fooBar')" />
<!-- ✗ BAD -->
<button @click="$emit('myEvent')" />
</template>
<script>
export default {
methods: {
onClick () {
/* ✓ GOOD */
this.$emit('click:row')
this.$emit('fooBar')
/* ✗ BAD */
this.$emit('myEvent')
}
}
}
</script>
```

</eslint-code-block>


## :books: Further Reading

Expand Down

0 comments on commit b104289

Please sign in to comment.