Skip to content

Commit

Permalink
Fix TS issues
Browse files Browse the repository at this point in the history
  • Loading branch information
GeorgianSorinMaxim committed Jul 25, 2022
1 parent 3ab55ba commit 5432b20
Show file tree
Hide file tree
Showing 80 changed files with 40,623 additions and 41,054 deletions.
68 changes: 62 additions & 6 deletions .eslint.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,13 @@
},
"extends": [
"eslint:recommended",
"standard",
"plugin:@typescript-eslint/recommended",
"plugin:react/recommended",
"plugin:import/errors",
"plugin:import/warnings",
"plugin:import/typescript",
"prettier",
"prettier/@typescript-eslint",
"prettier/react",
"prettier/standard"
"airbnb"
],
"plugins": ["@typescript-eslint", "simple-import-sort"],
"parser": "@typescript-eslint/parser",
Expand All @@ -42,7 +39,9 @@
}
},
"rules": {
"import/newline-after-import": "error",
"import/prefer-default-export": "off",
"import/extensions": "off",
"import/no-extraneous-dependencies": "off",
"no-fallthrough": "off",
"no-return-await": "off",
"no-undef": "off",
Expand All @@ -60,7 +59,64 @@
"@typescript-eslint/no-unused-vars": "off",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-empty-interface": "off",
"react/function-component-definition": "off",
"react/jsx-one-expression-per-line": "off",
"import/no-cycle": "off",
"camelcase": "off"
"camelcase": "off",
"quotes": [2, "double", { "avoidEscape": true }],
"object-curly-newline": "off",
"operator-linebreak": "off",
"implicit-arrow-linebreak": "off",
"no-confusing-arrow": "off",
"prefer-template": "off",
"default-case": "off",
"default-param-last": "off",
"no-duplicate-case": "off",
"global-require": "off",
"arrow-parens": "off",
"no-shadow": 0,
"jsx-a11y/href-no-hash": ["off"],
"react/jsx-props-no-spreading": ["off"],
"react/no-array-index-key": ["off"],
"react/jsx-filename-extension": "off",
"max-len": "off",
"no-use-before-define": "off",
"jest/no-disabled-tests": "off",
"spaced-comment": "off",
"react/destructuring-assignment": "off",
"prefer-destructuring": "off",
"import/newline-after-import": "off",
"no-underscore-dangle": "off",
"no-console": "off",
"react/sort-comp": "off",
"import/no-dynamic-require": "off",
"func-names": "off",
"no-return-assign": "off",
"consistent-return": "off",
"array-callback-return": "off",
"eslint-comments/no-unlimited-disable": "off",
"no-restricted-globals": "off",
"no-bitwise": "off",
"no-plusplus": "off",
"react/no-this-in-sfc": "off",
"react/no-access-state-in-setstate": "off",
"react-native/no-inline-styles": "off",
"import/no-named-as-default": "off",
"no-param-reassign": "off",
"import/no-unresolved": "off",
"react/require-default-props": "off",
"no-restricted-syntax": "off",
"lines-between-class-members": "off",
"no-nested-ternary": "off",
"no-unneeded-ternary": "off",
"no-useless-escape": "off",
"react/prefer-stateless-function": "off",
"react/jsx-no-bind": "off",
"no-unreachable": "off",
"no-unused-vars": "off",
"no-prototype-builtins": "off",
"arrow-body-style": "off",
"@typescript-eslint/ban-types": "off",
"react/jsx-closing-bracket-location": "off"
}
}
6 changes: 1 addition & 5 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- name: Set up Node.js
uses: actions/setup-node@v1
with:
node-version: 12
node-version: 17

- name: Install dependencies
run: yarn
Expand All @@ -31,10 +31,6 @@ jobs:
- name: Run linter
run: yarn lint

# Run Prettier
- name: Run prettier
run: yarn prettier

# Tests
- name: Run unit tests
run: yarn jest
57 changes: 40 additions & 17 deletions App.tsx
Original file line number Diff line number Diff line change
@@ -1,37 +1,62 @@
import React from "react";
import { Platform, StatusBar, StyleSheet, View, Text } from "react-native";
import {
Platform,
StatusBar,
StyleSheet,
View,
Text,
TextInput,
LogBox,
} from "react-native";
import { Provider } from "react-redux";

import { StringValues } from "./src/constants/StringValues";
import { Loader } from "./src/components";

// Persistor
import { PersistGate } from "redux-persist/integration/react";

// Navigation
import { NavigationContainer } from "@react-navigation/native";
import { RootNavigation, navigationRef } from "./src/navigation/RootNavigation";
import { RootStack } from "./src/navigation/AppNavigator";
import { navigationRef } from "./src/navigation/RootNavigation";

// Redux store
import { configureStore } from "./src/store/configureStore";
const { store, persistor } = configureStore();

const Loading = () => (
<View style={styles.loadingContainer}>
<Text>{StringValues.loading}</Text>
</View>
);
LogBox.ignoreLogs(["Require cycle:"]);
interface TextWithDefaultProps extends Text {
defaultProps?: { allowFontScaling?: boolean; maxFontSizeMultiplier?: number };
}

const App = () => {
interface TextInputWithDefaultProps extends TextInput {
defaultProps?: { allowFontScaling?: boolean; maxFontSizeMultiplier?: number };
}

(Text as unknown as TextWithDefaultProps).defaultProps =
(Text as unknown as TextWithDefaultProps).defaultProps || {};
(Text as unknown as TextWithDefaultProps).defaultProps!.allowFontScaling = true;
(
Text as unknown as TextWithDefaultProps
).defaultProps!.maxFontSizeMultiplier = 1.8;

(TextInput as unknown as TextInputWithDefaultProps).defaultProps =
(TextInput as unknown as TextInputWithDefaultProps).defaultProps || {};
(
TextInput as unknown as TextInputWithDefaultProps
).defaultProps!.allowFontScaling = true;
(
TextInput as unknown as TextInputWithDefaultProps
).defaultProps!.maxFontSizeMultiplier = 1.8;

export const App = () => {
return (
<View style={styles.container}>
<Provider store={store}>
<PersistGate loading={<Loading />} persistor={persistor}>
<PersistGate loading={<Loader />} persistor={persistor}>
{Platform.OS === "ios" && <StatusBar barStyle="default" />}
<NavigationContainer
// TODO: Remove @ts-ignore
// @ts-ignore
ref={navigationRef}>
<RootNavigation />
<NavigationContainer ref={navigationRef}>
<RootStack />
</NavigationContainer>
</PersistGate>
</Provider>
Expand All @@ -51,5 +76,3 @@ const styles = StyleSheet.create({
alignItems: "center",
},
});

export default App;
3 changes: 3 additions & 0 deletions __mocks__/react-native-config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default {
API_URL: 'test',
};
2 changes: 1 addition & 1 deletion index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AppRegistry } from "react-native";
import App from "./App";
import { App } from "./App";

AppRegistry.registerComponent("Hurt", () => App);
12 changes: 12 additions & 0 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1159,6 +1159,8 @@ PODS:
- react-native-config/App (= 1.4.6)
- react-native-config/App (1.4.6):
- React-Core
- react-native-flipper (0.155.0):
- React-Core
- react-native-pdf (6.5.0):
- React-Core
- react-native-safe-area-context (4.3.1):
Expand Down Expand Up @@ -1237,6 +1239,8 @@ PODS:
- React-Core
- RNCMaskedView (0.1.11):
- React
- RNCPicker (2.4.2):
- React-Core
- RNDeviceInfo (10.0.1):
- React-Core
- RNFastImage (8.5.11):
Expand Down Expand Up @@ -1380,6 +1384,7 @@ DEPENDENCIES:
- React-jsinspector (from `../node_modules/react-native/ReactCommon/jsinspector`)
- React-logger (from `../node_modules/react-native/ReactCommon/logger`)
- react-native-config (from `../node_modules/react-native-config`)
- react-native-flipper (from `../node_modules/react-native-flipper`)
- react-native-pdf (from `../node_modules/react-native-pdf`)
- react-native-safe-area-context (from `../node_modules/react-native-safe-area-context`)
- React-perflogger (from `../node_modules/react-native/ReactCommon/reactperflogger`)
Expand All @@ -1396,6 +1401,7 @@ DEPENDENCIES:
- ReactCommon/turbomodule/core (from `../node_modules/react-native/ReactCommon`)
- "RNCAsyncStorage (from `../node_modules/@react-native-community/async-storage`)"
- "RNCMaskedView (from `../node_modules/@react-native-community/masked-view`)"
- "RNCPicker (from `../node_modules/@react-native-picker/picker`)"
- RNDeviceInfo (from `../node_modules/react-native-device-info`)
- RNFastImage (from `../node_modules/react-native-fast-image`)
- "RNFBAnalytics (from `../node_modules/@react-native-firebase/analytics`)"
Expand Down Expand Up @@ -1514,6 +1520,8 @@ EXTERNAL SOURCES:
:path: "../node_modules/react-native/ReactCommon/logger"
react-native-config:
:path: "../node_modules/react-native-config"
react-native-flipper:
:path: "../node_modules/react-native-flipper"
react-native-pdf:
:path: "../node_modules/react-native-pdf"
react-native-safe-area-context:
Expand Down Expand Up @@ -1546,6 +1554,8 @@ EXTERNAL SOURCES:
:path: "../node_modules/@react-native-community/async-storage"
RNCMaskedView:
:path: "../node_modules/@react-native-community/masked-view"
RNCPicker:
:path: "../node_modules/@react-native-picker/picker"
RNDeviceInfo:
:path: "../node_modules/react-native-device-info"
RNFastImage:
Expand Down Expand Up @@ -1650,6 +1660,7 @@ SPEC CHECKSUMS:
React-jsinspector: 55605caf04e02f9b0e05842b786f1c12dde08f4b
React-logger: ca970551cb7eea2fd814d0d5f6fc1a471eb53b76
react-native-config: 7cd105e71d903104e8919261480858940a6b9c0e
react-native-flipper: 839f62f0b7cd1c28088030b0b04b72d0f88d5d85
react-native-pdf: de35db0d8f1e5d37e65e887554f7d4bd062af56b
react-native-safe-area-context: 6c12e3859b6f27b25de4fee8201cfb858432d8de
React-perflogger: c9161ff0f1c769993cd11d2751e4331ff4ceb7cd
Expand All @@ -1666,6 +1677,7 @@ SPEC CHECKSUMS:
ReactCommon: e30ec17dfb1d4c4f3419eac254350d6abca6d5a2
RNCAsyncStorage: b03032fdbdb725bea0bd9e5ec5a7272865ae7398
RNCMaskedView: 0e1bc4bfa8365eba5fbbb71e07fbdc0555249489
RNCPicker: 0250e95ad170569a96f5b0555cdd5e65b9084dca
RNDeviceInfo: ee3ec9e7a48fa8a2ea4d711ee312497857e4ee74
RNFastImage: 1f2cab428712a4baaf78d6169eaec7f622556dd7
RNFBAnalytics: 1aff53fe7ebd26405ac5e4c99011ccd0a473bf77
Expand Down
12 changes: 12 additions & 0 deletions ios/Pods/Manifest.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 comment on commit 5432b20

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ts-ignore's: 2 (unchanged)

Please sign in to comment.