Skip to content

Commit af507e3

Browse files
committed
fix: lint & typecheck
1 parent 60c671a commit af507e3

File tree

3 files changed

+10
-14
lines changed

3 files changed

+10
-14
lines changed

src/rangeUtils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ function sortRanges(ranges: MarkdownRange[]) {
2222
}
2323

2424
function groupRanges(ranges: MarkdownRange[]) {
25-
const lastVisibleRangeIndex: {[key in MarkdownType]?: number} = {};
25+
const lastVisibleRangeIndex: Partial<Record<MarkdownType, number>> = {};
2626

2727
return ranges.reduce((acc, range) => {
2828
const start = range.start;

src/web/utils/animationUtils.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,13 @@ const ANIMATED_ELEMENT_TYPES = ['spinner'] as const;
44

55
type AnimatedElementType = (typeof ANIMATED_ELEMENT_TYPES)[number];
66

7-
type AnimationTimes = {
8-
[key in AnimatedElementType]?: CSSNumberish[];
9-
};
7+
type AnimationTimes = Partial<Record<AnimatedElementType, CSSNumberish[]>>;
108

11-
const KEYFRAMES: {
12-
[key in AnimatedElementType]?: Keyframe[];
13-
} = {
9+
const KEYFRAMES: Partial<Record<AnimatedElementType, Keyframe[]>> = {
1410
spinner: [{transform: 'rotate(0deg)'}, {transform: 'rotate(360deg)'}],
1511
};
1612

17-
const OPTIONS: {[key in AnimatedElementType]?: KeyframeAnimationOptions} = {
13+
const OPTIONS: Partial<Record<AnimatedElementType, KeyframeAnimationOptions>> = {
1814
spinner: {
1915
duration: 1000,
2016
iterations: Infinity,

src/web/utils/webStyleUtils.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,27 +6,27 @@ import {mergeMarkdownStyleWithDefault} from '../../styleUtils';
66
let createReactDOMStyle: (style: any) => any;
77
try {
88
createReactDOMStyle =
9-
// eslint-disable-next-line @typescript-eslint/no-var-requires
9+
// eslint-disable-next-line @typescript-eslint/no-var-requires, @typescript-eslint/no-require-imports
1010
require('react-native-web/dist/exports/StyleSheet/compiler/createReactDOMStyle').default;
11-
} catch (e) {
11+
} catch {
1212
throw new Error('[react-native-live-markdown] Function `createReactDOMStyle` from react-native-web not found. Please make sure that you are using React Native Web 0.18 or newer.');
1313
}
1414

1515
let preprocessStyle: (style: any) => any;
1616
try {
1717
preprocessStyle =
18-
// eslint-disable-next-line @typescript-eslint/no-var-requires
18+
// eslint-disable-next-line @typescript-eslint/no-var-requires, @typescript-eslint/no-require-imports
1919
require('react-native-web/dist/exports/StyleSheet/preprocess').default;
20-
} catch (e) {
20+
} catch {
2121
throw new Error('[react-native-live-markdown] Function `preprocessStyle` from react-native-web not found.');
2222
}
2323

2424
let dangerousStyleValue: (name: string, value: any, isCustomProperty: boolean) => any;
2525
try {
2626
dangerousStyleValue =
27-
// eslint-disable-next-line @typescript-eslint/no-var-requires
27+
// eslint-disable-next-line @typescript-eslint/no-var-requires, @typescript-eslint/no-require-imports
2828
require('react-native-web/dist/modules/setValueForStyles/dangerousStyleValue').default;
29-
} catch (e) {
29+
} catch {
3030
throw new Error('[react-native-live-markdown] Function `dangerousStyleValue` from react-native-web not found.');
3131
}
3232

0 commit comments

Comments
 (0)