Skip to content

Commit c45ad6f

Browse files
authored
Merge pull request #14 from daboigbae/13-add-support-for-typescript
13 add support for typescript
2 parents 8908c28 + 268c0a2 commit c45ad6f

38 files changed

Lines changed: 515 additions & 333 deletions

.DS_Store

0 Bytes
Binary file not shown.

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ Run this command to create a new project with the template
2626
- [@reduxjs/toolkit](https://redux-toolkit.js.org/) to make redux implementation easier
2727
- [redux-persist](https://github.com/rt2zz/redux-persist) for redux store persistance.
2828
- [redux-thunk](https://github.com/gaearon/redux-thunk) to dispatch asynchronous actions.
29+
- [type-script](https://www.typescriptlang.org/) for typing and general robustness
30+
2931

3032
# 🏃‍♀️Running Your New App
3133
#### 📱iOS

template/.eslintrc.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@ module.exports = {
1111
"plugin:react/recommended",
1212
"prettier",
1313
"eslint:recommended",
14-
"plugin:jest/recommended"
14+
"plugin:jest/recommended",
15+
"plugin:@typescript-eslint/recommended" // Add TypeScript ESLint plugin
1516
],
17+
parser: "@typescript-eslint/parser", // Specify the TypeScript parser
1618

1719
parserOptions: {
1820
ecmaFeatures: {
@@ -22,7 +24,7 @@ module.exports = {
2224
sourceType: "module"
2325
},
2426

25-
plugins: ["react", "react-native", "detox"],
27+
plugins: ["react", "react-native", "detox", "@typescript-eslint"],
2628
ignorePatterns: ["!.*", "dist", "node_modules"],
2729
rules: {
2830
indent: [
@@ -37,7 +39,9 @@ module.exports = {
3739
quotes: ["error", "double"],
3840
semi: ["error", "always"],
3941
"no-console": ["error"],
40-
"no-unused-vars": ["error", { vars: "all" }]
42+
"no-unused-vars": "off", // Disable the default rule for unused variables
43+
"@typescript-eslint/no-unused-vars": ["error", { vars: "all" }] // Enable TypeScript-specific rule for unused variables
44+
4145
},
4246

4347
settings: {

template/App.js renamed to template/App.tsx

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,25 @@ import {PersistGate} from "redux-persist/integration/react";
77

88
import useLocalize from "./src/hooks/useLocalize";
99
import Navigation from "./src/navigation/Navigation";
10-
import store from "./src/redux/store";
10+
import store from "./src/redux/store";
1111

1212
import "react-native-gesture-handler";
1313

1414
const persistor = persistStore(store);
1515

1616
const App = () => {
17-
const {setI18nConfig} = useLocalize();
18-
19-
useEffect(() => {
20-
setI18nConfig();
21-
}, [setI18nConfig]);
22-
23-
return (
24-
<Provider store={store}>
25-
<PersistGate persistor={persistor}>
26-
<Navigation />
27-
</PersistGate>
28-
</Provider>
29-
);
17+
const {setI18nConfig} = useLocalize();
18+
useEffect(() => {
19+
setI18nConfig();
20+
}, [setI18nConfig]);
21+
22+
return (
23+
<Provider store={store}>
24+
<PersistGate persistor={persistor}>
25+
<Navigation />
26+
</PersistGate>
27+
</Provider>
28+
);
3029
};
3130

3231
export default App;

template/app.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/// <reference types="nativewind/types" />

template/babel.config.js

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
module.exports = {
2-
presets: ["module:metro-react-native-babel-preset"],
3-
plugins: [
4-
[
5-
"module-resolver",
6-
{
7-
root: ["./"],
8-
alias: {
9-
"@api": "./src/api",
10-
"@screens": "./src/screens",
11-
"@components": "./src/components",
12-
"@navigation": "./src/navigation",
13-
"@redux": "./src/redux",
14-
"@assets": "./src/assets",
15-
"@hooks": "./src/hooks",
16-
"@utils": "./src/utils",
17-
},
18-
},
19-
],
20-
"@babel/plugin-proposal-export-namespace-from",
21-
"nativewind/babel",
22-
"react-native-reanimated/plugin",
23-
],
2+
presets: ["module:metro-react-native-babel-preset"],
3+
plugins: [
4+
[
5+
"module-resolver",
6+
{
7+
root: ["./"],
8+
alias: {
9+
"@api": "./src/api",
10+
"@screens": "./src/screens",
11+
"@components": "./src/components",
12+
"@navigation": "./src/navigation",
13+
"@redux": "./src/redux",
14+
"@assets": "./src/assets",
15+
"@hooks": "./src/hooks",
16+
"@utils": "./src/utils",
17+
},
18+
},
19+
],
20+
"@babel/plugin-proposal-export-namespace-from",
21+
"nativewind/babel",
22+
"react-native-reanimated/plugin",
23+
],
2424
};

template/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@
55
import {AppRegistry} from "react-native";
66

77
import App from "./App";
8-
import {name as appName} from "./app.json";
8+
import {name} from "./app.json";
99

10-
AppRegistry.registerComponent(appName, () => App);
10+
AppRegistry.registerComponent(name, () => App);

template/ios/Podfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -793,4 +793,4 @@ SPEC CHECKSUMS:
793793

794794
PODFILE CHECKSUM: 55eb011f6491078310d39c6095b0268d9cbfc7c4
795795

796-
COCOAPODS: 1.12.1
796+
COCOAPODS: 1.11.3

template/ios/ProjectName.xcodeproj/project.pbxproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@
211211
};
212212
};
213213
};
214-
buildConfigurationList = 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "projectname" */;
214+
buildConfigurationList = 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "ProjectName" */;
215215
compatibilityVersion = "Xcode 12.0";
216216
developmentRegion = en;
217217
hasScannedForEncodings = 0;
@@ -691,7 +691,7 @@
691691
defaultConfigurationIsVisible = 0;
692692
defaultConfigurationName = Release;
693693
};
694-
83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "projectname" */ = {
694+
83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "ProjectName" */ = {
695695
isa = XCConfigurationList;
696696
buildConfigurations = (
697697
83CBBA201A601CBA00E9B192 /* Debug */,

template/ios/ProjectName.xcworkspace/contents.xcworkspacedata

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)