-
-
Notifications
You must be signed in to change notification settings - Fork 700
Open
Description
Checklist
- I have tried restarting my IDE and the issue persists.
- I have read the FAQ and my problem is not listed.
Tell us about your environment
- ESLint version: 9.31.1
- eslint-plugin-vue version: 10.6.1
- Vue version:
- Node version:
- Operating System:
Please show your full configuration:
import eslintPluginVue from 'eslint-plugin-vue';
import { defineConfig } from 'eslint/config';
import vueEslintParser from 'vue-eslint-parser';
export default defineConfig([
{
files: ['*.vue'],
plugins: {
vue: eslintPluginVue,
},
languageOptions: {
parser: vueEslintParser,
},
rules: {
'vue/no-duplicate-class-names': 2,
},
},
]);What did you do?
Sometimes it's desirable to include the same class name multiple times, while also avoiding the situation when the class appears more than once in runtime.
Here's an example from the real component when this happens and no-duplicate-class-names reports on the second bg-secondary class appearance:
<template>
<div
:class="[
(type === 'primary' || type === 'secondary') && {
'bg-white': background === 'primary',
'bg-secondary': background === 'secondary',
},
type === 'tertiary' && 'bg-secondary px-3 py-2',
]"
></div>
</template>What did you expect to happen?
I think no-duplicate-class-names checks should be improved. Yet I understand that precise checking of whether class appearance conditions are intersecting might be difficult.
What actually happened?
bg-secondary class was reported as duplicate by the rule in question.
Repository to reproduce this issue
Metadata
Metadata
Assignees
Labels
No labels