How do you guys name your components?
Unanswered
Chartreux posted this in #help-forum
ChartreuxOP
I usually name my component files using PascalCase, but I’ve noticed that most code uses kebab-case. Using a different naming method won’t cause any specific issues later, right? Is there a convention for this? This got me overthinking
10 Replies
Asian black bear
Pascal case was popular in the last decade but there are tons of issues with case insensitive file systems.
When you commit a file and change the casing locally it's not necessarily reflected in the repo and will cause bespoke build errors.
This is why many devs have elected to go with kebab case ensuring there is no possiblity for issues caused by inconsistent casing.
I think I need to refactor my code
Asian black bear
If you do that you will pretty much experience the issues mentioned if you don't pay attention. For files with a single word such as
Foo.ts
you'll notice that renaming them to foo.ts
might not appear as a change. You will need to git rm
these to punch the cache and recommit them.@Asian black bear If you do that you will pretty much experience the issues mentioned if you don't pay attention. For files with a single word such as `Foo.ts` you'll notice that renaming them to `foo.ts` might not appear as a change. You will need to `git rm` these to punch the cache and recommit them.
ChartreuxOP
So it should be fine as long as I consistently use the same naming style and casing?
Asian black bear
Pascal case is okay as well for as long you know what you're doing.
It's just too easy to overlook accidental mistakes while renaming / chaging casing.
@Asian black bear It's just too easy to overlook accidental mistakes while renaming / chaging casing.
ChartreuxOP
yea, you're right