Skip to content

Fix bugs pointed out by ESlint

Florian Müllner requested to merge wip/fmuellner/minor-bug-fixes into master

Inspired by gjs, I've added an eslint CI job to polari and gnome-shell-extensions. It helps catching trivial bugs (like typos in variable names that are easy to overlook) and frees the reviewer from dealing with basic coding style issues.

That would clearly be useful for gnome-shell as well, although it'll take a bit of work to get there, both due to the big code base, and because neither of the existing approaches is a good fit (I think):

  • gjs runs eslint against both master and the MR branch and compares the result

    This approach means that CI guards against new issues being introduced, while allowing for existing issues to be fixed gradually. It does have a considerable downside though: In order to be comparable, the CI script strips all line information from the error report, which makes addressing the issues quite paintful for the MR author

  • polari/g-s-e were updated to pass eslint without errors before adding the CI job

    Neat, but only really practical for smaller code bases.

I have an idea for checking only line additions in a MR request1, but with the upcoming freezes, now isn't the best time to work on it.

In the meantime, it's still useful to address some of the issues being pointed out, be it because they are genuine bugs, or because the changes are (relatively) unintrusive.

So this is merely a first batch of patches, but it's the most relevant, as it fixes actual bugs rather than style issues.

  1. with the caveat that we'd miss some errors, like removing all uses of a variable but forgetting to remove the declaration

Merge request reports