Skip to content

Commit 70e507d

Browse files
authored
Merge pull request #129 from callstack/use-callstack-eslint
chore: Migrate to `@callstack` eslint config
2 parents ef8db2c + b6ac264 commit 70e507d

File tree

9 files changed

+449
-318
lines changed

9 files changed

+449
-318
lines changed

.eslintrc.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
module.exports = {
22
root: true,
3-
extends: ['@react-native', 'plugin:prettier/recommended'],
3+
extends: ['@callstack'],
44
ignorePatterns: ['node_modules/', 'lib/'],
5+
overrides: [
6+
{
7+
files: ['**/*.config.js'], // metro.config.js & react-native.config.js
8+
rules: {
9+
'import/no-extraneous-dependencies': ['off'],
10+
},
11+
},
12+
],
513
};

.github/workflows/main.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,6 @@ jobs:
3939
fetch-depth: 0
4040
- uses: ./.github/actions/install-dependencies
4141

42-
- name: Lint files
43-
run: yarn lint
44-
4542
- name: Lint Android files
4643
run: yarn lint:android
4744

@@ -51,6 +48,10 @@ jobs:
5148
- name: Lib build
5249
run: yarn build
5350

51+
- name: Lint files
52+
run: yarn lint
53+
# required to run after `yarn build`
54+
5455
build-android:
5556
name: Build Android
5657
runs-on: ubuntu-22.04

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,3 +76,6 @@ lefthook.yml
7676
# testing
7777
/coverage
7878
.cxx
79+
80+
# eslint
81+
.eslintcache

example/ios/Podfile.lock

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -807,9 +807,23 @@ PODS:
807807
- React-jsinspector (0.72.6)
808808
- React-logger (0.72.6):
809809
- glog
810-
- react-native-image-editor (2.3.0):
811-
- React
810+
- react-native-image-editor (3.0.0):
811+
- RCT-Folly (= 2021.07.22.00)
812+
- RCTRequired
813+
- RCTTypeSafety
814+
- React-Codegen
815+
- React-Core
816+
- React-debug
817+
- React-Fabric
818+
- React-graphics
819+
- React-jsi
820+
- React-NativeModulesApple
821+
- React-RCTFabric
812822
- React-RCTImage
823+
- React-utils
824+
- ReactCommon/turbomodule/bridging
825+
- ReactCommon/turbomodule/core
826+
- Yoga
813827
- React-NativeModulesApple (0.72.6):
814828
- React-callinvoker
815829
- React-Core
@@ -1115,7 +1129,7 @@ SPEC CHECKSUMS:
11151129
React-jsiexecutor: faca9c368233f59ed24601aca0185870466a96e9
11161130
React-jsinspector: 194e32c6aab382d88713ad3dd0025c5f5c4ee072
11171131
React-logger: cebf22b6cf43434e471dc561e5911b40ac01d289
1118-
react-native-image-editor: fc444bd0c9ffbc12bb6f46177773e88dc2d9c5b9
1132+
react-native-image-editor: 2d9fddfd0a036db8f031c2789293c91497b534fb
11191133
React-NativeModulesApple: 63505fb94b71e2469cab35bdaf36cca813cb5bfd
11201134
React-perflogger: e3596db7e753f51766bceadc061936ef1472edc3
11211135
React-RCTActionSheet: 17ab132c748b4471012abbcdcf5befe860660485

example/metro.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ const config = {
3939
extraNodeModules,
4040
},
4141
transformer: {
42-
getTransformOptions: async () => ({
42+
getTransformOptions: () => ({
4343
transform: {
4444
experimentalImportSupport: false,
4545
inlineRequires: true,

example/src/ImageCropper.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import React, { Component } from 'react';
22
import { Image, Platform, ScrollView } from 'react-native';
33

4-
import type { ImageSourcePropType, StyleProp, ViewStyle } from 'react-native';
5-
import type { ImageCropData, ImageOffset, ImageSize } from './types';
64
import { NativeSyntheticEvent } from 'react-native/Libraries/Types/CoreEventTypes';
75
import { NativeScrollEvent } from 'react-native/Libraries/Components/ScrollView/ScrollView';
86

7+
import type { ImageSourcePropType, StyleProp, ViewStyle } from 'react-native';
8+
import type { ImageCropData, ImageOffset, ImageSize } from './types';
9+
910
export interface ImageCropperProps {
1011
image: ImageSize & ImageSourcePropType;
1112
size: ImageSize;
@@ -115,6 +116,7 @@ export class ImageCropper extends Component<ImageCropperProps> {
115116
>
116117
<Image
117118
testID="testImage"
119+
accessibilityIgnoresInvertColors
118120
source={this.props.image}
119121
style={this._scaledImageSize}
120122
/>

example/src/SquareImageCropper.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ import {
99
} from 'react-native';
1010
import ImageEditor from '@react-native-community/image-editor';
1111

12+
import type { LayoutChangeEvent } from 'react-native';
1213
import { DEFAULT_IMAGE_WIDTH, DEFAULT_IMAGE_HEIGHT } from './constants';
1314
import { ImageCropper } from './ImageCropper';
1415

15-
import type { LayoutChangeEvent } from 'react-native';
1616
import type { ImageCropData, ImageSize } from './types';
1717

1818
interface State {
@@ -90,6 +90,7 @@ export class SquareImageCropper extends Component<Props, State> {
9090
onTransformDataChange={this._onTransformDataChange}
9191
/>
9292
<TouchableHighlight
93+
accessibilityRole="button"
9394
style={styles.cropButtonTouchable}
9495
onPress={this._crop}
9596
>
@@ -107,10 +108,12 @@ export class SquareImageCropper extends Component<Props, State> {
107108
<SafeAreaView style={styles.container}>
108109
<Text style={styles.text}>Here is the cropped image</Text>
109110
<Image
111+
accessibilityIgnoresInvertColors
110112
source={{ uri: this.state.croppedImageURI }}
111113
style={[styles.imageCropper, this.state.measuredSize]}
112114
/>
113115
<TouchableHighlight
116+
accessibilityRole="button"
114117
style={styles.cropButtonTouchable}
115118
onPress={this._reset}
116119
>

package.json

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,10 @@
6565
"devDependencies": {
6666
"@babel/core": "^7.23.2",
6767
"@babel/preset-env": "^7.23.2",
68-
"@react-native/eslint-config": "^0.74.0",
68+
"@callstack/eslint-config": "^14.1.0",
6969
"@react-native/typescript-config": "^0.74.0",
7070
"@types/react": "^18.2.34",
71-
"@typescript-eslint/parser": "^6.9.1",
72-
"eslint": "^8.53.0",
73-
"eslint-config-prettier": "^9.0.0",
74-
"eslint-plugin-prettier": "^5.0.1",
71+
"eslint": "^8.56.0",
7572
"metro-react-native-babel-preset": "0.76.8",
7673
"prettier": "^3.0.3",
7774
"react": "^18.2.0",

0 commit comments

Comments
 (0)