What it does
Why AI tools generate this pattern
Code Examples
✕ Incorrect (Flagged by AI Guard)
// Bad example✓ Correct (Safe & Deterministic)
// Good exampleHow to Fix
- Follow the good example above and handle or avoid the flagged pattern appropriately.
Nuances & False Positive Prevention
Legitimate usage can be exempted with inline disable comments (// ai-guard-disable-next-line no-dead-branch) when appropriate.
Configuration
Enable or override this rule in your ESLint configuration:
eslint.config.mjs
// eslint.config.mjs
export default [
{
plugins: { 'ai-guard': aiGuard },
rules: {
'ai-guard/no-dead-branch': 'warn', // or 'error' or 'off'
},
},
];