Commit graph

1531 commits

Author SHA1 Message Date
Stephen Niedzielski e284163014 Hygiene: use consistent ESLint severity syntax
Bug: T165036
Change-Id: I43a500fceb8179d30240dbec8ed56f8d4c7551e9
2018-03-21 10:45:09 +00:00
Stephen Niedzielski 2221055bc1 Hygiene: forbid lint warnings
Bug: T165036
Change-Id: I257b0e3ac410d8153161b55b7fec85bf28644795
2018-03-21 10:44:52 +00:00
Stephen Niedzielski 57762e0417 Hygiene: favor const
Bug: T165036
Change-Id: I17d374eaac6627ca6a8ba178862b2a9cff2538c0
2018-03-21 10:44:24 +00:00
jenkins-bot 875789adf2 Merge "Hygiene: replace var with let and const" 2018-03-21 10:41:34 +00:00
Timo Tijhof 7d70739b79 build: Remove redundant excludes from "eslint:sources" task
None of the exclude patterns were matching the included patterns,
as such they were no-ops.

Change-Id: I99fca4f6e2f6252c818a6fbb8588f6ba68dfe054
2018-03-20 17:23:31 -07:00
Timo Tijhof 0f08ac9a9c Tooling: Remove some redundant max-len patterns
- `///` is not used in any linted files.
  It is/was used in webpack dist, but those are not and should not
  be passed through ESLint.
- `QUnit` was presumably added prematurely on the assumption
  that overly long test names should not be broken over multiple
  lines. However, being strings, they are already ignored.
- `// (?!eslint..)` was redundant. Ignoring warnings from max-len
  about an eslint-disable line has no influence on the actual
  parsing of those lines by ESLint.

Follows-up 807100b.

Bug: T185295
Change-Id: I2be2492848190b53d45240b38a08784b4a370819
2018-03-20 17:23:14 -07:00
Stephen Niedzielski 0bee0906d4 Hygiene: replace var with let and const
eslint \
    --cache \
    --max-warnings 0 \
    --report-unused-disable-directives \
    --fix \
    src tests

Change-Id: I051275126ae7fa9affd16c2504017c0584f2d9c7
2018-03-20 14:14:02 -05:00
Stephen Niedzielski 422a02d61a Hygiene: remove unneeded renderer test setup
Change-Id: Id3e0a4af1f88c57c3ef141dac67a8b13643a2dcb
2018-03-20 09:27:08 -05:00
Stephen Niedzielski ece4670710 Hygiene: use arrow for anonymous functions
In some places, the arrow function seems more natural. This patch
approximates the following with manual amendments:

  find \
    -not \( \( -name node_modules -o -name .git -o -name vendor -o -name doc -o -name resources \) -prune \) \
    -iname \*.js|
  xargs -rd\\n sed -ri 's%function\s*(\([^)]*\))%\1 =>%g'

Files to focus on were identified with:

  rg -slg\!/resources/dist/ -g\!/i18n/ -g\!/doc/ 'this|self|arguments|bind|call|apply|new'|
  xargs -rd\\n git difftool -y

Bug: T165036
Change-Id: Ic66b6000b8fc000f9bfde39749f9cfa69924a13c
2018-03-20 09:27:08 -05:00
Stephen Niedzielski a67466acc0 Hygiene: replace obvious function methods
Replace easily identifiable object functions with method syntax:

  find \
    -not \( \( -name node_modules -o -name .git -o -name vendor -o -name doc -o -name resources \) -prune \) \
    -iname \*.js|
  xargs -rd\\n sed -ri 's%:\s*function\s*(\([^)]*\))%\1%g'

Bug: T165036
Change-Id: I90693ee99a6a36dff820dd5ae6f6000429763058
2018-03-20 09:27:07 -05:00
Stephen Niedzielski a2a743d775 Hygiene: use object shorthand where obvious
Approximately:

  find \
    -not \( \( -name node_modules -o -name .git -o -name vendor -o -name doc -o -name resources \) -prune \) \
    -iname \*.js|
  xargs -rd\\n sed -ri 's%(\b\S+\b)\s*:\s*\b\1\b%\1%g'

Bug: T165036
Change-Id: I48869dc93b66f908e070288eb2f035bb064993e3
2018-03-20 09:26:20 -05:00
Stephen Niedzielski 5872c8376d Fix: JSDoc Node.js file copy bug
Upgrade JSDoc from v3.4.3 to 3.5.5:
- v3.5.0 JSDoc can parse any JavaScript that is supported by Babel
  compiler.
- v3.5.1 fixes an incompatibility bug in Node.js < v5.10.0
- v3.5.5 fixes an incompatibility bug in Node.js v8.5.0

Prior to this change, object shorthand caused the following errors:

  jsdoc -c jsdoc.json
  fs.js:1979
    binding.copyFile(src, dest, flags);
            ^

  Error: EISDIR: illegal operation on a directory, copyfile '/home/stephen/dev/wmf/vagrant2/mediawiki/extensions/Popups/node_modules/jsdoc/templates/default/static/fonts/OpenSans-Bold-webfont.eot' -> 'doc/autogenerated/fonts'
      at Object.fs.copyFileSync (fs.js:1979:11)
      at /home/stephen/dev/wmf/vagrant2/mediawiki/extensions/Popups/node_modules/jsdoc/templates/default/publish.js:471:12
      at Array.forEach (<anonymous>)
      at Object.exports.publish (/home/stephen/dev/wmf/vagrant2/mediawiki/extensions/Popups/node_modules/jsdoc/templates/default/publish.js:468:17)
      at Object.module.exports.cli.generateDocs (/home/stephen/dev/wmf/vagrant2/mediawiki/extensions/Popups/node_modules/jsdoc/cli.js:430:39)
      at Object.module.exports.cli.processParseResults (/home/stephen/dev/wmf/vagrant2/mediawiki/extensions/Popups/node_modules/jsdoc/cli.js:383:20)
      at module.exports.cli.main (/home/stephen/dev/wmf/vagrant2/mediawiki/extensions/Popups/node_modules/jsdoc/cli.js:227:14)
      at Object.module.exports.cli.runCommand (/home/stephen/dev/wmf/vagrant2/mediawiki/extensions/Popups/node_modules/jsdoc/cli.js:180:5)
      at /home/stephen/dev/wmf/vagrant2/mediawiki/extensions/Popups/node_modules/jsdoc/jsdoc.js:103:9
      at Object.<anonymous> (/home/stephen/dev/wmf/vagrant2/mediawiki/extensions/Popups/node_modules/jsdoc/jsdoc.js:104:3)
      at Module._compile (module.js:662:30)
      at Object.Module._extensions..js (module.js:673:10)
      at Module.load (module.js:575:32)
      at tryModuleLoad (module.js:515:12)
      at Function.Module._load (module.js:507:3)
      at Function.Module.runMain (module.js:703:10)

https://github.com/jsdoc3/jsdoc/releases/tag/3.5.0
https://github.com/jsdoc3/jsdoc/releases/tag/3.5.1
https://github.com/jsdoc3/jsdoc/releases/tag/3.5.2
https://github.com/jsdoc3/jsdoc/releases/tag/3.5.3
https://github.com/jsdoc3/jsdoc/releases/tag/3.5.4
https://github.com/jsdoc3/jsdoc/releases/tag/3.5.5

Bug: T165036
Change-Id: Ic7a22b6992d45fa0ea3d011a9ad5200d7cc73b80
2018-03-20 09:24:06 -05:00
Stephen Niedzielski 3c3f162226 Fix: pin package versions to patch revision
CI doesn't use a version of NPM that reads package-lock files which
seems to break some build product diff checks.

Bug: T165036
Change-Id: I29383c1a5c1f7f102fe458ac778adc3bf264c9fd
2018-03-20 09:22:43 -05:00
Stephen Niedzielski 42816702eb Hygiene: replace Mustache templates w/ ES6 strings
Replace Mustache.js templates with template literals. An effort was made
to minimize additional refactoring, so feel free to ask for more but it
ain't coming in this PS.

Bug: T165036
Change-Id: I4a6a1d93a2922c3a9ef3ae93c47da17a35c644f0
2018-03-20 08:06:02 -05:00
Stephen Niedzielski e5df865d51 Hygiene: enable Babel transpilation
Enable the Babel transpiler so that ES6 template literals,
destructuring, and arrow functions can be used in production.
"last n versions" syntax was not used so that builds are more
reproducible.

Bug: T165036
Change-Id: I553b6d14cc368c7b4366f68d13038c3d505f5429
2018-03-20 07:59:14 -05:00
Stephen Niedzielski d35286a064 Update: upgrade to Webpack 4 & improve output size
Upgrade from Webpack v2.0.12 to v4.1.1. There have been many changes to
Webpack... Noticeable in the bundle size is that a number of files are
now inlined and generally minification is improved.

Changes related to the upgrade include:

- Remove unsupported UglifyJS options which link back to T188081. These
  appear to have been anticipatory but never acted on and it isn't clear
  whether they even worked or not.
- Pass the -p plag for production optimizations; pass the -d flag since
  production doesn't support watching.
- NamedModulesPlugin is now on by default but only in development mode
  so no change was made.
- Webpack command line client now must be installed separated and
  appears in package.json as webpack-cli.

https://github.com/webpack/webpack/releases/tag/v2.2.0
https://github.com/webpack/webpack/releases/tag/v2.2.1
https://github.com/webpack/webpack/releases/tag/v2.3.0
https://github.com/webpack/webpack/releases/tag/v2.3.1
https://github.com/webpack/webpack/releases/tag/v2.3.2
https://github.com/webpack/webpack/releases/tag/v2.3.3
https://github.com/webpack/webpack/releases/tag/v2.4.0
https://github.com/webpack/webpack/releases/tag/v2.4.1
https://github.com/webpack/webpack/releases/tag/v2.5.0
https://github.com/webpack/webpack/releases/tag/v2.5.1
https://github.com/webpack/webpack/releases/tag/v2.6.0
https://github.com/webpack/webpack/releases/tag/v2.6.1
https://github.com/webpack/webpack/releases/tag/v3.0.0
https://github.com/webpack/webpack/releases/tag/v3.1.0
https://github.com/webpack/webpack/releases/tag/v3.2.0
https://github.com/webpack/webpack/releases/tag/v3.3.0
https://github.com/webpack/webpack/releases/tag/v3.4.0
https://github.com/webpack/webpack/releases/tag/v3.4.1
https://github.com/webpack/webpack/releases/tag/v3.5.0
https://github.com/webpack/webpack/releases/tag/v3.5.1
https://github.com/webpack/webpack/releases/tag/v3.5.2
https://github.com/webpack/webpack/releases/tag/v3.5.3
https://github.com/webpack/webpack/releases/tag/v3.5.4
https://github.com/webpack/webpack/releases/tag/v3.5.5
https://github.com/webpack/webpack/releases/tag/v3.5.6
https://github.com/webpack/webpack/releases/tag/v3.6.0
https://github.com/webpack/webpack/releases/tag/v3.7.0
https://github.com/webpack/webpack/releases/tag/v3.7.1
https://github.com/webpack/webpack/releases/tag/v3.8.0
https://github.com/webpack/webpack/releases/tag/v3.8.1
https://github.com/webpack/webpack/releases/tag/v3.9.0
https://github.com/webpack/webpack/releases/tag/v3.9.1
https://github.com/webpack/webpack/releases/tag/v3.10.0
https://github.com/webpack/webpack/releases/tag/v3.11.0
https://github.com/webpack/webpack/releases/tag/v4.0.0
https://medium.com/webpack/webpack-4-released-today-6cdb994702d4
https://github.com/webpack/webpack/releases/tag/v4.0.1
https://github.com/webpack/webpack/releases/tag/v4.1.0
https://github.com/webpack/webpack/releases/tag/v4.1.1

Bug: T165036
Change-Id: Ic146e680d368fee7ee207b484460ce94f8bd7283
2018-03-20 07:55:37 -05:00
jenkins-bot c2bb43b552 Merge "Hygiene: add Webpack performance requirements" 2018-03-20 12:12:10 +00:00
jenkins-bot 7fac0b7870 Merge "Disambiguation icon should be regular mw-ui-icon size" 2018-03-19 22:38:12 +00:00
jdlrobson ef045be304 Disambiguation icon should be regular mw-ui-icon size
Bug: T168392
Change-Id: I54125fdf6649f33f5a1c797b618f558b9330b62c
2018-03-19 23:23:34 +01:00
Translation updater bot af412a909a Localisation updates from https://translatewiki.net.
Change-Id: I9d6a9b67c867664a2bf36a8496dd507024ea89c1
2018-03-19 22:19:50 +01:00
Stephen Niedzielski a836890788 Hygiene: add Webpack performance requirements
Webpack has some simple but useful options for specifying performance
limits. This patch enables asset and entry point (+ all dependencies)
filesize requirements for production builds. This helps us track
minified but uncompressed filesizes which are reported by
mw.loader.inspect() (including CSS).

https://webpack.js.org/configuration/performance/

Bug: T165036
Change-Id: I331ff34f50270be2912fd8cef5219cafc6957e80
2018-03-19 09:39:53 -05:00
jenkins-bot 7e21c42fea Merge "QA: Cleanup unnecessary test changes" 2018-03-16 17:15:18 +00:00
jdlrobson 695a7b6b58 QA: Cleanup unnecessary test changes
Various tweaks were made in Ibe212721807d3698dc45ef46b2dbde15ca9d2f70
to get the browser tests to pass. Many of them were unnecessary.

Change-Id: I47ac37512da38a33f4b3b919cc412b79231b0324
2018-03-16 09:53:04 -07:00
Translation updater bot 225aee5a32 Localisation updates from https://translatewiki.net.
Change-Id: I62a737c2d94e477667b1b69413c7c9fff46ac173
2018-03-15 22:52:16 +01:00
jenkins-bot 6cca20703d Merge "Hide package lock file from git diff" 2018-03-15 14:49:58 +00:00
Stephen Niedzielski 674ade83e7 Hygiene: move settings dialog to separate file
Separate the settings dialog and settings dialog renderer into two
files.

Bug: T165036
Change-Id: I500add4b89ec8c5d1a76d7c5572f62204d61f62d
2018-03-14 21:39:39 +00:00
Translation updater bot 47f0c45bbc Localisation updates from https://translatewiki.net.
Change-Id: I2933f942ff07cbcdb91d73ec2e9d383f9e9dd1d4
2018-03-14 22:23:51 +01:00
Stephen Niedzielski e26c12db52 Hygiene: move thumbnail code to separate file
Move thumbnail code from renderer to a separate file, thumbnail.

Bug: T165036
Change-Id: I6c55750ec302de6341e8e91dee34581ee66499d7
2018-03-14 14:19:41 -05:00
Stephen Niedzielski b8dfad87e8 Doc: add pokey mask documentation
Bug: T165036
Change-Id: Ib16cac249a49954b11b39bef2c1449552e3f1c01
2018-03-14 14:19:16 -05:00
jdlrobson 77ab060997 Hide package lock file from git diff
This helps with readability. Given its auto-generated it shouldn't
be necessary to scrutinise it during code review.

Change-Id: I0ae3bfef4f5fac399dd094398850ea7d73906045
2018-03-14 19:06:51 +00:00
Stephen Niedzielski 4eb9c0efa8 Hygiene: move SVG string to file
- Add SVG Inline Loader for Webpack. This allows SVG files to be
  imported.

- Update the Webpack and test configurations to use the new loader.

- Scope the ESLint rules down to just JavaScript files so that linting
  isn't attempted on the SVG.

Bug: T165036
Change-Id: I00bccff4c3167975c19d577be6343dcaca7ddb2d
2018-03-14 12:04:28 -07:00
jenkins-bot 9940b3719a Merge "Custom page preview for disambiguation pages" 2018-03-14 18:45:00 +00:00
jenkins-bot 02285d6ab2 Merge "Doc: add Mobile Content Service example; fix tabs" 2018-03-14 18:37:22 +00:00
Jan Drewniak 1e946a379d Custom page preview for disambiguation pages
Creating a different page preview for disambiguation pages.

This patch:
- modifies the Preview model to accept a new 'type' property
- modifies the Restbase Gateway to pass the 'type' prop to the Preview model
- creates a new template to accept both generic/disambig previews
- modifies the renderer to render the new template
- generates icons for new template through resource loader
- adds new i18n strings
- modifies event-logging "preview seen" event to send new "disambiguation" previewType
- updates event logging schema version
- adds tests for Preview model and renderer for new preview type
- does way too much? yes, yes it does.

Bug: T168392
Change-Id: Idc936cc3eabbdd99a3d98f43c66b4cdbb7d24917
2018-03-14 11:24:26 -07:00
Stephen Niedzielski 642cd3009e Doc: add Mobile Content Service example; fix tabs
Add example for developing with a local copy of the Mobile Content
Service. Also: make tabs consistent with the rest of the repo.

Change-Id: I4cfb562c18c12df828e84602d01514c8c3cc20e6
2018-03-14 11:39:54 -05:00
jdlrobson deaaf0961b Remove popups from critical rendering path
Instead load it via mw.loader.using

We retain the module name ext.popups as this will be present
in cached HTML, however now it will load the bulk of the code
inside ext.popups.main

Bug: T176211
Change-Id: Ibe212721807d3698dc45ef46b2dbde15ca9d2f70
2018-03-13 08:44:31 -07:00
Translation updater bot f43e1158a1 Localisation updates from https://translatewiki.net.
Change-Id: I0cbe0a1239f4f079d8bd045526c675e52f9390e9
2018-03-10 22:14:25 +01:00
libraryupgrader 8391f5cc71 build: Updating jakub-onderka/php-parallel-lint to 1.0.0
Change-Id: I0ebddbc9b6ef2cb2a78f5d8fbddb07488b4a6159
2018-03-10 02:25:40 +00:00
jenkins-bot e621fd196d Merge "Give summary a min-height to avoid overlap with gradient." 2018-03-09 19:38:55 +00:00
jdlrobson 3cd45bca2a Give summary a min-height to avoid overlap with gradient.
Bug: T188581
Change-Id: I5b6012b61577ead60dc0d0e87ebcad5042304104
2018-03-09 09:07:19 -08:00
jdlrobson f5f21a8d09 RESTBase url is configurable
Allow developers to use different endpoints for summaries
= developer happiness

This is useful for the following use cases:
* A developer wants to test against a production endpoint via
CORS
* A developer has setup an API where REST is hosted elsewhere
e.g. http://localhost:6927/en.wikipedia.org/v1/
* A user wants to create their own REST summary compatible
endpoint
* A wiki e.g. wikidata wants to use a different endpoint which is compatible
with the summary endpoint.

We are unlikely to use it ourselves on Wikimedia wikis (the
default should suffice) but this will be a powerful tool for

When not configured this will continue to work as per normal

Change-Id: I8a7e12fbc43cddbac678e0d7b81d1e877b747b22
2018-03-09 16:15:19 +00:00
jdlrobson ca440dfbed Remove client side formatters in Popups code base for MW API.
Stripping parentheticals were designed specifically for working around
issues with content inside wikimedia wikis and error prone.

This problem for wikimedia wikis is solved by the mobile content
service.

Given we have no intentions to use the MediaWiki API for summaries.
They are not necessarily useful to third parties and it makes little
sense to maintain them (a third party can configure their own API or
use their own REST endpoint if they really do need them).

Bug: T189042
Change-Id: I2729dc9f172af0afee1c6f0cd563c556b4ae0aeb
2018-03-08 21:05:49 +00:00
Stephen Niedzielski e9e3d59232 Hygiene: only report diff status
When the diff test fails, don't dump 40k characters to console. Just
report that the failure occurred.

Change-Id: I1cc31fcdebe3e1097ed9e80dfbe3fb6e0dfc34b2
2018-03-07 13:58:08 -06:00
Kunal Mehta e351fd1550 Use SPDX 3.0 license identifier
SPDX released version 3 of their license list (<https://spdx.org/licenses/>),
which changed the FSF licenses to explicitly end in -only or -or-later
instead of relying on an easy to miss + symbol.

Bug: T183858
Change-Id: If21be3dd6d81dbeb30911bbe3be29e20b55bf6da
2018-03-02 15:33:58 -08:00
jdlrobson 8e47b54796 Remove client side formatters in the REST formatter
These are now taken care of by the Mobile-Content-Service's
summary  endpoint and no longer needed here!

They are actually breaking certain previews so time for these
to go!

Bug: T183833
Change-Id: Icd2a21127c2f5881943564eca4df6bed3c15e223
2018-03-02 12:04:08 -08:00
Sam Smith 58ae3d01ea i13n: Clarify nature of timestamp property
Specifically, clarify why the timestamp property is merged into the data
bag that represents the event when it is.

Change-Id: I184de734e66490fc728a4f9c2f84bf0765aeed08
2018-02-28 18:06:14 +00:00
Translation updater bot 9899f10a2d Localisation updates from https://translatewiki.net.
Change-Id: Ia7a4e7cb6b9778410606fb38e66885f2c1e65d7d
2018-02-27 22:25:54 +01:00
Željko Filipin 541a42dd17 Update README file for Selenium tests
Bug: T187862
Change-Id: Ib62a6059e8048712617870d07746bee1ab92e371
2018-02-27 14:04:39 +01:00
Translation updater bot 308203f8b8 Localisation updates from https://translatewiki.net.
Change-Id: I1b2b4f8cc4958123f9961946166efcf19de1a00d
2018-02-26 22:20:46 +01:00
jdlrobson 535149c16c Upgrade schema and log the required fields
This change updates the schema and begins to log
additional information such as source_namespace, id
and title. This information is provided inside the
boot action.

Additional changes:
* Allow camel case in bundle artifact

Bug: T184793
Bug: T186728
Change-Id: I425ffecc018bef2958d0dfe957a40a065e3e6c56
2018-02-26 10:25:30 -08:00