saz-enforce
v2.2.0
Published
Enterprise React/Next.js code enforcement — ESLint, Tailwind, TypeScript configs + security scan, auto-fix, scoring, CI/CD, hooks by Muhammad Salman
Maintainers
Readme
saz-enforce
Enterprise code enforcement for React & Next.js — by Muhammad Salman
106 rules | security scanner | auto-fix | project scoring | watch mode | CI integration | zero runtime deps
Install & Init
npm install saz-enforce
npx saz initAlso works as npx saz-enforce init. Asks 8 questions and scaffolds everything:
| Question | Options |
|----------|---------|
| Team | Full Stack / Frontend / Backend |
| Framework | React / Next.js |
| Language | JavaScript / TypeScript |
| Typography | Standardized / Design Patterns / Both |
| Animations | No / Yes (opt-in via data-animate) |
| Kafka | No / Yes → if yes: backend ready or dev mode? |
| i18n | No / Yes (en + ar + RTL) |
| Theme | No / Event-based / Static multi / Both |
For existing projects:
npx saz audit # read-only compatibility report
npx saz baseline # freeze current violations for CICLI Commands
npx saz check # interactive audit
npx saz check --report # CI mode (no prompts)
npx saz check --fix-all # auto-fix all
npx saz check --baseline # only new violations
npx saz check --changed # only changed files
npx saz fix # auto-fix + ESLint + Prettier
npx saz watch # scan on save
npx saz security # security vulnerability scan
npx saz score # grade A+ to F across 10 categories
npx saz rules # list all 106 rules
npx saz arch # validate project architecture
npx saz hooks # install pre-commit hooks
npx saz ci --github # generate CI workflow
npx saz doctor # detect version drift
npx saz eject <target> # copy config as standalone file
npx saz info # show project configConfig Files
// .eslintrc.js (JS)
module.exports = require("saz-enforce/configs/eslint");
// .eslintrc.js (TS)
module.exports = require("saz-enforce/configs/eslint-ts");
// tailwind.config.js
module.exports = { presets: [require("saz-enforce/configs/tailwind")] };
// tsconfig.json
{ "extends": "saz-enforce/configs/tsconfig.json" }Auto-adapts to ESLint 8/9, TypeScript-ESLint v6/7/8, Tailwind v3/v4.
What's Enforced — 106 Rules
| Category | Rules | Examples |
|----------|-------|---------|
| Code Quality | 21 | No var, no debugger, strict equality, no magic numbers |
| Type Safety | 12 | No any, no as assertions, use ?? over \|\| |
| CSS / Tailwind | 7 | No inline styles, no raw colors, no !important |
| Security | 16 | No eval, no localStorage tokens, no dangerouslySetInnerHTML |
| React Patterns | 12 | No array index keys, no inline handlers, no nested components |
| Performance | 7 | No sync fs, no moment.js, no full lodash import |
| Accessibility | 9 | alt on images, labels on inputs, rem not px |
| Data Fetching | 5 | Use axios instance, no hardcoded URLs |
| Design Lint | 8 | No raw Tailwind colors, deprecated tokens, focus-visible |
| HTML5 Semantic | 10 | Use <dialog>, <nav>, <header>, <time> |
Optional Features
Design Patterns (Q3)
14-token typography scale, HSL colors, responsive breakpoints, lucide-react icons, landing page template.
Animations (Q4)
Opt-in via data-animate on <html>. 11 CSS keyframes + RevealSection, StaggerGrid, TiltCard components. Graceful degradation without framer-motion.
Kafka Queue (Q5)
createQueueThunk replaces createAsyncThunk for mutations. Queue lifecycle state, GlobalMessageBar UI, dev simulator, WebSocket placeholder for production. If your backend isn't Kafka-ready yet, choose dev mode — the simulator fakes queue events locally so you can build the frontend first.
BMAD Agents (Q6)
7 AI agents (Analyst, Architect, PM, Dev, QA, SM, UX) + MCP config for Claude Code/Cursor/Windsurf.
i18n (Q7)
i18next + react-i18next + RTL support. English + Arabic translations, LanguageSwitcher component, useFormattedDate hook.
Theme System (Q8)
Event-based (system preference auto-switch) and/or static multi-theme (5 themes: Light, Dark, Ocean, Forest, Sunset). ThemeProvider, useTheme, ThemeModeSwitcher, ThemeSwitcher.
Custom Rules & Overrides
// saz.rules.js — add project-specific rules
module.exports = [
{ id: "no-moment", description: "Use date-fns", severity: "error",
test: (line) => /\bmoment\s*\(/.test(line) },
];// saz.config.json — override severity
{ "rules": { "no-console": "off", "no-any": "warning" } }// saz-ignore sec-eval-usage
const x = eval(code); // suppress specific ruleCI Integration
npx saz ci --github # generate workflow
npx saz check --report # zero-tolerance (new projects)
npx saz check --baseline --report # incremental (existing projects)
npx saz check --report --max-warnings 10 # warning thresholdRequirements
- Node.js
>=16.0.0| Zero runtime deps - Skip postinstall:
SAZ_SKIP_POSTINSTALL=1 npm install
Author
Muhammad Salman — GitHub | npm
MIT License
