Skip to content

Commit

Permalink
Merge pull request #1556 from RoboSats/fix-mobile-eslint
Browse files Browse the repository at this point in the history
Fix mobile eslint
  • Loading branch information
KoalaSat authored Oct 19, 2024
2 parents ee5d7d7 + 9f5c394 commit 7b08f33
Show file tree
Hide file tree
Showing 11 changed files with 113 additions and 350 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ repos:
- '--fix=lf'
- id: trailing-whitespace
- id: pretty-format-json
exclude: ^frontend/
exclude: ^frontend/|^mobile/
args:
- '--autofix'
- '--no-sort-keys'
Expand Down
3 changes: 2 additions & 1 deletion frontend/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
"env": {
"browser": true,
"es2021": true,
"jest": true
"jest": true,
"node": true
},
"extends": [
"eslint:recommended",
Expand Down
11 changes: 7 additions & 4 deletions mobile/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,23 @@
"extends": [
"eslint:recommended",
"plugin:react/recommended",
"standard-with-typescript",
"plugin:@typescript-eslint/recommended",
"prettier"
],
"overrides": [],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": "latest",
"ecmaFeatures": {
"jsx": true
},
"sourceType": "module",
"project": "./tsconfig.json"
"project": "./tsconfig.json",
"tsconfigRootDir": "./"
},
"plugins": ["react", "react-hooks", "@typescript-eslint", "prettier"],
"rules": {
"react-hooks/rules-of-hooks": "error",
"react-hooks/rules-of-hooks": "off",
"react-hooks/exhaustive-deps": "warn",
"react/prop-types": "off",
"react/react-in-jsx-scope": "off"
Expand All @@ -33,5 +35,6 @@
"react": {
"version": "detect"
}
}
},
"ignorePatterns": ["html/*", "android/app/build/*"]
}
2 changes: 1 addition & 1 deletion mobile/.prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
"trailingComma": "all",
"jsxSingleQuote": true,
"bracketSpacing": true
}
}
15 changes: 7 additions & 8 deletions mobile/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,10 @@ const App = () => {
loadCookie('settings_light_qr');
loadCookie('settings_network');
loadCookie('settings_connection');
loadCookie('settings_use_proxy').then((useProxy) => {
loadCookie('settings_use_proxy').then((useProxy: string | undefined) => {
SystemModule.useProxy(useProxy ?? 'true');
});
loadCookie('settings_stop_notifications').then((stopNotifications) => {
loadCookie('settings_stop_notifications').then((stopNotifications: string | undefined) => {
SystemModule.stopNotifications(stopNotifications ?? 'false');
});
loadCookie('garage_slots').then((slots) => {
Expand All @@ -106,13 +106,11 @@ const App = () => {
});
};

const onCatch = (dataId: string, event: any) => {
const onCatch = (dataId: string, event: unknown) => {
let json = '{}';
let code = 500;
if (event.message) {
const reponse = /Request Response Code \((?<code>\d*)\)\: (?<json>\{.*\})/.exec(
event.message,
);
const reponse = /Request Response Code \((?<code>\d*)\): (?<json>\{.*\})/.exec(event.message);
json = reponse?.groups?.json ?? '{}';
code = reponse?.groups?.code ? parseInt(reponse?.groups?.code) : 500;
}
Expand Down Expand Up @@ -192,7 +190,9 @@ const App = () => {
key,
detail: storedValue,
});
} catch (error) {}
} catch (e) {
console.log('setCookie', e);
}
};

return (
Expand All @@ -202,7 +202,6 @@ const App = () => {
uri,
}}
onMessage={onMessage}
// @ts-expect-error
userAgent={`${app_name} v${app_version} Android`}
style={{ backgroundColor: backgroundColors[colorScheme] }}
ref={(ref) => (webViewRef.current = ref)}
Expand Down
2 changes: 2 additions & 0 deletions mobile/babel.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* global module */

module.exports = {
presets: ['module:metro-react-native-babel-preset'],
};
1 change: 1 addition & 0 deletions mobile/metro.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*
* @format
*/
/* global module */

module.exports = {
transformer: {
Expand Down
Loading

0 comments on commit 7b08f33

Please sign in to comment.