Skip to content

Commit e3be7fb

Browse files
committed
Add lint
1 parent 4f3cfb1 commit e3be7fb

File tree

9 files changed

+1556
-70
lines changed

9 files changed

+1556
-70
lines changed

.eslintignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
node_modules
1+
node_modules
2+
apps

.eslintrc.js

+10-4
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,27 @@ module.exports = {
55
// 'plugin:ft-flow/recommended',
66
],
77
parser: 'hermes-eslint',
8-
plugins: [
9-
'ft-flow'
10-
],
8+
plugins: ['ft-flow'],
119
env: {
1210
node: true,
1311
browser: true,
1412
jest: true,
1513
},
1614
rules: {
1715
'import/order': 0,
16+
'react/jsx-props-no-multi-spaces': 'off',
1817
},
1918
settings: {
2019
'import/resolver': {
2120
node: {
22-
extensions: ['.js', '.jsx', '.json', '.native.js', '.ios.js', '.android.js'],
21+
extensions: [
22+
'.js',
23+
'.jsx',
24+
'.json',
25+
'.native.js',
26+
'.ios.js',
27+
'.android.js',
28+
],
2329
},
2430
},
2531
},

.github/workflows/test.yml

+6-6
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
- uses: actions/checkout@v4
1313
- uses: actions/[email protected]
1414
with:
15-
node-version: 16.x
15+
node-version: 18.x
1616
- name: Get yarn cache directory path
1717
id: yarn-cache-dir-path
1818
run: echo "::set-output name=dir::$(yarn cache dir)"
@@ -34,7 +34,7 @@ jobs:
3434
- uses: actions/checkout@v4
3535
- uses: actions/[email protected]
3636
with:
37-
node-version: 16.x
37+
node-version: 18.x
3838
- name: Get yarn cache directory path
3939
id: yarn-cache-dir-path
4040
run: echo "::set-output name=dir::$(yarn cache dir)"
@@ -72,7 +72,7 @@ jobs:
7272
- uses: actions/checkout@v4
7373
- uses: actions/[email protected]
7474
with:
75-
node-version: 16.x
75+
node-version: 18.x
7676
- name: Get yarn cache directory path
7777
id: yarn-cache-dir-path
7878
run: echo "::set-output name=dir::$(yarn cache dir)"
@@ -103,14 +103,14 @@ jobs:
103103
pod install
104104
cd ..
105105
xcodebuild -workspace ios/RNExternalDisplayExample.xcworkspace -scheme RNExternalDisplayExample -configuration Debug -sdk iphonesimulator -derivedDataPath ios/build
106-
106+
107107
test-android-newarch:
108108
runs-on: ubuntu-latest
109109
steps:
110110
- uses: actions/checkout@v4
111111
- uses: actions/[email protected]
112112
with:
113-
node-version: 16.x
113+
node-version: 18.x
114114
- name: Get yarn cache directory path
115115
id: yarn-cache-dir-path
116116
run: echo "::set-output name=dir::$(yarn cache dir)"
@@ -145,7 +145,7 @@ jobs:
145145
- uses: actions/checkout@v4
146146
- uses: actions/[email protected]
147147
with:
148-
node-version: 16.x
148+
node-version: 18.x
149149
- name: Get yarn cache directory path
150150
id: yarn-cache-dir-path
151151
run: echo "::set-output name=dir::$(yarn cache dir)"

apps/external-display-example/src/ScrollView.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export default function Example(props: Props) {
4040
>
4141
{new Array(100).fill(0).map((_, i) => (
4242
<Text
43-
// eslint-disable-next-line react/no-array-index-key
43+
4444
key={`item-${i}`}
4545
style={{
4646
color: 'white',

apps/ipad-multiscenes-headless-example/tsconfig.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@
66
"@/*": ["./*"]
77
}
88
},
9-
"include": ["**/*.ts", "**/*.tsx"]
9+
"include": ["**/*.ts", "**/*.tsx", "withMultipleSceneSupport.js"]
1010
}

package.json

+8-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@
77
],
88
"packageManager": "[email protected]",
99
"scripts": {
10-
"start": "cd apps/external-display-example && yarn start"
10+
"start": "cd apps/external-display-example && yarn start",
11+
"lint": "eslint ."
12+
},
13+
"devDependencies": {
14+
"@fugood/eslint-config-react": "^0.5.1",
15+
"eslint": "^8.43.0",
16+
"eslint-plugin-ft-flow": "^3.0.0",
17+
"hermes-eslint": "^0.19.2"
1118
}
1219
}

packages/react-native-external-display/index.js

+2
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,11 @@ const ExternalDisplayView = (props: Props) => {
4444
} = props
4545
const screens = useExternalDisplay(props)
4646
const scr = screens[screen]
47+
4748
if (!scr && !fallbackInMainScreen) {
4849
return null
4950
}
51+
5052
return (
5153
<ScreenContext.Provider value={scr}>
5254
<RNExternalDisplay

packages/react-native-external-display/js/useExternalDisplay.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@ export const useExternalDisplay = ({
2121

2222
useEffect(() => {
2323
const { connect, change, disconnect } = listenEvent({
24-
onScreenConnect: info => {
24+
onScreenConnect: (info) => {
2525
setScreens(info)
2626
if (onScreenConnect) onScreenConnect(info)
2727
},
28-
onScreenChange: info => {
28+
onScreenChange: (info) => {
2929
setScreens(info)
3030
if (onScreenChange) onScreenChange(info)
3131
},
32-
onScreenDisconnect: info => {
32+
onScreenDisconnect: (info) => {
3333
setScreens(info)
3434
if (onScreenDisconnect) onScreenDisconnect(info)
3535
},
@@ -39,7 +39,7 @@ export const useExternalDisplay = ({
3939
change.remove()
4040
disconnect.remove()
4141
}
42-
}, [])
42+
}, [onScreenChange, onScreenConnect, onScreenDisconnect])
4343

4444
return screens
4545
}

0 commit comments

Comments
 (0)