Skip to content

Commit 53291fe

Browse files
authored
Scripts: ESLint minor version upgrade to 7.17.0 (#27965)
* Scripts: Upgrade ESLint and its configuration to version 7.17 * Autofix errors detected in unit tests * Disable more linting errors used in the existing code * Fix more reported warnings * Add changelog entries for ESLint upgrade * Update the package lock file * Update test snapshots to align with test name changes
1 parent e073409 commit 53291fe

53 files changed

Lines changed: 1101 additions & 565 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

package-lock.json

Lines changed: 877 additions & 440 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/api-fetch/src/middlewares/test/fetch-all-middleware.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,12 @@ describe( 'Fetch All Middleware', () => {
2020
const originalOptions = { url: '/posts?per_page=-1' };
2121
let counter = 1;
2222
jest.doMock( '../../index.js', () => ( options ) => {
23-
if ( counter === 1 ) {
24-
expect( options.url ).toBe( '/posts?per_page=100' );
25-
} else {
26-
expect( options.url ).toBe( '/posts?per_page=100&page=2' );
27-
}
23+
const expectedUrl =
24+
counter === 1
25+
? '/posts?per_page=100'
26+
: '/posts?per_page=100&page=2';
27+
expect( options.url ).toBe( expectedUrl );
28+
2829
const response = Promise.resolve( {
2930
status: 200,
3031
headers: {

packages/block-directory/src/store/test/selectors.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,11 +234,11 @@ describe( 'selectors', () => {
234234
},
235235
};
236236

237-
it( 'it should reflect that the block is installing', () => {
237+
it( 'should reflect that the block is installing', () => {
238238
expect( isInstalling( state, BLOCK_1_ID ) ).toBeTruthy();
239239
} );
240240

241-
it( 'it should reflect that the block is not installing', () => {
241+
it( 'should reflect that the block is not installing', () => {
242242
expect( isInstalling( state, 'not-in-state' ) ).toBeFalsy();
243243
expect( isInstalling( state, BLOCK_2_ID ) ).toBeFalsy();
244244
} );

packages/block-editor/src/components/responsive-block-control/test/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ describe( 'Default and Responsive modes', () => {
362362
expect( responsiveControlGroup ).toBeNull();
363363
} );
364364

365-
it( 'should render custom responsive controls when renderResponsiveControls prop is provided and in responsive mode ', () => {
365+
it( 'should render custom responsive controls when renderResponsiveControls prop is provided and in responsive mode', () => {
366366
const spyRenderDefaultControl = jest.fn();
367367

368368
const mockRenderResponsiveControls = jest.fn( ( viewports ) => {

packages/block-editor/src/store/test/selectors.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2930,7 +2930,7 @@ describe( 'selectors', () => {
29302930
expect( getTemplateLock( state ) ).toBe( 'all' );
29312931
} );
29322932

2933-
it( 'should return null if the specified clientId was not found ', () => {
2933+
it( 'should return null if the specified clientId was not found', () => {
29342934
const state = {
29352935
settings: { templateLock: 'all' },
29362936
blockListSettings: {

packages/block-serialization-spec-parser/shared-tests.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -335,9 +335,9 @@ const hasPHP =
335335
// skipping preserves snapshots while commenting out or simply
336336
// not injecting the tests prompts `jest` to remove "obsolete snapshots"
337337
const makeTest = hasPHP
338-
? // eslint-disable-next-line jest/valid-describe
338+
? // eslint-disable-next-line jest/valid-describe, jest/valid-title
339339
( ...args ) => describe( ...args )
340-
: // eslint-disable-next-line jest/no-disabled-tests, jest/valid-describe
340+
: // eslint-disable-next-line jest/no-disabled-tests, jest/valid-describe, jest/valid-title
341341
( ...args ) => describe.skip( ...args );
342342

343343
export const phpTester = ( name, filename ) =>

packages/blocks/src/api/test/registration.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -646,6 +646,7 @@ describe( 'blocks', () => {
646646
// Verify that for deprecations, the filter is called with a merge of pre-filter
647647
// settings with deprecation keys omitted and the deprecation entry.
648648
if ( i > 0 ) {
649+
// eslint-disable-next-line jest/no-conditional-expect
649650
expect( settings ).toEqual( {
650651
...omit(
651652
{

packages/components/src/color-picker/test/input.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import { DOWN, ENTER, SPACE, UP } from '@wordpress/keycodes';
1313
*/
1414
import { Input } from '../inputs';
1515

16-
describe( 'Input ', () => {
16+
describe( 'Input', () => {
1717
describe( 'calls onChange prop with commit state', () => {
1818
test( 'onKeyDown = ENTER', () => {
1919
const onChange = jest.fn();

packages/components/src/external-link/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@ export function ExternalLink(
2626
).join( ' ' );
2727
const classes = classnames( 'components-external-link', className );
2828
return (
29+
/* eslint-disable react/jsx-no-target-blank */
2930
<a
3031
{ ...additionalProps }
3132
className={ classes }
3233
href={ href }
33-
// eslint-disable-next-line react/jsx-no-target-blank
3434
target="_blank"
3535
rel={ rel }
3636
ref={ ref }
@@ -47,6 +47,7 @@ export function ExternalLink(
4747
className="components-external-link__icon"
4848
/>
4949
</a>
50+
/* eslint-enable react/jsx-no-target-blank */
5051
);
5152
}
5253

packages/components/src/form-token-field/test/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ describe( 'FormTokenField', () => {
241241

242242
// before sending a hover event, we need to wait for
243243
// SuggestionList#_scrollingIntoView to become false
244-
jest.runTimersToTime( 100 );
244+
jest.advanceTimersByTime( 100 );
245245

246246
TestUtils.Simulate.mouseEnter( hoverSuggestion );
247247
expect( getSelectedSuggestion() ).toEqual( [ 'wi', 'th' ] );

0 commit comments

Comments
 (0)