Build: Fix the ESLint config for demos
Some checks failed
Filestash / Update Filestash (push) Has been cancelled
Node / ${{ matrix.BROWSER }} | ${{ matrix.JQUERYS.name }} (chrome, map[name:jQuery git versions:--jquery git --jquery 3.x-git]) (push) Has been cancelled
Node / ${{ matrix.BROWSER }} | ${{ matrix.JQUERYS.name }} (chrome, map[name:jQuery stable versions:--jquery 3.7.1 --jquery 3.6.4 --jquery 2.2.4 --jquery 1.12.4]) (push) Has been cancelled
Node / ${{ matrix.BROWSER }} | ${{ matrix.JQUERYS.name }} (firefox, map[name:jQuery git versions:--jquery git --jquery 3.x-git]) (push) Has been cancelled
Node / ${{ matrix.BROWSER }} | ${{ matrix.JQUERYS.name }} (firefox, map[name:jQuery stable versions:--jquery 3.7.1 --jquery 3.6.4 --jquery 2.2.4 --jquery 1.12.4]) (push) Has been cancelled
Node / edge | ${{ matrix.JQUERYS.name }} (map[name:jQuery git versions:--jquery git --jquery 3.x-git]) (push) Has been cancelled
Node / edge | ${{ matrix.JQUERYS.name }} (map[name:jQuery stable versions:--jquery 3.7.1 --jquery 3.6.4 --jquery 2.2.4 --jquery 1.12.4]) (push) Has been cancelled
Node / safari | ${{ matrix.JQUERYS.name }} (map[name:jQuery git versions:--jquery git --jquery 3.x-git]) (push) Has been cancelled
Node / safari | ${{ matrix.JQUERYS.name }} (map[name:jQuery stable versions:--jquery 3.7.1 --jquery 3.6.4 --jquery 2.2.4 --jquery 1.12.4]) (push) Has been cancelled

The ESLint config for `demos` extends the one for the `ui` directory. However,
the `ui` one used to not be a root one, making the `demos` one effectively not
depend on the `jquery` preset. Fix that and fix lots of lint violations in
`demos/search.js`.

Closes gh-2303
This commit is contained in:
Michał Gołębiowski-Owczarek 2024-10-17 23:47:29 +02:00 committed by GitHub
parent 3934c68dee
commit 49bb397606
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 586 additions and 578 deletions

View File

@ -1,5 +1,9 @@
{ {
"root": true, "root": true,
"extends": "../ui/.eslintrc.json" "extends": "../ui/.eslintrc.json",
"globals": {
"require": true
}
} }

View File

@ -596,32 +596,32 @@
return result; return result;
} }
$.ajaxTransport( "json", function( options, originalOptions ) { $.ajaxTransport( "json", function( options, originalOptions ) {
if ( options.url.indexOf( 'search.json' ) === -1 ) { if ( options.url.indexOf( "search.json" ) === -1 ) {
return; return;
} }
return { return {
abort: function() {}, abort: function() {},
send: function( headers, completeCallback ) { send: function( headers, completeCallback ) {
console.log( 'Mocked AJAX response for ' + options.url ); console.log( "Mocked AJAX response for " + options.url );
var result = searchResponse( originalOptions.data.term || '' ); var result = searchResponse( originalOptions.data.term || "" );
setTimeout( function() { setTimeout( function() {
completeCallback( 200, 'OK', { text: JSON.stringify( result ) }, [] ); completeCallback( 200, "OK", { text: JSON.stringify( result ) }, [] );
}, 2000 ); }, 2000 );
} }
}; };
} ); } );
$.ajaxTransport( "script", function( options, originalOptions ) { $.ajaxTransport( "script", function( options, originalOptions ) {
if ( options.url.indexOf( 'search.json' ) === -1 ) { if ( options.url.indexOf( "search.json" ) === -1 ) {
return; return;
} }
return { return {
abort: function() {}, abort: function() {},
send: function( headers, completeCallback ) { send: function( headers, completeCallback ) {
console.log( 'Mocked AJAX response for ' + options.url ); console.log( "Mocked AJAX response for " + options.url );
var result = searchResponse( originalOptions.data.term || '' ); var result = searchResponse( originalOptions.data.term || "" );
var script = options.jsonpCallback + '(' + JSON.stringify( result ) + ')'; var script = options.jsonpCallback + "(" + JSON.stringify( result ) + ")";
setTimeout( function() { setTimeout( function() {
completeCallback( 200, 'OK', { text: script }, [] ); completeCallback( 200, "OK", { text: script }, [] );
}, 2000 ); }, 2000 );
} }
}; };

View File

@ -1,4 +1,8 @@
{ {
"root": true,
"extends": "jquery",
"parserOptions": { "parserOptions": {
"ecmaVersion": 5 "ecmaVersion": 5
}, },