Skip to content

Commit 35dc036

Browse files
jaworekDrakeoon
andauthored
chore: update eslint (#3356)
Co-authored-by: Daniel Szczepanik <[email protected]>
1 parent 5282be5 commit 35dc036

File tree

237 files changed

+2708
-2920
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

237 files changed

+2708
-2920
lines changed

.eslintignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,6 @@ testSetup.js
77

88
# generated by bob
99
lib/
10+
11+
# babel files
12+
src/babel

.eslintrc

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@
33
"browser": true
44
},
55

6-
"extends": ["@callstack"],
7-
8-
"plugins": ["react-native"],
6+
"extends": "@callstack",
97

108
"rules": {
119
"one-var": "off",
@@ -16,10 +14,39 @@
1614

1715
"import/no-extraneous-dependencies": "off",
1816
"import/first": "off",
17+
"import/order": [
18+
"error",
19+
{
20+
"groups": [
21+
["external", "builtin"],
22+
"internal",
23+
["sibling", "parent"],
24+
"index"
25+
],
26+
"pathGroups": [
27+
{
28+
"pattern": "@(react|react-native)",
29+
"group": "external",
30+
"position": "before"
31+
},
32+
{
33+
"pattern": "@src/**",
34+
"group": "internal"
35+
}
36+
],
37+
"pathGroupsExcludedImportTypes": ["internal", "react"],
38+
"newlines-between": "always",
39+
"alphabetize": {
40+
"order": "asc",
41+
"caseInsensitive": true
42+
}
43+
}
44+
],
1945

2046
"react-native/no-unused-styles": "error",
2147
"react-native/split-platform-components": "off",
22-
"react-native/no-raw-text": "off"
48+
"react-native/no-raw-text": "off",
49+
"react-native-a11y/has-valid-accessibility-descriptors": "off"
2350
},
2451

2552
"settings": {

docs/component-docs.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* @flow */
22

3-
import path from 'path';
43
import fs from 'fs';
4+
import path from 'path';
55

66
const root = path.join(__dirname, '..');
77
const dist = path.join(__dirname, 'dist');

docs/pages/0.index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/* @flow */
22

33
import * as React from 'react';
4+
45
import Home from './src/Home';
56

67
export default class Index extends React.Component<{}> {

docs/pages/6.showcase.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/* @flow */
22

33
import * as React from 'react';
4+
45
import Showcase from './src/Showcase';
56

67
export default class ShowcasePage extends React.Component<{}> {

docs/pages/src/Home.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22
/* eslint-disable import/no-commonjs */
33

44
import * as React from 'react';
5-
import { styled } from 'linaria/react';
5+
66
import { Link, Header } from 'component-docs/components';
7+
import { styled } from 'linaria/react';
8+
79
import ThemeIcon from '../../components/theme-icon';
810
import Content from './components/Content';
911

docs/pages/src/Showcase.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
/* @flow */
22

33
import * as React from 'react';
4-
import { styled } from 'linaria/react';
4+
55
import color from 'color';
66
import { Header } from 'component-docs/components';
7+
import { styled } from 'linaria/react';
78

9+
import GithubIcon from '../../components/github-icon';
810
import GooglePlayIcon from '../../components/google-play-icon';
911
import IphoneIcon from '../../components/iphone-icon';
1012
import Content from './components/Content';
11-
import GithubIcon from '../../components/github-icon';
1213

1314
type Data = {
1415
color: string,
@@ -198,7 +199,11 @@ export default class Showcase extends React.Component<{}> {
198199
return (
199200
<div key={item.image}>
200201
<ImageContainer>
201-
<Image src={item.image} alt="" />
202+
<Image
203+
src={item.image}
204+
alt=""
205+
accessibilityIgnoresInvertColors
206+
/>
202207
<Info style={{ backgroundColor: item.color }}>
203208
<AppName
204209
style={{

docs/pages/src/components/IconsList.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/* @flow */
22

33
import * as React from 'react';
4+
45
import { styled } from 'linaria/react';
56
import icons from 'react-native-vector-icons/glyphmaps/MaterialCommunityIcons.json';
67

example/.eslintrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"extends": "../.eslintrc",
33

44
"settings": {
5-
"import/core-modules": [ "react-native-paper" ]
5+
"import/core-modules": ["react-native-paper"]
66
},
77

88
"rules": {

example/babel.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
const path = require('path');
2+
23
const pak = require('../package.json');
34

45
module.exports = function (api) {

example/metro.config.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
// /* eslint-disable import/no-commonjs */
22

3-
const path = require('path');
4-
const blacklist = require('metro-config/src/defaults/exclusionList');
53
const escape = require('escape-string-regexp');
4+
const blacklist = require('metro-config/src/defaults/exclusionList');
5+
const path = require('path');
6+
67
const pak = require('../package.json');
78

89
const root = path.resolve(__dirname, '..');

example/src/DrawerItems.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import * as React from 'react';
22
import { View, StyleSheet, I18nManager } from 'react-native';
3+
34
import { DrawerContentScrollView } from '@react-navigation/drawer';
5+
import * as Updates from 'expo-updates';
46
import {
57
Badge,
68
Drawer,
@@ -11,8 +13,9 @@ import {
1113
useTheme,
1214
MD3Colors,
1315
} from 'react-native-paper';
14-
import * as Updates from 'expo-updates';
16+
1517
import { isWeb } from '../utils';
18+
1619
import { PreferencesContext } from './';
1720

1821
type Props = {

example/src/ExampleList.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
import * as React from 'react';
22
import { FlatList } from 'react-native';
3+
4+
import type { StackNavigationProp } from '@react-navigation/stack';
35
import { List, Divider, useTheme } from 'react-native-paper';
46
import { useSafeArea } from 'react-native-safe-area-context';
5-
import type { StackNavigationProp } from '@react-navigation/stack';
67

78
import ActivityIndicatorExample from './Examples/ActivityIndicatorExample';
9+
import AnimatedFABExample from './Examples/AnimatedFABExample';
810
import AppbarExample from './Examples/AppbarExample';
911
import AvatarExample from './Examples/AvatarExample';
1012
import BadgeExample from './Examples/BadgeExample';
@@ -27,18 +29,17 @@ import MenuExample from './Examples/MenuExample';
2729
import ProgressBarExample from './Examples/ProgressBarExample';
2830
import RadioButtonExample from './Examples/RadioButtonExample';
2931
import RadioButtonGroupExample from './Examples/RadioButtonGroupExample';
32+
import RadioButtonItemExample from './Examples/RadioButtonItemExample';
3033
import SearchbarExample from './Examples/SearchbarExample';
34+
import SegmentedButtonExample from './Examples/SegmentedButtonsExample';
3135
import SnackbarExample from './Examples/SnackbarExample';
3236
import SurfaceExample from './Examples/SurfaceExample';
3337
import SwitchExample from './Examples/SwitchExample';
3438
import TextExample from './Examples/TextExample';
3539
import TextInputExample from './Examples/TextInputExample';
40+
import ThemeExample from './Examples/ThemeExample';
3641
import ToggleButtonExample from './Examples/ToggleButtonExample';
3742
import TouchableRippleExample from './Examples/TouchableRippleExample';
38-
import ThemeExample from './Examples/ThemeExample';
39-
import RadioButtonItemExample from './Examples/RadioButtonItemExample';
40-
import AnimatedFABExample from './Examples/AnimatedFABExample';
41-
import SegmentedButtonExample from './Examples/SegmentedButtonsExample';
4243

4344
export const examples: Record<
4445
string,

example/src/Examples/ActivityIndicatorExample.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
import * as React from 'react';
22
import { View, StyleSheet } from 'react-native';
3+
34
import {
45
ActivityIndicator,
56
MD2Colors,
67
FAB,
78
useTheme,
89
MD3Colors,
910
} from 'react-native-paper';
11+
1012
import ScreenWrapper from '../ScreenWrapper';
1113

1214
const ActivityIndicatorExample = () => {

example/src/Examples/AnimatedFABExample/AnimatedFABExample.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import * as React from 'react';
22
import { View, StyleSheet, FlatList, Animated, Platform } from 'react-native';
33
import type { NativeSyntheticEvent, NativeScrollEvent } from 'react-native';
4+
45
import {
56
MD2Colors,
67
MD3Colors,
@@ -10,6 +11,7 @@ import {
1011
Text,
1112
} from 'react-native-paper';
1213
import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
14+
1315
import { animatedFABExampleData } from '../../../utils';
1416
import CustomFAB from './CustomFAB';
1517
import CustomFABControls, {

example/src/Examples/AnimatedFABExample/CustomFAB.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
StyleSheet,
77
Platform,
88
} from 'react-native';
9+
910
import { AnimatedFAB, useTheme } from 'react-native-paper';
1011

1112
type CustomFABProps = {

example/src/Examples/AnimatedFABExample/CustomFABControls.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import React from 'react';
22
import { StyleSheet, View, FlatList } from 'react-native';
3-
import { Paragraph, RadioButton, Text, useTheme } from 'react-native-paper';
3+
4+
import { TouchableOpacity } from 'react-native-gesture-handler';
45
import type {
56
AnimatedFABAnimateFrom,
67
AnimatedFABIconMode,
78
} from 'react-native-paper';
8-
import { TouchableOpacity } from 'react-native-gesture-handler';
9+
import { Paragraph, RadioButton, Text, useTheme } from 'react-native-paper';
910

1011
export type Controls = {
1112
iconMode: AnimatedFABIconMode;
@@ -45,6 +46,7 @@ const CustomControl = ({
4546

4647
return (
4748
<TouchableOpacity
49+
accessibilityRole="button"
4850
onPress={() => onChange(item)}
4951
style={styles.controlItem}
5052
>

example/src/Examples/AppbarExample.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import * as React from 'react';
22
import { View, Platform, StyleSheet } from 'react-native';
3+
34
import type { StackNavigationProp } from '@react-navigation/stack';
45
import {
56
Appbar,
@@ -11,10 +12,11 @@ import {
1112
RadioButton,
1213
List,
1314
} from 'react-native-paper';
14-
import ScreenWrapper from '../ScreenWrapper';
15-
import { yellowA200 } from '../../../src/styles/themes/v2/colors';
1615
import { useSafeAreaInsets } from 'react-native-safe-area-context';
1716

17+
import { yellowA200 } from '../../../src/styles/themes/v2/colors';
18+
import ScreenWrapper from '../ScreenWrapper';
19+
1820
type Props = {
1921
navigation: StackNavigationProp<{}>;
2022
};

example/src/Examples/AvatarExample.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
import * as React from 'react';
22
import { View, StyleSheet } from 'react-native';
3+
34
import {
45
Avatar,
56
List,
67
MD2Colors,
78
MD3Colors,
89
useTheme,
910
} from 'react-native-paper';
11+
1012
import ScreenWrapper from '../ScreenWrapper';
1113

1214
const AvatarExample = () => {

example/src/Examples/BadgeExample.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import * as React from 'react';
22
import { View, StyleSheet } from 'react-native';
3+
34
import {
45
Badge,
56
IconButton,
@@ -10,6 +11,7 @@ import {
1011
useTheme,
1112
MD3Colors,
1213
} from 'react-native-paper';
14+
1315
import ScreenWrapper from '../ScreenWrapper';
1416

1517
const BadgeExample = () => {

example/src/Examples/BannerExample.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
import * as React from 'react';
22
import { View, StyleSheet, Image, Dimensions, Platform } from 'react-native';
3+
34
import {
45
Banner,
56
FAB,
67
useTheme,
78
MD2Colors,
89
MD3Colors,
910
} from 'react-native-paper';
11+
1012
import ScreenWrapper from '../ScreenWrapper';
1113

1214
const PHOTOS = Array.from({ length: 24 }).map(
@@ -67,7 +69,11 @@ const BannerExample = () => {
6769
<View style={styles.grid}>
6870
{PHOTOS.map((uri) => (
6971
<View key={uri} style={styles.item}>
70-
<Image source={{ uri }} style={styles.photo} />
72+
<Image
73+
source={{ uri }}
74+
style={styles.photo}
75+
accessibilityIgnoresInvertColors
76+
/>
7177
</View>
7278
))}
7379
</View>

example/src/Examples/BottomNavigationExample.tsx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,12 @@ import {
77
Platform,
88
Easing,
99
} from 'react-native';
10+
11+
import type { StackNavigationProp } from '@react-navigation/stack';
1012
import { Appbar, BottomNavigation, Menu, useTheme } from 'react-native-paper';
11-
import ScreenWrapper from '../ScreenWrapper';
1213
import { useSafeAreaInsets } from 'react-native-safe-area-context';
13-
import type { StackNavigationProp } from '@react-navigation/stack';
14+
15+
import ScreenWrapper from '../ScreenWrapper';
1416

1517
type RoutesState = Array<{
1618
key: string;
@@ -40,7 +42,11 @@ const PhotoGallery = ({ route }: Route) => {
4042
<ScreenWrapper contentContainerStyle={styles.content}>
4143
{PHOTOS.map((uri) => (
4244
<View key={uri} style={styles.item}>
43-
<Image source={{ uri }} style={styles.photo} />
45+
<Image
46+
source={{ uri }}
47+
style={styles.photo}
48+
accessibilityIgnoresInvertColors
49+
/>
4450
</View>
4551
))}
4652
</ScreenWrapper>

0 commit comments

Comments
 (0)