Merge "eslint: Lint Gruntile.js using server rules"

This commit is contained in:
jenkins-bot 2022-02-10 05:37:23 +00:00 committed by Gerrit Code Review
commit 7b75d3775c
6 changed files with 29 additions and 20 deletions

View file

@ -1,15 +1,7 @@
{ {
"root": true, "root": true,
"extends": [ "extends": [
"wikimedia/client-es5", "wikimedia/server",
"wikimedia/jquery",
"wikimedia/mediawiki",
"wikimedia/jsduck" "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 ) { 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-banana-checker' );
grunt.loadNpmTasks( 'grunt-contrib-watch' ); grunt.loadNpmTasks( 'grunt-contrib-watch' );
@ -28,7 +29,6 @@ module.exports = function ( grunt ) {
'modules/**/*.{css,less}' 'modules/**/*.{css,less}'
] ]
}, },
// eslint-disable-next-line es/no-object-assign, compat/compat
banana: Object.assign( { banana: Object.assign( {
options: { requireLowerCase: false } options: { requireLowerCase: false }
}, conf.MessagesDirs ), }, 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 * A container that manages all models that are involved in creating
* the notification list. There are currently two types of models: * 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. * 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 * cross wiki notification, which acts as an item but itself contains
* a list. * a list.
* *
* All notification models that are managed by the manager must implement the * All notification models that are managed by the manager must implement the
* following methods: * following methods:
* * getName - This should retrieve the model's name for the manager to fetch * - getName - This should retrieve the model's name for the manager to fetch
* * isGroup - This should be true for xwiki model and local bundles * - isGroup - This should be true for xwiki model and local bundles
* * hasUnseen - This should iterate in the model's items and check whether * - hasUnseen - This should iterate in the model's items and check whether
* there are any unseen notifications within them. * 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 * @class
* @mixins OO.EventEmitter * @mixins OO.EventEmitter

View file

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

View file

@ -20,7 +20,7 @@
badge.$el.find( '.zero' ).length === 0; badge.$el.find( '.zero' ).length === 0;
badge.setCount( 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' ); assert.strictEqual( badge.$el.find( '.zero' ).length, 1, 'A zero class is present on the badge' );
badge.setCount( 105 ); badge.setCount( 105 );
assert.strictEqual( badge.options.notificationCountRaw, 100, 'Number is capped to 100.' ); assert.strictEqual( badge.options.notificationCountRaw, 100, 'Number is capped to 100.' );