-
Notifications
You must be signed in to change notification settings - Fork 889
Conversation
Thanks for your interest in palantir/tslint, @euclio! Before we can accept your pull request, you need to sign our contributor license agreement - just visit https://cla.palantir.com/ and follow the instructions. Once you sign, I'll automatically update this pull request. |
1721259
to
b8dc933
Compare
src/rules/fileNameCasingRule.ts
Outdated
|
||
const casing = this.ruleArguments[0] as Casing; | ||
|
||
let isCorrectCasing = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
refactor: make a private isCorrectCasing(fileName)
function that returns a boolean in each switch case instead of declaring a let
variable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
case Casing.KebabCase: | ||
return isKebabCased(fileName); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: blank line between function members.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
enum Casing { | ||
CamelCase = "camel-case", | ||
PascalCase = "pascal-case", | ||
KebabCase = "kebab-case", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤔 camelCase
, PascalCase
, kebab-case
? weird to write them all in kebab case. this comment is inspired by the error message:
File name must be camel-cased.
vs File name must be camelCased.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think i'm into the string matching the expected casing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can change the error message, but I think that the option names should stay kebab-cased for consistency with other rule options.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice
@giladgray Awesome, thanks! Could you go ahead and close #3434? Looks like it didn't close automatically. |
* add fileNameCasing rule * use camel case name for tslintCli * refactor casing check into helper function * use stylized name for casing in failure message
Getting
Version 5.10.0 |
@tommedema This lint hasn't been included in a release yet |
PR checklist
Overview of change:
Creates a new fileNameCasing rule that ensures consistent casing for all file names.
CHANGELOG.md entry:
[new-rule] file-name-casing