Skip to main content
New aislop v0.13.1 patch — calibrates hidden-fallback detection and fixes regex comment-masker false positives. Read the changelog →
ai-slop/unused-import auto-fixable

Unused import.

An import that no remaining code references. Usually left over after a refactor or a deletion the agent forgot to follow through on.

Flagged shape and clean shape.

Each example shows the exact code shape the rule is looking for, then the smallest version that keeps the intent without hiding risk or adding noise.

Flagged example
import { useEffect, useState, useMemo } from 'react'
import { formatDate } from '../utils/dates'

export function Counter() {
  const [count, setCount] = useState(0)
  return <button onClick={() => setCount(c => c + 1)}>{count}</button>
}
Why this trips

Deterministic AST match: flags imported bindings with zero references in the module.

Clean example
import { useState } from 'react'

export function Counter() {
  const [count, setCount] = useState(0)
  return <button onClick={() => setCount(c => c + 1)}>{count}</button>
}
What changed

Delete bindings that no code references. Keep side-effect imports and real re-exports, but make those explicit so the reader can tell the import has a purpose.

Agents add imports speculatively then refactor away the consumer; the import lingers because removing it requires re-reading the file end-to-end.

How this rule is justified.

Rule id

ai-slop/unused-import

Enforcing engine

ai-slop

Detector strategy

Deterministic AST match: flags imported bindings with zero references in the module.

Legitimate code that is NOT flagged

Side-effect imports, type-only imports that are referenced, and re-exported bindings are not flagged.

Evidence

Unused code appeared across unrelated projects in the first public scan batch.