Page MenuHomePhabricator

Review and update eslint rules configuration
Closed, ResolvedPublic3 Estimated Story Points

Description

Currently, the mwgate-node12-docker test includes a bunch of warnings from eslint. Example from recent merge of https://gerrit.wikimedia.org/r/c/mediawiki/extensions/GlobalWatchlist/+/698861

03:45:25 Running "eslint:all" (eslint) task
03:45:37 
03:45:37 /src/modules/Linker.js
03:45:37   18:1  warning  This line has a length of 103. Maximum allowed is 100  max-len
03:45:37   44:1  warning  This line has a length of 101. Maximum allowed is 100  max-len
03:45:37 
03:45:37 /src/modules/MultiSiteWrapper.js
03:45:37    8:1  warning  This line has a length of 106. Maximum allowed is 100  max-len
03:45:37   10:0  warning  The type 'GlobalWatchlistDebugger' is undefined        jsdoc/no-undefined-types
03:45:37   49:9  warning  Promise.all() is not supported in IE 11                compat/compat
03:45:37   68:9  warning  Promise is not supported in IE 11                      compat/compat
03:45:37 
03:45:37 /src/modules/SiteBase.js
03:45:37     7:0  warning  The type 'GlobalWatchlistDebugger' is undefined        jsdoc/no-undefined-types
03:45:37     8:0  warning  The type 'GlobalWatchlistLinker' is undefined          jsdoc/no-undefined-types
03:45:37    14:1  warning  This line has a length of 108. Maximum allowed is 100  max-len
03:45:37    90:9  warning  Promise is not supported in IE 11                      compat/compat
03:45:37   137:9  warning  Promise is not supported in IE 11                      compat/compat
03:45:37   216:9  warning  Promise is not supported in IE 11                      compat/compat
03:45:37   240:9  warning  Promise is not supported in IE 11                      compat/compat
03:45:37   274:9  warning  Promise is not supported in IE 11                      compat/compat
03:45:37   335:9  warning  Promise is not supported in IE 11                      compat/compat
03:45:37   353:9  warning  Promise is not supported in IE 11                      compat/compat
03:45:37 
03:45:37 /src/modules/SiteDisplay.js
03:45:37   14:0  warning  The type 'GlobalWatchlistDebugger' is undefined        jsdoc/no-undefined-types
03:45:37   15:0  warning  The type 'GlobalWatchlistLinker' is undefined          jsdoc/no-undefined-types
03:45:37   21:1  warning  This line has a length of 111. Maximum allowed is 100  max-len
03:45:37 
03:45:37 /src/modules/SiteVue.js
03:45:37   14:0  warning  The type 'GlobalWatchlistDebugger' is undefined        jsdoc/no-undefined-types
03:45:37   15:0  warning  The type 'GlobalWatchlistLinker' is undefined          jsdoc/no-undefined-types
03:45:37   21:1  warning  This line has a length of 107. Maximum allowed is 100  max-len
03:45:37 
03:45:37 /src/modules/SpecialGlobalWatchlist.display.js
03:45:37   106:10  warning  Promise is not supported in IE 11  compat/compat
03:45:37 
03:45:37 /src/modules/WikibaseHandler.js
03:45:37     9:0  warning  The type 'GlobalWatchlistDebugger' is undefined        jsdoc/no-undefined-types
03:45:37    90:1  warning  This line has a length of 118. Maximum allowed is 100  max-len
03:45:37    98:9  warning  Promise is not supported in IE 11                      compat/compat
03:45:37   129:1  warning  This line has a length of 148. Maximum allowed is 100  max-len
03:45:37   218:9  warning  Promise is not supported in IE 11                      compat/compat
03:45:37 
03:45:37 /src/modules/getSettings.error.js
03:45:37   4:1  warning  This line has a length of 106. Maximum allowed is 100  max-len
03:45:37 
03:45:37 /src/modules/getSettings.js
03:45:37   24:0  warning  The type 'GlobalWatchlistDebugger' is undefined  jsdoc/no-undefined-types
03:45:37 
03:45:37 /src/modules/vue/EntryRow.vue
03:45:37   88:13  warning  'v-html' directive can lead to XSS attack  vue/no-v-html
03:45:37   90:31  warning  'v-html' directive can lead to XSS attack  vue/no-v-html
03:45:37 
03:45:37 /src/modules/vue/SitesWithoutChanges.vue
03:45:37   13:1  warning  This line has a length of 110. Maximum allowed is 100  max-len
03:45:37   14:1  warning  This line has a length of 126. Maximum allowed is 100  max-len
03:45:37 
03:45:37 /src/modules/vue/SpecialGlobalWatchlist.vue
03:45:37   182:11  warning  Promise is not supported in IE 11  compat/compat
03:45:37 
03:45:37 /src/modules/vue/Toolbar.vue
03:45:37   31:1  warning  This line has a length of 130. Maximum allowed is 100  max-len
03:45:37 
03:45:37 /src/modules/watchlistUtils.js
03:45:37   100:1  warning  This line has a length of 101. Maximum allowed is 100  max-len
03:45:37   102:1  warning  This line has a length of 101. Maximum allowed is 100  max-len
03:45:37   107:1  warning  This line has a length of 103. Maximum allowed is 100  max-len
03:45:37   108:1  warning  This line has a length of 104. Maximum allowed is 100  max-len
03:45:37   112:0  warning  The type 'GlobalWatchlistLinker' is undefined          jsdoc/no-undefined-types
03:45:37   148:0  warning  The type 'GlobalWatchlistLinker' is undefined          jsdoc/no-undefined-types
03:45:37   173:0  warning  The type 'GlobalWatchlistLinker' is undefined          jsdoc/no-undefined-types
03:45:37   324:1  warning  This line has a length of 128. Maximum allowed is 100  max-len
03:45:37   324:0  warning  The type 'GlobalWatchlistLinker' is undefined          jsdoc/no-undefined-types
03:45:37 
03:45:37 ✖ 45 problems (0 errors, 45 warnings)

We should consider addressing these. Additionally, in .eslintrc.json a couple of rules are disabled that we should consider enabling.
I also realized that (as eslint correctly points out) Promise isn't always available, and while there is a polyfill for that in core, we aren't actually loading it.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript
DannyS712 renamed this task from Review eslint rules to Review and update eslint rules configuration.Jun 30 2021, 3:08 AM

Change 702176 had a related patch set uploaded (by DannyS712; author: DannyS712):

[mediawiki/extensions/GlobalWatchlist@master] Properly load polyfill for Promise, and update eslint rules

https://gerrit.wikimedia.org/r/702176

Change 702177 had a related patch set uploaded (by DannyS712; author: DannyS712):

[mediawiki/extensions/GlobalWatchlist@master] Enable and fix eslint jsdoc rules

https://gerrit.wikimedia.org/r/702177

Change 702176 merged by jenkins-bot:

[mediawiki/extensions/GlobalWatchlist@master] Properly load polyfill for Promise, and update eslint rules

https://gerrit.wikimedia.org/r/702176

Change 702177 merged by jenkins-bot:

[mediawiki/extensions/GlobalWatchlist@master] Enable and fix eslint jsdoc rules

https://gerrit.wikimedia.org/r/702177

Change 702184 had a related patch set uploaded (by DannyS712; author: DannyS712):

[mediawiki/extensions/GlobalWatchlist@master] Have eslint fail on warnings too, and fix existing warnings

https://gerrit.wikimedia.org/r/702184

DannyS712 set the point value for this task to 3.
DannyS712 moved this task from Unsorted to Awaiting review and deployment on the User-DannyS712 board.

Change 702184 merged by jenkins-bot:

[mediawiki/extensions/GlobalWatchlist@master] Have eslint fail on warnings too, and fix existing warnings

https://gerrit.wikimedia.org/r/702184

DannyS712 moved this task from In progress to Done on the MediaWiki-extensions-GlobalWatchlist board.
DannyS712 set Final Story Points to 4.