Skip to content

Commit bed3c12

Browse files
enkoclaude
andcommitted
fix(ci): Allow leading digit in kebab-case filename rule
The kebab-case Danger rule required the filename stem to start with a letter, so a legitimately kebab-cased, date-prefixed name like 2026-06-13-backend-review.md failed — and the rule's own suggestion was a no-op (it suggested the identical name). Kebab-case permits digit-led segments (dates, 2fa-setup, …); relax the stem regex to /^[a-z0-9]+(-[a-z0-9]+)*$/ and restore the original review filename. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent 20030ca commit bed3c12

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

packages/danger/src/rules/kebab-case-files.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@ import * as path from 'path';
22
import type { DangerRule } from '../types';
33
import { isExemptFile, isIgnoredPath } from '../utils';
44

5-
const KEBAB_CASE_STEM = /^[a-z][a-z0-9]*(-[a-z0-9]+)*$/;
5+
// Lowercase alphanumeric segments separated by single hyphens. A segment may
6+
// start with a digit so date-prefixed names (e.g. 2026-06-13-backend-review)
7+
// and names like 2fa-setup are valid kebab-case.
8+
const KEBAB_CASE_STEM = /^[a-z0-9]+(-[a-z0-9]+)*$/;
69

710
// Migration files use a "<timestamp>_<name>" pattern — strip the prefix before checking
811
const MIGRATION_PREFIX = /^\d+_/;

0 commit comments

Comments
 (0)