Enhance `color-no-hex` Rule to Support Custom Linting Messages
Opened this issue · 0 comments
Description
The color-no-hex
rule within the @metamask/eslint-plugin-design-tokens
package plays a crucial role in enforcing the use of design tokens over static hex color values, aligning our codebase with the design system's guidelines. To further improve the developer experience and provide more context-specific guidance, we propose updating this rule to support custom linting messages. This enhancement will allow for a default message to be provided but also enable platform-specific overrides, offering more tailored feedback to developers based on the unique requirements or conventions of different platforms within our ecosystem.
Technical Details
- Objective: Update the
color-no-hex
rule to allow for a default linting message that can be overridden with custom messages for specific platforms. - Implementation Steps:
- Modify the rule's logic to include a default linting message that discourages the use of static hex color values in favor of design tokens.
- Implement functionality within the rule configuration to accept an optional
message
parameter, allowing for custom messages to be specified. - Ensure that the custom message, if provided, overrides the default message when linting code.
- Update the documentation for the
color-no-hex
rule within the@metamask/eslint-plugin-design-tokens
package to explain how to configure custom messages.
- Dependencies: This task requires access to the source code of the
@metamask/eslint-plugin-design-tokens
package and familiarity with its rule development conventions.
Acceptance Criteria
- The
color-no-hex
rule includes a clear and informative default linting message that aligns with the design system's guidelines. - Developers can specify custom linting messages for the
color-no-hex
rule in the ESLint configuration, tailoring feedback to the needs of different platforms. - Custom messages, when specified, correctly override the default message during the linting process.
- The documentation for the
color-no-hex
rule is updated to include guidance on configuring custom linting messages, with examples provided for clarity. - The enhancement does not introduce regressions or negatively impact the rule's ability to accurately identify and flag static hex color values.
Additional Notes
This enhancement is aimed at making the linting process more adaptable and informative, providing developers with specific guidance that reflects the context of their work. By allowing for custom linting messages, we can improve adherence to our design system while accommodating the diverse needs of our development ecosystem.