Skip to content

Commit da5d11f

Browse files
committed
Fix most lint errors
1 parent f091413 commit da5d11f

File tree

14 files changed

+100
-106
lines changed

14 files changed

+100
-106
lines changed

dotcom-rendering/src/admin/appsNavTool/AppsNavTool.stories.tsx

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import type { Meta, StoryObj } from '@storybook/react-webpack5';
2+
import { fn, within } from 'storybook/test';
23
import { parse } from 'valibot';
3-
import { ukNav } from '../../../fixtures/manual/appsNav/uk';
44
import { auNav } from '../../../fixtures/manual/appsNav/au';
5-
import { AppsNavSchema, type AppsNav } from './appsNav';
6-
import { AppsNavTool, PublishResult } from './AppsNavTool';
7-
import { fn, within } from 'storybook/test';
5+
import { ukNav } from '../../../fixtures/manual/appsNav/uk';
86
import { error, ok } from '../../lib/result';
7+
import { AppsNavSchema } from './appsNav';
8+
import type { PublishResult } from './AppsNavTool';
9+
import { AppsNavTool } from './AppsNavTool';
910

1011
const meta = {
1112
title: 'Admin/Apps Nav Tool',
@@ -21,9 +22,7 @@ export const UKNav = {
2122
nav: parse(AppsNavSchema, ukNav),
2223
editionId: 'UK',
2324
guardianBaseUrl: 'https://www.theguardian.com',
24-
publish: fn((_data: AppsNav) =>
25-
Promise.resolve<PublishResult>(ok(true)),
26-
),
25+
publish: fn(() => Promise.resolve<PublishResult>(ok(true))),
2726
},
2827
} satisfies Story;
2928

@@ -37,21 +36,21 @@ export const AUNav = {
3736

3837
export const AddSectionForm = {
3938
...UKNav,
40-
play: ({ canvas, userEvent }) => {
39+
play: async ({ canvas, userEvent }) => {
4140
const addSection = canvas.getByRole('button', { name: 'Add Section' });
4241

43-
userEvent.click(addSection);
42+
await userEvent.click(addSection);
4443
},
4544
} satisfies Story;
4645

4746
export const EditSectionForm = {
4847
...UKNav,
49-
play: ({ canvas, userEvent }) => {
48+
play: async ({ canvas, userEvent }) => {
5049
// ! is used here to make sure we get an error in storybook if this
5150
// can't be found.
5251
const addSection = canvas.getAllByRole('button', { name: 'Edit' })[0]!;
5352

54-
userEvent.click(addSection);
53+
await userEvent.click(addSection);
5554
},
5655
} satisfies Story;
5756

@@ -147,7 +146,7 @@ export const PublishConfirm = {
147146
export const PublishError = {
148147
args: {
149148
...UKNav.args,
150-
publish: fn((_data: AppsNav) =>
149+
publish: fn(() =>
151150
Promise.resolve<PublishResult>(error('NetworkError')),
152151
),
153152
},

dotcom-rendering/src/admin/appsNavTool/AppsNavTool.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
import { headlineMedium34Object, space } from '@guardian/source/foundations';
22
import { useCallback, useReducer } from 'react';
3+
import { type EditionId, getEditionFromId } from '../../lib/edition';
4+
import type { Result } from '../../lib/result';
35
import { type AppsNav } from './appsNav';
4-
import { DispatchContext, reducer } from './state';
5-
import { MenuButtons } from './MenuButtons';
6-
import { Sections } from './Sections';
7-
import { getEditionFromId, type EditionId } from '../../lib/edition';
86
import { EditDialog } from './EditDialog';
9-
import { InsertDialog } from './InsertDialog';
10-
import { StatusMessage } from './StatusMessage';
11-
import type { Result } from '../../lib/result';
127
import type { PublishError } from './error';
8+
import { InsertDialog } from './InsertDialog';
9+
import { MenuButtons } from './MenuButtons';
1310
import { PublishDialog } from './PublishDialog';
11+
import { Sections } from './Sections';
12+
import { DispatchContext, reducer } from './state';
13+
import { StatusMessage } from './StatusMessage';
1414

1515
type Props = {
1616
nav: AppsNav;

dotcom-rendering/src/admin/appsNavTool/Dialog.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {
33
palette,
44
space,
55
} from '@guardian/source/foundations';
6-
import { useEffect, useRef, type ReactNode } from 'react';
6+
import { type ReactNode, useEffect, useRef } from 'react';
77

88
type Props = {
99
children: ReactNode;

dotcom-rendering/src/admin/appsNavTool/EditDialog.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { useCallback } from 'react';
2-
import { useDispatch, type State } from './state';
32
import { SectionForm } from './SectionForm';
3+
import { type State, useDispatch } from './state';
44

55
type Props = {
66
editing: State['editing'] | undefined;

dotcom-rendering/src/admin/appsNavTool/InsertDialog.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { useCallback } from 'react';
2-
import { useDispatch, type State } from './state';
32
import { SectionForm } from './SectionForm';
3+
import { type State, useDispatch } from './state';
44

55
type Props = {
66
insertingAt: State['insertingAt'] | undefined;

dotcom-rendering/src/admin/appsNavTool/MenuButtons.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import { space } from '@guardian/source/foundations';
22
import {
33
Button,
4-
SvgReload,
54
SvgArrowOutdent,
65
SvgPlus,
6+
SvgReload,
77
SvgUpload,
88
} from '@guardian/source/react-components';
9-
import type { Section } from './appsNav';
10-
import { useDispatch, type HistoryEvent } from './state';
119
import type { ReactNode } from 'react';
10+
import type { Section } from './appsNav';
11+
import { type HistoryEvent, useDispatch } from './state';
1212

1313
type Props = {
1414
initialSections: Section[];

dotcom-rendering/src/admin/appsNavTool/PublishDialog.tsx

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
1-
import { useCallback, type FormEventHandler, type ReactNode } from 'react';
2-
import { Dialog } from './Dialog';
3-
import { type HistoryEvent } from './state';
1+
import { css } from '@emotion/react';
2+
import {
3+
headlineBold17Object,
4+
palette,
5+
space,
6+
textEgyptian17Object,
7+
} from '@guardian/source/foundations';
48
import {
59
Button,
610
SvgArrowDownStraight,
@@ -10,15 +14,11 @@ import {
1014
SvgPlus,
1115
SvgUpload,
1216
} from '@guardian/source/react-components';
13-
import {
14-
headlineBold17Object,
15-
palette,
16-
space,
17-
textEgyptian17Object,
18-
} from '@guardian/source/foundations';
19-
import { useDispatch } from './state';
20-
import { css } from '@emotion/react';
17+
import { type FormEventHandler, type ReactNode, useCallback } from 'react';
2118
import type { Section } from './appsNav';
19+
import { Dialog } from './Dialog';
20+
import { type HistoryEvent } from './state';
21+
import { useDispatch } from './state';
2222

2323
type Props = {
2424
history: HistoryEvent[];
@@ -27,12 +27,14 @@ type Props = {
2727
};
2828

2929
export const PublishDialog = (props: Props) => {
30+
const { publish } = props;
31+
3032
const submit: FormEventHandler = useCallback(
3133
(e) => {
3234
e.preventDefault();
3335
props.publish();
3436
},
35-
[props.publish],
37+
[publish],
3638
);
3739

3840
return (

dotcom-rendering/src/admin/appsNavTool/SectionButtons.tsx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1+
import { css } from '@emotion/react';
12
import { space } from '@guardian/source/foundations';
23
import {
34
Button,
4-
SvgEdit,
5-
SvgBin,
6-
SvgArrowUpStraight,
75
SvgArrowDownStraight,
6+
SvgArrowUpStraight,
7+
SvgBin,
8+
SvgEdit,
89
SvgPlus,
910
} from '@guardian/source/react-components';
1011
import type { MobileOverride } from './appsNav';
1112
import { useDispatch } from './state';
12-
import { css } from '@emotion/react';
1313

1414
type Props = {
1515
location: number[];
@@ -52,7 +52,7 @@ const Edit = (props: {
5252
size="xsmall"
5353
priority="primary"
5454
icon={<SvgEdit />}
55-
hideLabel
55+
hideLabel={true}
5656
onClick={() =>
5757
dispatch({
5858
kind: 'edit',
@@ -76,7 +76,7 @@ const Delete = (props: { location: Props['location'] }) => {
7676
size="xsmall"
7777
priority="primary"
7878
icon={<SvgBin />}
79-
hideLabel
79+
hideLabel={true}
8080
onClick={() =>
8181
dispatch({ kind: 'delete', location: props.location })
8282
}
@@ -98,7 +98,7 @@ const MoveUp = (props: { location: Props['location']; index: number }) => {
9898
priority="secondary"
9999
icon={<SvgArrowUpStraight />}
100100
disabled={props.index === 0}
101-
hideLabel
101+
hideLabel={true}
102102
onClick={() =>
103103
dispatch({ kind: 'moveUp', location: props.location })
104104
}
@@ -124,7 +124,7 @@ const MoveDown = (props: {
124124
priority="secondary"
125125
icon={<SvgArrowDownStraight />}
126126
disabled={props.index === props.numberOfSections - 1}
127-
hideLabel
127+
hideLabel={true}
128128
onClick={() =>
129129
dispatch({ kind: 'moveDown', location: props.location })
130130
}
@@ -145,7 +145,7 @@ const AddSubsection = (props: { location: Props['location'] }) => {
145145
size="xsmall"
146146
priority="tertiary"
147147
icon={<SvgPlus />}
148-
hideLabel
148+
hideLabel={true}
149149
onClick={() =>
150150
dispatch({ kind: 'insertInto', location: props.location })
151151
}

dotcom-rendering/src/admin/appsNavTool/SectionForm.tsx

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1+
import { css } from '@emotion/react';
12
import { space } from '@guardian/source/foundations';
2-
import { TextInput, Button, Select } from '@guardian/source/react-components';
3+
import { Button, Select, TextInput } from '@guardian/source/react-components';
34
import {
4-
useState,
5+
type ChangeEventHandler,
56
type FormEventHandler,
67
useCallback,
7-
type ChangeEventHandler,
8+
useState,
89
} from 'react';
9-
import { css } from '@emotion/react';
10-
import { mobileOverrideOptions, type MobileOverride } from './appsNav';
10+
import { type MobileOverride, mobileOverrideOptions } from './appsNav';
1111
import { Dialog } from './Dialog';
1212

1313
type Props = {
@@ -83,6 +83,8 @@ const MobileOverrideSelect = (props: {
8383
mobileOverride: MobileOverride | undefined;
8484
setMobileOverride: (a: MobileOverride | undefined) => void;
8585
}) => {
86+
const { setMobileOverride } = props;
87+
8688
const onChange = useCallback<ChangeEventHandler<HTMLSelectElement>>(
8789
(e) => {
8890
if (isMobileOverride(e.target.value)) {
@@ -91,7 +93,7 @@ const MobileOverrideSelect = (props: {
9193
props.setMobileOverride(undefined);
9294
}
9395
},
94-
[props.setMobileOverride],
96+
[setMobileOverride],
9597
);
9698

9799
return (

dotcom-rendering/src/admin/appsNavTool/Sections.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ import {
33
palette,
44
space,
55
} from '@guardian/source/foundations';
6-
import { type Section as SectionModel } from './appsNav';
7-
import { SectionButtons } from './SectionButtons';
86
import { SvgChevronDownSingle } from '@guardian/source/react-components';
97
import type { ReactNode } from 'react';
8+
import { type Section as SectionModel } from './appsNav';
9+
import { SectionButtons } from './SectionButtons';
1010

1111
type Props = {
1212
sections: SectionModel[];
@@ -51,7 +51,7 @@ const Section = (props: {
5151
numberOfSections={props.numberOfSections}
5252
/>
5353
<Chevron subSections={props.section.sections} />
54-
<Title location={props.location}>{props.section.title}</Title>{' '}
54+
<Title>{props.section.title}</Title>{' '}
5555
<Path
5656
path={props.section.path}
5757
guardianBaseUrl={props.guardianBaseUrl}
@@ -127,7 +127,7 @@ const Chevron = (props: { subSections: SectionModel[] | undefined }) => {
127127
);
128128
};
129129

130-
const Title = (props: { children: ReactNode; location: number[] }) => (
130+
const Title = (props: { children: ReactNode }) => (
131131
<span
132132
css={{
133133
...headlineBold17Object,

0 commit comments

Comments
 (0)