Skip to content

Commit 8eab682

Browse files
author
Alexandr Kozhevnikov
committed
linter config
1 parent 436cac5 commit 8eab682

12 files changed

+85
-74
lines changed

.eslintrc.js

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
module.exports = {
22
root: true,
3-
extends: '@react-native-community',
3+
extends: ['@react-native-community', 'plugin:prettier/recommended', 'prettier'],
4+
plugins: ['react', 'unused-imports', 'prettier'],
45
rules: {
6+
'no-unused-vars': 'off', // or "@typescript-eslint/no-unused-vars": "off",
7+
'unused-imports/no-unused-imports': 'error',
8+
'unused-imports/no-unused-vars': [
9+
'warn',
10+
{ vars: 'all', varsIgnorePattern: '^_', args: 'after-used', argsIgnorePattern: '^_' }
11+
],
512
'prettier/prettier': [
613
'error',
714
{
@@ -10,14 +17,15 @@ module.exports = {
1017
bracketSameLine: true,
1118
bracketSpacing: true,
1219
singleQuote: true,
13-
trailingComma: 'all',
20+
trailingComma: 'none',
1421
tabWidth: 2,
1522
useTabs: false,
16-
semi: false,
17-
},
23+
semi: false
24+
}
1825
],
1926
semi: 'off',
27+
'comma-dangle': ['warn', 'never'],
2028
'react-native/no-inline-styles': 'off',
21-
'react-hooks/exhaustive-deps': 'off',
22-
},
29+
'react-hooks/exhaustive-deps': 'off'
30+
}
2331
}

example/App.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
useColorScheme,
99
View,
1010
Platform,
11-
KeyboardAvoidingView,
11+
KeyboardAvoidingView
1212
} from 'react-native'
1313

1414
import { Colors } from 'react-native/Libraries/NewAppScreen'
@@ -22,7 +22,7 @@ const App = () => {
2222
const isDarkMode = useColorScheme() === 'dark'
2323

2424
const backgroundStyle = {
25-
backgroundColor: isDarkMode ? Colors.darker : Colors.lighter,
25+
backgroundColor: isDarkMode ? Colors.darker : Colors.lighter
2626
}
2727

2828
return (
@@ -70,23 +70,23 @@ const App = () => {
7070

7171
const styles = StyleSheet.create({
7272
scrollContainer: {
73-
flex: 1,
73+
flex: 1
7474
},
7575
container: {
76-
padding: 20,
76+
padding: 20
7777
},
7878
title: {
7979
textAlign: 'center',
8080
fontSize: 25,
81-
marginBottom: 50,
81+
marginBottom: 50
8282
},
8383
section: {
84-
marginBottom: 40,
84+
marginBottom: 40
8585
},
8686
sectionTitle: {
8787
fontWeight: 'bold',
88-
marginBottom: 3,
89-
},
88+
marginBottom: 3
89+
}
9090
})
9191

9292
export default App

example/components/LocalDataSetExample.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export const LocalDataSetExample = memo(() => {
1515
dataSet={[
1616
{ id: '1', title: 'Alpha' },
1717
{ id: '2', title: 'Beta' },
18-
{ id: '3', title: 'Gamma' },
18+
{ id: '3', title: 'Gamma' }
1919
]}
2020
/>
2121
<Text style={{ color: '#668', fontSize: 13 }}>Selected item: {JSON.stringify(selectedItem)}</Text>

example/components/LocalDataSetExample2.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export const LocalDataSetExample2 = memo(() => {
1414
dataSet={[
1515
{ id: '1', title: '🐑' },
1616
{ id: '2', title: '✨' },
17-
{ id: '3', title: '👌' },
17+
{ id: '3', title: '👌' }
1818
]}
1919
suggestionsListMaxHeight={500}
2020
renderItem={(item, text) => (

example/components/RemoteDataSetExample.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,19 @@ export const RemoteDataSetExample = memo(() => {
1515
return
1616
}
1717
setLoading(true)
18-
const response = await fetch('https://jsonplaceholder.typicode.com/posts').then((data) => new Promise(res => {
19-
setTimeout(() => res(data), 2000) // imitate of a long response
20-
}))
18+
const response = await fetch('https://jsonplaceholder.typicode.com/posts').then(
19+
data =>
20+
new Promise(res => {
21+
setTimeout(() => res(data), 2000) // imitate of a long response
22+
})
23+
)
2124
const items = await response.json()
2225

2326
const suggestions = items
2427
.filter(item => item.title.toLowerCase().includes(filterToken))
2528
.map(item => ({
2629
id: item.id,
27-
title: item.title,
30+
title: item.title
2831
}))
2932

3033
setRemoteDataSet(suggestions)
@@ -39,13 +42,13 @@ export const RemoteDataSetExample = memo(() => {
3942
useFilter={false}
4043
clearOnFocus={false}
4144
textInputProps={{
42-
placeholder: 'Start typing est...',
45+
placeholder: 'Start typing est...'
4346
}}
4447
onSelectItem={setSelectedItem}
4548
loading={loading}
4649
onChangeText={getSuggestions}
4750
suggestionsListTextStyle={{
48-
color: '#8f3c96',
51+
color: '#8f3c96'
4952
}}
5053
EmptyResultComponent={<Text style={{ padding: 10, fontSize: 15 }}>Oops ¯\_(ツ)_/¯</Text>}
5154
/>

example/components/RemoteDataSetExample2.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export const RemoteDataSetExample2 = memo(() => {
2727
.filter(item => item.title.toLowerCase().includes(filterToken))
2828
.map(item => ({
2929
id: item.id,
30-
title: item.title,
30+
title: item.title
3131
}))
3232
setSuggestionsList(suggestions)
3333
setLoading(false)
@@ -44,7 +44,7 @@ export const RemoteDataSetExample2 = memo(() => {
4444
<View
4545
style={[
4646
{ flex: 1, flexDirection: 'row', alignItems: 'center' },
47-
Platform.select({ ios: { zIndex: 1 } }),
47+
Platform.select({ ios: { zIndex: 1 } })
4848
]}>
4949
<AutocompleteDropdown
5050
ref={searchRef}
@@ -73,21 +73,21 @@ export const RemoteDataSetExample2 = memo(() => {
7373
borderRadius: 25,
7474
backgroundColor: '#383b42',
7575
color: '#fff',
76-
paddingLeft: 18,
77-
},
76+
paddingLeft: 18
77+
}
7878
}}
7979
rightButtonsContainerStyle={{
8080
right: 8,
8181
height: 30,
8282

83-
alignSelf: 'center',
83+
alignSelf: 'center'
8484
}}
8585
inputContainerStyle={{
8686
backgroundColor: '#383b42',
87-
borderRadius: 25,
87+
borderRadius: 25
8888
}}
8989
suggestionsListContainerStyle={{
90-
backgroundColor: '#383b42',
90+
backgroundColor: '#383b42'
9191
}}
9292
containerStyle={{ flexGrow: 1, flexShrink: 1 }}
9393
renderItem={(item, text) => <Text style={{ color: '#fff', padding: 15 }}>{item.title}</Text>}

example/components/RemoteDataSetExample3.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export const RemoteDataSetExample3 = memo(() => {
2727
.filter(item => item.title.toLowerCase().includes(filterToken))
2828
.map(item => ({
2929
id: item.id,
30-
title: item.title,
30+
title: item.title
3131
}))
3232
setSuggestionsList(suggestions)
3333
setLoading(false)
@@ -44,7 +44,7 @@ export const RemoteDataSetExample3 = memo(() => {
4444
<View
4545
style={[
4646
{ flex: 1, flexDirection: 'row', alignItems: 'center' },
47-
Platform.select({ ios: { zIndex: 1 } }),
47+
Platform.select({ ios: { zIndex: 1 } })
4848
]}>
4949
<Button style={{ flexGrow: 0 }} title="Clear" onPress={() => dropdownController.current.clear()} />
5050
<View style={{ width: 10 }} />
@@ -74,12 +74,12 @@ export const RemoteDataSetExample3 = memo(() => {
7474
style: {
7575
borderRadius: 25,
7676
color: '#383b42',
77-
paddingLeft: 18,
78-
},
77+
paddingLeft: 18
78+
}
7979
}}
8080
rightButtonsContainerStyle={{
8181
height: 30,
82-
alignSelf: 'center',
82+
alignSelf: 'center'
8383
}}
8484
inputContainerStyle={{
8585
borderRadius: 25,
@@ -89,15 +89,15 @@ export const RemoteDataSetExample3 = memo(() => {
8989
shadowColor: '#00000099',
9090
shadowOffset: {
9191
width: 0,
92-
height: 5,
92+
height: 5
9393
},
9494
shadowOpacity: 0.3,
9595
shadowRadius: 8.46,
9696

97-
elevation: 13,
97+
elevation: 13
9898
}}
9999
suggestionsListContainerStyle={{
100-
backgroundColor: '#fff',
100+
backgroundColor: '#fff'
101101
}}
102102
containerStyle={{ flexGrow: 1, flexShrink: 1 }}
103103
renderItem={(item, text) => {

src/HOC/withFadeAnimation.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export const withFadeAnimation = (WrappedComponent, containerStyle) => {
1010
duration: 800,
1111
toValue: 1,
1212
useNativeDriver: true,
13-
easing: Easing.bezier(0.3, 0.58, 0.25, 0.99),
13+
easing: Easing.bezier(0.3, 0.58, 0.25, 0.99)
1414
}).start()
1515
}, [])
1616

src/NothingFound.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ export const NothingFound = memo(({ ...props }) => {
99
<Text style={styles.text}>{props.emptyResultText || 'Nothing found'}</Text>
1010
</View>
1111
),
12-
{},
12+
{}
1313
)
1414
return <EL />
1515
})
1616

1717
const styles = StyleSheet.create({
1818
container: {
19-
padding: 10,
19+
padding: 10
2020
},
21-
text: { textAlign: 'center' },
21+
text: { textAlign: 'center' }
2222
})

src/RightButton.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export const RightButton = memo(
1515
loading,
1616
buttonsContainerStyle,
1717
ChevronIconComponent,
18-
ClearIconComponent,
18+
ClearIconComponent
1919
}) => {
2020
const isOpenedAnimationValue = useRef(new Animated.Value(0)).current
2121

@@ -24,21 +24,21 @@ export const RightButton = memo(
2424
duration: 350,
2525
toValue: isOpened ? 1 : 0,
2626
useNativeDriver: true,
27-
easing: Easing.bezier(0.3, 0.58, 0.25, 0.99),
27+
easing: Easing.bezier(0.3, 0.58, 0.25, 0.99)
2828
}).start()
2929
}, [isOpened])
3030

3131
const chevronSpin = isOpenedAnimationValue.interpolate({
3232
inputRange: [0, 1],
33-
outputRange: ['0deg', '180deg'],
33+
outputRange: ['0deg', '180deg']
3434
})
3535

3636
return (
3737
<View
3838
style={{
3939
...styles.container,
4040
height: inputHeight,
41-
...buttonsContainerStyle,
41+
...buttonsContainerStyle
4242
}}>
4343
{!loading && showClear && (
4444
<TouchableOpacity onPress={onClearPress} style={styles.clearButton}>
@@ -55,7 +55,7 @@ export const RightButton = memo(
5555
)}
5656
</View>
5757
)
58-
},
58+
}
5959
)
6060

6161
const styles = StyleSheet.create({
@@ -67,16 +67,16 @@ const styles = StyleSheet.create({
6767
zIndex: 10,
6868
justifyContent: 'center',
6969
alignItems: 'center',
70-
backgroundColor: 'transparent',
70+
backgroundColor: 'transparent'
7171
},
7272
clearButton: {
7373
width: 26,
74-
alignItems: 'center',
74+
alignItems: 'center'
7575
},
7676
chevronButton: {
7777
width: 26,
7878
alignItems: 'center',
7979
height: '100%',
80-
justifyContent: 'center',
81-
},
80+
justifyContent: 'center'
81+
}
8282
})

0 commit comments

Comments
 (0)