eslint-plugin-vue icon indicating copy to clipboard operation
eslint-plugin-vue copied to clipboard

New rule `vue/quotes`

Open szulcus opened this issue 2 years ago • 9 comments

Tell us about your environment

  • ESLint version: ^8.28.0
  • eslint-plugin-vue version: 9.14.0
  • Node version: v16.19.0

The problem you want to solve. This warning, but in vue tamplate: image image

Your take on the correct solution to problem. Similar like: https://eslint.org/docs/latest/rules/quotes

szulcus avatar May 23 '23 09:05 szulcus

Sounds good, thanks for the suggestion! This should be relatively easy, as we have a reusable function for wrapping core ESLint rules.

Would you like to give it a try? See https://eslint.vuejs.org/developer-guide/#proposing-a-new-rule-or-a-rule-change. You can take e.g. the vue/camelcase rule and its implementation as a base.

FloEdelmann avatar May 23 '23 12:05 FloEdelmann

@FloEdelmann I didn't know there was a way to create custom rules. I'd like to try it, but it might take me a while to get to know it. I won't have time for that anytime soon, but maybe later I can help with the new rules. Thanks for the offer!

szulcus avatar May 23 '23 15:05 szulcus

Note that we may need to exclude warnings within directives.

<template>
  <img v-bind:title="$t(`foo`)" />
</template>

ota-meshi avatar May 24 '23 00:05 ota-meshi

Hi, I just wrote a rule for this, but since it's only for my personal use, the test cases are not comprehensive and only consider quotes in mustache tags. I haven't considered quotes within directives. Maybe you can use it as a reference :)

Bernankez avatar May 24 '23 04:05 Bernankez