Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create prefer-theme-color-js-tokens rule #25

Open
georgewrmarshall opened this issue Jun 5, 2024 · 0 comments
Open

Create prefer-theme-color-js-tokens rule #25

georgewrmarshall opened this issue Jun 5, 2024 · 0 comments
Labels
team-design-system All issues relating to design system

Comments

@georgewrmarshall
Copy link
Collaborator

georgewrmarshall commented Jun 5, 2024

Description

Implement a new ESLint rule to encourage the use of theme color tokens in lightTheme and darkTheme over the brandColor object, similar to the existing prefer-theme-color-classnames rule. This new rule will help enforce consistent theming across projects by preferring light and dark theme color tokens.

Technical Details

  • Create a rule within the @metamask/design-tokens plugin to enforce the use of theme color JS tokens instead of colors inside of the brandColor object.
  • The rule should check for literal color references and suggest the corresponding theme color tokens from the light and dark themes.

Acceptance Criteria

  • The rule must detect direct literal color references like brandColor.blue050, brandColor.white, brandColor.black etc and suggest the corresponding theme color tokens.
  • Proper documentation must be added, similar to the prefer-theme-color-classnames rule.
  • Unit tests must be included to verify the rule's functionality.
  • Ensure compatibility with existing ESLint configurations used in MetaMask projects.

References

This rule aims to ensure that theme colors are centralized and easily manageable, promoting consistent theming and simplifying updates across the project's UI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
team-design-system All issues relating to design system
Projects
None yet
Development

No branches or pull requests

1 participant