CAMEL_CASE matching pattern exception case
yfhui opened this issue · comments
Describe the bug
For file name like g2tClass
, current CAMEL_CASE that cannot support very well
Expected behavior
Current if the 2nd char of the file is a number, then no matter what pattern it is, it cannot be recongized as CAMEL_CASE.
I have tried g2tClass.js
g2TClass.js
and G2TClass.js
, all of them failed the CAMCL_CASE, and I expect either g2tClass.js
g2TClass.js
can pass the case
Plugin configuration
"check-file/filename-naming-convention": ["error", {
"/classes/": "CAMEL_CASE",
}],
Project structure
If applicable, add a minimal reproducible project structure generated by the tree
cmd like the one below.
.
├── create_folder_file.sh
├── classes
│ ├── classes
│ └── g2tClass.js
├── package-lock.json
├── package.json
└── src
└── kebab-case
└── index.js
Desktop (please complete the following information):
Linux
Additional context
Correct me if this is my mistake
I checked the source code and the pattern for CAMEL_CASE is +([a-z])*([A-Z]*([a-z0-9]))
, seems it's behvaior matches with my observation. If the 2nd character is a number, then it will fail the case
@yfhui Thanks for your issue. Your guess is correct, the current pattern of CAMEL_CASE only allow the first word made from a-z. I also agree with g2tClass
is a valid camelCase style expression, I will release a new version to fix this bug.
thx a lot for your quick response! looking forward for the fix!
solved!