Fix JS on MusicBrainz to follow the "one true brace style"
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 brace-style 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 'brace-style: [warn, 1tbs]' 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.
The errors here can be mostly fixed by passing the --fix
option to check_eslint_rule
, that is:
./script/check_eslint_rule 'brace-style: [warn, 1tbs]' root/ --fix
Doing this is not sufficient to finish the task, though, since the automatic fix breaks other ESLint rules (like indent). You will have to review the automatic fixes to ensure they are otherwise compliant with our ESLint rules. The easiest way is by using an IDE that supports ESLint directly or through a plugin, such as VS Code, IntelliJ, or Eclipse, or you can just fix the errors manually.
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).