Rule proposal: `filename-case` Pascal case, ignore extensions or consider long extensions
See original GitHub issueCurrently with filename-case
it lints every part of the filename before the final extension. So if I select pascalCase
and write a file Button.test.ts
it will error because test
is not Test
. I personally prefer to see test
in lower case and Button
as Pascal case, but this is not currently possible with the rule options supplied.
It would be nice to either disable the rule to the right of the first .
or specify that part should be lowercase. Maybe a lint setting as unicorn/extension
as ‘long’ or ‘short’ would be a nice way to categorize which part of the filename to consider the name vs the extension.
What setting would process to for linting
long
: { name: ‘Button’, extension: ‘.test.ts’ }
short
: { name: ‘Button.test’, extension: ‘.ts’ }
Fail
Button.Test.tsx
Pass
Button.test.tsx
Issue Analytics
- State:
- Created 2 years ago
- Reactions:4
- Comments:6 (4 by maintainers)
Top Results From Across the Web
eslint-plugin-unicorn/filename-case.md at main - GitHub
This rule is enabled in the ✓ recommended config. Enforces all linted files to have their names in a certain case style and...
Read more >file-name-casing - Rule
Rule : file-name-casing. Enforces a consistent file naming convention. Rationale. Helps maintain a consistent style across a file hierarchy. Config.
Read more >LimagitoXI File Mover
This software offers quite a few features that make the program very flexible and useful for a variety of file management tasks as...
Read more >eslint-config-ash-nazg - npm
See index.js (and node.js for ash-nazg/node rules) for the rules we ... In ESLint 7 it is no longer necessary to pass the...
Read more >Issuehunt
Rule proposal : Improvement for filename-case rule #1745 ... main file extensions ( .ts and .spec.ts ) and each one use a different...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@fisker I think the rule should just ignore anything after the last two dots. There could be other patterns too, like
Foo.config.js
. We don’t want to have to manually maintain a list.Actually, maybe we can just make
Button.test.ts
allowed by default and see if anyone complains. I have never seen the formatButton.Foo.ts
used before. I think a secondary file extension is almost always used as a classifier.