Page MenuHomePhabricator

eslint should not forbid Array.prototype.includes in databridge
Closed, ResolvedPublic



We seem to be inheriting the upstream Wikimedia eslint configuration for the no-restricted-syntax rule. This currently forbids some methods like Array.prototype.includes for browser compatibility reasons. That makes sense for mediawiki, but we are transforming/polyfilling our code and these methods should be allowed.

Options to resolve this problem are:
1: disable eslint for the offending syntax in our code
2: not checking 'no-restricted-syntax' rule
3: modifying 'no-restricted-syntax' rule locally
4: not extending 'wikimedia/language/es6'
5: changing upstream so that the extra rules for "es6+" are separate from
the rules for "nothing new than es6"

Since changing this upstream can be a longer process, option 5 cannot be
a solution right now. But I filed an issue upstream:

Option 1 might work in this instance, but I expect this to come up again
and again, since this is some pretty common syntax.

Option 3 would mean a lot of local config code that would need to keep
up with changes to the repo.

Option 4 would loose us some rules that we apparently would like to use.

This leaves Option 2. Since the 'no-restricted-syntax' option seems to
be only used for disallowing syntax for compatibility reasons by
Wikimedia, it should be fine to just not check it at all.


Related Gerrit Patches:
mediawiki/extensions/Wikibase : masterbridge: don't forbid es6 methods in eslint

Event Timeline

Michael created this task.Jul 5 2019, 11:32 AM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJul 5 2019, 11:32 AM

Change 520876 had a related patch set uploaded (by Michael Große; owner: Michael Große):
[mediawiki/extensions/Wikibase@master] bridge: don't forbid es6 methods in eslint

Michael claimed this task.Jul 5 2019, 12:14 PM
Michael updated the task description. (Show Details)
Restricted Application added a project: User-Michael. · View Herald TranscriptJul 5 2019, 12:14 PM

Change 520876 merged by jenkins-bot:
[mediawiki/extensions/Wikibase@master] bridge: don't forbid es6 methods in eslint

Michael moved this task from Peer Review to Done on the Wikidata-Bridge-Sprint-1 board.
Pablo-WMDE closed this task as Resolved.Jul 17 2019, 8:51 AM