Skip to content

Commit 69cbd2b

Browse files
Allow unused vars as object rest siblings
1 parent b15c2b2 commit 69cbd2b

File tree

4 files changed

+11
-6
lines changed

4 files changed

+11
-6
lines changed

eslint.config.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,17 @@ export default defineConfig([
4343
'import/no-named-as-default-member': 'off',
4444
'import/no-unresolved': 'off',
4545
'import/no-unused-modules': 'off',
46+
47+
// Prefer rules that are type aware
48+
'no-unused-vars': 'off',
49+
'@typescript-eslint/no-unused-vars': [
50+
'error',
51+
{
52+
argsIgnorePattern: '^_',
53+
varsIgnorePattern: '^_',
54+
ignoreRestSiblings: true,
55+
},
56+
],
4657
},
4758
settings: {
4859
'import/resolver': {

src/components/form-elements/checkboxes/Checkboxes.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ const CheckboxesComponent = forwardRef<HTMLDivElement, CheckboxesProps>((props,
7272

7373
return (
7474
<FormGroup<CheckboxesProps> inputType="checkboxes" {...rest}>
75-
{/* eslint-disable-next-line @typescript-eslint/no-unused-vars */}
7675
{({ className, small, name, id, idPrefix, error, ...restRenderProps }) => {
7776
resetCheckboxIds();
7877
const contextValue: ICheckboxesContext = {

src/components/form-elements/radios/Radios.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ const RadiosComponent = forwardRef<HTMLDivElement, RadiosProps>((props, forwarde
7979

8080
return (
8181
<FormGroup<RadiosProps> inputType="radios" {...rest}>
82-
{/* eslint-disable-next-line @typescript-eslint/no-unused-vars */}
8382
{({ className, inline, small, name, id, error, ...restRenderProps }) => {
8483
resetRadioIds();
8584
const contextValue: IRadiosContext = {

src/components/utils/__tests__/FormGroup.test.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,6 @@ describe('FormGroup', () => {
220220
it('string component', async () => {
221221
const { container } = await renderClient(
222222
<FormGroup<TextInputProps> inputType="input" error="Oh no there's an error!">
223-
{/* eslint-disable-next-line @typescript-eslint/no-unused-vars */}
224223
{({ error, ...rest }) => <input {...rest} />}
225224
</FormGroup>,
226225
{ className: 'nhsuk-form-group' },
@@ -245,7 +244,6 @@ describe('FormGroup', () => {
245244
hint="This is a hint"
246245
label="Form Label"
247246
>
248-
{/* eslint-disable-next-line @typescript-eslint/no-unused-vars */}
249247
{({ error, ...rest }) => <input {...rest} />}
250248
</FormGroup>
251249
</main>,
@@ -264,7 +262,6 @@ describe('FormGroup', () => {
264262
error="This is an error"
265263
hint="This is a hint"
266264
>
267-
{/* eslint-disable-next-line @typescript-eslint/no-unused-vars */}
268265
{({ error, ...rest }) => <input {...rest} />}
269266
</FormGroup>,
270267
{ className: 'nhsuk-form-group' },
@@ -279,7 +276,6 @@ describe('FormGroup', () => {
279276
it('should have no aria-describedby when there is no hint or label', async () => {
280277
const { container } = await renderClient(
281278
<FormGroup<TextInputProps> inputType="input">
282-
{/* eslint-disable-next-line @typescript-eslint/no-unused-vars */}
283279
{({ error, ...rest }) => <input {...rest} />}
284280
</FormGroup>,
285281
{ className: 'nhsuk-form-group' },

0 commit comments

Comments
 (0)