Follows-up Id6d13bbea6:
- '$': mw.loader.implement does this already.
- 'mw': Use the canonical name directly.
This replaces the following patterns:
File closures (common):
- `( function ( $, mw ) {` => `( function () {`
- `( function ( $ ) {` => `( function () {`
- `( function ( mw ) {` => `( function () {`
- `( function ( mw, $ ) {` => `( function () {`
File closures (rare):
- `( function ( mw, $, OO ) {` => `( function () {`
- `( function ( mw, OO, $ ) {` => `( function () {`
- `( function ( mw, document ) {` => `( function () {`
Combined dom-ready and file closure (rare):
- `jQuery( function ( $ ) {` => `$( function () {
- `jQuery( function () {` => `$( function () {
Remaining references in files without a closure, as found by
the new ESLint setting (rare):
- `jQuery` => `$`
- `mediaWiki` => `mw`
Change-Id: I7cf2426cde597259e8c6f3f6f615a1a81a0ca82b
60 lines
1.3 KiB
JSON
60 lines
1.3 KiB
JSON
{
|
|
"extends": "wikimedia",
|
|
"env": {
|
|
"browser": true
|
|
},
|
|
"globals": {
|
|
"require": false,
|
|
"module": false,
|
|
"mw": false,
|
|
"$": false,
|
|
"OO": false
|
|
},
|
|
"rules": {
|
|
"no-restricted-properties": [
|
|
2,
|
|
{
|
|
"object": "$",
|
|
"property": "map",
|
|
"message": "Please use Array.prototype.map instead"
|
|
},
|
|
{
|
|
"object": "$",
|
|
"property": "inArray",
|
|
"message": "Please use Array.prototype.indexOf instead"
|
|
},
|
|
{
|
|
"object": "$",
|
|
"property": "each",
|
|
"message": "Please consider different approaches to $.each, especially when using Array's. You can override this warning if necessary with eslint-disable-next-line."
|
|
},
|
|
{
|
|
"object": "$",
|
|
"property": "isArray",
|
|
"message": "Please use Array.isArray instead"
|
|
},
|
|
{
|
|
"object": "$",
|
|
"property": "isFunction",
|
|
"message": "Please use typeof (e.g. typeof e === 'function') instead"
|
|
},
|
|
{
|
|
"object": "$",
|
|
"property": "grep",
|
|
"message": "Please use Array.prototype.filter instead"
|
|
},
|
|
{
|
|
"object": "$",
|
|
"property": "trim",
|
|
"message": "Please use String.prototype.trim instead"
|
|
},
|
|
{
|
|
"object": "$",
|
|
"property": "proxy",
|
|
"message": "Please use Function.prototype.bind instead"
|
|
}
|
|
],
|
|
"dot-notation": 0,
|
|
"max-len": 0
|
|
}
|
|
}
|