astro/prefer-class-list-directive
require
class:list
directives instead ofclass
with expressions
- 🔧 The
--fix
option on the command line can automatically fix some of the problems reported by this rule.
📖 Rule Details
This rule aims to replace the class
attribute with expression with the class:list
directive.
---
/* eslint astro/prefer-class-list-directive: "error" */
---
{/* ✓ GOOD */}
<div class:list={[foo, bar]}></div>
{/* ✗ BAD */}
<div class={foo + " " + bar}></div>
🔧 Options
Nothing.
👫 Related Rules
📚 Further Reading
🚀 Version
This rule was introduced in eslint-plugin-astro v0.4.0
🔍 Implementation
Edit this page
Back
← astro/no-unused-css-selector Next Page
astro/prefer-object-class-list →
← astro/no-unused-css-selector Next Page
astro/prefer-object-class-list →