Page MenuHomePhabricator

Improve Wikimedia portals JS linting
Open, MediumPublicBUG REPORT


Currently, the Wikimedia portals ESlint configuration ignores the ./data directory. This leads to unnecessary inconsistencies in the code. Instead, that directory should be linted with the proper wikimedia/server configuration and the linting errors should be fixed.

Additionally, the src directory is linted with "env": { "browser": true } in src/.eslintrc.json even though it contains controller.js files which are processed with Node.js. The configuration should be updated to exclude these files instead of marking them with eslint-env node, es6 comments in each individual file.

Note: Files can potentially be fixed with the npm run lint:fix command.

Event Timeline

Change 1009785 had a related patch set uploaded (by Jdrewniak; author: Jdrewniak):

[wikimedia/portals@master] [WIP] Update JS linting rules

Jdrewniak triaged this task as Medium priority.

Hi @Punith.nyk would you like to work on this task? I started a Work in progress patch with an updated configuration:
There's a handy gerrit shortcut for pulling down someone else's patches
git review -d 1009785 .
You can then amend the patch and push updates to it.
I think most of the linting errors can be auto-fixed with npm run lint:fix but there might be some that need attention. If you want to push a patch but git commit --amend fails, you can add git commit --no-verify to skip the pre-commit hook.