Skip to content

Commit

Permalink
fix linter errors (#343)
Browse files Browse the repository at this point in the history
* fix linter errors

should be a no-op

* fix more linter errors

* fix comment spacing
  • Loading branch information
NovemLinguae authored Apr 25, 2024
1 parent b907dca commit 6a62d6b
Show file tree
Hide file tree
Showing 6 changed files with 86 additions and 80 deletions.
14 changes: 2 additions & 12 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,10 @@
"rules": {
"camelcase": 0,
"eqeqeq": 0,
"jsdoc/check-param-names": 0,
"jsdoc/check-tag-names": 0,
"jsdoc/no-undefined-types": 0,
"jsdoc/require-param": 0,
"jsdoc/require-param-type": 0,
"jsdoc/require-returns": 0,
"jsdoc/require-returns-check": 0,
"jsdoc/valid-types": 0,
"max-len": 0,
"max-statements-per-line": 0,
"no-console": 0,
"no-global-assign": 0,
"no-implicit-globals": 0,
Expand All @@ -36,12 +31,7 @@
"no-undef": 0,
"no-underscore-dangle": 0,
"no-unused-vars": 0,
"no-use-before-define": 0,
"no-useless-concat": 0,
"no-useless-escape": 0,
"one-var": 0,
"spaced-comment": 0,
"vars-on-top": 0
"no-use-before-define": 0
},
"settings": {
"jsdoc": {
Expand Down
4 changes: 2 additions & 2 deletions src/afch.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//<nowiki>
// <nowiki>
( function () {
// Check that we're in the right namespace and on the right page
switch ( mw.config.get( 'wgNamespaceNumber' ) ) {
Expand Down Expand Up @@ -43,4 +43,4 @@
}
} );
}() );
//</nowiki>
// </nowiki>
43 changes: 21 additions & 22 deletions src/modules/core.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
//<nowiki>
// <nowiki>
( function ( AFCH, $, mw ) {
$.extend( AFCH, {

/**
* Log anything to the console
*
* @param {anything} thing(s)
* @param {any} thing(s)
*/
log: function () {
var args = Array.prototype.slice.call( arguments );
Expand Down Expand Up @@ -46,7 +46,7 @@
/**
* Prepares the AFCH gadget by setting constants and checking environment
*
* @return {bool} Whether or not all setup functions executed successfully
* @return {boolean} Whether or not all setup functions executed successfully
*/
setup: function () {
// Check requirements
Expand Down Expand Up @@ -118,7 +118,7 @@
// the script, so long as there was a user whose name was
// three characters long on the list!
var $howToDisable,
sanitizedUser = user.replace( /[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, '\\$&' ),
sanitizedUser = user.replace( /[-[\]/{}()*+?.\\^$|]/g, '\\$&' ),
userSysop = $.inArray( 'sysop', mw.config.get( 'wgUserGroups' ) ) > -1,
userNPP = $.inArray( 'patroller', mw.config.get( 'wgUserGroups' ) ) > -1,
userOnWhitelist = ( new RegExp( '\\|\\s*' + sanitizedUser + '\\s*}' ) ).test( text ),
Expand Down Expand Up @@ -272,7 +272,7 @@
* Makes an API request to get a variety of details about the current
* revision of the page, which it then sets.
*
* @param {bool} usecache if true, will resolve immediately if function has
* @param {boolean} usecache if true, will resolve immediately if function has
* run successfully before
* @return {jQuery.Deferred} resolves when data set successfully
*/
Expand Down Expand Up @@ -307,7 +307,7 @@
/**
* Gets the page text
*
* @param {bool} usecache use cache if possible
* @param {boolean} usecache use cache if possible
* @return {string}
*/
this.getText = function ( usecache ) {
Expand Down Expand Up @@ -392,9 +392,9 @@
/**
* Gets the categories from the page
*
* @param {bool} useApi If true, use the api to get categories, instead of parsing the page. This is
* @param {boolean} useApi If true, use the api to get categories, instead of parsing the page. This is
* necessary if you need info about transcluded categories.
* @param {bool} includeCategoryLinks If true, will also include links to categories (e.g. [[:Category:Foo]]).
* @param {boolean} includeCategoryLinks If true, will also include links to categories (e.g. [[:Category:Foo]]).
* Note that if useApi is true, includeCategoryLinks must be false.
* @return {Array}
*/
Expand Down Expand Up @@ -739,7 +739,7 @@
* @param {string} newTitle Move target
* @param {string} reason Reason for moving; shown in move log
* @param {Object} additionalParameters https://www.mediawiki.org/wiki/API:Move#Parameters
* @param {bool} hide Don't show the move in the status display
* @param {boolean} hide Don't show the move in the status display
* @return {jQuery.Deferred} Resolves with success/failure
*/
movePage: function ( oldTitle, newTitle, reason, additionalParameters, hide ) {
Expand Down Expand Up @@ -794,12 +794,11 @@
* Notifies a user. Follows redirects and appends a message
* to the bottom of the user's talk page.
*
* @param {string} user
* @param {Object} data object with properties
* @param {string} user
* @param {Object} options object with properties
* - message: {string}
* - summary: {string} edit summary
* - hide: {bool}, default false
* @param options
* @return {jQuery.Deferred} Resolves with success/failure
*/
notifyUser: function ( user, options ) {
Expand Down Expand Up @@ -867,7 +866,7 @@
} );
}

appendText += ' ~~' + '~~' + '~\n';
appendText += ' ~~~~~\n';

logPage.edit( {
contents: appendText,
Expand Down Expand Up @@ -910,7 +909,7 @@
}

var byUser = ' by [[User:' + options.submitter + '|]]';
var sig = ' ~~' + '~~' + '~\n';
var sig = ' ~~~~~\n';

// Make log edit
logPage.edit( {
Expand Down Expand Up @@ -1001,7 +1000,7 @@
/**
* Creates the status container
*
* @param {selector} location String/jQuery selector for where the
* @param {string|jQuery} location String/jQuery selector for where the
* status container should be prepended
*/
init: function ( location ) {
Expand Down Expand Up @@ -1103,7 +1102,7 @@
$.each( substitutions, function ( original, replacement ) {
text = text.replace(
// Escape the original substitution key, then make it a global regex
new RegExp( original.replace( /[-\/\\^$*+?.()|[\]{}]/g, '\\$&' ), 'g' ),
new RegExp( original.replace( /[-/\\^$*+?.()|[\]{}]/g, '\\$&' ), 'g' ),
replacement
);
} );
Expand Down Expand Up @@ -1685,7 +1684,7 @@
* @param {Array<Object>} existingWikiProjects An array of associative arrays. The associative arrays contain the keys {string} displayName (example: Somalia), {string} templateName (example: WikiProject Somalia), and {boolean} alreadyOnPage
* @param {boolean} alreadyHasWPBio
* @param {null} existingWPBioTemplateName
* @returns {Object} { {string} talkText, {number} countOfWikiProjectsAdded, {number} countOfWikiProjectsRemoved }
* @return {Object} { {string} talkText, {number} countOfWikiProjectsAdded, {number} countOfWikiProjectsRemoved }
*/
addTalkPageBanners: function ( talkText, newAssessment, revId, isBiography, newWikiProjects, lifeStatus, subjectName, existingWikiProjects, alreadyHasWPBio, existingWPBioTemplateName ) {
var talkTextPrefix = '';
Expand All @@ -1711,13 +1710,13 @@
}

// Add and remove WikiProjects
/** @var {Array} */
/** @member {Array} */
var wikiProjectsToAdd = newWikiProjects.filter( function ( newTemplateName ) {
return !existingWikiProjects.some( function ( existingTplObj ) {
return existingTplObj.templateName === newTemplateName;
} );
} );
/** @var {Array} */
/** @member {Array} */
var wikiProjectsToRemove = existingWikiProjects.filter( function ( existingTplObj ) {
return !newWikiProjects.some( function ( newTemplateName ) {
return existingTplObj.templateName === newTemplateName;
Expand Down Expand Up @@ -1841,7 +1840,7 @@
*
* @param {string} string string to parse
* @param mwstyle
* @return {Date|integer}
* @return {Date|number}
*/
parseForTimestamp: function ( string, mwstyle ) {
var exp, match, date;
Expand Down Expand Up @@ -1875,7 +1874,7 @@
* Parses a MediaWiki internal YYYYMMDDHHMMSS timestamp
*
* @param {string} string
* @return {Date|bool} if unable to parse, returns false
* @return {Date|boolean} if unable to parse, returns false
*/
mwTimestampToDate: function ( string ) {
var date, dateMatches = /(\d{4})(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)/.exec( string );
Expand Down Expand Up @@ -1950,4 +1949,4 @@
} );

}( AFCH, jQuery, mediaWiki ) );
//</nowiki>
// </nowiki>
Loading

0 comments on commit 6a62d6b

Please sign in to comment.