Skip to content
This repository has been archived by the owner on Mar 25, 2021. It is now read-only.

Add support for complex matching to file-name-casing-rule #4284

Merged
merged 17 commits into from
Nov 22, 2018
Merged

Add support for complex matching to file-name-casing-rule #4284

merged 17 commits into from
Nov 22, 2018

Conversation

yordis
Copy link
Contributor

@yordis yordis commented Nov 12, 2018

fixes #4220. Fixes #4071

PR checklist

Overview of change:

Following #4220 we could pass a key-value pair where the key represents a regex that will be used
for matching against the names.

A little caveat, the regex is always a termination regex.

For example:

.component.tsx is actually .component.tsx$ (notice the $).

Allowing arbitrary Regex is a rabbit hole, at least this way we ware safe to remove the last part of the Regex from the string and be able to check the remaining name, since we do not want to check validate the regex section of the name.

Is there anything you'd like reviewers to focus on?

I am missing the correct options configuration, I am not sure what is the correct config.

CHANGELOG.md entry:

[enhancement] file-name-casing-rule supports regex expression for matching file

@palantirtech
Copy link
Member

Thanks for your interest in palantir/tslint, @yordis! 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.

src/rules/fileNameCasingRule.ts Outdated Show resolved Hide resolved
src/rules/fileNameCasingRule.ts Outdated Show resolved Hide resolved
@yordis
Copy link
Contributor Author

yordis commented Nov 12, 2018

Linter is failing related to an issue I encounter, to be honest, I tried to fix it but it seems that TypeScript is the issue.

I need help on that one.

Copy link
Contributor

@JoshuaKGoldberg JoshuaKGoldberg left a comment

Choose a reason for hiding this comment

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

The strict-boolean-expressions error seems spooky and mysterious at first glance... once my comments are addressed, if it's still there, I can take a longer look. Odd.

Thanks for sending this in!

src/rules/fileNameCasingRule.ts Show resolved Hide resolved
src/rules/fileNameCasingRule.ts Outdated Show resolved Hide resolved
src/rules/fileNameCasingRule.ts Outdated Show resolved Hide resolved
src/rules/fileNameCasingRule.ts Outdated Show resolved Hide resolved
src/rules/fileNameCasingRule.ts Outdated Show resolved Hide resolved
src/rules/fileNameCasingRule.ts Outdated Show resolved Hide resolved
src/rules/fileNameCasingRule.ts Outdated Show resolved Hide resolved
src/rules/fileNameCasingRule.ts Show resolved Hide resolved
@yordis
Copy link
Contributor Author

yordis commented Nov 12, 2018

@JoshuaKGoldberg finished the reviews except one that I need your response about it

Copy link
Contributor

@JoshuaKGoldberg JoshuaKGoldberg left a comment

Choose a reason for hiding this comment

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

Almost ready 😁

src/rules/fileNameCasingRule.ts Outdated Show resolved Hide resolved
src/rules/fileNameCasingRule.ts Show resolved Hide resolved
src/rules/fileNameCasingRule.ts Outdated Show resolved Hide resolved
@JoshuaKGoldberg
Copy link
Contributor

JoshuaKGoldberg commented Nov 12, 2018

Oh dear, I just realized there's already PR for this. Sorry @yordis, I didn't realize the linked #4220 is a duplicate of #4071. Funny how two PRs for about the same feature look so different.

I don't want to close this PR, in case the other doesn't goes in, but let's hold off on merging this in out of respect for @cheeZery having already sent one in.

src/rules/fileNameCasingRule.ts Outdated Show resolved Hide resolved
@JoshuaKGoldberg JoshuaKGoldberg merged commit a95d862 into palantir:master Nov 22, 2018
@yordis
Copy link
Contributor Author

yordis commented Nov 24, 2018

@JoshuaKGoldberg do you know how long it would take to get this feature released?

@JoshuaKGoldberg
Copy link
Contributor

Unfortunately no. The Palantir folks are looking into getting some to maintain TSLint full time and I don't have those rights.

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

Successfully merging this pull request may close these issues.

Improve file-name-casing rule [Feature Request] Support pattern matching for rule "file-name-casing"
3 participants