Repository navigation
ESLint integration for enforcing Nuxt UI design-system conventions #7061
Closed
createwithjames
started this conversation in
Ideas
Replies: 1 comment 1 reply
|
Great idea! I've opened #7329 with a
I didn't add rules to block restyling components, |
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Summary
Would the Nuxt UI team consider providing an official ESLint integration, shareable configuration or adapter for enforcing Nuxt UI's design-system conventions?
Nuxt UI already provides semantic colors, component variants, design tokens and centralized theme configuration. However, it would be useful to automatically enforce the intended use of these features throughout an application.
The goal is to prevent unintentional design-system deviations, particularly in larger projects and applications developed with AI coding assistants.
Problem
It's easy to bypass Nuxt UI's design system by applying raw Tailwind utilities directly to components.
For example:
Instead, an application might expect developers to use semantic properties and utilities:
Both approaches are valid, but the first can bypass the application's theme configuration.
Currently, enforcing these conventions largely depends on documentation, code reviews and developer discipline.
Proposed solution
Provide optional linting support for Nuxt UI's existing design-system conventions.
Ideally, this would include:
Semantic token enforcement: Detect raw Tailwind palette colors and arbitrary values where an application requires semantic design tokens.
Component-aware linting: Recognize Nuxt UI components, including automatically imported components, and optionally flag styling that overrides their intended semantic properties.
Theme awareness: Where practical, recognize application-specific semantic colors, component variants and theme configuration rather than relying on hardcoded rules.
Configurable restrictions: Allow teams to configure permitted styling overrides, exceptions and rule severity. Legitimate use of
classanduishould remain supported.Vue SFC support: Handle static and statically analyzable dynamic classes in Vue templates, as well as Nuxt UI's slot-specific
uioverrides.Ideally, diagnostic messages would explain the violation and recommend an appropriate semantic token or component property when one can be determined reliably.
Potential implementation
Rather than building another general-purpose Tailwind linter, could Nuxt UI provide an integration with an existing tool such as @shadcn/lint?
That project already supports Vue, Tailwind CSS 4, configurable linting rules and component-specific styling contracts.
The missing piece is Nuxt UI-specific integration, particularly:
classanduioverrides.An initial implementation could be relatively small: an official configuration or adapter demonstrating semantic token enforcement and Nuxt UI component recognition.
This could subsequently be expanded if there's sufficient interest.
Related discussions
This request is specifically about providing automated enforcement for Nuxt UI's existing design-system conventions, rather than changing its component customization APIs.
Would the maintainers be open to an official integration, reference configuration or community-maintained adapter?
All reactions