Linting stroll
-
I decided to do something for my health today and took a linter to our codebase. The linter immediately uncovered a few unintended globals which is verygood. It also found a lot of missing semicolons. Just when I was about to feel relaxed enough and ready to do something useful instead of inserting semicolons, the linter directed me to this line:
var id = id
-
Oh. Only one line?
Recently I converted an application that contained this anti-pattern all over the place.Unfortunately, I can''t recall the instance.
This is probably a direct result of my current system status... I'll try to be quiet.
-
Recently I converted an application that contained this anti-pattern all over the place.
Did you uncover a 'rationale' for this pattern?
My curiosity went looking for the commit that introduced the line and this is what it looks like, slightly shortened:
function makeSomeId(id) { var somePrefix=getSomePrefix(id) - var idY = id - return somePrefix + idY; + var id = id + return somePrefix + id; }
So this line has a history of stupid.
-
-
When you frequently write code in a language which requires a separate linter, and you don't almost immediately try to use one, you have found tr<nbsp/>.
-
When you frequently write code in a language which requires a separate linter,
and you don't almost immediately try to use one,you have found tr<nbsp/>.
FTFY
-
While I agree with you there, we live in an unfortunate age where js is ubiquitous.
-
There's always Emscripten etc.
-
If I was doing web things, I'd be using either Clojure or TypeScript. But only because Silverlight is dead.
-
There's only 400 more missing semicolons to go. Where would I take my sense of accomplishment if not for this?