ITADN

`vue/no-literals-in-template` should skip `xxx-style` and `xxx-class`

#3071OpenZacharyBear 创建于 2026-04-20
accepted proposition
Z
ZacharyBearcommented
<!-- Before proposing rule changes, please make sure it hasn't been posted already. You can see all open propositions here: https://github.com/vuejs/eslint-plugin-vue/issues?q=is%3Aopen+is%3Aissue+label%3A%22new+rule+proposition%22 --> **What rule do you want to change?** Some components accept a `xxx-style` or `xxx-class` attribute, it would be passed to its child components or elements. In this case, they should be allowed. `vue/no-literals-in-template` didn't recognized these props. **Does this change cause the rule to produce more or fewer warnings?** Fewer **How will the change be implemented? (New option, new default behavior, etc.)?** As the property's type implements `ClassValue` or `StyleValue`, they should be skipped. **Please provide some example code that this change will affect:** <!-- Put your code examples here --> ```vue <ElScrollbar :view-class="[{ filled: props.fill }]" /> ``` **What does the rule currently do for this code?** It passed classes to `ElScrollbar`, then `ElScrollbar` will pass these classes to it's element `div.el-scrollbar__view`. **What will the rule do after it's changed?** It will skip prefixed class or style properties. **Additional context** <!-- Add any other context or screenshots about the feature request here. --> `string`, `Record<string, any>` and some types is implemented `ClassValue`, it's hard to recognize what is a attribute should be skipped.
2 条评论