pbakaus/impeccable · error

Unknown ignore-file flag: ${arg}

Error message

Unknown ignore-file flag: ${arg}

What it means

parseIgnoreFileArgs() accepts exactly two flags: `--shared` and `--local` (plus the explicitly-rejected --reason handled by error 27). Any other `--` token is an unknown flag and is refused, so a typo cannot be absorbed into the stored glob.

Source

Thrown at plugin/skills/impeccable/scripts/hook-admin.mjs:603

  writeDetectorConfig(cwd, config);
  return `Added "${rule}" to detector.ignoreRules. Current: ${config.ignoreRules.join(', ')}`;
}

function parseIgnoreFileArgs(args) {
  const positionals = [];
  let shared = false;
  let local = false;

  for (const raw of args) {
    const arg = String(raw || '');
    if (arg === '--shared') {
      shared = true;
    } else if (arg === '--local') {
      local = true;
    } else if (arg === '--reason' || arg.startsWith('--reason=')) {
      throw new Error('--reason is not supported for ignore-file because detector.ignoreFiles stores globs only; use ignore-value when a documented rule-specific exception fits');
    } else if (arg.startsWith('--')) {
      throw new Error(`Unknown ignore-file flag: ${arg}`);
    } else {
      positionals.push(arg);
    }
  }

  if (shared && local) throw new Error('Pass only one scope flag: --shared or --local');
  if (positionals.length > 1) throw new Error('Pass exactly one glob to ignore-file');

  return {
    glob: positionals[0],
    local,
  };
}

function addIgnoreFile(cwd, args) {
  const parsed = parseIgnoreFileArgs(args);
  const glob = parsed.glob;
  if (!glob) throw new Error(`Pass a glob, e.g. ${IMPECCABLE_COMMAND} hooks ignore-file "src/legacy/**"`);

View on GitHub (pinned to d14711ae3d)

Solutions

  1. Use `--shared` (default, committed config) or `--local` (gitignored) for scope.
  2. Remove any unrelated flags.

Example fix

# before
impeccable hooks ignore-file "src/legacy/**" --global

# after
impeccable hooks ignore-file "src/legacy/**" --shared
Defensive patterns

Strategy: validation

Validate before calling

const IGNORE_FILE_FLAGS = new Set(['--shared', '--local', '--reason']);
for (const a of args) {
  if (String(a).startsWith('--') && !IGNORE_FILE_FLAGS.has(a) && !String(a).startsWith('--reason=')) {
    throw new Error(`Unknown ignore-file flag: ${a}`);
  }
}

Type guard

function isKnownIgnoreFileFlag(arg) {
  return arg === '--shared' || arg === '--local';
}

Prevention

When it happens

Trigger: Running `hooks ignore-file "<glob>"` with a flag like `--global` (meant to be `--shared`), `--all-values`, or any token not in {--shared, --local}.

Common situations: Guessing the scope flag name; mixing in flags from ignore-rule/ignore-value; stale documentation suggesting a flag that was renamed.

Related errors


AI-assisted analysis of pbakaus/impeccable@d14711ae3d (2026-08-13). Data as JSON: /api/errors/177804a8504a2e09. Report an issue: GitHub.