Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lint against non-kebab-cased enum values #548

Merged
merged 2 commits into from
Aug 31, 2023
Merged

lint against non-kebab-cased enum values #548

merged 2 commits into from
Aug 31, 2023

Conversation

bakkot
Copy link
Contributor

@bakkot bakkot commented Aug 30, 2023

Fixes #544.

continue;
}
const text = item.contents[0];
if (/[A-Z ]/.test(text.contents)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (/[A-Z ]/.test(text.contents)) {
if (!/^[\p{Ll}\d]+(?:-[\p{Ll}\d]+)*$/v.test(text.contents)) {

const location = offsetToLineAndColumn(algorithmSource, text.location.start.offset);
report({
ruleId,
message: 'enum values should be kebab-cased',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
message: 'enum values should be kebab-cased',
message: 'enum values should be lowercase and kebab-cased',

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait what? Doesn't kebab-case imply lowercase?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

THIS-IS-STILL-KEBAB

Copy link
Member

@michaelficarra michaelficarra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM otherwise

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

consider linting against camelCase enum values
2 participants