On Sun, Nov 29, 2015, at 08:40 PM, Andrew Halberstadt wrote:
> I believe |mach add-lint| is more or less what I'm proposing here. For
> every mach command, there is an underlying library that implements all
> the magic. Some sort of library has to hold the registry, micro-lints or
> not. This will be that library.
If people writing JS code never have to be aware of mozlint, then
indeed, I think we're golden. But if adding a JS linting rule means
learning a mozlint configuration file, or means that a lint error can
occur from a try run but wasn't found when the developer's editor ran
eslint, then not golden.
I'm on board for naive linters against languages where we don't have a
better solution as long as they are the only solution we provide for
that language/file type.
Feel free to skip everything below here if we're already golden:
My concern in general derives from developers in general already being a
bit FUDdy on linters and contributor fatigue from having to deal with
Mozilla-specific stuff that doesn't need to be Mozilla-specific. On
FxOS Gaia, we adopted jslint, then jshint, and are currently migrating
to eslint. A common attitude was that the earlier jslint/jshint lint
errors were nuisances, with most things just being syntactic nits or
otherwise harmless. This has led to instances of them being ignored,
with real fancy eslint errors on important security checks ignored and
checked into the tree via the expected failure mechanism.
> I think the effort/complexity of this proposal is being blown out of
> proportion. I already have a prototype with working micro-lints that run
> in parallel, and it's currently no more than 200 lines of code. In fact,
> the reason I'm tackling them first is *because* they are so easy to get
> going. (This is a spare time project, linting has nothing to do with any
> of my goals or deliverables).
I'm not concerned so much about the complexity of the implementation
itself so much as the cognitive burden of its existence for developers
and the possibility of "there's N ways to do X" when there really only
needs to be 1.
Especially if the naive implementation is fundamentally unsound but need
not be. For example, I expect JS template literals (which allow
embedding a series of JS expressions of arbitrary complexity and so
fundamentally exceed the capability of regular expressions to match)
would allow one to construct either false positives or false negatives
for any JS linter that does not include a full parse of the source file.
Given how easy eslint already makes it to avoid false positives/false
negatives in this case and that there are ways that we can make it extra
easy to configure eslint rules, introducing an unsound mechanism seems
inadvisable since it will contribute to an attitude that the linters can
and should be ignored.
In effect, I assert that allowing developers to add unnecessarily
unsound lints to the tree so that they can avoid learning eslint, the
dominant linter for JS (and therefore a useful thing to learn), creates
a tragedy of the commons that hurts everyone. If it's important to stop
people from using certain code idioms, it's important to do it in a
sound way that rules out known classes of false positives/negatives and
keeps people trusting the linters.
> It seems to me like we're both arguing for many of the same things. The
> only disagreement seems to be that you think micro-lints are worse than
> no micro-lints, while I think they're useful in addition to more
> intelligent ones.
Yes. But I do believe it's possible for extra tooling to be a hindrance
even when it is indeed an improvement in some regards. For example,
arguably the creation of the node-based
https://www.npmjs.com/package/mozilla-download when we already had
https://pypi.python.org/pypi/mozdownload was not helping things. I know
I certainly was frustrated when mozilla-download broke for me several
times and I had to investigate its implementation and provide fixes,
whereas presumably if we had been using the more aggressively supported
mozdownload I never would have encountered the problems or could have
poked an existing/active maintainer or the existing contributor-base.
Andrew