diff --git a/.changeset/old-moles-sort.md b/.changeset/old-moles-sort.md new file mode 100644 index 0000000000..2ad24946c2 --- /dev/null +++ b/.changeset/old-moles-sort.md @@ -0,0 +1,5 @@ +--- +"stylelint": patch +--- + +Fixed: `unit-no-unknown` false positives for font-relative length units diff --git a/lib/reference/units.js b/lib/reference/units.js index b7ee630b0a..72ab5ead0d 100644 --- a/lib/reference/units.js +++ b/lib/reference/units.js @@ -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', diff --git a/lib/rules/unit-no-unknown/__tests__/index.js b/lib/rules/unit-no-unknown/__tests__/index.js index 2dc5fc82a6..5ebd859f57 100644 --- a/lib/rules/unit-no-unknown/__tests__/index.js +++ b/lib/rules/unit-no-unknown/__tests__/index.js @@ -239,6 +239,9 @@ testRule({ code: 'a { image-resolution: 1x; }', description: 'ignore `x` unit in image-resolution', }, + { + code: 'a { width: 8ic; }', + }, ], reject: [