Environment
ESLint version: v10.10.0
@eslint/css version: v2.0.0
Node version: v22.15.0
npm version: v11.12.1
Operating System: Windows 11
Which language are you using?
stylesheet
What did you do?
eslint.config.js
import css from "@eslint/css";
import { defineConfig } from "eslint/config";
export default defineConfig([
{
files: ["**/*.css"],
plugins: { css },
language: "css/css",
rules: { "css/relative-font-units": "error" },
},
]);
test.css
/* reported (expected) */
.a {
font-size: 12px;
}
.b {
font: 12px Arial;
}
/* not reported (unexpected) */
.c {
font-size: clamp(12px, 2vw, 20px);
}
.d {
font-size: calc(12px + 1rem);
}
.e {
font-size: min(12px, 1rem);
}
.f {
font: clamp(12px, 2vw, 20px) Arial;
}
What did you expect to happen?
The 12px inside clamp(), calc(), and min() in .c–.f should be reported. The rule exists to disallow absolute font-size units, and font-size: clamp(12px, 2vw, 20px) still uses px. Fluid typography with clamp() is a very common pattern, so this is a significant gap.
What actually happened?
Only .a and .b are reported. Every declaration whose value is a math function (.c–.f) passes silently, even though each one contains 12px.
test.css
3:14 error Use only allowed relative units for 'font-size' - rem css/relative-font-units
6:9 error Use only allowed relative units for 'font-size' - rem css/relative-font-units
✖ 2 problems (2 errors, 0 warnings)
Link to Minimal Reproducible Example
https://stackblitz.com/edit/stackblitz-starters-8rrnybj4?file=eslint.config.js
Participation
AI acknowledgment
Additional comments
No response
Disclosure: I'm a participant of open source contribution program OSSCA
Environment
ESLint version: v10.10.0
@eslint/css version: v2.0.0
Node version: v22.15.0
npm version: v11.12.1
Operating System: Windows 11
Which language are you using?
stylesheet
What did you do?
eslint.config.jstest.cssWhat did you expect to happen?
The
12pxinsideclamp(),calc(), andmin()in.c–.fshould be reported. The rule exists to disallow absolute font-size units, andfont-size: clamp(12px, 2vw, 20px)still usespx. Fluid typography withclamp()is a very common pattern, so this is a significant gap.What actually happened?
Only
.aand.bare reported. Every declaration whose value is a math function (.c–.f) passes silently, even though each one contains12px.Link to Minimal Reproducible Example
https://stackblitz.com/edit/stackblitz-starters-8rrnybj4?file=eslint.config.js
Participation
AI acknowledgment
Additional comments
No response
Disclosure: I'm a participant of open source contribution program OSSCA