Docs/Rules/Quality Rules

Quality Rules

Rules that enforce code quality patterns and catch AI mistakes.

quality/import-aliases

Severity: block | Enforces @/ imports, blocks deep relative imports (4+ levels) and src/ imports.

quality/no-use-client-in-pages

Severity: block | Blocks "use client" directive in Next.js page.tsx and layout.tsx files.

quality/naming-conventions

Severity: block | PascalCase for component files, use prefix for hooks, no vague filenames (utils.ts, helpers.ts).

rules: {
  'quality/naming-conventions': {
    componentDirs: ['/components/', '/_components/'],
    hookDirs: ['/hooks/'],
    allowedVagueFiles: ['src/lib/utils.ts'],
  },
}

quality/no-deprecated-api

Severity: block | Detects deprecated APIs: cacheTime (use gcTime), getServerSideProps (use Server Components), React.FC.

quality/anti-patterns

Severity: warn | Catches AI mistakes. Enable features via preset or config:

rules: {
  'quality/anti-patterns': {
    blockCssFiles: true,      // No CSS/SCSS in Tailwind projects
    blockInlineStyles: true,  // No style={{}} in JSX
    blockConsoleLog: true,    // No console.log in production
  },
}

quality/no-console-log

Severity: warn | Detects console.log in production code. Skips test files and scripts by default.

quality/max-file-length

Severity: warn | Warns when source files exceed a configurable line limit (default: 400).

quality/file-structure

Severity: warn | Warns when components are outside /components/ or hooks outside /hooks/.

quality/hallucination-guard

Severity: warn | Verifies relative imports reference files that actually exist on disk.

quality/test-coverage

Severity: warn | Warns when creating source files with no corresponding .test or .spec file.

quality/dead-exports

Severity: warn | Detects exported symbols that are not imported by any nearby files.

quality/no-any-type

Severity: warn | Event: PreToolUse | Tools: Write

Warns about any type usage in TypeScript files: : any, as any, <any>. Skips .d.ts declaration files.

rules: {
  'quality/no-any-type': {
    allowInFiles: ['src/legacy/'],
  },
}

quality/error-handling

Severity: warn | Event: PreToolUse | Tools: Write

Warns about empty catch blocks and catch blocks that only contain console.log. Errors should be properly handled, not silently swallowed.

quality/a11y-jsx

Severity: warn | Event: PreToolUse | Tools: Write

Checks JSX/TSX for common accessibility issues: <img> without alt, <a href="#"> (use <button>), onClick on <div>/<span> without role attribute.

quality/magic-numbers

Severity: info | Event: PreToolUse | Tools: Write

Warns when 3+ magic numbers (numeric literals outside const declarations) appear in a file. Opt-in rule for stricter projects. Allows 0, 1, -1, 2, 100 by default.