This rule reports a utility whose name matches a pattern that your project forbids. It checks the name as written, not the generated CSS. The rule is off until you list utilities.
Configuration
{
"lint": {
"rules": {
"no-restricted-utilities": {
"severity": "warn",
"utilities": [
{
"pattern": "space-*",
"message": "Use gap on the container."
}
]
}
}
}
}Reported
style("flex flex-col space-y-4");no-restricted-utilities: utility `space-y-4` is forbidden: Use gap on the container.Fixed
style("flex flex-col gap-4");How to fix
Follow the message of the matching entry. In the example, the project prefers
gap to space-*, so the fix keeps the same spacing with gap-4.
Options
utilities lists entries with a name pattern and an optional message.
Patterns accept * and ?, and they are case-sensitive.
To also catch other utilities that produce the same CSS, use no-restricted-declarations.
Rule settings
| Preset | Severity |
|---|---|
recommended | off |
strict | off |
stylistic | off |
| Option | Default |
|---|---|
utilities | [] |
Configure lint to change the severity or options.