Introduces a new concept called matchers. Matchers allow finer control than regular expressions as they operate directly on the abstract syntax tree.
This allows additional filtering, such as literals in conditions or logical expressions.
<img class={`
these classes will get linted
${someVariable === "this string will NOT get linted" ? "but this will" : "and this will too"}
${someVariable && "this string will get linted"}
`} />
There are currently 3 types of matchers:
objectKeys: matches all object keys
objectValues: matches all object values
strings: matches all string literals that are not object keys or values
It is possible to provide a pathPattern to the objectKeys and objectValues matchers, to only match keys/values that match the pathPattern. This allows for more fine-grained control for common utilities like Class Variance Authority.
The pathPattern is a regular expression that is matched against the object path.
For example, the following matcher will only match object values for the compoundVariants.class key:
<img class={
cva("this will get linted", {
compoundVariants: [
{
class: "and this will get linted",
myVariant: "but this will not get linted"
}
]
})
} />;
Introduces a new concept called matchers. Matchers allow finer control than regular expressions as they operate directly on the abstract syntax tree. This allows additional filtering, such as literals in conditions or logical expressions.
There are currently 3 types of matchers:
objectKeys
: matches all object keysobjectValues
: matches all object valuesstrings
: matches all string literals that are not object keys or valuesIt is possible to provide a
pathPattern
to theobjectKeys
andobjectValues
matchers, to only match keys/values that match thepathPattern
. This allows for more fine-grained control for common utilities like Class Variance Authority.The
pathPattern
is a regular expression that is matched against the object path.For example, the following matcher will only match object values for the
compoundVariants.class
key:closes #17