Skip to main content

number-max-precision

Limit the number of decimal places allowed in numbers.

a { top: 3.245634px; }/**           โ†‘ * This decimal place */

Options#

int: Maximum number of decimal places allowed.

For example, with 2:

The following patterns are considered problems:

a { top: 3.245px; }
a { top: 3.245634px; }
@media (min-width: 3.234em) {}

The following patterns are not considered problems:

a { top: 3.24px; }
@media (min-width: 3.23em) {}

Optional secondary options#

ignoreProperties: ["/regex/", /regex/, "string"]#

Ignore the precision of numbers for the specified properties.

For example, with 0.

Given:

["transition"]

The following patterns are considered problems:

a { top: 10.5px; }

The following patterns are not considered problems:

a { transition: all 4.5s ease; }

ignoreUnits: ["/regex/", /regex/, "string"]#

Ignore the precision of numbers for values with the specified units.

For example, with 2.

Given:

["/^my-/", "%"]

The following patterns are considered problems:

a { top: 3.245px; }
a { top: 3.245634px; }
@media (min-width: 3.234em) {}

The following patterns are not considered problems:

a { top: 3.245%; }
@media (min-width: 3.23em) {}
a {  width: 10.5432%;}
a { top: 3.245my-unit; }
a {  width: 10.989my-other-unit;}