pbakaus/impeccable · error

Pass a rule id, e.g. ${IMPECCABLE_COMMAND} hooks ignore-rule

Error message

Pass a rule id, e.g. ${IMPECCABLE_COMMAND} hooks ignore-rule side-tab

What it means

addIgnoreRule() requires one positional argument: the rule id to add to detector.ignoreRules. normalizeRuleId trims and lowercases the first positional; if the result is empty the command throws with a concrete example. This stops a no-op invocation from reporting success with no rule added.

Source

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

    } 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.`);
  }
  const config = mergeDetectorConfig(readRawDetectorConfig(cwd));
  if (!config.ignoreRules.includes(rule)) config.ignoreRules.push(rule);
  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;

View on GitHub (pinned to d14711ae3d)

Solutions

  1. Provide a rule id, e.g. `hooks ignore-rule side-tab`.
  2. If automating, ensure the rule positional is non-empty before invoking the command.

Example fix

# before
impeccable hooks ignore-rule

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

Strategy: validation

Validate before calling

const rule = normalizeRuleId(positionals[0]);
if (!rule) {
  throw new Error('Pass a rule id, e.g. /impeccable hooks ignore-rule side-tab');
}

Type guard

function hasRuleId(positionalZero) {
  return typeof positionalZero === 'string' && positionalZero.trim() !== '';
}

Prevention

When it happens

Trigger: Running `hooks ignore-rule` with no positional at all, or with only flags (e.g. `hooks ignore-rule --all-values` and nothing else), so positionals[0] is undefined.

Common situations: Forgetting the rule id; expecting the flag to imply a rule; a script that builds the argv dynamically and drops the empty positional.

Related errors


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