The plugin provides a set of default selectors that determine how rules behave when checking your code. If you want to add custom selectors (like custom tags, callees, attributes, or variables) without losing the built-in ones, you should import getDefaultSelectors from eslint-plugin-better-tailwindcss/defaults and spread them into your rule configuration.
import eslintPluginBetterTailwindcss from "eslint-plugin-better-tailwindcss";
import { getDefaultSelectors } from "eslint-plugin-better-tailwindcss/defaults";
import { MatcherType, SelectorKind } from "eslint-plugin-better-tailwindcss/types";
export default [
{
plugins: {
"better-tailwindcss": eslintPluginBetterTailwindcss
},
rules: {
"better-tailwindcss/enforce-consistent-class-order": ["warn", {
selectors: [
...getDefaultSelectors(),
// custom tag
{
kind: SelectorKind.Tag,
match: [
{
type: MatcherType.String
}
],
name: "^myTag$"
},
// custom callee
{
kind: SelectorKind.Callee,
match: [
{
type: MatcherType.String
}
],
name: "^myFunction$"
},
// custom attribute
{
kind: SelectorKind.Attribute,
match: [
{
type: MatcherType.String
}
],
name: "^myAttribute$"
},
// custom variable
{
kind: SelectorKind.Variable,
match: [
{
type: MatcherType.String
}
],
name: "^myVariable$"
}
]
}]
}
}
];