eslint-plugin-theme-guardrails
v0.1.0
Published
ESLint rules enforcing MUI theme compliance -- ban hardcoded colors, fontWeight, and fontFamily
Maintainers
Readme
eslint-plugin-theme-guardrails
ESLint rules enforcing MUI theme compliance -- ban hardcoded colors, fontWeight, and fontFamily.
What it catches
- Hardcoded hex colors (
color: "#ff0000") -- usetheme.palette.*instead - Hardcoded fontWeight (
fontWeight: 700) -- usetheme.typography.fontWeightBoldetc. - Hardcoded fontFamily (
fontFamily: "Arial") -- usetheme.typography.fontFamily
Files under /theme/ directories and themeConfig files are automatically excluded.
Install
npm install eslint-plugin-theme-guardrails --save-devUsage (flat config)
// eslint.config.mjs
import themeGuardrails from "eslint-plugin-theme-guardrails";
export default [
themeGuardrails.configs.recommended,
// ... your other configs
];Rules
| Rule | Description |
| --- | --- |
| theme-guardrails/no-hardcoded-styles | Disallow hardcoded colors, fontWeight numbers, and fontFamily strings |
License
MIT
