Skip to content

Files

Latest commit

 

History

History
95 lines (64 loc) · 1.2 KB

number-max-precision.md

File metadata and controls

95 lines (64 loc) · 1.2 KB

Pattern: Too many decimal places in number

Issue: -

Description

Limit the number of decimal places allowed in numbers.

Examples

int: Maximum number of decimal places allowed.

For example, with 2:

The following patterns are considered violations:

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

The following patterns are not considered violations:

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

Configuration

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

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

For example, with 2.

Given:

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

The following patterns are considered violations:

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

The following patterns are not considered violations:

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

Further Reading