Revert "build: Update eslint-config-wikimedia to 0.22.1"

This reverts commit b72c648d21.

Reason for revert: Causes an issue with the search
(See https://phabricator.wikimedia.org/F35009362)

Change-Id: I09f7e5c9eab677bfd5a92cf2d8389d20a2d6e87a
This commit is contained in:
Jdlrobson 2022-03-16 23:40:42 +00:00
parent b72c648d21
commit f7a859bac5
8 changed files with 299 additions and 813 deletions

987
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -33,7 +33,7 @@
"@wikimedia/types-wikimedia": "0.2.0", "@wikimedia/types-wikimedia": "0.2.0",
"@wikimedia/wvui": "0.3.5", "@wikimedia/wvui": "0.3.5",
"babel-loader": "8.0.6", "babel-loader": "8.0.6",
"eslint-config-wikimedia": "0.22.1", "eslint-config-wikimedia": "0.20.0",
"grunt-banana-checker": "0.9.0", "grunt-banana-checker": "0.9.0",
"jest": "26.4.2", "jest": "26.4.2",
"jest-fetch-mock": "3.0.3", "jest-fetch-mock": "3.0.3",

View File

@ -35,7 +35,6 @@ const main = () => {
// @ts-ignore // @ts-ignore
testGroup = stickyConfig ? stickyConfig.group : FEATURE_TEST_GROUP, testGroup = stickyConfig ? stickyConfig.group : FEATURE_TEST_GROUP,
targetElement = stickyHeader.header, targetElement = stickyHeader.header,
// @ts-ignore
targetIntersection = stickyHeader.stickyIntersection, targetIntersection = stickyHeader.stickyIntersection,
isStickyHeaderAllowed = stickyHeader.isStickyHeaderAllowed() && isStickyHeaderAllowed = stickyHeader.isStickyHeaderAllowed() &&
testGroup !== 'unsampled' && AB.isInTestGroup( testGroup, FEATURE_TEST_GROUP ); testGroup !== 'unsampled' && AB.isInTestGroup( testGroup, FEATURE_TEST_GROUP );

View File

@ -434,11 +434,11 @@ function isAllowedAction( action ) {
} }
const const
pageStickyIntersection = document.getElementById( stickyIntersection = document.getElementById(
FIRST_HEADING_ID FIRST_HEADING_ID
), ),
pageUserMenu = document.getElementById( USER_MENU_ID ), userMenu = document.getElementById( USER_MENU_ID ),
pageUserMenuStickyContainer = document.getElementsByClassName( userMenuStickyContainer = document.getElementsByClassName(
STICKY_HEADER_USER_MENU_CONTAINER_CLASS STICKY_HEADER_USER_MENU_CONTAINER_CLASS
)[ 0 ], )[ 0 ],
allowedNamespace = isAllowedNamespace( mw.config.get( 'wgNamespaceNumber' ) ), allowedNamespace = isAllowedNamespace( mw.config.get( 'wgNamespaceNumber' ) ),
@ -451,9 +451,9 @@ const
*/ */
function isStickyHeaderAllowed() { function isStickyHeaderAllowed() {
return !!header && return !!header &&
!!pageStickyIntersection && !!stickyIntersection &&
!!pageUserMenu && !!userMenu &&
pageUserMenuStickyContainer && userMenuStickyContainer &&
allowedNamespace && allowedNamespace &&
allowedAction && allowedAction &&
'IntersectionObserver' in window; 'IntersectionObserver' in window;
@ -463,19 +463,19 @@ function isStickyHeaderAllowed() {
* @param {IntersectionObserver} observer * @param {IntersectionObserver} observer
*/ */
function initStickyHeader( observer ) { function initStickyHeader( observer ) {
if ( !isStickyHeaderAllowed() || !header || !pageUserMenu || !pageStickyIntersection ) { if ( !isStickyHeaderAllowed() || !header || !userMenu || !stickyIntersection ) {
return; return;
} }
makeStickyHeaderFunctional( makeStickyHeaderFunctional(
header, header,
pageUserMenu, userMenu,
pageUserMenuStickyContainer, userMenuStickyContainer,
observer, observer,
pageStickyIntersection stickyIntersection
); );
setupSearchIfNeeded( header ); setupSearchIfNeeded( header );
addVisualEditorHooks( pageStickyIntersection, observer ); addVisualEditorHooks( stickyIntersection, observer );
// Make sure ULS outside sticky header disables the sticky header behaviour. // Make sure ULS outside sticky header disables the sticky header behaviour.
// @ts-ignore // @ts-ignore
@ -505,6 +505,6 @@ module.exports = {
initStickyHeader, initStickyHeader,
isStickyHeaderAllowed, isStickyHeaderAllowed,
header, header,
pageStickyIntersection, stickyIntersection,
STICKY_HEADER_EXPERIMENT_NAME STICKY_HEADER_EXPERIMENT_NAME
}; };

View File

@ -153,7 +153,7 @@ function initSearchLoader( document ) {
/** /**
* 1. If we are in a browser that doesn't support ES6 fall back to non-JS version. * 1. If we are in a browser that doesn't support ES6 fall back to non-JS version.
* 2. Disable on Wikidata per T281318 until the REST API is ready. * 2. Disable on Wikidata per T281318 until the REST API is ready.
*/ **/
if ( isWikidata || mw.loader.getState( 'skins.vector.search' ) === null ) { if ( isWikidata || mw.loader.getState( 'skins.vector.search' ) === null ) {
document.body.classList.remove( document.body.classList.remove(
'skin-vector-search-vue' 'skin-vector-search-vue'

View File

@ -24,18 +24,16 @@
@submit="onSubmit" @submit="onSubmit"
> >
<template #default> <template #default>
<input <input type="hidden"
type="hidden"
name="title" name="title"
:value="searchPageTitle" :value="searchPageTitle"
> >
<input <input type="hidden"
type="hidden"
name="wprov" name="wprov"
:value="wprov" :value="wprov"
> >
</template> </template>
<template #search-footer-text> <template #search-footer-text="{ searchQuery }">
<span v-i18n-html:vector-searchsuggest-containing="[ searchQuery ]"></span> <span v-i18n-html:vector-searchsuggest-containing="[ searchQuery ]"></span>
</template> </template>
</wvui-typeahead-search> </wvui-typeahead-search>
@ -47,11 +45,36 @@ const wvui = require( 'wvui-search' ),
client = require( './restSearchClient.js' ), client = require( './restSearchClient.js' ),
instrumentation = require( './instrumentation.js' ); instrumentation = require( './instrumentation.js' );
// @vue/component
module.exports = { module.exports = {
name: 'App', name: 'App',
components: { components: wvui,
WvuiTypeaheadSearch: wvui.WvuiTypeaheadSearch mounted() {
// access the element associated with the wvui-typeahead-search component
// eslint-disable-next-line no-jquery/variable-pattern
const wvuiSearchForm = this.$refs.searchForm.$el;
if ( this.autofocusInput ) {
// TODO: The wvui-typeahead-search component does not accept an autofocus parameter
// or directive. This can be removed when its does.
wvuiSearchForm.querySelector( 'input' ).focus();
}
},
computed: {
/**
* Allow wikis eg. Hebrew Wikipedia to replace the default search API client
*
* @return {module:restSearchClient~SearchClient}
*/
getClient: () => {
return client( mw.config );
},
language: () => {
return mw.config.get( 'wgUserLanguage' );
},
domain: () => {
// It might be helpful to allow this to be configurable in future.
return mw.config.get( 'wgVectorSearchHost', location.host );
}
}, },
props: { props: {
id: { id: {
@ -72,38 +95,38 @@ module.exports = {
}, },
/** The keyboard shortcut to focus search. */ /** The keyboard shortcut to focus search. */
searchAccessKey: { searchAccessKey: {
type: String, type: String
default: ''
}, },
/** The access key informational tip for search. */ /** The access key informational tip for search. */
searchTitle: { searchTitle: {
type: String, type: String
default: ''
}, },
/** The ghost text shown when no search query is entered. */ /** The ghost text shown when no search query is entered. */
searchPlaceholder: { searchPlaceholder: {
type: String, type: String
default: ''
}, },
/** /**
* The search query string taken from the server-side rendered input immediately before * The search query string taken from the server-side rendered input immediately before
* client render. * client render.
*/ */
searchQuery: { searchQuery: {
type: String, type: String
default: ''
}, },
showThumbnail: { showThumbnail: {
type: Boolean type: Boolean,
default: true
}, },
showDescription: { showDescription: {
type: Boolean type: Boolean,
default: true
}, },
highlightQuery: { highlightQuery: {
type: Boolean type: Boolean,
default: true
}, },
autoExpandWidth: { autoExpandWidth: {
type: Boolean type: Boolean,
default: false
} }
}, },
data() { data() {
@ -116,23 +139,6 @@ module.exports = {
instrumentation: instrumentation.listeners instrumentation: instrumentation.listeners
}; };
}, },
computed: {
/**
* Allow wikis eg. Hebrew Wikipedia to replace the default search API client
*
* @return {module:restSearchClient~SearchClient}
*/
getClient: () => {
return client( mw.config );
},
language: () => {
return mw.config.get( 'wgUserLanguage' );
},
domain: () => {
// It might be helpful to allow this to be configurable in future.
return mw.config.get( 'wgVectorSearchHost', location.host );
}
},
methods: { methods: {
/** /**
* @param {SubmitEvent} event * @param {SubmitEvent} event
@ -142,17 +148,6 @@ module.exports = {
instrumentation.listeners.onSubmit( event ); instrumentation.listeners.onSubmit( event );
} }
},
mounted() {
// access the element associated with the wvui-typeahead-search component
// eslint-disable-next-line no-jquery/variable-pattern
const wvuiSearchForm = this.$refs.searchForm.$el;
if ( this.autofocusInput ) {
// TODO: The wvui-typeahead-search component does not accept an autofocus parameter
// or directive. This can be removed when its does.
wvuiSearchForm.querySelector( 'input' ).focus();
}
} }
}; };
</script> </script>

View File

@ -25,7 +25,7 @@
* @property {ResourceLoaderSkinModuleLogos} data-logos as configured, * @property {ResourceLoaderSkinModuleLogos} data-logos as configured,
* the return value of ResourceLoaderSkinModule::getAvailableLogos. * the return value of ResourceLoaderSkinModule::getAvailableLogos.
* @property {string} msg-sitetitle alternate text for wordmark * @property {string} msg-sitetitle alternate text for wordmark
* href the url to navigate to on click. href the url to navigate to on click.
* @property {string} msg-sitesubtitle alternate text for tagline. * @property {string} msg-sitesubtitle alternate text for tagline.
*/ */

View File

@ -8,10 +8,13 @@ exports[`App renders a typeahead search component 1`] = `
client="[object Object]" client="[object Object]"
domain="localhost" domain="localhost"
formaction="" formaction=""
highlightquery="true"
id="searchform" id="searchform"
initialinputvalue="" initialinputvalue=""
placeholder="Search MediaWiki" placeholder="Search MediaWiki"
searchpagetitle="Special:Search" searchpagetitle="Special:Search"
showdescription="true"
showthumbnail="true"
suggestionslabel="searchresults" suggestionslabel="searchresults"
title="search" title="search"
urlgenerator="[object Object]" urlgenerator="[object Object]"