[eslint] Disable mediawiki/class-doc

Given our use of constants for tracking classes this eslint rule
is more an annoyance than helpful.

Change-Id: I37570e3e851997d058f2d93777990dddb3d04089
This commit is contained in:
bwang 2022-02-11 10:19:59 -06:00 committed by Jdlrobson
parent d4fb2960d6
commit 52c7c2ee75
7 changed files with 5 additions and 18 deletions

View File

@ -11,6 +11,7 @@
"ResourceLoader's `packageFiles` do not require wrapping but the `module` option is only available in ES6+."
],
"no-implicit-globals": "off",
"compat/compat": "warn"
"compat/compat": "warn",
"mediawiki/class-doc": "off"
}
}

View File

@ -17,5 +17,8 @@
"VectorHeaderObserver": "VectorHeaderObserver"
}
}
},
"rules": {
"mediawiki/class-doc": "off"
}
}

View File

@ -26,7 +26,6 @@ function bindSearchBoxHandler( searchBox, header ) {
!ev.target.closest( '.wvui-typeahead-suggestion' ) &&
!searchBox.contains( ev.target )
) {
// eslint-disable-next-line mediawiki/class-doc
header.classList.remove( SEARCH_VISIBLE_CLASS );
document.removeEventListener( 'click', clickHandler );
@ -54,7 +53,6 @@ function bindToggleClickHandler( searchBox, header, searchToggle ) {
// from the page when clicked.
ev.preventDefault();
// eslint-disable-next-line mediawiki/class-doc
header.classList.add( SEARCH_VISIBLE_CLASS );
// Defer binding the search box handler until after the event bubbles to the

View File

@ -35,10 +35,8 @@ function copyAttribute( from, to, attribute ) {
*/
function show() {
if ( header ) {
// eslint-disable-next-line mediawiki/class-doc
header.classList.add( STICKY_HEADER_VISIBLE_CLASS );
}
// eslint-disable-next-line mediawiki/class-doc
document.body.classList.remove( ULS_HIDE_CLASS );
}
@ -47,9 +45,7 @@ function show() {
*/
function hide() {
if ( header ) {
// eslint-disable-next-line mediawiki/class-doc
header.classList.remove( STICKY_HEADER_VISIBLE_CLASS );
// eslint-disable-next-line mediawiki/class-doc
document.body.classList.add( ULS_HIDE_CLASS );
}
}
@ -112,7 +108,6 @@ function removeNode( node ) {
*/
function removeClassFromNodes( nodes, className ) {
Array.prototype.forEach.call( nodes, function ( node ) {
// eslint-disable-next-line mediawiki/class-doc
node.classList.remove( className );
} );
}
@ -124,12 +119,9 @@ function removeClassFromNodes( nodes, className ) {
* @param {string} status 'watched', 'unwatched', or 'temporary'
*/
function updateStickyWatchlink( watchSticky, status ) {
/* eslint-disable mediawiki/class-doc */
watchSticky.classList.toggle( 'mw-ui-icon-wikimedia-star', status === 'unwatched' );
watchSticky.classList.toggle( 'mw-ui-icon-wikimedia-unStar', status === 'watched' );
watchSticky.classList.toggle( 'mw-ui-icon-wikimedia-halfStar', status === 'temporary' );
/* eslint-enable mediawiki/class-doc */
watchSticky.setAttribute( 'data-event-name', status === 'unwatched' ? 'watch-sticky-header' : 'unwatch-sticky-header' );
}
@ -396,7 +388,6 @@ function makeStickyHeaderFunctional(
const primaryEdit = protectedEdit || ( veEdit || ceEdit );
const secondaryEdit = veEdit ? ceEdit : null;
const disableStickyHeader = () => {
// eslint-disable-next-line mediawiki/class-doc
headerElement.classList.remove( STICKY_HEADER_VISIBLE_CLASS );
stickyObserver.unobserve( stickyIntersection );
};

View File

@ -54,19 +54,15 @@ module.exports = function tableOfContents( props ) {
const parentSection = /** @type {HTMLElement} */ ( tocSection.closest( `.${PARENT_SECTION_CLASS}` ) );
if ( activeChildSection ) {
// eslint-disable-next-line mediawiki/class-doc
activeChildSection.classList.remove( ACTIVE_SECTION_CLASS );
}
if ( activeParentSection ) {
// eslint-disable-next-line mediawiki/class-doc
activeParentSection.classList.remove( ACTIVE_SECTION_CLASS );
}
// eslint-disable-next-line mediawiki/class-doc
tocSection.classList.add( ACTIVE_SECTION_CLASS );
if ( parentSection ) {
// eslint-disable-next-line mediawiki/class-doc
parentSection.classList.add( ACTIVE_SECTION_CLASS );
}

View File

@ -66,7 +66,6 @@ function addPortletLinkHandler( item, data ) {
if ( isIconCapable && data.id && link ) {
// If class was previously added this will be a no-op so it is safe to call even
// if we've previously enhanced it.
// eslint-disable-next-line mediawiki/class-doc
link.classList.add(
'mw-ui-icon',
'mw-ui-icon-before',

View File

@ -4,7 +4,6 @@
* That doesn't happen in this file but the linter still throws an error.
* https://github.com/wikimedia/eslint-plugin-mediawiki/blob/master/docs/rules/class-doc.md
*/
/* eslint-disable mediawiki/class-doc */
/** @interface VectorResourceLoaderVirtualConfig */
/** @interface MediaWikiPageReadyModule */