noTailwindArbitraryValue
Summary
Section titled “Summary”- Diagnostic Category:
lint/nursery/noTailwindArbitraryValue - This rule doesn’t have a fix.
- The default severity of this rule is information.
- This rule belongs to the following domains:
- Sources:
- Same as
tailwindcss/no-arbitrary-value
- Same as
How to configure
Section titled “How to configure”{ "linter": { "rules": { "nursery": { "noTailwindArbitraryValue": "error" } } }}Description
Section titled “Description”Disallow arbitrary values in Tailwind CSS utility classes.
Arbitrary values (e.g. w-[400px], text-[#555]) and arbitrary properties
(e.g. [color:red]) bypass Tailwind’s configured theme scales. This rule reports
them so teams can keep styling constrained to named utilities from their Tailwind
configuration.
Examples
Section titled “Examples”Invalid
Section titled “Invalid”<div class="w-[400px]"></div>code-block.html:1:15 lint/nursery/noTailwindArbitraryValue ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
ℹ Found an arbitrary value in a Tailwind CSS class.
> 1 │ <div class=“w-[400px]”></div>
│ ^^^^^^^
2 │
ℹ Arbitrary values bypass Tailwind’s theme configuration, defeating design-system consistency and making styles harder to refactor.
ℹ Use a named utility from your Tailwind configuration instead.
ℹ This rule belongs to the nursery group, which means it is not yet stable and may change in the future. Visit https://biomejs.dev/linter/#nursery for more information.
<div class="text-[#555] bg-white"></div>code-block.html:1:18 lint/nursery/noTailwindArbitraryValue ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
ℹ Found an arbitrary value in a Tailwind CSS class.
> 1 │ <div class=“text-[#555] bg-white”></div>
│ ^^^^^^
2 │
ℹ Arbitrary values bypass Tailwind’s theme configuration, defeating design-system consistency and making styles harder to refactor.
ℹ Use a named utility from your Tailwind configuration instead.
ℹ This rule belongs to the nursery group, which means it is not yet stable and may change in the future. Visit https://biomejs.dev/linter/#nursery for more information.
<div class="[color:red]"></div>code-block.html:1:13 lint/nursery/noTailwindArbitraryValue ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
ℹ Found an arbitrary value in a Tailwind CSS class.
> 1 │ <div class=“[color:red]”></div>
│ ^^^^^^^^^^^
2 │
ℹ Arbitrary values bypass Tailwind’s theme configuration, defeating design-system consistency and making styles harder to refactor.
ℹ Use a named utility from your Tailwind configuration instead.
ℹ This rule belongs to the nursery group, which means it is not yet stable and may change in the future. Visit https://biomejs.dev/linter/#nursery for more information.
<div class="w-4 text-red-500 bg-white"></div><div class="[&:nth-child(3)]:px-2"></div>Options
Section titled “Options”By default, this rule checks the class attribute. The attributes
option adds more HTML attributes to check.
{ "linter": { "rules": { "nursery": { "noTailwindArbitraryValue": { "level": "on", "options": { "attributes": [ "classList" ] } } } } }}<div classList="w-[400px]"></div>attributes
Section titled “attributes”Additional HTML attribute names to check.
Default: [] (the class attribute is always checked).
Related links
Section titled “Related links”Summary
Section titled “Summary”- Diagnostic Category:
lint/nursery/noTailwindArbitraryValue - This rule doesn’t have a fix.
- The default severity of this rule is information.
- This rule belongs to the following domains:
- Sources:
- Same as
tailwindcss/no-arbitrary-value
- Same as
How to configure
Section titled “How to configure”{ "linter": { "rules": { "nursery": { "noTailwindArbitraryValue": "error" } } }}Description
Section titled “Description”Disallow arbitrary values in Tailwind CSS utility classes.
Arbitrary values (e.g. w-[400px], text-[#555]) and arbitrary properties
(e.g. [color:red]) bypass Tailwind’s configured theme scales. This rule reports
them so teams can keep styling constrained to named utilities from their Tailwind
configuration.
Examples
Section titled “Examples”Invalid
Section titled “Invalid”<div className="w-[400px]" />;code-block.jsx:1:19 lint/nursery/noTailwindArbitraryValue ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
ℹ Found an arbitrary value in a Tailwind CSS class.
> 1 │ <div className=“w-[400px]” />;
│ ^^^^^^^
2 │
ℹ Arbitrary values bypass Tailwind’s theme configuration, defeating design-system consistency and making styles harder to refactor.
ℹ Use a named utility from your Tailwind configuration instead.
ℹ This rule belongs to the nursery group, which means it is not yet stable and may change in the future. Visit https://biomejs.dev/linter/#nursery for more information.
<div className="text-[#555] bg-white" />;code-block.jsx:1:22 lint/nursery/noTailwindArbitraryValue ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
ℹ Found an arbitrary value in a Tailwind CSS class.
> 1 │ <div className=“text-[#555] bg-white” />;
│ ^^^^^^
2 │
ℹ Arbitrary values bypass Tailwind’s theme configuration, defeating design-system consistency and making styles harder to refactor.
ℹ Use a named utility from your Tailwind configuration instead.
ℹ This rule belongs to the nursery group, which means it is not yet stable and may change in the future. Visit https://biomejs.dev/linter/#nursery for more information.
<div className="[color:red]" />;code-block.jsx:1:17 lint/nursery/noTailwindArbitraryValue ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
ℹ Found an arbitrary value in a Tailwind CSS class.
> 1 │ <div className=“[color:red]” />;
│ ^^^^^^^^^^^
2 │
ℹ Arbitrary values bypass Tailwind’s theme configuration, defeating design-system consistency and making styles harder to refactor.
ℹ Use a named utility from your Tailwind configuration instead.
ℹ This rule belongs to the nursery group, which means it is not yet stable and may change in the future. Visit https://biomejs.dev/linter/#nursery for more information.
<div className="w-4 text-red-500 bg-white" />;<div className="[&:nth-child(3)]:px-2" />;Options
Section titled “Options”By default, this rule checks the class and className JSX attributes.
The attributes option adds more JSX attributes to check, and functions
enables checking string arguments and tagged templates in matching utilities.
{ "linter": { "rules": { "nursery": { "noTailwindArbitraryValue": { "level": "on", "options": { "attributes": [ "classList" ], "functions": [ "clsx" ] } } } } }}attributes
Section titled “attributes”Additional JSX attribute names to check.
Default: [] (the class and className attributes are always checked).
functions
Section titled “functions”Function or tagged template names whose classes will be checked for arbitrary values.
Default: [].
<div className={clsx("w-[400px]")} />;code-block.jsx:1:25 lint/nursery/noTailwindArbitraryValue ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
ℹ Found an arbitrary value in a Tailwind CSS class.
> 1 │ <div className={clsx(“w-[400px]”)} />;
│ ^^^^^^^
2 │
ℹ Arbitrary values bypass Tailwind’s theme configuration, defeating design-system consistency and making styles harder to refactor.
ℹ Use a named utility from your Tailwind configuration instead.
ℹ This rule belongs to the nursery group, which means it is not yet stable and may change in the future. Visit https://biomejs.dev/linter/#nursery for more information.
Related links
Section titled “Related links”Copyright (c) 2023-present Biome Developers and Contributors.