question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

New rules suggestion to prevent common coding typos (length and constructor)

See original GitHub issue

As 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:closed
  • Created 6 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
ljharbcommented, Jul 13, 2017

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.

0reactions
yvelecommented, Jul 13, 2017

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 😉

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found