Skip to content
This repository was archived by the owner on Sep 30, 2025. It is now read-only.
This repository was archived by the owner on Sep 30, 2025. It is now read-only.

Fix incorrect stylelint-polaris failures in @font-face rules #7991

@aaronccasanova

Description

@aaronccasanova

We are incorrectly failing font-weight usages in @font-face rules and recommending authors use Polaris custom properties. However, Polaris custom properties are not really applicable in this context and more importantly are not permitted in @font-face rules:

image

Possible solutions:

  • Suggest authors add a stylelint-disable-next-line comment:
    • Easy to document
    • Concise documentation can be added to the stylelint error
    • @font-face usage is typically minimal
    • Low time investment
  • Create a custom stylelint-polaris rule that handles the edge case:
    • No additional documentation required
    • Higher time investment
    • Rough outline:
      • Wrap the declaration-property-disallowed-list rule
      • Intercept font-weight failures
      • Check if the font-weight's parent is a @font-face node
      • Exit early

Note: Our styles-tokenize-font migration is also incorrectly replacing font-weight values with tokens.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions