wikimedia-gadgets/twinkle-starter

JavaScript parse error (scripts need to be valid ECMAScript 5): Parse error: Unterminated string literal in file 'MediaWiki:Gadget-Twinkle.js' on line 12

siddharthvp opened this issue · 4 comments

Caused by 28c846b. Needs to be looked into.

so I tried out this starter on idwiki, and encountered this issue.

My trick here is to prettify the built codes and use it there: https://id.wikipedia.org/wiki/MediaWiki:Gadget-TwinkleV3.js

Screenshot 2021-12-22 225020

and the mediawiki error message points to this line in the gadget

Screenshot 2021-12-22 225009

which apparently caused by this RegExp in orange-18n:

https://github.com/wikimedia-gadgets/orange-i18n/blob/2a13edf418cab7beb9efb5ca995bffb758dc101b/src/emitter.js#L13-L21

Upstream bug reports:

Also relevant is https://phabricator.wikimedia.org/T75714 since if that is solved, this issue will be resolved.

Belated note: https://phabricator.wikimedia.org/T298386 has been resolved, this should not be occurring now.

In case it does occur, there's also the option of using |requiresES6 in the gadget definition which disables the MW script validator altogether. JS in non-ES6 browsers is anyway not supported at all by MediaWiki now (T178356).