Mainly auto fixes but also getting rid of some straight forward lint
warnings to reduce the wall of issues a bit when running the tests.
Also removing some rule exceptions that seem to got more relaxed
upstream.
Change-Id: Icb4d73374583675be74517e6df6508314d61e8c2
* Babel upgraded to a version that works with new Node's OpenSSL.
* Various loaders upgraded to match
* Babel config changed as plugin-proposal-private-property-in-object is now official
* Webpack config updated as noEmitOnErrors was renamed to not be a negation
* Webpack config updated as namedModules was renamed to the wider moduleIds
* Ignore the built Webpack output from eslint
Bug: T354943
Change-Id: I449f601b8218925d96bfb423fc0f349214d08385
This reverts commit a6a65204c6.
to restore custom preview types.
-- Changes since revert
The previous patch accidentally removed the syncUserSettings
changeListener. This has now been restored with several modifications:
* We have a migrate script which rewrites existing localStorage settings
to the new system
* The existing save functions are generalized.
The changes since this patch are captured in
Ia73467799a9b535f7a3cf7268727c9fab7af0d7e
-- More information
A new REGISTER_SETTING action replaces the BOOT action for
registering settings. This allows custom preview types to be
associated with a setting. They do this by adding the enabled
property to the module they provide to mw.popups.register
Every time the new action is called, we refresh the settings
dialog UI with the new settings.
Previously the settings dialog was hardcoded, but now it is generated
from the registered preview types by deriving associated messages
and checking they exist, so by default custom types will not show
up in the settings.
Benefits:
* This change empowers us to add a setting for Math previews to allow
them to be enabled or disabled.
* Allows us to separate references as its own module
Additional notes:
* The syncUserSettings.js changeListener is no longer needed as the logic
for this is handled inside the "userSettings" change listener in response to
the "settings" reducer which is responding to
SETTINGS_CHANGE and REGISTER_SETTING actions.
Upon merging:
* https://www.mediawiki.org/wiki/Extension:Popups#Extensibility will be
updated to detail how a setting can be registered.
Bug: T334261
Bug: T326692
Change-Id: Ie17d622870511ac9730fc9fa525698fc3aa0d5b6
Also restructure eslint config so that
* root files are linted with server rules
* src and tests share config
Change-Id: Ie4d0731ba9670af7f3e60cdfe3c4e331386b17c6
When the user sets a different language than the projects content
language, ReferencePreviews were rendered LTR. By using the bdi
tag this behavior is fixed.
Note that PagePreviews gets language and direction from the
TextExtracts response and use them to achive the same. The latter
is not straight forward available for ReferencePreviews so I'm
using bdi to achieve the same.
Bug: T345833
Change-Id: I6554e6e1db3aac06c04c9185500e05de238adde2
Dwell delay varies between popup type so should be part of the
definition. Since this is needed by reference tooltips we should
make this part of the Page preview model. This will allow us to
separate concerns of the architecture and reference tooltips
for better maintenance between WMDE and web team.
Bug: T326692
Change-Id: Ia021c8b90fd69d70c4b33744520bb963a65db036
I also removed the bool on the shouldUseReferencePopupsBetaFeature
method. It was always just used with `true`
Bug: T293072
Change-Id: I1a2d6f912fcac2ac77539581897e0feab489edf0
- check if the element has the function in it before using it
- implementing a native code to get the same result based on polyfill examples
- fix Coverage Block
Bug: T340081
Change-Id: I1c2ce46a88cde6323ab862964062dd722ff5edcb
For fetch and AbortController we provide native polyfills (see
resources/src/skip-web2017-polyfills.js) so safe to use this here.
This will be empty for modern browsers.
Change-Id: Ic0f55eb0a0276be3587a4b866834bddff1124ad2
Broken by If2b4073115d9082829e4917c87c167d18f5431d9
Change import to directly hit the Codex library
This should also allow web team to respond to Codex upgrades
at their own pace (via package.json)
Render functions must now be registered in storybook for
them to display. Follow up to
Iefe98c1f0422dbf034e385b1a41a859d030a2cf4
Change-Id: Iac9dede15f4de3a4d584f1e505e379764af6dcbf
The `webdriverio` package does not need to be an explicit dependency.
It is a dependency of `@wdio/cli`.
Bug: T325059
Change-Id: I9d72d936e763dde9bc6d21708bf03fd39ee32ba0
Allow extensions to register new types of previews via
extension attributes.
Changes:
- The check for reference previews doesn't make sense
as $('a[ href*="#" ]' ) will match any elements with a hash
fragment, so the additional check to Title.getFragment
will not provide a different result. This was introduced in
I9ec57e0fbb0d21beaaa7b359c1c2bef64d2c14f5
- Links that point to themselves are marked with mw-selflink
in MediaWiki so this can use the not selector we already have.
- The new API is used internally and only available via extension
Attributes
- An example is provided in SkinJSON
(https://github.com/jdlrobson/mediawiki-skins-skinjson/pull/14)
Bug: T233099
Change-Id: Iefe98c1f0422dbf034e385b1a41a859d030a2cf4
Updating 'svgo' to v2.8.0 and newest Wikimedia SVG guidelines –
mainly around new whitespace features of SVGO.
Change-Id: I37da089916d2efad696989427b0a06b392d1d89c
eslint:
* Remove hardcoded glob paths that are (relatively slow) to expand
before linting could start, in favour of specifying directories
which can be iterated while linting happens.
* JSON files in i18n/ were skipped, unlike other repos.
JS code under .storybook/ was skipped.
JS code under resources/ext.popups/ was skipped.
Fix all these by doing what other repos do, which is to let
ESLint iterate the repository and tell it which directories not to
enter. This has the happy side-effect of making IDE integrations
for ESLint work correctly (as customisation in package.json has the
same problems as using Gruntfile, namely that invoking 'eslint'
directly can't be aware of this), as well as allowing things like
`eslint --fix` to be used.
```
/Popups/resources/ext.popups/index.js
4:2 error Unexpected var, use let or const instead no-var
```
nyc:
* Remove SPAWN_WRAP_SHIM_ROOT.
This was a hack for an early CI experiment that hasn't been
needed for several years.
storybook:
* Remove gitignore entries for additional npm and build output in the
storybook subdirectory, which appears to not exist anymore since
189b386a13.
Doxygen:
* Sync with cookiecutter example from
https://gerrit.wikimedia.org/g/mediawiki/tools/cookiecutter-library/+/HEAD/
- remove redundant stuff,
- enable quiet mode to hide verbose non-warning,
- include CoC.
Change-Id: If8f6b833067192aea96a87f04c7978c9af11f996
The npm "test" script runs, among other things
* npm -s run -s doc
* npm run build-storybook
since the doc script is
`jsdoc -c jsdoc.json && npm run build-storybook`
this results in building the storybook output twice. Remove
it from the "test" script.
Also, remove duplicate -s
Change-Id: Iee54e0c8455b752efc714c1fb1487b030ba007a1
This removes the webpack.config.js file, moving the webpack config
into main.js, which replaces config.js.
- Moves the global jQuery into the webpack config in main.js.
- Removes the outdates .nvmrc file in the webpack folder.
- Moves the mockMediaWiki initialization from config.js into
index.stories.js
- Upgrades webpack to 4.22.2
Bug: T271763
Change-Id: Ie008d69e992625113ae98d52ad6d37186eb933de
Removes the following add-ons and their configuration from Storybook:
- addon-cssresources
- addon-knobs
- addon-options
This will hopefully ease the upgrade to Storybook 6.
Removes the custom CSS grid used to position previews within the Storybook
instance in favour of a flexbox layout. This simplifies the creation
of previews for Storybook.
This change requires us to to add relative positioning to
`.mwe-popups-container` so that the footer is correctly positioned in the
popup without absolute positioning. This positioning has been moved to
be Storybook specific to avoid an regressions in production.
Bug: T271763
Change-Id: I9a97291cb4bca7d4cc60dad232a60f6f92c0adea
These numbers haven't been updated for some time now due to the many
recent changes in the code. Since we're wrapping things up I guess
it makes sense to have them accurate again.
Change-Id: I73c202a65192e8011acefd664bea7b62b1b556da