loeffel-io / ls-lint

An extremely fast directory and filename linter - Bring some structure to your project filesystem

Home Page:https://ls-lint.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Acronyms in PascalCase

jfairley opened this issue · comments

I'm applying ls-lint to more of our existing repositories, and I'm at an impasse with files that have acronyms in the name. The PascalCase walker isn't happy with consecutive capital letters, at least more than 2; I see you already have a special case accounted for, citing SsrVFor.ts.

In my case, I have files with SEO in the name. Consider a file like ManualSEO.tsx. I know I can lowercase eo, but it IMO, ManualSeo.tsx doesn't look correct. A similar argument could be made for files named with HTML or PDF.

In my opinion, considering acronyms, there really shouldn't be a rule stating that there be a limit to the number of consecutive capital letters.

I really would submit a PR, but I don't know go. 😅

But if I could figure out relative imports, what I would suggest is rather than walking the file name, import rule_regex.Validate and give it /([A-Z][a-z]*[0-9]*)+/. This pattern would allow for "multi-letter words" like Manual as well as "single-letter words" like S, E, and O as well as numbers, which seem to be already allowed as long as they don't come first... Although, the regex match is only one line, so maybe it's just easier to copy it.