DEV Community

Discussion on: How not to lint your code?

Collapse
 
qm3ster profile image
Mihail Malo

I must say, I wholly support the import/export rules, they make automatic imports, renames, and other tooling work so much better, as well as generally causing less diffs and consistent naming throughout a project.
I also begrudgingly agree with the sorting rules.

I am not convinced about "return-undefined" or even "noImplicitReturns" though.
Implicit returns in a void-returning function are a no-brainer, the body just ends and you're done. And having undefined written is just noise, that is what return means.

Personally I'd forbid return undefined in all positions, and return at the end of a function. Is there a way to do that?

Collapse
 
areknawo profile image
Arek Nawo

It's a good idea. Sadly, such a simple rule isn't present in TSLint and even ESLint. The closest thing I found is consistent-return from ESLint, but still, it's not exactly the right thing.