Skip to content

Commit

Permalink
Fix unit-no-unknown false positives for font-relative length units (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
ybiquitous committed Sep 29, 2022
1 parent eee9deb commit f0d8a57
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/old-moles-sort.md
@@ -0,0 +1,5 @@
---
"stylelint": patch
---

Fixed: `unit-no-unknown` false positives for font-relative length units
12 changes: 9 additions & 3 deletions lib/reference/units.js
Expand Up @@ -3,13 +3,19 @@
const uniteSets = require('../utils/uniteSets.js');

const lengthUnits = new Set([
// Relative length units
// Font-relative length units
'cap',
'ch',
'em',
'ex',
'ch',
'ic',
'lh',
'rcap',
'rch',
'rem',
'rex',
'ric',
'rlh',
'lh',
// Viewport-percentage lengths
'dvh',
'dvmax',
Expand Down
3 changes: 3 additions & 0 deletions lib/rules/unit-no-unknown/__tests__/index.js
Expand Up @@ -239,6 +239,9 @@ testRule({
code: 'a { image-resolution: 1x; }',
description: 'ignore `x` unit in image-resolution',
},
{
code: 'a { width: 8ic; }',
},
],

reject: [
Expand Down

0 comments on commit f0d8a57

Please sign in to comment.