Skip to content

feat: allow relative-size and global values in relative-font-units#214

Merged
nzakas merged 3 commits into
eslint:mainfrom
xbinaryx:relative-font-units-logic-update
Jul 31, 2025
Merged

feat: allow relative-size and global values in relative-font-units#214
nzakas merged 3 commits into
eslint:mainfrom
xbinaryx:relative-font-units-logic-update

Conversation

@xbinaryx

Copy link
Copy Markdown
Contributor

Prerequisites checklist

What is the purpose of this pull request?

To update the relative-font-units rule to more clearly and strictly enforce the use of relative font units, while always allowing relative-size keywords and global values, and always disallowing absolute-size keywords.

What changes did you make? (Give an overview)

  • Updated the rule logic to:
    • Always allow the smaller and larger relative-size keywords.
    • Always allow global values such as inherit, initial, revert, revert-layer, and unset.
    • Always disallow absolute-size keywords (xx-small, x-small, small, medium, large, x-large, xx-large, xxx-large) and the math keyword.
  • Updated tests and documentation to reflect the new rule behavior.

Related Issues

Fixes #193

Is there anything you'd like reviewers to focus on?

@github-project-automation github-project-automation Bot moved this to Needs Triage in Triage Jul 28, 2025
@lumirlumir lumirlumir added the accepted There is consensus among the team that this change meets the criteria for inclusion label Jul 28, 2025
@lumirlumir lumirlumir requested a review from a team July 28, 2025 08:20
@Tanujkanti4441 Tanujkanti4441 moved this from Needs Triage to Implementing in Triage Jul 28, 2025

@Tanujkanti4441 Tanujkanti4441 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for the PR! Everything looks good, just a minor change request.

Comment thread docs/rules/relative-font-units.md

@nzakas nzakas left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for taking a look at this.

There is no such thing as a math keyword in CSS, there are only math functions. Please update the logic and docs to take this into account.

@xbinaryx

Copy link
Copy Markdown
Contributor Author

@nzakas font-size does accept a math keyword, distinct from math functions. It's listed by MDN as part of the font-size syntax.

@nzakas

nzakas commented Jul 31, 2025

Copy link
Copy Markdown
Member

Huh. I didn't realize that was a literal value, I thought it was a reference to the math functions. TIL. 👍

@nzakas nzakas left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM. Thanks!

@nzakas nzakas merged commit 933d71c into eslint:main Jul 31, 2025
22 checks passed
@github-project-automation github-project-automation Bot moved this from Implementing to Complete in Triage Jul 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

accepted There is consensus among the team that this change meets the criteria for inclusion contributor pool feature

Projects

Status: Complete

Development

Successfully merging this pull request may close these issues.

Bug: relative-font-units does not handle inherit

4 participants