简体   繁体   中英

ESlint rule for function names with TypeScript (camelCase with lower case for first letter)

Following these guidelines (and almost any other), function s and var names should use lowerCamelCase while Class (and c'tors) names should use UpperCamelCase.

I've looked for an ESLint rule to enforce this convention but the closest I've found is id-match which doesn't seem to distinguish between function , var , or class .

Is there a better rule? Should I be using the id-match rule along with new-cap rule? (feels dirty)

Unfortunately it seems like there is no better option at the moment...

Unfortunately, it looks like there wasn't enough interest from the team or community to implement this change. While we wish we'd be able to accommodate everyone's requests, we do need to prioritize. We've found that issues failing to reach accepted status after 21 days tend to never be accepted, and as such, we close those issues. This doesn't mean the idea isn't interesting or useful, just that it's not something the team can commit to. https://github.com/eslint/eslint/issues/10473

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM