Skip to content

Commit 6c0558e

Browse files
nodejs/reactjs weather app
0 parents  commit 6c0558e

35 files changed

+6765
-0
lines changed

.gitignore

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

.prettierrc.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"singleQuote": true,
3+
"printWidth": 100,
4+
"proseWrap": "always",
5+
"tabWidth": 2,
6+
"requireConfig": false,
7+
"useTabs": false,
8+
"trailingComma": "es5",
9+
"bracketSpacing": true,
10+
"arrowParens": "always",
11+
"jsxSingleQuote": false,
12+
"endOfLine": "auto",
13+
"jsxBracketSameLine": false,
14+
"semi": true
15+
}

README.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Boilerplate-code-for-ReactJs-TypeScript-NodeJs-Vite-TailwindCss-ESLint
2+
A boilerplate code for ReactJs, TypeScript, NodeJs, Vite and TailwindCss with ESLint
3+
4+
# TypeScript + NodeJs + ReactJs Project
5+
6+
This project is built using TypeScript, Vite for the frontend, and `tsx` for running TypeScript in Node.js without compilation. Linting is set up for code quality.
7+
8+
---
9+
10+
## 📦 Installation
11+
12+
```bash
13+
# Install dependencies
14+
yarn install
15+
16+
# Install tsx globally to run TypeScript files in Node.js
17+
yarn global add tsx
18+
19+
# Install nodemon globally for NodeJs to automatically restart application when changes are done
20+
yarn global add nodemon
21+
22+
#run
23+
yarn dev
24+
25+
#run specific file in nodejs
26+
tsx server/src/server.ts
27+

eslint.config.js

Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
import typescriptEslint from '@typescript-eslint/eslint-plugin';
2+
import tsParser from '@typescript-eslint/parser';
3+
import eslintImport from 'eslint-plugin-import';
4+
import prettier from 'eslint-plugin-prettier';
5+
import react from 'eslint-plugin-react';
6+
import reactHooks from 'eslint-plugin-react-hooks';
7+
import validateJsxNesting from 'eslint-plugin-validate-jsx-nesting';
8+
export default [
9+
{
10+
ignores: ['node_modules', '.gitignore', 'dist', 'build', 'coverage', 'server/**'],
11+
},
12+
{
13+
files: ['src/**/*.{ts,tsx}'],
14+
languageOptions: {
15+
parser: tsParser,
16+
parserOptions: {
17+
ecmaVersion: 'latest',
18+
sourceType: 'module',
19+
project: './tsconfig.json',
20+
jsx: true,
21+
},
22+
},
23+
plugins: {
24+
react,
25+
'react-hooks': reactHooks,
26+
'@typescript-eslint': typescriptEslint,
27+
import: eslintImport,
28+
prettier,
29+
'validate-jsx-nesting': validateJsxNesting,
30+
},
31+
settings: {
32+
react: {
33+
version: 'detect',
34+
},
35+
'import/resolver': {
36+
typescript: {
37+
project: './tsconfig.json',
38+
},
39+
node: true,
40+
},
41+
},
42+
rules: {
43+
// ======================
44+
// Import/Module Rules
45+
// ======================
46+
'import/order': [
47+
'error',
48+
{
49+
groups: [
50+
'builtin',
51+
'external',
52+
'internal',
53+
'parent',
54+
'sibling',
55+
'index',
56+
'object',
57+
'type',
58+
],
59+
pathGroups: [
60+
{ pattern: '@/**', group: 'internal' },
61+
{ pattern: '{@/**/*,*}.{css,scss}', group: 'object', position: 'after' },
62+
],
63+
distinctGroup: false,
64+
'newlines-between': 'never',
65+
alphabetize: { order: 'asc', caseInsensitive: true },
66+
},
67+
],
68+
69+
// ======================
70+
// Core JavaScript Rules
71+
// ======================
72+
'no-console': 'warn',
73+
'no-debugger': 'error',
74+
'no-unused-vars': 'off',
75+
76+
// ======================
77+
// TypeScript Rules
78+
// ======================
79+
'@typescript-eslint/no-unused-vars': ['warn', { argsIgnorePattern: '^_' }],
80+
'@typescript-eslint/explicit-module-boundary-types': 'off',
81+
82+
// ======================
83+
// React Rules
84+
// ======================
85+
// React Basic Rules
86+
'react/react-in-jsx-scope': 'off',
87+
'react/prop-types': 'off',
88+
'react/jsx-no-undef': 'warn',
89+
'react/jsx-pascal-case': 'warn',
90+
'react/jsx-uses-react': 'error',
91+
'react/jsx-uses-vars': 'error',
92+
'react/no-this-in-sfc': 'error',
93+
94+
// React JSX Specific Rules
95+
'react/jsx-no-useless-fragment': 'warn',
96+
'react/jsx-key': 'warn',
97+
'react/jsx-no-duplicate-props': 'warn',
98+
'react/jsx-curly-brace-presence': ['warn', 'never'],
99+
'react/jsx-no-comment-textnodes': 'warn',
100+
'react/jsx-no-bind': ['off', { ignoreRefs: true }],
101+
'react/jsx-no-literals': 'off',
102+
'react/jsx-max-depth': ['off', { max: 3 }],
103+
104+
// React Component Structure
105+
'react/sort-comp': [
106+
'warn',
107+
{
108+
order: ['static-methods', 'lifecycle', 'everything-else', 'render', 'render-return'],
109+
},
110+
],
111+
'react/no-unstable-nested-components': ['warn', { allowAsProps: true }],
112+
113+
// React Deprecations/Warnings
114+
'react/no-deprecated': 'warn',
115+
'react/no-danger': 'off',
116+
'react/no-array-index-key': 'off',
117+
'react/no-unescaped-entities': 'off',
118+
'react/no-unknown-property': 'warn',
119+
'react/jsx-no-constructed-context-values': 'warn',
120+
121+
// React Props
122+
'react/require-default-props': 'warn',
123+
'react/no-unused-prop-types': 'warn',
124+
'react/no-render-return-value': 'warn',
125+
126+
// ======================
127+
// React Hooks Rules
128+
// ======================
129+
'react-hooks/rules-of-hooks': 'error',
130+
'react-hooks/exhaustive-deps': ['warn', { additionalHooks: '(useQuery|useMutation)' }],
131+
132+
// ======================
133+
// JSX Nesting Validation
134+
// ======================
135+
'validate-jsx-nesting/no-invalid-jsx-nesting': 'error',
136+
137+
// ======================
138+
// Formatting/Prettier
139+
// ======================
140+
'prettier/prettier': [
141+
'error',
142+
{
143+
endOfLine: 'auto',
144+
},
145+
],
146+
147+
// ======================
148+
// TanStack Query Rules (Commented)
149+
// ======================
150+
// '@tanstack/query/exhaustive-deps': 'error',
151+
// '@tanstack/query/no-rest-destructuring': 'warn',
152+
// '@tanstack/query/stable-query-client': 'error'
153+
},
154+
},
155+
];

index.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7+
<title>Weather App</title>
8+
</head>
9+
<body>
10+
<div id="root"></div>
11+
<script type="module" src="/src/main.tsx"></script>
12+
</body>
13+
</html>

package.json

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
{
2+
"name": "frontend",
3+
"version": "0.1.0",
4+
"private": true,
5+
"type": "module",
6+
"packageManager": "[email protected]",
7+
"dependencies": {
8+
"@vitejs/plugin-react": "^4.3.4",
9+
"lodash": "^4.17.21",
10+
"react": "^18.2.0",
11+
"react-dom": "^18.2.0",
12+
"react-error-boundary": "^5.0.0",
13+
"react-icons": "^5.5.0",
14+
"react-redux": "^9.2.0",
15+
"react-router": "^7.6.0",
16+
"redux": "^5.0.1",
17+
"sass": "^1.69.0",
18+
"usehooks-ts": "^3.1.1",
19+
"web-vitals": "^2.1.0"
20+
},
21+
"devDependencies": {
22+
"@tailwindcss/vite": "^4.1.3",
23+
"@types/node": "^22.14.0",
24+
"@types/react": "^19.1.0",
25+
"@types/react-dom": "^19.1.1",
26+
"@typescript-eslint/eslint-plugin": "^8.0.0",
27+
"@typescript-eslint/parser": "^8.0.0",
28+
"autoprefixer": "^10.4.21",
29+
"eslint": "^9.1.0",
30+
"eslint-config-prettier": "^9.1.0",
31+
"eslint-import-resolver-alias": "^1.1.2",
32+
"eslint-import-resolver-typescript": "^4.3.1",
33+
"eslint-plugin-import": "^2.29.1",
34+
"eslint-plugin-jsx-a11y": "^6.8.0",
35+
"eslint-plugin-node": "^11.1.0",
36+
"eslint-plugin-prettier": "^5.1.3",
37+
"eslint-plugin-react": "^7.33.2",
38+
"eslint-plugin-react-hooks": "^5.0.0",
39+
"eslint-plugin-validate-jsx-nesting": "^0.1.1",
40+
"postcss": "^8.5.3",
41+
"prettier": "^3.2.5",
42+
"tailwindcss": "^4.1.3",
43+
"ts-node": "^10.9.2",
44+
"typescript": "^5.3.3",
45+
"vite": "^6.2.4",
46+
"vite-plugin-checker": "^0.9.1",
47+
"vite-plugin-svgr": "^4.3.0",
48+
"vite-tsconfig-paths": "^5.1.4"
49+
},
50+
"scripts": {
51+
"dev": "vite",
52+
"build": "vite build",
53+
"preview": "vite preview",
54+
"lint": "eslint . --ext .ts,.tsx,.js,.jsx",
55+
"lint:fix": "eslint . --ext .ts,.tsx,.js,.jsx --fix",
56+
"format": "prettier --write .",
57+
"type-check": "tsc --noEmit",
58+
"validate": "yarn type-check && yarn lint && yarn format",
59+
"clean-install": "rm -rf node_modules .eslintcache yarn.lock && yarn install",
60+
"sort-imports": "eslint --fix --rule 'import/order: [\"error\", {\"groups\": [\"builtin\",\"external\",\"internal\",\"parent\",\"sibling\",\"index\",\"object\",\"type\"], \"newlines-between\": \"always\"}]' src/**/*.{ts,tsx}"
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+
]
71+
},
72+
"engines": {
73+
"node": ">=18.0.0"
74+
}
75+
}

public/favicon.ico

3.78 KB
Binary file not shown.

public/logo192.png

5.22 KB
Loading

public/logo512.png

9.44 KB
Loading

public/manifest.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"short_name": "React App",
3+
"name": "Create React App Sample",
4+
"icons": [
5+
{
6+
"src": "favicon.ico",
7+
"sizes": "64x64 32x32 24x24 16x16",
8+
"type": "image/x-icon"
9+
},
10+
{
11+
"src": "logo192.png",
12+
"type": "image/png",
13+
"sizes": "192x192"
14+
},
15+
{
16+
"src": "logo512.png",
17+
"type": "image/png",
18+
"sizes": "512x512"
19+
}
20+
],
21+
"start_url": ".",
22+
"display": "standalone",
23+
"theme_color": "#000000",
24+
"background_color": "#ffffff"
25+
}

0 commit comments

Comments
 (0)