pbakaus/impeccable · error

Unknown ignore-rule flag: ${arg}

Error message

Unknown ignore-rule flag: ${arg}

What it means

parseIgnoreRuleArgs() accepts only two flags for `hooks ignore-rule`: `--all-values` and `--reason`/`--reason=` (the latter is accepted for command symmetry but stored nowhere, since ignoreRules holds rule ids only). Any other token beginning with `--` is treated as an unknown flag and rejected immediately, to stop a typo from folding silently into a stored value.

Source

Thrown at plugin/skills/impeccable/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 d14711ae3d)

Solutions

  1. Use exactly `--all-values` (full name) and/or `--reason [text]`.
  2. Remove flags that belong to other subcommands (--file, --shared, --local are not valid for ignore-rule).
  3. Re-read the accepted flag set: only --all-values and --reason.

Example fix

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

# after
impeccable hooks ignore-rule side-tab --all-values
Defensive patterns

Strategy: validation

Validate before calling

const IGNORE_RULE_FLAGS = new Set(['--all-values', '--reason']);
function validateIgnoreRuleArgs(args) {
  for (const a of args) {
    if (String(a).startsWith('--') && !IGNORE_RULE_FLAGS.has(a) && !String(a).startsWith('--reason=')) {
      throw new Error(`Unknown ignore-rule flag: ${a}`);
    }
  }
}

Type guard

function isKnownIgnoreRuleFlag(arg) {
  return arg === '--all-values' || arg === '--reason' || arg.startsWith('--reason=');
}

Prevention

When it happens

Trigger: Running `hooks ignore-rule <rule>` with an unrecognized flag such as `--all` (instead of `--all-values`), or a flag that belongs to a different subcommand like `--file`, `--shared`, or `--local`.

Common situations: Muscle memory from ignore-value/ignore-file flag sets; abbreviation mistakes (`--all` vs `--all-values`); copy-pasting a command from a different subcommand's help.

Related errors


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