Dev: allow unused destructured variables in lint rules (#33548)
Allow unused destructured variables in lint rules - there were exceptions to the rule being added everywhere and it seems to be a reasonable allowance
This commit is contained in:
parent
feb3ab0581
commit
04bef970ef
|
@ -129,10 +129,6 @@ export function searchItemsByString< T extends ItemType >(
|
||||||
* @return {string} Resource name for item totals.
|
* @return {string} Resource name for item totals.
|
||||||
*/
|
*/
|
||||||
export function getTotalCountResourceName( itemType: string, query: Query ) {
|
export function getTotalCountResourceName( itemType: string, query: Query ) {
|
||||||
// Disable eslint rule because we're using this spread to omit properties
|
|
||||||
// that don't affect item totals count results.
|
|
||||||
// eslint-disable-next-line no-unused-vars, camelcase
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
||||||
const { _fields, page, per_page, ...totalsQuery } = query;
|
const { _fields, page, per_page, ...totalsQuery } = query;
|
||||||
|
|
||||||
return getResourceName( 'total-' + itemType, { ...totalsQuery } );
|
return getResourceName( 'total-' + itemType, { ...totalsQuery } );
|
||||||
|
|
|
@ -100,8 +100,6 @@ describe( 'orders reducer', () => {
|
||||||
totalCount,
|
totalCount,
|
||||||
} );
|
} );
|
||||||
|
|
||||||
const resourceName = getOrderResourceName( query );
|
|
||||||
|
|
||||||
expect( state.data[ 1 ].total ).toEqual( initialState.data[ 1 ].total );
|
expect( state.data[ 1 ].total ).toEqual( initialState.data[ 1 ].total );
|
||||||
expect( state.data[ 2 ] ).toEqual( orders[ 1 ] );
|
expect( state.data[ 2 ] ).toEqual( orders[ 1 ] );
|
||||||
} );
|
} );
|
||||||
|
|
|
@ -28,9 +28,6 @@ export function getOrderResourceName( query: Partial< OrdersQuery > ) {
|
||||||
export function getTotalOrderCountResourceName(
|
export function getTotalOrderCountResourceName(
|
||||||
query: Partial< OrdersQuery >
|
query: Partial< OrdersQuery >
|
||||||
) {
|
) {
|
||||||
// Disable eslint rule because we're using this spread to omit properties
|
|
||||||
// that don't affect item totals count results.
|
|
||||||
// eslint-disable-next-line no-unused-vars, camelcase
|
|
||||||
const { _fields, page, per_page, ...totalsQuery } = query;
|
const { _fields, page, per_page, ...totalsQuery } = query;
|
||||||
|
|
||||||
return getOrderResourceName( totalsQuery );
|
return getOrderResourceName( totalsQuery );
|
||||||
|
|
|
@ -28,10 +28,6 @@ export function getProductResourceName( query: Partial< ProductQuery > ) {
|
||||||
export function getTotalProductCountResourceName(
|
export function getTotalProductCountResourceName(
|
||||||
query: Partial< ProductQuery >
|
query: Partial< ProductQuery >
|
||||||
) {
|
) {
|
||||||
// Disable eslint rule because we're using this spread to omit properties
|
|
||||||
// that don't affect item totals count results.
|
|
||||||
// eslint-disable-next-line no-unused-vars, camelcase
|
|
||||||
const { _fields, page, per_page, ...totalsQuery } = query;
|
const { _fields, page, per_page, ...totalsQuery } = query;
|
||||||
|
|
||||||
return getProductResourceName( totalsQuery );
|
return getProductResourceName( totalsQuery );
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
Significance: minor
|
||||||
|
Type: dev
|
||||||
|
|
||||||
|
Allow unused destructured variables in lint rules #35548
|
|
@ -35,10 +35,11 @@ module.exports = {
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
'no-unused-vars': [
|
'@typescript-eslint/no-unused-vars': [
|
||||||
'error',
|
'error',
|
||||||
{
|
{
|
||||||
varsIgnorePattern: 'createElement',
|
varsIgnorePattern: 'createElement',
|
||||||
|
ignoreRestSiblings: true,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
'react/react-in-jsx-scope': 'error',
|
'react/react-in-jsx-scope': 'error',
|
||||||
|
|
Loading…
Reference in New Issue