eslint: Lint Gruntile.js using server rules

Change-Id: Ic7d67098492558fdd6cec292afd22aaf8693a594
This commit is contained in:
Ed Sanders 2022-02-07 16:30:24 +00:00
parent a10814bff4
commit ba38b57c83
6 changed files with 29 additions and 20 deletions

View file

@ -1,15 +1,7 @@
{
"root": true,
"extends": [
"wikimedia/client-es5",
"wikimedia/jquery",
"wikimedia/mediawiki",
"wikimedia/server",
"wikimedia/jsduck"
],
"env": {
"commonjs": true
},
"rules": {
"max-len": "off"
}
]
}

View file

@ -1,6 +1,7 @@
/* eslint-env node, es6 */
'use strict';
module.exports = function ( grunt ) {
var conf = grunt.file.readJSON( 'extension.json' );
const conf = grunt.file.readJSON( 'extension.json' );
grunt.loadNpmTasks( 'grunt-banana-checker' );
grunt.loadNpmTasks( 'grunt-contrib-watch' );
@ -28,7 +29,6 @@ module.exports = function ( grunt ) {
'modules/**/*.{css,less}'
]
},
// eslint-disable-next-line es/no-object-assign, compat/compat
banana: Object.assign( {
options: { requireLowerCase: false }
}, conf.MessagesDirs ),

15
modules/.eslintrc.json Normal file
View file

@ -0,0 +1,15 @@
{
"root": true,
"extends": [
"wikimedia/client-es5",
"wikimedia/jquery",
"wikimedia/mediawiki",
"wikimedia/jsduck"
],
"env": {
"commonjs": true
},
"rules": {
"max-len": "off"
}
}

View file

@ -2,19 +2,19 @@
/**
* A container that manages all models that are involved in creating
* the notification list. There are currently two types of models:
* * mw.echo.dm.SortedList - This currently includes the local model
* - mw.echo.dm.SortedList - This currently includes the local model
* or any model that has individual messages.
* * mw.echo.dm.CrossWikiNotificationItem - This is a model for the
* - mw.echo.dm.CrossWikiNotificationItem - This is a model for the
* cross wiki notification, which acts as an item but itself contains
* a list.
*
* All notification models that are managed by the manager must implement the
* following methods:
* * getName - This should retrieve the model's name for the manager to fetch
* * isGroup - This should be true for xwiki model and local bundles
* * hasUnseen - This should iterate in the model's items and check whether
* - getName - This should retrieve the model's name for the manager to fetch
* - isGroup - This should be true for xwiki model and local bundles
* - hasUnseen - This should iterate in the model's items and check whether
* there are any unseen notifications within them.
* * getCount - Get a total count of available notifications currently in the model
* - getCount - Get a total count of available notifications currently in the model
*
* @class
* @mixins OO.EventEmitter

View file

@ -1,5 +1,7 @@
{
"root": true,
"extends": [
"../../modules/.eslintrc.json",
"wikimedia/qunit"
],
"rules": {

View file

@ -20,7 +20,7 @@
badge.$el.find( '.zero' ).length === 0;
badge.setCount( 0 );
assert.ok( initialClassExpectationsMet, 'No icon and no zero class' );
assert.true( initialClassExpectationsMet, 'No icon and no zero class' );
assert.strictEqual( badge.$el.find( '.zero' ).length, 1, 'A zero class is present on the badge' );
badge.setCount( 105 );
assert.strictEqual( badge.options.notificationCountRaw, 100, 'Number is capped to 100.' );