New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rule camelcase cannot detect between upper-camelcase and lower-camelcase when lint property
.
#10473
Comments
property
.property
.
Can |
@platinumazure I'm sorry that I've reply to wrong thread just now. Actually |
|
Or should I turn to concentrate on fix |
No, I was only asking if it could work for your use case. Let's see what the rest of the team thinks. |
Thanks, I've tried that. Only if:
It could work for my use case. |
My understanding is that capital letters at the start of a name are conventionally used for constructor functions, whereas lowercase letters are conventionally used for almost everything else. If this option were implemented, do you think you would use lower-camelcase letters for constructor names? To me, it seems like the problem is that ESLint is allowing upper-camelcase names for non-constructor-function values, not that it's allowing upper-camelcase names in general. (Unfortunately, the former problem probably wouldn't be fixable due to dynamic typing.) |
@not-an-aardvark Yes, just like what you said, upper-camelcase means it is a constructor. // We usually use constructor like this:
import ClassA from 'class-a';
const a = new ClassA();
// Hardly ever seen this:
// obj is defined somewhere
const a = obj.ClassA(); So we want to lint object properties name in lower-camelcase. Thanks a lot for reply. |
It seems that I should stop thinking about modify rule |
Hi everyone, I'v forked and made some improvements for rule Thanks everyone for keeping focus on this issue, here's my new PR: #10477 |
Sorry that I got busy on my work and had a cold last week. I'm working on it now. @mcclowes |
New PR created, I don't know if there will be a conflict. If there is, I'll do a git rebase job. @mcclowes |
Unfortunately, it looks like there wasn't enough interest from the team Thanks for contributing to ESLint and we appreciate your understanding. |
What rule do you want to change?
camelcase
Does this change cause the rule to produce more or fewer warnings?
More warnings.
How will the change be implemented? (New option, new default behavior, etc.)?
New options.
Please provide some example code that this change will affect:
This is bad code example.
This is good code example.
What does the rule currently do for this code?
All will be ok. The rule currently do not detect what type of camelcase is using for
property
.What will the rule do after it's changed?
There will be an option to configure upper-camelcase or lower-camelcase for
property
.What's more
I'm willing to fork and make a PR if my idea is acceptable. 😃
https://github.com/tinymins/eslint/tree/properties-style
The text was updated successfully, but these errors were encountered: