pbakaus/impeccable · error

Unknown ignore-rule flag

Error message

Unknown ignore-rule flag: ${arg}

What it means

Thrown while parsing arguments for the `hooks ignore-rule` subcommand. The parser accepts only --all-values, --reason <text>, and --reason=<text>; any other token starting with `--` is rejected instead of being silently ignored or folded into the rule id. This is a deliberate guard: a typo'd flag used to be stored as part of the rule name and the command reported success while suppressing nothing.

Solutions

  1. Remove the unknown flag — ignore-rule supports only --all-values and --reason.
  2. If you meant --all-values (needed for overused-font), fix the spelling.
  3. If you meant to scope to files, switch subcommand: `hooks ignore-value <rule> <value> --file <glob>`.
  4. If you meant a scope flag, note ignore-rule writes to shared detector config only and has no --shared/--local.

Example fix

# before
impeccable hooks ignore-rule side-tab --local

# after
impeccable hooks ignore-rule side-tab
impeccable hooks ignore-value low-contrast "#eee" --file "src/legacy/**" --local
Defensive patterns

Strategy: validation

Validate before calling

const KNOWN = new Set(['--all-values', '--reason']);
function validateIgnoreRuleArgs(args) {
  const hasRule = args.some(a => !a.startsWith('--'));
  if (!hasRule) throw new Error('rule id required');
  for (const a of args) {
    if (a.startsWith('--') && !KNOWN.has(a) && !a.startsWith('--reason=')) {
      throw new Error(`unsupported flag ${a}; allowed: --all-values, --reason`);
    }
  }
}

Try / catch

try {
  addIgnoreRule(cwd, args);
} catch (err) {
  // Usage error: surface the message verbatim to the operator; do not retry.
  console.error(String(err.message));
  process.exit(2);
}

Prevention

When it happens

Trigger: `hooks ignore-rule side-tab --al-values` (typo for --all-values); `hooks ignore-rule side-tab --force` or `--silent` (flags that do not exist for this subcommand); `hooks ignore-rule side-tab --local` (scope flags are not supported for ignore-rule, unlike ignore-file/ignore-value); `--reason=text` variants of any misspelled reason flag.

Common situations: Muscle memory from the ignore-file/ignore-value subcommands carrying --shared/--local into ignore-rule; agents synthesizing plausible-looking flags; shell tab-completion inserting a wrong flag.

Related errors


AI-assisted analysis of pbakaus/impeccable@f88b2837a7 (2026-08-18). Data as JSON: /api/errors/e3f9f66488666323. Report an issue: GitHub.

Appendix: source

Thrown at skill/scripts/hook-admin.mjs:564

function normalizeRuleId(rule) {
  return String(rule || '').trim().toLowerCase();
}

function parseIgnoreRuleArgs(args) {
  const positionals = [];
  let allValues = false;

  for (let i = 0; i < args.length; i++) {
    const arg = String(args[i] || '');
    if (arg === '--all-values') {
      allValues = true;
    } else if (arg === '--reason') {
      while (i + 1 < args.length && !String(args[i + 1]).startsWith('--')) i++;
    } else if (arg.startsWith('--reason=')) {
      // Accepted for command symmetry; ignoreRules stores rule ids only.
    } else if (arg.startsWith('--')) {
      throw new Error(`Unknown ignore-rule flag: ${arg}`);
    } else {
      positionals.push(arg);
    }
  }

  return {
    rule: normalizeRuleId(positionals[0]),
    allValues,
  };
}

function addIgnoreRule(cwd, args) {
  const parsed = parseIgnoreRuleArgs(args);
  const rule = parsed.rule;
  if (!rule) throw new Error(`Pass a rule id, e.g. ${IMPECCABLE_COMMAND} hooks ignore-rule side-tab`);
  if (rule === 'overused-font' && !parsed.allValues) {
    throw new Error(`overused-font is value-specific by default. Use ${IMPECCABLE_COMMAND} hooks ignore-value overused-font <font> for a confirmed font, or ${IMPECCABLE_COMMAND} hooks ignore-rule overused-font --all-values only when the user asked to ignore overused fonts generally.`);
  }

View on GitHub (pinned to f88b2837a7)