vuejs / eslint-plugin-vue

Official ESLint plugin for Vue.js
https://eslint.vuejs.org/
MIT License
4.47k stars 666 forks source link

Replace `v-on:` and `v-bind:` always by shortcuts `@` and `:` #2509

Closed vikingair closed 4 months ago

vikingair commented 4 months ago

Please describe what the rule should do: When v-on: and v-bind: are being used the rule should complain and suggest (even autofix) these with the respective shortcuts @ and :. Exceptions are of course usages without specified keys e.g. v-bind="...".

What category should the rule belong to? [x] Enforces code style (layout) [ ] Warns about a potential error (problem) [ ] Suggests an alternate way of doing something (suggestion) [ ] Other (please specify:)

Provide 2-3 code examples that this rule should warn about:

<MyComponent
  v-bind:num="2"
  v-on:click="handleClick"
/>
<!-- should be -->
<MyComponent
  :num="2"
  @click="handleClick"
/>
FloEdelmann commented 4 months ago

See https://eslint.vuejs.org/rules/v-bind-style.html and https://eslint.vuejs.org/rules/v-on-style.html