Skip to content

Commit 554257d

Browse files
author
Anesh Parvatha
committed
Initial commit
1 parent 226f47d commit 554257d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+17498
-1
lines changed

.env

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
//https://github.com/facebook/create-react-app/issues/5825
2+
3+
SKIP_PREFLIGHT_CHECK=true
4+
5+
//the variable declaration should start with REACT_APP_
6+
//Eg:-REACT_APP_ENV=development
7+

.env.alpha

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
//https://github.com/facebook/create-react-app/issues/5825
2+
3+
SKIP_PREFLIGHT_CHECK=true
4+
5+
//the variable declaration should start with REACT_APP_
6+
//Eg:-REACT_APP_ENV=development

.env.beta

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
//https://github.com/facebook/create-react-app/issues/5825
2+
3+
SKIP_PREFLIGHT_CHECK=true
4+
5+
//the variable declaration should start with REACT_APP_
6+
//Eg:-REACT_APP_ENV=development

.env.gamma

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
//https://github.com/facebook/create-react-app/issues/5825
2+
3+
SKIP_PREFLIGHT_CHECK=true
4+
5+
//the variable declaration should start with REACT_APP_
6+
//Eg:-REACT_APP_ENV=development

.env.production

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
//https://github.com/facebook/create-react-app/issues/5825
2+
3+
SKIP_PREFLIGHT_CHECK=true
4+
5+
//the variable declaration should start with REACT_APP_
6+
//Eg:-REACT_APP_ENV=development

.env.staging

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
//https://github.com/facebook/create-react-app/issues/5825
2+
3+
SKIP_PREFLIGHT_CHECK=true
4+
5+
//the variable declaration should start with REACT_APP_
6+
//Eg:-REACT_APP_ENV=development
7+
8+
REACT_APP_NKB_BASE_URL = https://nkb-backend-10xiitian-staging-apis.ibhubs.in/api/
9+
10+
REACT_APP_GTM_ID = GTM-TT9MHTQ
11+
12+
REACT_APP_GOOGLE_SITE_VERIFICATION = ''
13+
14+
REACT_APP_USERSNAP_ID = ''
15+
16+
REACT_APP_SEGMENT_ID = 9HHiENJNjKhD6JdpJVegnRLkWqwyvToR
17+
18+
REACT_APP_SENTRY_KEY=https://[email protected]/1852258
19+
20+
REACT_APP_ONE_SIGNAL_APP_ID = 997515ae-d139-4fcd-992f-e520a8522cdc
21+
22+
REACT_APP_PROGRAM_SLUGS_URL = https://nkb-backend-media-static-tenxiitian.s3.ap-south-1.amazonaws.com/tenxiitian_prod/website-static/jsons/staging/slugs.json

.eslintignore

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
2+
# node.js
3+
#
4+
node_modules/
5+
npm-debug.log
6+
yarn-error.log
7+
config/
8+
build/
9+
public/
10+
dist/
11+
storybook/storyLoader.js
12+
styles.tsx
13+
styleguide/
14+
*.gen.js

.eslintrc.json

+116
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
{
2+
"parser": "@typescript-eslint/parser",
3+
"plugins": ["react", "@typescript-eslint", "prettier", "import"],
4+
"parserOptions": {
5+
"ecmaFeatures": {
6+
"jsx": true
7+
},
8+
"useJSXTextNode": true,
9+
"project": "./tsconfig.json"
10+
},
11+
"env": {
12+
"browser": true,
13+
"node": true,
14+
"es6": true,
15+
"jest": true
16+
},
17+
"extends": [
18+
"eslint:recommended",
19+
"plugin:react/recommended",
20+
"plugin:@typescript-eslint/eslint-recommended",
21+
"plugin:@typescript-eslint/recommended",
22+
"plugin:import/errors",
23+
"plugin:import/warnings",
24+
"plugin:import/typescript",
25+
"prettier/@typescript-eslint",
26+
"plugin:prettier/recommended",
27+
"prettier",
28+
"prettier/react",
29+
"eslint-config-prettier"
30+
],
31+
"rules": {
32+
//TODO:Need to add some more rules to this file
33+
34+
"prettier/prettier": ["error", { "singleQuote": true }],
35+
36+
"arrow-body-style": [2, "as-needed"],
37+
"comma-dangle": [2, "never"],
38+
"max-depth": 0,
39+
"max-len": 0,
40+
"max-params": 0,
41+
"max-statements": 0,
42+
"newline-per-chained-call": 0,
43+
"no-confusing-arrow": [0, { "allowParens": false }],
44+
"no-use-before-define": 0,
45+
"prefer-template": 2,
46+
"class-methods-use-this": 0,
47+
"require-yield": 0,
48+
"prefer-promise-reject-errors": 0,
49+
"camelcase": "off",
50+
"@typescript-eslint/camelcase": [
51+
"error",
52+
{
53+
"properties": "never",
54+
"ignoreDestructuring": true
55+
}
56+
],
57+
"@typescript-eslint/interface-name-prefix": 1,
58+
"no-underscore-dangle": [
59+
"error",
60+
{
61+
"allowAfterThis": true,
62+
"allowAfterSuper": true
63+
}
64+
],
65+
"function-paren-newline": 0,
66+
"no-else-return": 1,
67+
"semi": 0,
68+
"quotes": 0,
69+
"arrow-parens": 0,
70+
"no-nested-ternary": 0,
71+
72+
"react/no-array-index-key": 0,
73+
"react/destructuring-assignment": 0,
74+
"react/jsx-closing-tag-location": 0,
75+
"react/forbid-prop-types": 0,
76+
"react/jsx-first-prop-new-line": [2, "multiline"],
77+
"react/jsx-filename-extension": 0,
78+
"react/jsx-no-target-blank": 0,
79+
"react/jsx-uses-vars": 2,
80+
"react/require-default-props": 0,
81+
"react/require-extension": 0,
82+
"react/self-closing-comp": 0,
83+
"react/sort-comp": 0,
84+
85+
/****
86+
The following rules are made available via `eslint-plugin-import`
87+
****/
88+
89+
"import/extensions": 0,
90+
"import/order": [
91+
"error",
92+
{
93+
"groups": [
94+
"builtin",
95+
"external",
96+
"internal",
97+
"parent",
98+
"sibling",
99+
"index"
100+
]
101+
}
102+
],
103+
"import/imports-first": 0,
104+
"import/newline-after-import": 0,
105+
"import/no-dynamic-require": 0
106+
},
107+
"settings": {
108+
"react": {
109+
"pragma": "React",
110+
"version": "detect"
111+
}
112+
},
113+
"globals": {
114+
"GLOBAL": true
115+
}
116+
}

.gitignore

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# dependencies
4+
/node_modules
5+
/.pnp
6+
.pnp.js
7+
8+
# testing
9+
/coverage
10+
11+
# production
12+
/build
13+
14+
# misc
15+
.DS_Store
16+
.env.local
17+
.env.development.local
18+
.env.test.local
19+
.env.production.local
20+
21+
npm-debug.log*
22+
yarn-debug.log*
23+
yarn-error.log*
24+
.npmrc
25+
26+
cypress/screenshots
27+
cypress/videos

.lintstagedrc.js

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module.exports = {
2+
'*.json?(x)': ['prettier --write', 'git add -A'],
3+
'*.md?(x)': ['prettier --write', 'git add -A']
4+
}

.prettierrc

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"overrides": [
3+
{
4+
"files": "*.test.js",
5+
"options": {
6+
"semi": false
7+
}
8+
}
9+
],
10+
"singleQuote": true,
11+
"jsxSingleQuote": true,
12+
"semi": false,
13+
"printWidth": 80,
14+
"tabWidth": 3
15+
}

README.md

+15-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,15 @@
1-
# modular-react-typescript-boilerplate
1+
# Modular React MobX Typescript Boilerplate
2+
3+
![React MobX Typescript](/docs/images/react_mobx_typescript.png)
4+
5+
A modular boilerplate suitable for large and complex applications built with latest stack React, Typescript, MobX, Webpack, Storybook, Styled Components, Cypress and followed industry standard practices like ✔️Clean Code, 🧪TDD
6+
7+
## Table of Contents
8+
9+
1. [Install](#install)
10+
2. [Introduction](#introduction)
11+
3. [Tech Stack](#tech-stack)
12+
4. [Best practices](#best-practices)
13+
4.1 [Clean Code](#clean-code)
14+
4.2 [Test-driven Development](#tdd)
15+
5. [Contributing](#contributing)

babel.config.js

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
module.exports = {
2+
presets: ['@babel/preset-env'],
3+
plugins: [
4+
[
5+
'@babel/plugin-proposal-decorators',
6+
{
7+
legacy: true
8+
}
9+
]
10+
]
11+
}

docs/images/react_mobx_typescript.png

20.2 KB
Loading

package.json

+106
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
{
2+
"name": "modular-react-typescript-boilerplate",
3+
"version": "0.0.1",
4+
"private": true,
5+
"dependencies": {
6+
"@babel/core": "7.7.2",
7+
"@types/jest": "24.0.23",
8+
"@types/node": "12.12.9",
9+
"@types/react": "16.9.11",
10+
"@types/react-dom": "16.9.4",
11+
"@types/react-loader-spinner": "3.1.0",
12+
"@types/react-router-dom": "5.1.3",
13+
"@types/styled-components": "4.4.2",
14+
"env-cmd": "10.0.1",
15+
"eslint-plugin-import": "2.18.2",
16+
"eslint-plugin-react": "7.16.0",
17+
"hoist-non-react-statics": "3.3.1",
18+
"husky": "3.1.0",
19+
"i18next": "19.0.1",
20+
"i18next-xhr-backend": "3.2.2",
21+
"js-cookie": "2.2.1",
22+
"lint-staged": "9.4.3",
23+
"madge": "3.6.0",
24+
"mobx": "5.15.0",
25+
"mobx-react": "6.1.4",
26+
"node-sass": "4.13.0",
27+
"react": "^16.12.0",
28+
"react-dom": "^16.12.0",
29+
"react-helmet": "5.2.1",
30+
"react-i18next": "11.2.2",
31+
"react-loader-spinner": "3.1.5",
32+
"react-router-dom": "5.1.2",
33+
"react-scripts": "3.2.0",
34+
"styled-components": "4.4.1",
35+
"typescript": "3.7.2",
36+
"yarnhook": "0.4.3"
37+
},
38+
"scripts": {
39+
"start": "react-scripts start",
40+
"start:master": "env-cmd -f .env.production yarn start",
41+
"e2e:start": "E2E=true && --env.API_URL=http://localhost:8000 set \"CI=false\" && react-scripts start",
42+
"build": "GENERATE_SOURCEMAP=false react-scripts build",
43+
"build:beta": "set \"CI=false\" && env-cmd -f .env.beta yarn build",
44+
"build:gamma": "set \"CI=false\" && env-cmd -f .env.gamma yarn build",
45+
"build:staging": "set \"CI=false\" && env-cmd -f .env.staging yarn build",
46+
"build:master": "set \"CI=false\" && env-cmd -f .env.production yarn build",
47+
"test": "IS_JEST=true react-scripts test --silent",
48+
"test:ci": "yarn test --watchAll=false --silent",
49+
"eject": "react-scripts eject",
50+
"lint": "eslint --ignore-path .gitignore --fix --ext .ts,.tsx src/",
51+
"storybook": "start-storybook -p 9009 -s public",
52+
"build-storybook": "build-storybook -s public"
53+
},
54+
"engines": {
55+
"npm": ">=5.6.0",
56+
"yarn": ">=1.17.3",
57+
"node": ">=12.6.0"
58+
},
59+
"eslintConfig": {
60+
"extends": "react-app"
61+
},
62+
"browserslist": {
63+
"production": [
64+
">0.2%",
65+
"not dead",
66+
"not op_mini all"
67+
],
68+
"development": [
69+
"last 1 chrome version",
70+
"last 1 firefox version",
71+
"last 1 safari version"
72+
]
73+
},
74+
"devDependencies": {
75+
"@babel/core": "7.7.2",
76+
"@babel/plugin-proposal-decorators": "7.7.0",
77+
"@babel/plugin-syntax-jsx": "7.2.0",
78+
"@babel/preset-env": "7.7.1",
79+
"@storybook/addon-actions": "^5.2.6",
80+
"@storybook/addon-knobs": "5.2.6",
81+
"@storybook/addon-links": "^5.2.6",
82+
"@storybook/addon-notes": "5.2.6",
83+
"@storybook/addons": "5.2.6",
84+
"@storybook/preset-create-react-app": "1.3.1",
85+
"@storybook/react": "^5.2.6",
86+
"@testing-library/jest-dom": "4.2.4",
87+
"@testing-library/react": "9.3.2",
88+
"@types/storybook__react": "4.0.2",
89+
"@typescript-eslint/eslint-plugin": "2.3.0",
90+
"@typescript-eslint/parser": "2.8.0",
91+
"babel-eslint": "10.0.3",
92+
"cypress": "3.8.0",
93+
"eslint": "6.4.0",
94+
"eslint-config-prettier": "6.3.0",
95+
"eslint-plugin-prettier": "3.1.0",
96+
"prettier": "1.19.1"
97+
},
98+
"husky": {
99+
"hooks": {
100+
"pre-push": "yarn test:ci",
101+
"pre-commit": "madge --format es6 --circular src/ && lint-staged && tsc --noEmit --skipLibCheck ",
102+
"post-merge": "yarnhook",
103+
"post-rewrite": "yarnhook"
104+
}
105+
}
106+
}
+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"app": {
3+
"learnReact": "Learn React"
4+
},
5+
"common": {
6+
"failureView": {
7+
"retry": "Retry"
8+
}
9+
}
10+
}

0 commit comments

Comments
 (0)