New rules suggestion to prevent common coding typos (length and constructor)
See original GitHub issueAs a non native english developper I lost a huge amount of time fixing the same typos again and again.
I fixed common constructor
typos using id-blacklist rule. It’s safe because who would ever use those IDs:
{
"id-blacklist" : ["error",
"contructor",
"contrutor",
"construtor",
"construcor",
"constuctor"
]
}
I also fixed length
typos using no-restricted-properties, It’s safe because what evil mind would ever use lenght
in any code?!
{
"no-restricted-properties" : ["error", {
property : "lenght"
}]
}
Could we have this directly within eslint-config-airbnb-base?
This could save the world a huge amount of time 😉
Related issue: https://github.com/eslint/eslint/issues/8940
PS: I’m pretty sure there is many other use cases, for example this related issue about propTypes
typos: https://github.com/yannickcr/eslint-plugin-react/issues/65 (and see also react/no-typos)
Issue Analytics
- State:
- Created 6 years ago
- Comments:5
Top Results From Across the Web
Secure Coding Guidelines for Java SE - Oracle
This web page contains Secure Coding Guidelines for the Java Programming Language. ... [3] provide many features to mitigate common programming mistakes.
Read more >Google C++ Style Guide
Style rules should pull their weight · Optimize for the reader, not the writer · Be consistent with existing code · Be consistent...
Read more >Top 10 Most Common C++ Mistakes That Developers Make
Common Mistake #1: Using “new” and ”delete” Pairs Incorrectly · Common Mistake #2: Forgotten Virtual Destructor · Common Mistake #3: Deleting an Array...
Read more >Java Software Errors: How to Avoid 50 Code Issues in Java
We've rounded up 50 of the most common Java software errors, complete with code examples and tutorials to help you work around common...
Read more >C++ Coding Standard
Prepending 'a' prevents any conflict with method names. Often your methods and attribute names will be similar, especially for accessors. Example. class ...
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
Non-English speakers are important too!
I do think that it’s not something we should add; but I’d love to see a core no-typos rule.
Instructive discussion… it’s maybe more a problem for non native english developers (I’m french).
We also use a lot of classes on non react projects.
We will keep those rules added to our own rules (inherited from airbnb).
I agree eslint-config-airbnb-base should be kept as simple as possible (for maintenance, etc.)
Feel free to close the issue, and thanks again for your time 😉