Closed Bug 1979109 Opened 1 year ago Closed 1 year ago

Generate data from design-tokens.json that can be used for custom Stylelint rules

Categories

(Developer Infrastructure :: Lint and Formatting, task)

Tracking

(firefox143 fixed)

RESOLVED FIXED
143 Branch
Tracking Status
firefox143 --- fixed

People

(Reporter: hjones, Assigned: jooliver)

References

(Blocks 1 open bug)

Details

(Whiteboard: [recomp][acorntractors])

Attachments

(1 file)

design-tokens.json is our source of truth for everything design tokens related. We use Style Dictionary to transform it into various CSS files, and we also use it to generate tokens-storybook.mjs, which provides the data for our design tokens table.

Ideally we can use design-tokens.json as the source of truth for our custom Stylelint rules too, so that the variables the rules are checking for will get updated automatically when we rename/add/remove tokens. This could take the form of either adding a new Style Dictionary format, or possibly just refactoring and renaming tokens-storybook.mjs to something more generic that can work for multiple purposes. I have a POC commit demonstrating this latter approach here.

Here's the tentative list of rules I think we'll want/be able to add, which should inform the data structure (I'm open to suggestions and feedback on this):

  • background-color
  • border-color (likely includes some outline values)
  • border-radius
  • border-width (less sure about this/lower priority)
  • font-size
  • font-weight
  • opacity
  • size
  • space
  • text-color
  • icon-color (might be hard to determine if it's actually getting applied to an icon or not)
  • icon-size (might be hard to determine if it's actually getting applied to an icon or not)
  • box-shadow
Blocks: 1979115
Assignee: nobody → jooliver
Status: NEW → ASSIGNED

Renames tokens-storybook.mjs to tokens-table.mjs and updates usage.
This work is a prerequisite for upcoming work to create custom style lint rules.

Pushed by hjones@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/202c3bd61b51 https://hg.mozilla.org/integration/autoland/rev/0a10fa42cabe rename storybook tokens for reuse r=reusable-components-reviewers,desktop-theme-reviewers,hjones
Pushed by nbeleuzu@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/b08f892ea369 https://hg.mozilla.org/integration/autoland/rev/e017d715b346 Revert "Bug 1979109 - rename storybook tokens for reuse r=reusable-components-reviewers,desktop-theme-reviewers,hjones" for causing node design failures
Pushed by hjones@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/f6f8dc0c8874 https://hg.mozilla.org/integration/autoland/rev/97a0c641abc8 rename storybook tokens for reuse r=reusable-components-reviewers,desktop-theme-reviewers,hjones
Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 143 Branch

Looks like this re-landed.

Flags: needinfo?(jooliver)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: