DEV Community

Discussion on: One bite at a time - How to introduce new lint rules in a large codebase

Collapse
 
ashishsurana profile image
Ashish Surana • Edited

Great article, I have been there and done that, Now we have pipelines taking care of linting issues at least.
I have an opinion about auto fixable issues. For example: if we talk about let vs const which can be auto-fixed.
But in the case of objects, it might produce ambiguity in code readability.
if we are doing let a = {}; a.foo = "bar" (which is not a correct way to mutate objects but this can be found in codebase), eslint throws error and can be auto fixed to const a = {}. But this is wrong as the object is not a constant and we are changing the properties.

Collapse
 
christiankohler profile image
Christian Kohler

Thank you. I honestly don’t know all the edge cases of auto fixing and I agree that has to be used with caution.

Your example would be fine for me since const only checks if the reference changes (or if it is a primitive it would behave as you would expect and checks the value). I use const almost exclusively. But I guess that’s also personal style.