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

Allow regex in `vue/no-restricted-class`

Open jd-solanki opened this issue 3 years ago • 1 comments

What rule do you want to change? vue/no-restricted-class

Does this change cause the rule to produce more or fewer warnings? No

How will the change be implemented? (New option, new default behavior, etc.)? Allow a regex pattern just like we did here

Please provide some example code that this change will affect:

<div class="ml-2" />

What does the rule currently do for this code? Right now to restrict the classes which are not RTL friendly I have to write long list of them:

'vue/no-restricted-class': ['error', 'ml-1', 'ml-2', /* And more... */],

What will the rule do after it's changed? Once this rule accept regex pattern we don't have to write long list, just below is enough:

'vue/no-restricted-class': ['error', '/^(m|p)(l|r)-/'],

Additional context None

jd-solanki avatar May 05 '22 06:05 jd-solanki

PRs welcome!

FloEdelmann avatar May 05 '22 09:05 FloEdelmann