mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/MinervaNeue
synced 2024-11-27 15:40:15 +00:00
Curtail use of mw.mobileFrontend in Minerva
The MobileFrontend dependency in Minerva is problematic. Code that Minerva needs should live in core. MobileFrontend should load code on all skins when they operate on a mobile domain. This eslint check reminds developers of this in a hope it encourages more upstreaming to core when possible. Of course disabling is also an option, but this check will at least make us aware of when we are moving further away from the goal. Change-Id: I62183c9aefc81053e4ad81fb746decef2dd24b44
This commit is contained in:
parent
d0be74ac0f
commit
ef5003f310
|
@ -15,6 +15,10 @@
|
|||
"rules": {
|
||||
"no-restricted-properties": [
|
||||
"error",
|
||||
{
|
||||
"property": "mobileFrontend",
|
||||
"message": "Minerva should only make use of core code. Any code using mobileFrontend should be placed inside the MobileFrontend extension"
|
||||
},
|
||||
{
|
||||
"property": "define",
|
||||
"message": "The method `define` if used with mw.mobileFrontend is deprecated. Please use `module.exports`."
|
||||
|
|
|
@ -55,4 +55,5 @@
|
|||
|
||||
module.exports = BackToTopOverlay;
|
||||
|
||||
// eslint-disable-next-line no-restricted-properties
|
||||
}( mw.mobileFrontend ) );
|
||||
|
|
|
@ -2,6 +2,7 @@ module.exports = function () {
|
|||
var BackToTopOverlay = require( './BackToTopOverlay.js' ),
|
||||
backtotop = new BackToTopOverlay(),
|
||||
features = mw.config.get( 'wgMinervaFeatures', {} ),
|
||||
// eslint-disable-next-line no-restricted-properties
|
||||
M = mw.mobileFrontend,
|
||||
mobile = M.require( 'mobile.startup' ),
|
||||
browser = mobile.Browser.getSingleton(),
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
module.exports = function () {
|
||||
var
|
||||
// eslint-disable-next-line no-restricted-properties
|
||||
M = mw.mobileFrontend,
|
||||
mobile = M.require( 'mobile.startup' ),
|
||||
loader = mobile.rlModuleLoader,
|
||||
|
|
|
@ -43,4 +43,6 @@
|
|||
}
|
||||
|
||||
module.exports = shareIcon;
|
||||
|
||||
// eslint-disable-next-line no-restricted-properties
|
||||
}( mw.mobileFrontend, mw.msg, mw.config ) );
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* Given a test name, sampling rate, and session ID, provides a class that buckets a user into
|
||||
* a predefined bucket ("unsampled", "control", or "treatment") and starts an AB-test.
|
||||
*/
|
||||
( function ( M, mwExperiments ) {
|
||||
( function ( mwExperiments ) {
|
||||
var bucket = {
|
||||
UNSAMPLED: 'unsampled', // Old treatment: not sampled and not instrumented.
|
||||
CONTROL: 'control', // Old treatment: sampled and instrumented.
|
||||
|
@ -74,4 +74,5 @@
|
|||
}
|
||||
|
||||
module.exports = AB;
|
||||
}( mw.mobileFrontend, mw.experiments ) );
|
||||
|
||||
}( mw.experiments ) );
|
||||
|
|
|
@ -89,4 +89,6 @@
|
|||
} );
|
||||
|
||||
module.exports = NotificationBadge;
|
||||
|
||||
// eslint-disable-next-line no-restricted-properties
|
||||
}( mw.mobileFrontend ) );
|
||||
|
|
|
@ -104,4 +104,6 @@
|
|||
bind: bind,
|
||||
render: render
|
||||
};
|
||||
|
||||
// eslint-disable-next-line no-restricted-properties
|
||||
}( mw.mobileFrontend ) );
|
||||
|
|
|
@ -166,4 +166,6 @@
|
|||
getOnClickHandler: getOnClickHandler
|
||||
}
|
||||
};
|
||||
|
||||
// eslint-disable-next-line no-restricted-properties
|
||||
}( mw.mobileFrontend, mw.track, mw.msg ) );
|
||||
|
|
|
@ -63,6 +63,7 @@
|
|||
} );
|
||||
};
|
||||
}(
|
||||
// eslint-disable-next-line no-restricted-properties
|
||||
mw.mobileFrontend,
|
||||
mw.track,
|
||||
mw.config,
|
||||
|
|
|
@ -373,4 +373,6 @@
|
|||
require( './watchstar.js' )( mobile );
|
||||
}
|
||||
} );
|
||||
|
||||
// eslint-disable-next-line no-restricted-properties
|
||||
}( mw.mobileFrontend ) );
|
||||
|
|
|
@ -116,4 +116,5 @@
|
|||
|
||||
module.exports = MainMenu;
|
||||
|
||||
// eslint-disable-next-line no-restricted-properties
|
||||
}( mw.mobileFrontend ) );
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
*/
|
||||
module.exports = function () {
|
||||
var badge,
|
||||
// eslint-disable-next-line no-restricted-properties
|
||||
M = mw.mobileFrontend,
|
||||
mainMenu = require( './menu.js' ),
|
||||
router = require( 'mediawiki.router' ),
|
||||
|
|
|
@ -201,4 +201,5 @@
|
|||
}
|
||||
};
|
||||
|
||||
// eslint-disable-next-line no-restricted-properties
|
||||
}( mw.mobileFrontend ) );
|
||||
|
|
|
@ -30,4 +30,6 @@
|
|||
} );
|
||||
|
||||
module.exports = IssueList;
|
||||
|
||||
// eslint-disable-next-line no-restricted-properties
|
||||
}( mw.mobileFrontend ) );
|
||||
|
|
|
@ -23,4 +23,6 @@
|
|||
}
|
||||
} );
|
||||
module.exports = IssueNotice;
|
||||
|
||||
// eslint-disable-next-line no-restricted-properties
|
||||
}( mw.mobileFrontend ) );
|
||||
|
|
|
@ -54,4 +54,6 @@
|
|||
}
|
||||
|
||||
module.exports = pageIssuesOverlay;
|
||||
|
||||
// eslint-disable-next-line no-restricted-properties
|
||||
}( mw.mobileFrontend, mw.msg ) );
|
||||
|
|
|
@ -227,4 +227,5 @@
|
|||
}
|
||||
};
|
||||
|
||||
// eslint-disable-next-line no-restricted-properties
|
||||
}( mw.mobileFrontend ) );
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
* @singleton
|
||||
*/
|
||||
module.exports = function () {
|
||||
// eslint-disable-next-line no-restricted-properties
|
||||
var M = mw.mobileFrontend,
|
||||
mobile = M.require( 'mobile.startup' ),
|
||||
skin = mobile.Skin.getSingleton(),
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
module.exports = function () {
|
||||
// eslint-disable-next-line no-restricted-properties
|
||||
var M = mw.mobileFrontend,
|
||||
mobile = M.require( 'mobile.startup' ),
|
||||
references = mobile.references,
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
module.exports = function () {
|
||||
var
|
||||
// eslint-disable-next-line no-restricted-properties
|
||||
M = mw.mobileFrontend,
|
||||
mobile = M.require( 'mobile.startup' ),
|
||||
SearchOverlay = mobile.search.SearchOverlay,
|
||||
|
|
|
@ -54,6 +54,7 @@ module.exports = function ( mobile ) {
|
|||
* @return {Overlay}
|
||||
*/
|
||||
function talkSectionOverlay( id, talkOptions ) {
|
||||
// eslint-disable-next-line no-restricted-properties
|
||||
var M = mw.mobileFrontend;
|
||||
if ( id === 'new' ) {
|
||||
return new ( M.require( 'mobile.talk.overlays/TalkSectionAddOverlay' ) )( talkOptions );
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
"../../.eslintrc.json"
|
||||
],
|
||||
"rules": {
|
||||
"no-restricted-properties": "off",
|
||||
"no-jquery/no-parse-html-literal": "off"
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue