Skip to content

Commit

Permalink
Add lint
Browse files Browse the repository at this point in the history
  • Loading branch information
hellostu committed Oct 15, 2024
1 parent 4f3cfb1 commit 79b7a27
Show file tree
Hide file tree
Showing 8 changed files with 1,550 additions and 64 deletions.
3 changes: 2 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
node_modules
node_modules
apps
14 changes: 10 additions & 4 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,27 @@ module.exports = {
// 'plugin:ft-flow/recommended',
],
parser: 'hermes-eslint',
plugins: [
'ft-flow'
],
plugins: ['ft-flow'],
env: {
node: true,
browser: true,
jest: true,
},
rules: {
'import/order': 0,
'react/jsx-props-no-multi-spaces': 'off',
},
settings: {
'import/resolver': {
node: {
extensions: ['.js', '.jsx', '.json', '.native.js', '.ios.js', '.android.js'],
extensions: [
'.js',
'.jsx',
'.json',
'.native.js',
'.ios.js',
'.android.js',
],
},
},
},
Expand Down
2 changes: 1 addition & 1 deletion apps/external-display-example/src/ScrollView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export default function Example(props: Props) {
>
{new Array(100).fill(0).map((_, i) => (
<Text
// eslint-disable-next-line react/no-array-index-key
key={`item-${i}`}
style={{
color: 'white',
Expand Down
2 changes: 1 addition & 1 deletion apps/ipad-multiscenes-headless-example/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
"@/*": ["./*"]
}
},
"include": ["**/*.ts", "**/*.tsx"]
"include": ["**/*.ts", "**/*.tsx", "withMultipleSceneSupport.js"]
}
9 changes: 8 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@
],
"packageManager": "[email protected]",
"scripts": {
"start": "cd apps/external-display-example && yarn start"
"start": "cd apps/external-display-example && yarn start",
"lint": "eslint ."
},
"devDependencies": {
"@fugood/eslint-config-react": "^0.5.1",
"eslint": "^8.43.0",
"eslint-plugin-ft-flow": "^3.0.0",
"hermes-eslint": "^0.19.2"
}
}
2 changes: 2 additions & 0 deletions packages/react-native-external-display/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,11 @@ const ExternalDisplayView = (props: Props) => {
} = props
const screens = useExternalDisplay(props)
const scr = screens[screen]

if (!scr && !fallbackInMainScreen) {
return null
}

return (
<ScreenContext.Provider value={scr}>
<RNExternalDisplay
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ export const useExternalDisplay = ({

useEffect(() => {
const { connect, change, disconnect } = listenEvent({
onScreenConnect: info => {
onScreenConnect: (info) => {
setScreens(info)
if (onScreenConnect) onScreenConnect(info)
},
onScreenChange: info => {
onScreenChange: (info) => {
setScreens(info)
if (onScreenChange) onScreenChange(info)
},
onScreenDisconnect: info => {
onScreenDisconnect: (info) => {
setScreens(info)
if (onScreenDisconnect) onScreenDisconnect(info)
},
Expand All @@ -39,7 +39,7 @@ export const useExternalDisplay = ({
change.remove()
disconnect.remove()
}
}, [])
}, [onScreenChange, onScreenConnect, onScreenDisconnect])

return screens
}
Loading

0 comments on commit 79b7a27

Please sign in to comment.