Skip to content

Commit f061663

Browse files
Bump the typescript-eslint group with 2 updates (#13862)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Pascal Birchler <[email protected]>
1 parent 9fe7a35 commit f061663

File tree

34 files changed

+250
-218
lines changed

34 files changed

+250
-218
lines changed

.eslintrc

+2-5
Original file line numberDiff line numberDiff line change
@@ -333,11 +333,8 @@
333333
],
334334
"parser": "@typescript-eslint/parser",
335335
"parserOptions": {
336-
"EXPERIMENTAL_useProjectService": true,
337-
"warnOnUnsupportedTypeScriptVersion": false,
338-
"project": [
339-
".tsconfig.json"
340-
]
336+
"projectService": true,
337+
"warnOnUnsupportedTypeScriptVersion": false
341338
},
342339
"rules": {
343340
"@typescript-eslint/no-shadow": ["error",

package-lock.json

+191-161
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@
8484
"@types/node": "^22.9.3",
8585
"@types/styled-components": "^5.1.26",
8686
"@types/uuid": "^10.0.0",
87-
"@typescript-eslint/eslint-plugin": "^6.19.1",
88-
"@typescript-eslint/parser": "^6.19.1",
87+
"@typescript-eslint/eslint-plugin": "^8.16.0",
88+
"@typescript-eslint/parser": "^8.16.0",
8989
"@web-stories-wp/e2e-tests": "*",
9090
"@web-stories-wp/eslint-import-resolver": "*",
9191
"@web-stories-wp/jest-amp": "*",

packages/animation/src/components/test/animationProvider.tsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ import type { PropsWithChildren } from 'react';
2424
/**
2525
* Internal dependencies
2626
*/
27-
import { AnimationProvider, useStoryAnimationContext } from '..';
2827
import { createAnimationPart } from '../../parts';
29-
import { AnimationType, type Element } from '../../types';
28+
import { AnimationType, type Element, type StoryAnimation } from '../../types';
29+
import { AnimationProvider, useStoryAnimationContext } from '..';
3030

3131
jest.mock('flagged');
3232
jest.mock('../../parts', () => ({
@@ -187,13 +187,13 @@ describe('AnimationProvider', () => {
187187
rotationAngle: 0,
188188
};
189189
const elements = [element1, element2];
190-
const animType = AnimationType.Move as const;
190+
const animType = AnimationType.Move;
191191
const args = [
192192
{ bounces: 3, duration: 1000 },
193193
{ blinks: 2, offset: 20, blarks: 6, duration: 1000 },
194194
{ columns: 4, duration: 400 },
195195
];
196-
const animations = [
196+
const animations: StoryAnimation[] = [
197197
{ id: '1', targets: [target], type: animType, ...args[0] },
198198
{ id: '2', targets: [target], type: animType, ...args[1] },
199199
{ id: '3', targets: [target2], type: animType, ...args[2] },

packages/animation/src/utils/getOffPageOffset.ts

+8-8
Original file line numberDiff line numberDiff line change
@@ -24,27 +24,27 @@ import {
2424
type DimensionableElement,
2525
} from '@googleforcreators/units';
2626

27-
function calcTopOffset(box: ElementBox, dangerZoneOffset: number) {
27+
function calcTopOffset(box: ElementBox, dangerZoneOffset: number): number {
2828
const { y, height } = box;
2929
const toTop = dangerZoneOffset + y;
30-
return -Number((toTop / height) * 100.0 + 100.0).toFixed(5);
30+
return -Number(Number((toTop / height) * 100.0 + 100.0).toFixed(5));
3131
}
3232

33-
function calcBottomOffset(box: ElementBox, dangerZoneOffset: number) {
33+
function calcBottomOffset(box: ElementBox, dangerZoneOffset: number): number {
3434
const { y, height } = box;
3535
const toBottom = 100 - y + dangerZoneOffset;
36-
return Number((toBottom / height) * 100.0).toFixed(5);
36+
return Number(Number((toBottom / height) * 100.0).toFixed(5));
3737
}
3838

39-
function calcLeftOffset(box: ElementBox) {
39+
function calcLeftOffset(box: ElementBox): number {
4040
const { x, width } = box;
41-
return -Number((x / width) * 100.0 + 100.0).toFixed(5);
41+
return -Number(Number((x / width) * 100.0 + 100.0).toFixed(5));
4242
}
4343

44-
function calcRightOffset(box: ElementBox) {
44+
function calcRightOffset(box: ElementBox): number {
4545
const { x, width } = box;
4646
const toRight = 100 - x;
47-
return Number((toRight / width) * 100.0).toFixed(5);
47+
return Number(Number((toRight / width) * 100.0).toFixed(5));
4848
}
4949

5050
function getOffPageOffset(element: DimensionableElement) {

packages/animation/src/utils/test/getTotalDuration.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ const BASE_ANIMATION = {
2424
id: '1',
2525
targets: [],
2626
};
27-
const type = AnimationType.BlinkOn as const;
27+
const type = AnimationType.BlinkOn;
2828

2929
describe('getTotalDuration', () => {
3030
it('returns 0 if no animations supplied', () => {

packages/design-system/src/components/contextMenu/components/button.tsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,9 @@ const Button = forwardRef(function Button(
123123

124124
const handleClick = (evt: MouseEvent<HTMLButtonElement>) => {
125125
onClick(evt);
126-
dismissOnClick && onDismiss(evt.nativeEvent);
126+
if (dismissOnClick) {
127+
onDismiss(evt.nativeEvent);
128+
}
127129
};
128130

129131
const handleFocus = (evt: FocusEvent<HTMLButtonElement>) => {

packages/design-system/src/components/snackbar/snackbarMessage.tsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,9 @@ function SnackbarMessage({
230230
const handleAction = useCallback(
231231
(evt: MouseEvent<HTMLButtonElement>) => {
232232
onAction(evt);
233-
!isPreventActionDismiss && onDismiss();
233+
if (!isPreventActionDismiss) {
234+
onDismiss();
235+
}
234236
},
235237
[onAction, onDismiss, isPreventActionDismiss]
236238
);

packages/design-system/src/typings/styled.d.ts

+1
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,6 @@ import 'styled-components';
2525
import type { Theme } from '../theme';
2626

2727
declare module 'styled-components' {
28+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type -- On purpose.
2829
export interface DefaultTheme extends Theme {}
2930
}

packages/element-library/src/text/display.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ function TextDisplay({
257257
target.style.fontSize = updatedFontSize
258258
? `${dataToEditorY(updatedFontSize)}px`
259259
: '';
260-
const updatedMargin = transform?.updates?.marginOffset;
260+
const updatedMargin = transform?.updates?.marginOffset as number;
261261
target.style.margin = updatedMargin
262262
? `${dataToEditorY(-updatedMargin) / 2}px 0`
263263
: '';

packages/element-library/src/text/edit.tsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,9 @@ function TextEdit({
337337
editWrapper.style.left = `${boxRef.current.x + dx}px`;
338338
editWrapper.style.top = `${boxRef.current.y + dy}px`;
339339
}
340-
onResize && onResize();
340+
if (onResize) {
341+
onResize();
342+
}
341343
}
342344
}, [dataToEditorY, editWrapper, element, onResize, top, bottom]);
343345
// Invoke on each content update.

packages/element-library/src/typings/styled.d.ts

+1
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,6 @@ import 'styled-components';
2121
import type { Theme } from '@googleforcreators/design-system';
2222

2323
declare module 'styled-components' {
24+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type -- On purpose.
2425
export interface DefaultTheme extends Theme {}
2526
}

packages/media/src/seekVideo.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ function seekVideo(video: HTMLVideoElement, offset = 0.99): Promise<void> {
3232
video.addEventListener('seeking', (evt) => {
3333
const wait = setTimeout(() => {
3434
clearTimeout(wait);
35-
reject(evt);
35+
reject(evt as unknown as Error);
3636
}, THREE_SECONDS);
3737
});
3838
video.addEventListener('error', reject);

packages/rich-text/src/fauxSelection.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ export function useFauxSelection(
116116

117117
// Save that as the next editor state
118118
return selectedState;
119-
} catch (e) {
119+
} catch {
120120
// If the component has unmounted/remounted, some of the above might throw
121121
// if so, just ignore it and return old state
122122
return oldEditorState;

packages/rich-text/src/formatters/color.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ function stylesToCSS(styles: DraftInlineStyle): null | CSSProperties {
5757
let color: Pattern;
5858
try {
5959
color = styleToColor(style);
60-
} catch (e) {
60+
} catch {
6161
return null;
6262
}
6363

packages/rich-text/src/formatters/gradientColor.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ function stylesToCSS(styles: DraftInlineStyle): null | CSSProperties {
6868
let color: Pattern;
6969
try {
7070
color = styleToColor(colorStyle);
71-
} catch (e) {
71+
} catch {
7272
return null;
7373
}
7474

packages/rich-text/src/formatters/italic.ts

+1-4
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,7 @@ function isItalic(editorState: EditorState) {
5151
return !styles.includes(NONE);
5252
}
5353

54-
function toggleItalic(
55-
editorState: EditorState,
56-
flag?: undefined | boolean
57-
): EditorState {
54+
function toggleItalic(editorState: EditorState, flag?: boolean): EditorState {
5855
if (typeof flag === 'boolean') {
5956
return togglePrefixStyle(editorState, ITALIC, () => flag);
6057
}

packages/rich-text/src/formatters/underline.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ function isUnderline(editorState: EditorState) {
5151
return !styles.includes(NONE);
5252
}
5353

54-
function toggleUnderline(editorState: EditorState, flag?: undefined | boolean) {
54+
function toggleUnderline(editorState: EditorState, flag?: boolean) {
5555
if (typeof flag === 'boolean') {
5656
return togglePrefixStyle(editorState, UNDERLINE, () => flag);
5757
}

packages/rich-text/src/formatters/uppercase.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ function isUppercase(editorState: EditorState) {
5151
return !styles.includes(NONE);
5252
}
5353

54-
function toggleUppercase(editorState: EditorState, flag?: undefined | boolean) {
54+
function toggleUppercase(editorState: EditorState, flag?: boolean) {
5555
if (typeof flag === 'boolean') {
5656
return togglePrefixStyle(editorState, UPPERCASE, () => flag);
5757
}

packages/rich-text/src/formatters/weight.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ function isBold(editorState: EditorState) {
7373
return weights.every((w) => w >= SMALLEST_BOLD);
7474
}
7575

76-
function toggleBold(editorState: EditorState, flag?: undefined | boolean) {
76+
function toggleBold(editorState: EditorState, flag?: boolean) {
7777
if (typeof flag === 'boolean') {
7878
if (flag) {
7979
const getDefault = () => weightToStyle(DEFAULT_BOLD);

packages/story-editor/src/app/canvas/useCanvasCopyPaste.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ function useCanvasGlobalKeys() {
238238
if (files.length > 0) {
239239
uploadWithPreview(files);
240240
}
241-
} catch (e) {
241+
} catch {
242242
// Ignore.
243243
}
244244
},

packages/story-editor/src/app/media/utils/useDetectBaseColor.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ function useDetectBaseColor({
130130
});
131131
}
132132
}
133-
} catch (error) {
133+
} catch {
134134
// This might happen as an author when trying to updateMedia() that
135135
// was uploaded by someone else.
136136
// Do nothing with the error for now.
@@ -163,7 +163,7 @@ function useDetectBaseColor({
163163
if (posterResource) {
164164
imageSrc = getSmallestUrlForWidth(0, posterResource);
165165
}
166-
} catch (error) {
166+
} catch {
167167
// The user might not have the permission to access the video with context=edit.
168168
// This might happen as an author when the video
169169
// was uploaded by someone else.
@@ -181,7 +181,7 @@ function useDetectBaseColor({
181181
try {
182182
const color = await getMediaBaseColor(imageSrcProxied);
183183
await saveBaseColor(resource, color);
184-
} catch (error) {
184+
} catch {
185185
// Do nothing for now.
186186
}
187187
},

packages/story-editor/src/app/media/utils/useDetectVideoHasAudio.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ function useDetectVideoHasAudio({
8686
isMuted: !hasAudio,
8787
});
8888
}
89-
} catch (error) {
89+
} catch {
9090
// Do nothing for now.
9191
}
9292
},

packages/story-editor/src/app/media/utils/useFFmpeg.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -619,7 +619,7 @@ function useFFmpeg() {
619619
try {
620620
ffmpeg?.exit();
621621
// eslint-disable-next-line no-empty -- no-op
622-
} catch (e) {}
622+
} catch {}
623623

624624
trackTiming();
625625
}
@@ -674,7 +674,7 @@ function useFFmpeg() {
674674
try {
675675
ffmpeg?.exit();
676676
// eslint-disable-next-line no-empty -- no-op
677-
} catch (e) {}
677+
} catch {}
678678

679679
trackTiming();
680680
}

packages/story-editor/src/app/media/utils/useProcessMedia.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ function useProcessMedia({
236236
let file = null;
237237
try {
238238
file = await fetchRemoteFile(url, mimeType);
239-
} catch (e) {
239+
} catch {
240240
// Ignore for now.
241241
return;
242242
}
@@ -352,14 +352,14 @@ function useProcessMedia({
352352
let posterFile = null;
353353
try {
354354
file = await fetchRemoteFile(url, mimeType);
355-
} catch (e) {
355+
} catch {
356356
// Ignore for now.
357357
return;
358358
}
359359
if (poster) {
360360
try {
361361
posterFile = await fetchRemoteBlob(poster);
362-
} catch (e) {
362+
} catch {
363363
// Ignore for now.
364364
}
365365
}
@@ -451,14 +451,14 @@ function useProcessMedia({
451451
let posterFile = null;
452452
try {
453453
file = await fetchRemoteFile(url, mimeType);
454-
} catch (e) {
454+
} catch {
455455
// Ignore for now.
456456
return;
457457
}
458458
if (poster) {
459459
try {
460460
posterFile = await fetchRemoteBlob(poster);
461-
} catch (e) {
461+
} catch {
462462
// Ignore for now.
463463
}
464464
}
@@ -530,7 +530,7 @@ function useProcessMedia({
530530
let file = null;
531531
try {
532532
file = await fetchRemoteFile(url, mimeType);
533-
} catch (e) {
533+
} catch {
534534
// Ignore for now.
535535
return;
536536
}

packages/story-editor/src/app/story/effects/useHashState.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ function useHashState(
6363
}
6464
_value = JSON.parse(decodeURI(paramValue)) as string;
6565
}
66-
} catch (e) {
66+
} catch {
6767
// @TODO Add some error handling
6868
}
6969
return _value;

packages/story-editor/src/components/canvas/utils/getElementProperties.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ function getElementProperties(type: ElementType, element: Element) {
4646
let resource, scale, focalX, focalY, sticker;
4747
if (elementIs.sticker(element)) {
4848
sticker = element.sticker;
49-
ratio = STICKERS?.[sticker.type as keyof typeof STICKERS]?.aspectRatio;
49+
ratio = STICKERS?.[sticker.type]?.aspectRatio;
5050
} else if (elementIs.media(element)) {
5151
resource = element.resource;
5252
ratio =

packages/story-editor/src/components/mediaRecording/provider.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ function MediaRecordingProvider({ children }) {
249249
// remove these devices from the list.
250250
.filter((device) => device.label)
251251
);
252-
} catch (err) {
252+
} catch {
253253
// Do nothing for now.
254254
}
255255
}, []);

packages/story-editor/src/components/panels/design/link/link.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ function LinkPanel({ selectedElements, pushUpdateForObject }) {
177177
newIcon,
178178
needsProxy,
179179
});
180-
} catch (e) {
180+
} catch {
181181
setIsInvalidUrl(true);
182182
} finally {
183183
setFetchingMetadata(false);

packages/story-editor/src/utils/getMediaBaseColor.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ async function extractColorFromImage(img: HTMLImageElement): Promise<string> {
4141
if (err instanceof Error) {
4242
void trackError('image_base_color', err.message);
4343
}
44-
reject(err);
44+
reject(err as Error);
4545
}
4646
});
4747
}

packages/story-editor/src/utils/useCORSProxy.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ function useCORSProxy() {
5050
await fetch(link, {
5151
method: 'HEAD',
5252
});
53-
} catch (err) {
53+
} catch {
5454
shouldProxy = true;
5555
}
5656

0 commit comments

Comments
 (0)