Skip to content

Commit

Permalink
chore: update eslint (#3356)
Browse files Browse the repository at this point in the history
Co-authored-by: Daniel Szczepanik <[email protected]>
  • Loading branch information
jaworek and Drakeoon authored Sep 27, 2022
1 parent 5282be5 commit 35dc036
Show file tree
Hide file tree
Showing 237 changed files with 2,708 additions and 2,920 deletions.
3 changes: 3 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@ testSetup.js

# generated by bob
lib/

# babel files
src/babel
35 changes: 31 additions & 4 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
"browser": true
},

"extends": ["@callstack"],

"plugins": ["react-native"],
"extends": "@callstack",

"rules": {
"one-var": "off",
Expand All @@ -16,10 +14,39 @@

"import/no-extraneous-dependencies": "off",
"import/first": "off",
"import/order": [
"error",
{
"groups": [
["external", "builtin"],
"internal",
["sibling", "parent"],
"index"
],
"pathGroups": [
{
"pattern": "@(react|react-native)",
"group": "external",
"position": "before"
},
{
"pattern": "@src/**",
"group": "internal"
}
],
"pathGroupsExcludedImportTypes": ["internal", "react"],
"newlines-between": "always",
"alphabetize": {
"order": "asc",
"caseInsensitive": true
}
}
],

"react-native/no-unused-styles": "error",
"react-native/split-platform-components": "off",
"react-native/no-raw-text": "off"
"react-native/no-raw-text": "off",
"react-native-a11y/has-valid-accessibility-descriptors": "off"
},

"settings": {
Expand Down
2 changes: 1 addition & 1 deletion docs/component-docs.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* @flow */

import path from 'path';
import fs from 'fs';
import path from 'path';

const root = path.join(__dirname, '..');
const dist = path.join(__dirname, 'dist');
Expand Down
1 change: 1 addition & 0 deletions docs/pages/0.index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* @flow */

import * as React from 'react';

import Home from './src/Home';

export default class Index extends React.Component<{}> {
Expand Down
1 change: 1 addition & 0 deletions docs/pages/6.showcase.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* @flow */

import * as React from 'react';

import Showcase from './src/Showcase';

export default class ShowcasePage extends React.Component<{}> {
Expand Down
4 changes: 3 additions & 1 deletion docs/pages/src/Home.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@
/* eslint-disable import/no-commonjs */

import * as React from 'react';
import { styled } from 'linaria/react';

import { Link, Header } from 'component-docs/components';
import { styled } from 'linaria/react';

import ThemeIcon from '../../components/theme-icon';
import Content from './components/Content';

Expand Down
11 changes: 8 additions & 3 deletions docs/pages/src/Showcase.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
/* @flow */

import * as React from 'react';
import { styled } from 'linaria/react';

import color from 'color';
import { Header } from 'component-docs/components';
import { styled } from 'linaria/react';

import GithubIcon from '../../components/github-icon';
import GooglePlayIcon from '../../components/google-play-icon';
import IphoneIcon from '../../components/iphone-icon';
import Content from './components/Content';
import GithubIcon from '../../components/github-icon';

type Data = {
color: string,
Expand Down Expand Up @@ -198,7 +199,11 @@ export default class Showcase extends React.Component<{}> {
return (
<div key={item.image}>
<ImageContainer>
<Image src={item.image} alt="" />
<Image
src={item.image}
alt=""
accessibilityIgnoresInvertColors
/>
<Info style={{ backgroundColor: item.color }}>
<AppName
style={{
Expand Down
1 change: 1 addition & 0 deletions docs/pages/src/components/IconsList.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* @flow */

import * as React from 'react';

import { styled } from 'linaria/react';
import icons from 'react-native-vector-icons/glyphmaps/MaterialCommunityIcons.json';

Expand Down
2 changes: 1 addition & 1 deletion example/.eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"extends": "../.eslintrc",

"settings": {
"import/core-modules": [ "react-native-paper" ]
"import/core-modules": ["react-native-paper"]
},

"rules": {
Expand Down
1 change: 1 addition & 0 deletions example/babel.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const path = require('path');

const pak = require('../package.json');

module.exports = function (api) {
Expand Down
5 changes: 3 additions & 2 deletions example/metro.config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
// /* eslint-disable import/no-commonjs */

const path = require('path');
const blacklist = require('metro-config/src/defaults/exclusionList');
const escape = require('escape-string-regexp');
const blacklist = require('metro-config/src/defaults/exclusionList');
const path = require('path');

const pak = require('../package.json');

const root = path.resolve(__dirname, '..');
Expand Down
5 changes: 4 additions & 1 deletion example/src/DrawerItems.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import * as React from 'react';
import { View, StyleSheet, I18nManager } from 'react-native';

import { DrawerContentScrollView } from '@react-navigation/drawer';
import * as Updates from 'expo-updates';
import {
Badge,
Drawer,
Expand All @@ -11,8 +13,9 @@ import {
useTheme,
MD3Colors,
} from 'react-native-paper';
import * as Updates from 'expo-updates';

import { isWeb } from '../utils';

import { PreferencesContext } from './';

type Props = {
Expand Down
11 changes: 6 additions & 5 deletions example/src/ExampleList.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import * as React from 'react';
import { FlatList } from 'react-native';

import type { StackNavigationProp } from '@react-navigation/stack';
import { List, Divider, useTheme } from 'react-native-paper';
import { useSafeArea } from 'react-native-safe-area-context';
import type { StackNavigationProp } from '@react-navigation/stack';

import ActivityIndicatorExample from './Examples/ActivityIndicatorExample';
import AnimatedFABExample from './Examples/AnimatedFABExample';
import AppbarExample from './Examples/AppbarExample';
import AvatarExample from './Examples/AvatarExample';
import BadgeExample from './Examples/BadgeExample';
Expand All @@ -27,18 +29,17 @@ import MenuExample from './Examples/MenuExample';
import ProgressBarExample from './Examples/ProgressBarExample';
import RadioButtonExample from './Examples/RadioButtonExample';
import RadioButtonGroupExample from './Examples/RadioButtonGroupExample';
import RadioButtonItemExample from './Examples/RadioButtonItemExample';
import SearchbarExample from './Examples/SearchbarExample';
import SegmentedButtonExample from './Examples/SegmentedButtonsExample';
import SnackbarExample from './Examples/SnackbarExample';
import SurfaceExample from './Examples/SurfaceExample';
import SwitchExample from './Examples/SwitchExample';
import TextExample from './Examples/TextExample';
import TextInputExample from './Examples/TextInputExample';
import ThemeExample from './Examples/ThemeExample';
import ToggleButtonExample from './Examples/ToggleButtonExample';
import TouchableRippleExample from './Examples/TouchableRippleExample';
import ThemeExample from './Examples/ThemeExample';
import RadioButtonItemExample from './Examples/RadioButtonItemExample';
import AnimatedFABExample from './Examples/AnimatedFABExample';
import SegmentedButtonExample from './Examples/SegmentedButtonsExample';

export const examples: Record<
string,
Expand Down
2 changes: 2 additions & 0 deletions example/src/Examples/ActivityIndicatorExample.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import * as React from 'react';
import { View, StyleSheet } from 'react-native';

import {
ActivityIndicator,
MD2Colors,
FAB,
useTheme,
MD3Colors,
} from 'react-native-paper';

import ScreenWrapper from '../ScreenWrapper';

const ActivityIndicatorExample = () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import * as React from 'react';
import { View, StyleSheet, FlatList, Animated, Platform } from 'react-native';
import type { NativeSyntheticEvent, NativeScrollEvent } from 'react-native';

import {
MD2Colors,
MD3Colors,
Expand All @@ -10,6 +11,7 @@ import {
Text,
} from 'react-native-paper';
import Icon from 'react-native-vector-icons/MaterialCommunityIcons';

import { animatedFABExampleData } from '../../../utils';
import CustomFAB from './CustomFAB';
import CustomFABControls, {
Expand Down
1 change: 1 addition & 0 deletions example/src/Examples/AnimatedFABExample/CustomFAB.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
StyleSheet,
Platform,
} from 'react-native';

import { AnimatedFAB, useTheme } from 'react-native-paper';

type CustomFABProps = {
Expand Down
6 changes: 4 additions & 2 deletions example/src/Examples/AnimatedFABExample/CustomFABControls.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import React from 'react';
import { StyleSheet, View, FlatList } from 'react-native';
import { Paragraph, RadioButton, Text, useTheme } from 'react-native-paper';

import { TouchableOpacity } from 'react-native-gesture-handler';
import type {
AnimatedFABAnimateFrom,
AnimatedFABIconMode,
} from 'react-native-paper';
import { TouchableOpacity } from 'react-native-gesture-handler';
import { Paragraph, RadioButton, Text, useTheme } from 'react-native-paper';

export type Controls = {
iconMode: AnimatedFABIconMode;
Expand Down Expand Up @@ -45,6 +46,7 @@ const CustomControl = ({

return (
<TouchableOpacity
accessibilityRole="button"
onPress={() => onChange(item)}
style={styles.controlItem}
>
Expand Down
6 changes: 4 additions & 2 deletions example/src/Examples/AppbarExample.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import * as React from 'react';
import { View, Platform, StyleSheet } from 'react-native';

import type { StackNavigationProp } from '@react-navigation/stack';
import {
Appbar,
Expand All @@ -11,10 +12,11 @@ import {
RadioButton,
List,
} from 'react-native-paper';
import ScreenWrapper from '../ScreenWrapper';
import { yellowA200 } from '../../../src/styles/themes/v2/colors';
import { useSafeAreaInsets } from 'react-native-safe-area-context';

import { yellowA200 } from '../../../src/styles/themes/v2/colors';
import ScreenWrapper from '../ScreenWrapper';

type Props = {
navigation: StackNavigationProp<{}>;
};
Expand Down
2 changes: 2 additions & 0 deletions example/src/Examples/AvatarExample.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import * as React from 'react';
import { View, StyleSheet } from 'react-native';

import {
Avatar,
List,
MD2Colors,
MD3Colors,
useTheme,
} from 'react-native-paper';

import ScreenWrapper from '../ScreenWrapper';

const AvatarExample = () => {
Expand Down
2 changes: 2 additions & 0 deletions example/src/Examples/BadgeExample.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import * as React from 'react';
import { View, StyleSheet } from 'react-native';

import {
Badge,
IconButton,
Expand All @@ -10,6 +11,7 @@ import {
useTheme,
MD3Colors,
} from 'react-native-paper';

import ScreenWrapper from '../ScreenWrapper';

const BadgeExample = () => {
Expand Down
8 changes: 7 additions & 1 deletion example/src/Examples/BannerExample.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import * as React from 'react';
import { View, StyleSheet, Image, Dimensions, Platform } from 'react-native';

import {
Banner,
FAB,
useTheme,
MD2Colors,
MD3Colors,
} from 'react-native-paper';

import ScreenWrapper from '../ScreenWrapper';

const PHOTOS = Array.from({ length: 24 }).map(
Expand Down Expand Up @@ -67,7 +69,11 @@ const BannerExample = () => {
<View style={styles.grid}>
{PHOTOS.map((uri) => (
<View key={uri} style={styles.item}>
<Image source={{ uri }} style={styles.photo} />
<Image
source={{ uri }}
style={styles.photo}
accessibilityIgnoresInvertColors
/>
</View>
))}
</View>
Expand Down
12 changes: 9 additions & 3 deletions example/src/Examples/BottomNavigationExample.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ import {
Platform,
Easing,
} from 'react-native';

import type { StackNavigationProp } from '@react-navigation/stack';
import { Appbar, BottomNavigation, Menu, useTheme } from 'react-native-paper';
import ScreenWrapper from '../ScreenWrapper';
import { useSafeAreaInsets } from 'react-native-safe-area-context';
import type { StackNavigationProp } from '@react-navigation/stack';

import ScreenWrapper from '../ScreenWrapper';

type RoutesState = Array<{
key: string;
Expand Down Expand Up @@ -40,7 +42,11 @@ const PhotoGallery = ({ route }: Route) => {
<ScreenWrapper contentContainerStyle={styles.content}>
{PHOTOS.map((uri) => (
<View key={uri} style={styles.item}>
<Image source={{ uri }} style={styles.photo} />
<Image
source={{ uri }}
style={styles.photo}
accessibilityIgnoresInvertColors
/>
</View>
))}
</ScreenWrapper>
Expand Down
Loading

0 comments on commit 35dc036

Please sign in to comment.