@exxatdesignux/eslint-plugin
v0.1.0
Published
Exxat DS — ESLint flat-config plugin. Enforces token discipline (no hex / no deprecated tokens), no-toast, and no SLDS / Lightning leakage.
Downloads
23
Maintainers
Readme
@exxatdesignux/eslint-plugin
Flat-config ESLint plugin enforcing Exxat DS conventions:
- Token discipline (no hex literals, no deprecated tokens, hooks-index aware)
- No transient toast feedback (
sonneris gated behind the canonicalcomponents/ui/sonner.tsxshim — see.cursor/rules/exxat-no-toast.mdc) - No SLDS / Lightning cross-pollination (
.cursor/rules/exxat-no-slds-leakage.mdc)
The package is published to npm so consumers of @exxatdesignux/ui outside
this repo can install the same guardrails.
Install
pnpm add -D @exxatdesignux/eslint-pluginThe plugin reads tokens/hooks-index.json from @exxatdesignux/ui. If you
install the design system, the plugin will resolve the index automatically.
Inside this monorepo it resolves via the workspace alias.
Use (ESLint flat config)
// eslint.config.mjs
import exxatDs from "@exxatdesignux/eslint-plugin"
export default [
// …your existing TS/Next configs…
{
files: ["app/**/*.{ts,tsx}", "components/**/*.{ts,tsx}", "lib/**/*.{ts,tsx}"],
plugins: { "exxat-ds": exxatDs },
rules: {
"exxat-ds/no-hex-color": ["warn", {
// Paths where hex is legitimate (CSS-variable definitions, OS theme-color
// meta, fallback shims). Match by substring.
allowFiles: ["/app/globals.css", "/packages/ui/src/globals.css", "/lib/theme-color"],
}],
"exxat-ds/no-deprecated-tokens": "error",
"exxat-ds/no-sonner-toast": "error",
"exxat-ds/no-slds-classes": "error",
"exxat-ds/no-lightning-elements": "error",
},
},
]Rules
| Rule | What it catches | Authoritative doc |
|---|---|---|
| exxat-ds/no-hex-color | #rgb / #rrggbb in JSX className, inline style, cn() / clsx() arguments, Tailwind arbitrary brackets like bg-[#f00] | .cursor/rules/exxat-token-discipline.mdc |
| exxat-ds/no-deprecated-tokens | Any token name or Tailwind utility marked "deprecated": true in @exxatdesignux/ui tokens/hooks-index.json | apps/web/docs/migrations/, .cursor/rules/exxat-token-discipline.mdc |
| exxat-ds/no-sonner-toast | toast() calls + import { toast } from "sonner" outside the canonical components/ui/sonner.tsx shim | .cursor/rules/exxat-no-toast.mdc |
| exxat-ds/no-slds-classes | slds-* class names anywhere in JSX | .cursor/rules/exxat-no-slds-leakage.mdc |
| exxat-ds/no-lightning-elements | <lightning-*> JSX tags + imports from lwc, lightning/*, lightning-base-components, @lwc/synthetic-shadow, @salesforce-ux/* | .cursor/rules/exxat-no-slds-leakage.mdc |
How no-deprecated-tokens stays current
The rule reads @exxatdesignux/ui tokens/hooks-index.json at lint time.
Whenever you deprecate a token in packages/ui/src/globals.css (with
/* @deprecated vX.Y.Z — … */), run:
pnpm --filter @exxatdesignux/ui tokens:indexThe next eslint run picks up the new entry automatically. CI should run
pnpm --filter @exxatdesignux/ui tokens:check so a stale index fails the
build.
Authoring new rules
- Add the rule function next to the existing ones in
index.mjs. - Register it under
plugin.rules[...]. - Document it in this README + the
.cursor/rules/rule that the lint enforces. - Wire it into the consumer's
eslint.config.mjs.
ESLint rule API reference: https://eslint.org/docs/latest/extend/custom-rules.
Versioning
0.1.0— initial release. Rules:no-hex-color,no-deprecated-tokens,no-sonner-toast,no-slds-classes,no-lightning-elements.
