Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix unit-no-unknown false positives for font-relative length units #6374

Merged
merged 1 commit into from Sep 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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',
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sort alphabetically.

// 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