MetaBrainz Foundation

Change negated conditions in the JS on MusicBrainz that have an "else" branch, by inverting them

We use a tool called ESLint to find problems in our JavaScript code and ensure it has a consistent style. ESLint is configured to use "rules" which each check for a different problem in the code.

This task requires you to fix all problems detected by the no-negated-condition ESLint rule.

To invoke this rule and find a list of such problems, you must first navigate to the git checkout of musicbrainz-server in your terminal, and run:

./script/check_eslint_rule 'no-negated-condition: warn' root/

The output will tell you which files it detected problems in, including line numbers, alongside a description of the actual issue on each line.

For this task, you'll need to ensure negated conditions with an else branch, as in if (!a) { b(); } else { a(); } or !a ? b() : a(), are inverted (swapping the contents of the then/else branches) so that the condition isn't negated, making them more readable.

To complete the task, submit a pull request to our GitHub repository with a proper description mentioning the specific rule, and respond to any suggestions and requests by the MusicBrainz developers until the pull request is approved (you do not need to wait until it gets merged).

Task tags

  • musicbrainz
  • javascript
  • eslint

Students who completed this task

jbs1

Task type

  • code Code
close

2019