{
- "extends": "wikimedia",
- "env": {
- "browser": true
- },
+ "extends": [
+ "wikimedia/client",
+ "wikimedia/jquery"
+ ],
"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"
- },
-
- {
- "property": "codePointAt",
- "message": "Unsupported method String.prototype.codePointAt requires ES6."
- },
- {
- "property": "endsWith",
- "message": "Unsupported method String.prototype.endsWith requires ES6."
- },
- {
- "property": "normalize",
- "message": "Unsupported method String.prototype.normalize requires ES6."
- },
- {
- "property": "padEnd",
- "message": "Unsupported method String.prototype.padEnd requires ES2017."
- },
- {
- "property": "padStart",
- "message": "Unsupported method String.prototype.padStart requires ES2017."
- },
- {
- "property": "repeat",
- "message": "Unsupported method String.prototype.repeat requires ES6."
- },
- {
- "property": "startsWith",
- "message": "Unsupported method String.prototype.startsWith requires ES6."
- },
- {
- "property": "trimEnd",
- "message": "Unsupported method String.prototype.trimEnd is still experimental."
- },
- {
- "property": "trimLeft",
- "message": "Unsupported method String.prototype.trimLeft is still experimental."
- },
- {
- "property": "trimRight",
- "message": "Unsupported method String.prototype.trimRight is still experimental."
- },
- {
- "property": "trimStart",
- "message": "Unsupported method String.prototype.trimStart is still experimental."
- },
- {
- "property": "copyWithin",
- "message": "Unsupported method Array.prototype.copyWithin requires ES6."
- },
- {
- "property": "entries",
- "message": "Unsupported method Array.prototype.entries requires ES6."
- },
- {
- "property": "fill",
- "message": "Unsupported method Array.prototype.fill requires ES6."
- },
- {
- "property": "findIndex",
- "message": "Unsupported method Array.prototype.findIndex requires ES6."
- },
- {
- "property": "flat",
- "message": "Unsupported method Array.prototype.flat is still experimental."
- },
- {
- "property": "flatMap",
- "message": "Unsupported method Array.prototype.flatMap is still experimental."
- },
- {
- "object": "String",
- "property": "fromCodePoint",
- "message": "Unsupported method String.fromCodePoint requires ES6."
- },
- {
- "object": "String",
- "property": "raw",
- "message": "Unsupported method String.raw requires ES6."
- },
- {
- "object": "Array",
- "property": "from",
- "message": "Unsupported method Array.from requires ES6."
- },
- {
- "object": "Array",
- "property": "of",
- "message": "Unsupported method Array.of requires ES6."
- },
- {
- "object": "Object",
- "property": "assign",
- "message": "Unsupported method Object.assign requires ES6."
- },
- {
- "object": "Object",
- "property": "entries",
- "message": "Unsupported method Object.entries requires ES2017."
- },
- {
- "object": "Object",
- "property": "getOwnPropertyDescriptors",
- "message": "Unsupported method Object.getOwnPropertyDescriptors requires ES2017."
- },
- {
- "object": "Object",
- "property": "getOwnPropertySymbols",
- "message": "Unsupported method Object.getOwnPropertySymbols requires ES6."
- },
- {
- "object": "Object",
- "property": "is",
- "message": "Unsupported method Object.is requires ES6."
- },
- {
- "object": "Object",
- "property": "values",
- "message": "Unsupported method Object.values requires ES2017."
- }
- ],
- "no-restricted-syntax": [
- 2,
- {
- // Match expressions like .includes( … ) (false positives when used as a property name)
- "selector": "CallExpression[callee.type='MemberExpression'][callee.property.type='Identifier'][callee.property.name='includes']",
- "message": "Unsupported methods String.prototype.includes and Array.prototype.includes require ES6 and ES2016 respectively."
- },
- {
- // Match expressions like .find( function ( … ) { … } ) (avoid $( … ).find( … ))
- "selector": "CallExpression[callee.type='MemberExpression'][callee.property.type='Identifier'][callee.property.name='find'][arguments.length=1][arguments.0.type='FunctionExpression']",
- "message": "Unsupported method Array.prototype.find requires ES6."
- },
- {
- // Match expressions like .keys( … ), except Object.keys( … ) (which is valid)
- "selector": "CallExpression[callee.type='MemberExpression'][callee.property.type='Identifier'][callee.property.name='keys'][callee.object.name!='Object']",
- "message": "Unsupported method Array.prototype.keys requires ES6."
- },
- {
- // Match expressions like .values( … ), except Object.values( … ) (disallowed separately)
- "selector": "CallExpression[callee.type='MemberExpression'][callee.property.type='Identifier'][callee.property.name='values'][callee.object.name!='Object']",
- "message": "Unsupported method Array.prototype.values requires ES6."
- }
- ],
- "dot-notation": 0,
"max-len": 0
}
}