Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/guidelines.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ Feature authors should (in descending order of priority):

A feature's identifier is the feature's filename before the `.yml` extension.

Feature identifiers must contain only lowercase alphanumeric characters (a-z and 0-9) plus the `-` character (hyphen or minus sign) as a word separator.
Feature identifiers must start with a lowercase alphabetic character (a-z) and contain only lowercase alphanumeric characters (a-z and 0-9) plus the `-` character (hyphen or minus sign) as a word separator.

The identifier should match the name, with these additional guidelines:

Expand Down
5 changes: 3 additions & 2 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ const descriptionMaxLength = 300;
// of a draft directory doesn't work.
const draft = Symbol('draft');

const identifierPattern = /^[a-z0-9-]*$/;
// This must match the definition in docs/guidelines.md
const identifierPattern = /^[a-z][a-z0-9]*(-[a-z0-9]+)*$/;

function* yamlEntries(root: string): Generator<[string, any]> {
const filePaths = new fdir()
Expand All @@ -39,7 +40,7 @@ function* yamlEntries(root: string): Generator<[string, any]> {
const { name: key } = path.parse(fp);

if (!identifierPattern.test(key)) {
throw new Error(`${key} is not a valid identifier (must be lowercase a-z, 0-9, and hyphens)`);
throw new Error(`${key} is not a valid identifier (see guidelines)`);
}

const data = YAML.parse(fs.readFileSync(fp, { encoding: 'utf-8'}));
Expand Down