Skip to content

Commit a15966c

Browse files
author
Artur Bien
committed
style(all): fix lint issues
1 parent 20c3696 commit a15966c

File tree

11 files changed

+26
-30
lines changed

11 files changed

+26
-30
lines changed

example/src/MainNavigation.tsx

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,7 @@ import examples from './examples';
88

99
const flattenedExamples = examples.map(section => section.items).flat();
1010

11-
type RootStackParamList = {
12-
Home: undefined;
13-
ButtonExample: undefined;
14-
TextInputExample: undefined;
15-
};
16-
17-
const Stack = createStackNavigator<RootStackParamList>();
11+
const Stack = createStackNavigator();
1812

1913
const MainNavigation = () => {
2014
const { theme } = useContext(LocalThemeContext);
@@ -43,7 +37,6 @@ const MainNavigation = () => {
4337
{flattenedExamples.map(({ name, title, component }) => (
4438
<Stack.Screen
4539
key={name}
46-
/* @ts-ignore */
4740
name={name}
4841
component={component}
4942
options={{ title }}

example/src/examples/TypographyExample.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,7 @@ const TypographyExample = () => {
2424
</Container.Section>
2525
<Container.Section title='Anchor underlined'>
2626
<Panel>
27-
<Anchor onPress={() => console.warn('underline')} underline>
28-
React95 website
29-
</Anchor>
27+
<Anchor underline>React95 website</Anchor>
3028
</Panel>
3129
</Container.Section>
3230
</Container>

example/src/util/Container.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const styles = StyleSheet.create({
2323

2424
type ContainerProps = {
2525
children: React.ReactNode;
26-
style?: any;
26+
style?: StyleProp<ViewStyle>;
2727
};
2828

2929
const Container = ({ children, style }: ContainerProps) => (

src/Select/Select.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
StyleProp,
99
ViewStyle,
1010
} from 'react-native';
11+
import type { AnyValue } from '../types';
1112

1213
import { ThemeContext } from '../common/theming/Theme';
1314
import { blockSizes } from '../common/styles';
@@ -25,10 +26,10 @@ const dropdownSymbol = {
2526

2627
type Props = {
2728
options: Array<Option>;
28-
value: any;
29+
value: AnyValue;
2930
disabled?: boolean;
3031
// TODO: what to put below?
31-
onChange: (value: any) => void;
32+
onChange: (value: AnyValue) => void;
3233
style?: StyleProp<ViewStyle>;
3334
menuMaxHeight?: number;
3435
};

src/Select/SelectBase.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import React, { useContext, useState } from 'react';
22
import { StyleSheet, View, Text, TouchableHighlight } from 'react-native';
3-
3+
import type { AnyValue } from '../types';
44
import { ThemeContext } from '../common/theming/Theme';
55
import { blockSizes } from '../common/styles';
66

77
// TODO: allow for no option selected
88
export type Option = {
9-
value: any;
9+
value: AnyValue;
1010
label: React.ReactNode;
1111
};
1212

@@ -78,7 +78,7 @@ const styles = StyleSheet.create({
7878

7979
type SelectOptionsProps = {
8080
options: Array<Option>;
81-
values: [any];
81+
values: [AnyValue];
8282
onChange: (option: Option) => void;
8383
};
8484

src/Select/SelectBox.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React, { useContext } from 'react';
22
import { StyleProp, StyleSheet, View, ViewStyle } from 'react-native';
33
import { ThemeContext } from '../common/theming/Theme';
4+
import type { AnyValue } from '../types';
45

56
import getSelectOptions, { Option } from './SelectBase';
67
import { Border } from '../common/styleElements';
@@ -10,8 +11,8 @@ import { ScrollView } from '..';
1011

1112
type Props = {
1213
options: Array<Option>;
13-
value: [any] | any;
14-
onChange: (value: any) => void;
14+
value: [AnyValue] | AnyValue;
15+
onChange: (value: AnyValue) => void;
1516
style?: StyleProp<ViewStyle>;
1617
};
1718

src/Tabs/Tabs.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {
66
TouchableHighlight,
77
View,
88
} from 'react-native';
9-
9+
import type { AnyValue } from '../types';
1010
import { ThemeContext } from '../common/theming/Theme';
1111
import { padding, margin, blockSizes } from '../common/styles';
1212
import { Border } from '../common/styleElements';
@@ -15,8 +15,8 @@ import { Text, Panel } from '..';
1515
type TabsProps = {
1616
children?: React.ReactNode;
1717
style?: StyleProp<ViewStyle>;
18-
value: any;
19-
onChange?: (value: any) => void;
18+
value: AnyValue;
19+
onChange?: (value: AnyValue) => void;
2020
stretch?: boolean;
2121
};
2222

@@ -74,8 +74,8 @@ const Body = ({ children, style, ...rest }: TabBodyProps) => {
7474
type TabProps = {
7575
children?: React.ReactNode;
7676
style?: StyleProp<ViewStyle>;
77-
value: any;
78-
onPress?: (value: any) => void;
77+
value: AnyValue;
78+
onPress?: (value: AnyValue) => void;
7979
selected?: boolean;
8080
stretch?: boolean;
8181
};

src/TextInput/TextInput.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ const TextInput = ({
4444
placeholderTextColor={theme.materialTextDisabled}
4545
defaultValue={defaultValue}
4646
value={value}
47+
editable={!disabled}
4748
// eslint-disable-next-line react/jsx-props-no-spreading
4849
{...rest}
4950
/>

src/Typography/Text.spec.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
import React from 'react';
2-
import { render, fireEvent } from '@testing-library/react-native';
2+
import { render } from '@testing-library/react-native';
33

44
import { Text } from '..';
55

6-
const linkUrl = 'https://react95.io';
7-
86
const mockOpenUrl = jest.fn(url => Promise.resolve(url));
97

108
describe('<Text />', () => {

src/common/hooks/useControlledOrUncontrolled.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
import { useState, useCallback } from 'react';
2+
import type { AnyValue } from '../../types';
23

34
type Props = {
4-
value: any;
5-
defaultValue: any;
5+
value: AnyValue;
6+
defaultValue: AnyValue;
67
};
78

89
export default ({
910
value,
1011
defaultValue,
11-
}: Props): [any, (newValue: any) => void] => {
12+
}: Props): [AnyValue, (newValue: AnyValue) => void] => {
1213
const isControlled = value !== undefined;
1314
const [controlledValue, setControlledValue] = useState(defaultValue);
1415

0 commit comments

Comments
 (0)