Skip to content

Commit 69a56ba

Browse files
authored
chore: add @typescript-eslint/stylistic config and grammar fix in README.md (#711)
* chore: add @typescript-eslint/stylistic ESLint config and grammar fix in README.md * chore: updated examples deps * chore: updated deps * reformatted files * remove empty jsdoc comments
1 parent 9c7fd11 commit 69a56ba

File tree

10 files changed

+1054
-1420
lines changed

10 files changed

+1054
-1420
lines changed

.eslintrc.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ extends:
1010
- airbnb/hooks
1111
- eslint:recommended
1212
- plugin:@typescript-eslint/recommended
13+
- plugin:@typescript-eslint/stylistic
1314
- plugin:eslint-comments/recommended
1415
- plugin:import/errors
1516
- plugin:import/recommended
@@ -42,6 +43,10 @@ plugins:
4243
- react-hooks
4344
- react-native
4445
rules:
46+
'@typescript-eslint/array-type':
47+
- error
48+
- default: 'generic'
49+
readonly: 'generic'
4550
'@typescript-eslint/explicit-function-return-type': error
4651
'@typescript-eslint/explicit-module-boundary-types': error
4752
'@typescript-eslint/no-explicit-any':

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ export default function App() {
7777

7878
You can find more examples in the `examples` subdirectory. This subdirectory is
7979
a working [Expo](https://github.com/expo/expo) project demonstrating this
80-
library. It shows how to use the library with class components as well as
80+
library. It shows how to use the library with class components as well as with
8181
function components, and in TypeScript as well as in JavaScript. Navigate into
8282
the `examples` subdirectory, run `npm install`, and then run `npx expo start` to
8383
see the examples working.

examples/App.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,11 @@ const EXAMPLE_COMPONENT_ITEMS: Array<ItemType<ExampleComponent>> = [
6666
];
6767

6868
type Props = Record<string, never>;
69-
type State = {
69+
interface State {
7070
currentExample: ExampleComponent;
7171
examplePickerOpen: boolean;
7272
exampleComponents: Array<ItemType<ExampleComponent>>;
73-
};
73+
}
7474

7575
export default class App extends React.Component<Props, State> {
7676
constructor(props: Readonly<Props>) {

examples/example-src-files/typescript-class-example.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@ import React, { Component } from 'react';
22
import { Button, Text, View } from 'react-native';
33
import DropDownPicker, { ItemType } from 'react-native-dropdown-picker';
44

5-
type Props = {
5+
interface Props {
66
multiple: boolean;
7-
};
8-
type State = {
7+
}
8+
interface State {
99
open: boolean;
1010
singleValue: string | null;
11-
multiValue: string[] | null;
11+
multiValue: Array<string> | null;
1212
items: Array<ItemType<string>>;
13-
};
13+
}
1414

1515
export default class TypescriptClassExample extends Component<Props, State> {
1616
constructor(props: Readonly<Props>) {

examples/example-src-files/typescript-function-example.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export default function TypescriptFunctionExample(props: {
1212
}): JSX.Element {
1313
const [open, setOpen] = useState<boolean>(false);
1414
const [singleValue, setSingleValue] = useState<string | null>(null);
15-
const [multiValue, setMultiValue] = useState<string[] | null>(null);
15+
const [multiValue, setMultiValue] = useState<Array<string> | null>(null);
1616
const [items, setItems] = useState<Array<ItemType<string>>>([
1717
{ label: 'Apple', value: 'apple' },
1818
{ label: 'Banana', value: 'banana' },

examples/package-lock.json

Lines changed: 449 additions & 699 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/package.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
{
22
"name": "examples",
33
"version": "1.0.0",
4+
"private": true,
45
"main": "node_modules/expo/AppEntry.js",
56
"scripts": {
6-
"start": "expo start",
77
"android": "expo start --android",
88
"ios": "expo start --ios",
9+
"start": "expo start",
910
"web": "expo start --web"
1011
},
1112
"dependencies": {
12-
"expo": "~49.0.9",
13-
"expo-status-bar": "~1.6.0",
13+
"expo": "^49.0.13",
14+
"expo-status-bar": "~1.7.1",
1415
"react": "18.2.0",
15-
"react-native": "0.72.4",
16+
"react-native": "0.72.5",
1617
"react-native-dropdown-picker": "^5.4.6"
1718
},
1819
"devDependencies": {
19-
"@babel/core": "^7.22.15",
20-
"@types/react": "~18.2.21",
20+
"@babel/core": "^7.23.0",
21+
"@types/react": "~18.2.24",
2122
"typescript": "^5.2.2"
22-
},
23-
"private": true
23+
}
2424
}

index.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ declare module 'react-native-dropdown-picker' {
2222

2323
export type ValueType = string | number | boolean;
2424

25-
export type ItemType<T extends ValueType> = {
25+
export interface ItemType<T extends ValueType> {
2626
containerStyle?: StyleProp<ViewStyle>;
2727
disabled?: boolean;
2828
icon?: () => JSX.Element;
@@ -32,7 +32,7 @@ declare module 'react-native-dropdown-picker' {
3232
selectable?: boolean;
3333
testID?: string;
3434
value?: T;
35-
};
35+
}
3636

3737
export type ModeType = 'DEFAULT' | 'SIMPLE' | 'BADGE';
3838

0 commit comments

Comments
 (0)