├── .env.example ├── .eslintrc ├── .gitignore ├── .husky └── pre-commit ├── .prettierignore ├── .prettierrc ├── LICENSE ├── README.md ├── babel.config.json ├── index.html ├── jest.config.ts ├── jest.setup.ts ├── package.json ├── postcss.config.js ├── public └── vite.svg ├── src ├── App.test.tsx ├── App.tsx ├── assets │ └── react.svg ├── globals.css ├── main.tsx └── vite-env.d.ts ├── tailwind.config.js ├── tsconfig.json ├── tsconfig.node.json └── vite.config.ts /.env.example: -------------------------------------------------------------------------------- 1 | # .env.development | .env.staging | .env.production 2 | 3 | # VITE_ prefix is required 4 | 5 | # how to use (1 OR 2): 6 | # (1) import.meta.env.VITE_DISCORD 7 | # (2) process.env.VITE_DISCORD 8 | 9 | # example 10 | # VITE_DISCORD=https://bit.ly/GentlemanProgramming 11 | # VITE_WIKI=https://bit.ly/gentleman-wiki 12 | # VITE_GITHUB=https://github.com/joer9514 -------------------------------------------------------------------------------- /.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "env": { 3 | "browser": true, 4 | "es2022": true, 5 | "node": true, 6 | "jest": true 7 | }, 8 | "globals": { "JSX": true }, 9 | "settings": { 10 | "react": { "version": "detect" } 11 | }, 12 | "extends": [ 13 | "standard-with-typescript", 14 | "plugin:react/recommended", 15 | "plugin:react-hooks/recommended", 16 | "plugin:react/jsx-runtime", 17 | "plugin:prettier/recommended" 18 | ], 19 | "parser": "@typescript-eslint/parser", 20 | "overrides": [], 21 | "parserOptions": { 22 | "ecmaFeatures": { 23 | "jsx": true 24 | }, 25 | "ecmaVersion": "latest", 26 | "sourceType": "module", 27 | "project": ["./tsconfig.json"] 28 | }, 29 | "plugins": ["react", "react-refresh"], 30 | "rules": { 31 | "@typescript-eslint/explicit-function-return-type": "off", 32 | "@typescript-eslint/triple-slash-reference": "off", 33 | "@typescript-eslint/strict-boolean-expressions": "off", 34 | "@typescript-eslint/no-floating-promises": "off", 35 | "@typescript-eslint/no-confusing-void-expression": "off", 36 | "react-hooks/exhaustive-deps": "off" 37 | }, 38 | "ignorePatterns": [ 39 | "node_modules", 40 | "dist", 41 | "vite.config.ts", 42 | "jest.config.ts", 43 | "jest.setup.ts", 44 | ".eslintrc", 45 | "tailwind.config.js", 46 | "postcss.config.js" 47 | ] 48 | } 49 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Created by https://www.toptal.com/developers/gitignore/api/windows,macos,linux,visualstudiocode,webstorm,node,react,sass,sublimetext 2 | # Edit at https://www.toptal.com/developers/gitignore?templates=windows,macos,linux,visualstudiocode,webstorm,node,react,sass,sublimetext 3 | 4 | ### Linux ### 5 | *~ 6 | 7 | # temporary files which can be created if a process still has a handle open of a deleted file 8 | .fuse_hidden* 9 | 10 | # KDE directory preferences 11 | .directory 12 | 13 | # Linux trash folder which might appear on any partition or disk 14 | .Trash-* 15 | 16 | # .nfs files are created when an open file is removed but is still being accessed 17 | .nfs* 18 | 19 | ### macOS ### 20 | # General 21 | .DS_Store 22 | .AppleDouble 23 | .LSOverride 24 | 25 | # Icon must end with two \r 26 | Icon 27 | 28 | 29 | # Thumbnails 30 | ._* 31 | 32 | # Files that might appear in the root of a volume 33 | .DocumentRevisions-V100 34 | .fseventsd 35 | .Spotlight-V100 36 | .TemporaryItems 37 | .Trashes 38 | .VolumeIcon.icns 39 | .com.apple.timemachine.donotpresent 40 | 41 | # Directories potentially created on remote AFP share 42 | .AppleDB 43 | .AppleDesktop 44 | Network Trash Folder 45 | Temporary Items 46 | .apdisk 47 | 48 | ### macOS Patch ### 49 | # iCloud generated files 50 | *.icloud 51 | 52 | ### Node ### 53 | # Logs 54 | logs 55 | *.log 56 | npm-debug.log* 57 | package-lock.json 58 | yarn-debug.log* 59 | yarn-error.log* 60 | yarn.lock 61 | lerna-debug.log* 62 | .pnpm-debug.log* 63 | pnpm-lock.yaml 64 | 65 | # Diagnostic reports (https://nodejs.org/api/report.html) 66 | report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json 67 | 68 | # Runtime data 69 | pids 70 | *.pid 71 | *.seed 72 | *.pid.lock 73 | 74 | # Directory for instrumented libs generated by jscoverage/JSCover 75 | lib-cov 76 | 77 | # Coverage directory used by tools like istanbul 78 | coverage 79 | *.lcov 80 | 81 | # nyc test coverage 82 | .nyc_output 83 | 84 | # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) 85 | .grunt 86 | 87 | # Bower dependency directory (https://bower.io/) 88 | bower_components 89 | 90 | # node-waf configuration 91 | .lock-wscript 92 | 93 | # Compiled binary addons (https://nodejs.org/api/addons.html) 94 | build/Release 95 | 96 | # Dependency directories 97 | node_modules/ 98 | jspm_packages/ 99 | 100 | # Snowpack dependency directory (https://snowpack.dev/) 101 | web_modules/ 102 | 103 | # TypeScript cache 104 | *.tsbuildinfo 105 | 106 | # Optional npm cache directory 107 | .npm 108 | 109 | # Optional eslint cache 110 | .eslintcache 111 | 112 | # Optional stylelint cache 113 | .stylelintcache 114 | 115 | # Microbundle cache 116 | .rpt2_cache/ 117 | .rts2_cache_cjs/ 118 | .rts2_cache_es/ 119 | .rts2_cache_umd/ 120 | 121 | # Optional REPL history 122 | .node_repl_history 123 | 124 | # Output of 'npm pack' 125 | *.tgz 126 | 127 | # Yarn Integrity file 128 | .yarn-integrity 129 | 130 | # dotenv environment variable files 131 | .env 132 | .env.local 133 | 134 | .env.development 135 | .env.development.local 136 | 137 | .env.production 138 | .env.production.local 139 | 140 | .env.staging 141 | .env.staging.local 142 | 143 | .env.test 144 | .env.test.local 145 | 146 | # parcel-bundler cache (https://parceljs.org/) 147 | .cache 148 | .parcel-cache 149 | 150 | # Next.js build output 151 | .next 152 | out 153 | 154 | # Nuxt.js build / generate output 155 | .nuxt 156 | dist 157 | 158 | # Gatsby files 159 | .cache/ 160 | # Comment in the public line in if your project uses Gatsby and not Next.js 161 | # https://nextjs.org/blog/next-9-1#public-directory-support 162 | # public 163 | 164 | # vuepress build output 165 | .vuepress/dist 166 | 167 | # vuepress v2.x temp and cache directory 168 | .temp 169 | 170 | # Docusaurus cache and generated files 171 | .docusaurus 172 | 173 | # Serverless directories 174 | .serverless/ 175 | 176 | # FuseBox cache 177 | .fusebox/ 178 | 179 | # DynamoDB Local files 180 | .dynamodb/ 181 | 182 | # TernJS port file 183 | .tern-port 184 | 185 | # Stores VSCode versions used for testing VSCode extensions 186 | .vscode-test 187 | 188 | # yarn v2 189 | .yarn/cache 190 | .yarn/unplugged 191 | .yarn/build-state.yml 192 | .yarn/install-state.gz 193 | .pnp.* 194 | 195 | ### Node Patch ### 196 | # Serverless Webpack directories 197 | .webpack/ 198 | 199 | # Optional stylelint cache 200 | 201 | # SvelteKit build / generate output 202 | .svelte-kit 203 | 204 | ### react ### 205 | .DS_* 206 | **/*.backup.* 207 | **/*.back.* 208 | 209 | node_modules 210 | 211 | *.sublime* 212 | 213 | psd 214 | thumb 215 | sketch 216 | 217 | ### Sass ### 218 | .sass-cache/ 219 | *.css.map 220 | *.sass.map 221 | *.scss.map 222 | 223 | ### SublimeText ### 224 | # Cache files for Sublime Text 225 | *.tmlanguage.cache 226 | *.tmPreferences.cache 227 | *.stTheme.cache 228 | 229 | # Workspace files are user-specific 230 | *.sublime-workspace 231 | 232 | # Project files should be checked into the repository, unless a significant 233 | # proportion of contributors will probably not be using Sublime Text 234 | # *.sublime-project 235 | 236 | # SFTP configuration file 237 | sftp-config.json 238 | sftp-config-alt*.json 239 | 240 | # Package control specific files 241 | Package Control.last-run 242 | Package Control.ca-list 243 | Package Control.ca-bundle 244 | Package Control.system-ca-bundle 245 | Package Control.cache/ 246 | Package Control.ca-certs/ 247 | Package Control.merged-ca-bundle 248 | Package Control.user-ca-bundle 249 | oscrypto-ca-bundle.crt 250 | bh_unicode_properties.cache 251 | 252 | # Sublime-github package stores a github token in this file 253 | # https://packagecontrol.io/packages/sublime-github 254 | GitHub.sublime-settings 255 | 256 | ### VisualStudioCode ### 257 | .vscode/* 258 | !.vscode/settings.json 259 | !.vscode/tasks.json 260 | !.vscode/launch.json 261 | !.vscode/extensions.json 262 | !.vscode/*.code-snippets 263 | 264 | # Local History for Visual Studio Code 265 | .history/ 266 | 267 | # Built Visual Studio Code Extensions 268 | *.vsix 269 | 270 | ### VisualStudioCode Patch ### 271 | # Ignore all local history of files 272 | .history 273 | .ionide 274 | 275 | ### WebStorm ### 276 | # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider 277 | # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 278 | 279 | # User-specific stuff 280 | .idea/**/workspace.xml 281 | .idea/**/tasks.xml 282 | .idea/**/usage.statistics.xml 283 | .idea/**/dictionaries 284 | .idea/**/shelf 285 | 286 | # AWS User-specific 287 | .idea/**/aws.xml 288 | 289 | # Generated files 290 | .idea/**/contentModel.xml 291 | 292 | # Sensitive or high-churn files 293 | .idea/**/dataSources/ 294 | .idea/**/dataSources.ids 295 | .idea/**/dataSources.local.xml 296 | .idea/**/sqlDataSources.xml 297 | .idea/**/dynamic.xml 298 | .idea/**/uiDesigner.xml 299 | .idea/**/dbnavigator.xml 300 | 301 | # Gradle 302 | .idea/**/gradle.xml 303 | .idea/**/libraries 304 | 305 | # Gradle and Maven with auto-import 306 | # When using Gradle or Maven with auto-import, you should exclude module files, 307 | # since they will be recreated, and may cause churn. Uncomment if using 308 | # auto-import. 309 | # .idea/artifacts 310 | # .idea/compiler.xml 311 | # .idea/jarRepositories.xml 312 | # .idea/modules.xml 313 | # .idea/*.iml 314 | # .idea/modules 315 | # *.iml 316 | # *.ipr 317 | 318 | # CMake 319 | cmake-build-*/ 320 | 321 | # Mongo Explorer plugin 322 | .idea/**/mongoSettings.xml 323 | 324 | # File-based project format 325 | *.iws 326 | 327 | # IntelliJ 328 | out/ 329 | 330 | # mpeltonen/sbt-idea plugin 331 | .idea_modules/ 332 | 333 | # JIRA plugin 334 | atlassian-ide-plugin.xml 335 | 336 | # Cursive Clojure plugin 337 | .idea/replstate.xml 338 | 339 | # SonarLint plugin 340 | .idea/sonarlint/ 341 | 342 | # Crashlytics plugin (for Android Studio and IntelliJ) 343 | com_crashlytics_export_strings.xml 344 | crashlytics.properties 345 | crashlytics-build.properties 346 | fabric.properties 347 | 348 | # Editor-based Rest Client 349 | .idea/httpRequests 350 | 351 | # Android studio 3.1+ serialized cache file 352 | .idea/caches/build_file_checksums.ser 353 | 354 | ### WebStorm Patch ### 355 | # Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721 356 | 357 | # *.iml 358 | # modules.xml 359 | # .idea/misc.xml 360 | # *.ipr 361 | 362 | # Sonarlint plugin 363 | # https://plugins.jetbrains.com/plugin/7973-sonarlint 364 | .idea/**/sonarlint/ 365 | 366 | # SonarQube Plugin 367 | # https://plugins.jetbrains.com/plugin/7238-sonarqube-community-plugin 368 | .idea/**/sonarIssues.xml 369 | 370 | # Markdown Navigator plugin 371 | # https://plugins.jetbrains.com/plugin/7896-markdown-navigator-enhanced 372 | .idea/**/markdown-navigator.xml 373 | .idea/**/markdown-navigator-enh.xml 374 | .idea/**/markdown-navigator/ 375 | 376 | # Cache file creation bug 377 | # See https://youtrack.jetbrains.com/issue/JBR-2257 378 | .idea/$CACHE_FILE$ 379 | 380 | # CodeStream plugin 381 | # https://plugins.jetbrains.com/plugin/12206-codestream 382 | .idea/codestream.xml 383 | 384 | # Azure Toolkit for IntelliJ plugin 385 | # https://plugins.jetbrains.com/plugin/8053-azure-toolkit-for-intellij 386 | .idea/**/azureSettings.xml 387 | 388 | ### Windows ### 389 | # Windows thumbnail cache files 390 | Thumbs.db 391 | Thumbs.db:encryptable 392 | ehthumbs.db 393 | ehthumbs_vista.db 394 | 395 | # Dump file 396 | *.stackdump 397 | 398 | # Folder config file 399 | [Dd]esktop.ini 400 | 401 | # Recycle Bin used on file shares 402 | $RECYCLE.BIN/ 403 | 404 | # Windows Installer files 405 | *.cab 406 | *.msi 407 | *.msix 408 | *.msm 409 | *.msp 410 | 411 | # Windows shortcuts 412 | *.lnk 413 | 414 | # End of https://www.toptal.com/developers/gitignore/api/windows,macos,linux,visualstudiocode,webstorm,node,react,sass,sublimetext -------------------------------------------------------------------------------- /.husky/pre-commit: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | . "$(dirname "$0")/_/husky.sh" 3 | 4 | npx lint-staged 5 | -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | dist 3 | *lock* 4 | index.html -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "semi": true, 3 | "singleQuote": true, 4 | "jsxSingleQuote": true, 5 | "printWidth": 80, 6 | "plugins": ["prettier-plugin-tailwindcss"] 7 | } 8 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 Jose Espinosa 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # React-professional-configuration 2 | 3 | ### FREE 4 | 5 | Welcome to the most professional React configuration template you can find! 6 | 7 | This project is set up so that you only focus on the coding as I have done all the dirty work for you. You can play with the settings if you wish, but I recommend that you don't as it has very advanced and perfectly calculated settings. 8 | 9 | ## How to use this template 10 | 11 | At the top right, right where the clone button is, there is a new button so you can use this template completely from ZERO in your new project. 12 | 13 | ## How to install 14 | 15 | ```bash 16 | npm i 17 | ``` 18 | 19 | ```bash 20 | npm run dev 21 | ``` 22 | 23 | ## How to test 24 | 25 | ```bash 26 | npm run test 27 | ``` 28 | 29 | ```bash 30 | npm run test:watch 31 | ``` 32 | 33 | ## :bulb:Configurations: 34 | 35 | - React 36 | - react-swc 37 | - TypeScript 38 | - Vite 39 | - Tailwindcss 40 | - Postcss 41 | - Jest 42 | - Testing Library 43 | - Babel (for jest) 44 | - Husky 45 | - Eslint 46 | - standard js 47 | - Prettier 48 | - Clsx 49 | 50 | ## License 51 | 52 | ```txt 53 | MIT License 54 | 55 | Copyright (c) 2023 Jose Espinosa 56 | 57 | Permission is hereby granted, free of charge, to any person obtaining a copy 58 | of this software and associated documentation files (the "Software"), to deal 59 | in the Software without restriction, including without limitation the rights 60 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 61 | copies of the Software, and to permit persons to whom the Software is 62 | furnished to do so, subject to the following conditions: 63 | 64 | The above copyright notice and this permission notice shall be included in all 65 | copies or substantial portions of the Software. 66 | 67 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 68 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 69 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 70 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 71 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 72 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 73 | SOFTWARE. 74 | ``` 75 | 76 | ## Author 77 | 78 | [Jose Espinosa](https://github.com/joer9514) 79 | -------------------------------------------------------------------------------- /babel.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | ["@babel/preset-env", { "targets": { "esmodules": true } }], 4 | ["@babel/preset-react", { "runtime": "automatic" }], 5 | ["@babel/preset-typescript"] 6 | ] 7 | } 8 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | React professional configuration 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /jest.config.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * For a detailed explanation regarding each configuration property and type check, visit: 3 | * https://jestjs.io/docs/configuration 4 | */ 5 | 6 | export default { 7 | // A list of paths to directories that Jest should use to search for files in 8 | roots: [''], 9 | 10 | // A list of paths to modules that run some code to configure or set up the testing framework before each test 11 | setupFilesAfterEnv: ['/jest.setup.ts'], 12 | 13 | // A preset that is used as a base for Jest's configuration 14 | preset: 'ts-jest', 15 | 16 | // The test environment that will be used for testing 17 | testEnvironment: 'jest-environment-jsdom', 18 | 19 | // The glob patterns Jest uses to detect test files 20 | testMatch: [ 21 | '**/__tests__/**/*.[jt]s?(x)', 22 | '**/?(*.)+(spec|test|tests).[tj]s?(x)', 23 | ], 24 | 25 | // A map from regular expressions to paths to transformers 26 | transform: { 27 | '\\.tsx?$': 'ts-jest', 28 | '\\.ts?$': 'ts-jest', 29 | }, 30 | 31 | // A map from regular expressions to module names or to arrays of module names that allow to stub out resources with a single module 32 | moduleNameMapper: { 33 | '^@/(.*)$': '/src/$1', 34 | '^.+\\.(css|less|scss)$': 'babel-jest', 35 | }, 36 | 37 | // An array of file extensions your modules use 38 | moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'], 39 | 40 | // Automatically clear mock calls, instances, contexts and results before every test 41 | clearMocks: true, 42 | 43 | // Automatically reset mock state before every test 44 | resetMocks: true, 45 | 46 | // Reset the module registry before running each individual test 47 | resetModules: true, 48 | 49 | // Automatically restore mock state and implementation before every test 50 | restoreMocks: true, 51 | 52 | // An array of regexp pattern strings used to skip coverage collection 53 | coveragePathIgnorePatterns: ['/node_modules/', '/dist/'], 54 | 55 | // Indicates which provider should be used to instrument code for coverage 56 | coverageProvider: 'babel', 57 | }; 58 | -------------------------------------------------------------------------------- /jest.setup.ts: -------------------------------------------------------------------------------- 1 | import '@testing-library/jest-dom'; 2 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "react-professional-configuration", 3 | "private": true, 4 | "version": "2.0.1", 5 | "type": "module", 6 | "scripts": { 7 | "dev": "vite --mode development --host", 8 | "staging": "vite --mode staging --host", 9 | "prod": "vite --mode production --host", 10 | "build": "tsc && vite build", 11 | "preview": "vite preview --host", 12 | "lint": "eslint --fix . --ext ts,tsx", 13 | "format": "prettier --write .", 14 | "test": "jest", 15 | "test:watch": "jest --watchAll", 16 | "prepare": "husky install" 17 | }, 18 | "dependencies": { 19 | "clsx": "2.0.0", 20 | "react": "18.2.0", 21 | "react-dom": "18.2.0" 22 | }, 23 | "devDependencies": { 24 | "@babel/core": "7.23.5", 25 | "@babel/preset-env": "7.23.5", 26 | "@babel/preset-react": "7.23.3", 27 | "@babel/preset-typescript": "7.23.3", 28 | "@testing-library/dom": "9.3.3", 29 | "@testing-library/jest-dom": "6.1.5", 30 | "@testing-library/react": "14.1.2", 31 | "@testing-library/user-event": "14.5.1", 32 | "@types/jest": "29.5.11", 33 | "@types/node": "20.10.3", 34 | "@types/react": "18.2.42", 35 | "@types/react-dom": "18.2.17", 36 | "@typescript-eslint/eslint-plugin": "6.13.2", 37 | "@typescript-eslint/parser": "6.13.2", 38 | "@vitejs/plugin-react-swc": "3.5.0", 39 | "autoprefixer": "10.4.16", 40 | "babel-jest": "29.7.0", 41 | "cssnano": "6.0.1", 42 | "eslint": "8.55.0", 43 | "eslint-config-prettier": "9.1.0", 44 | "eslint-config-standard-with-typescript": "40.0.0", 45 | "eslint-plugin-import": "2.29.0", 46 | "eslint-plugin-n": "16.3.1", 47 | "eslint-plugin-prettier": "5.0.1", 48 | "eslint-plugin-promise": "6.1.1", 49 | "eslint-plugin-react": "7.33.2", 50 | "eslint-plugin-react-hooks": "4.6.0", 51 | "eslint-plugin-react-refresh": "0.4.5", 52 | "husky": "8.0.3", 53 | "jest": "29.7.0", 54 | "jest-environment-jsdom": "29.7.0", 55 | "lint-staged": "15.2.0", 56 | "postcss": "8.4.32", 57 | "prettier": "3.1.0", 58 | "prettier-plugin-tailwindcss": "0.5.9", 59 | "tailwindcss": "3.3.6", 60 | "ts-jest": "29.1.1", 61 | "ts-node": "10.9.1", 62 | "typescript": "5.3.3", 63 | "vite": "5.0.6" 64 | }, 65 | "lint-staged": { 66 | "*.{ts,tsx}": [ 67 | "npm run lint", 68 | "npm run format" 69 | ] 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /postcss.config.js: -------------------------------------------------------------------------------- 1 | export default { 2 | plugins: { 3 | tailwindcss: {}, 4 | autoprefixer: {}, 5 | ...(process.env.NODE_ENV === 'production' 6 | ? { 7 | cssnano: { 8 | preset: [ 9 | 'default', 10 | { autoprefixer: true, mergeIdents: true, discardUnused: true }, 11 | ], 12 | }, 13 | } 14 | : {}), 15 | }, 16 | }; 17 | -------------------------------------------------------------------------------- /public/vite.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/App.test.tsx: -------------------------------------------------------------------------------- 1 | import App from '@/App'; 2 | import { render, screen } from '@testing-library/react'; 3 | import userEvent from '@testing-library/user-event'; 4 | 5 | beforeEach(() => { 6 | render(); 7 | }); 8 | 9 | describe('', () => { 10 | describe('The App component should be displayed on the screen', () => { 11 | test('App renderer', () => { 12 | const title = screen.getByText(/REACT PROFESSIONAL CONFIGURATION!/); 13 | 14 | expect(title).toBeInTheDocument(); 15 | }); 16 | }); 17 | 18 | describe('Counter', () => { 19 | test('Counter should start at 0', () => { 20 | const counterButton = screen.getByText(/counter 0/i); 21 | expect(counterButton).toBeInTheDocument(); 22 | }); 23 | 24 | test('Counter should increment when the button is clicked', async () => { 25 | const counterButton = screen.getByText(/counter 0/i); 26 | await userEvent.click(counterButton); 27 | 28 | const updatedCounterButton = screen.getByText(/counter 1/i); 29 | expect(updatedCounterButton).toBeInTheDocument(); 30 | }); 31 | }); 32 | }); 33 | -------------------------------------------------------------------------------- /src/App.tsx: -------------------------------------------------------------------------------- 1 | import { useState } from 'react'; 2 | 3 | export default function App() { 4 | const [count, setCount] = useState(0); 5 | 6 | const onCounter = () => { 7 | setCount(count + 1); 8 | }; 9 | 10 | return ( 11 | <> 12 |
13 |

14 | REACT PROFESSIONAL CONFIGURATION! 15 |

16 | 23 |
24 | 25 | ); 26 | } 27 | -------------------------------------------------------------------------------- /src/assets/react.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/globals.css: -------------------------------------------------------------------------------- 1 | @tailwind base; 2 | @tailwind components; 3 | @tailwind utilities; 4 | -------------------------------------------------------------------------------- /src/main.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom/client'; 3 | import App from './App'; 4 | import './globals.css'; 5 | 6 | ReactDOM.createRoot(document.getElementById('root') as HTMLElement).render( 7 | 8 | 9 | , 10 | ); 11 | -------------------------------------------------------------------------------- /src/vite-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | -------------------------------------------------------------------------------- /tailwind.config.js: -------------------------------------------------------------------------------- 1 | export default { 2 | darkMode: 'class', 3 | important: 'html', 4 | content: [ 5 | 'index.html', 6 | './src/App.tsx', 7 | './src/components/**/*.{tsx,jsx,js,css,html}', 8 | './src/routes/**/*.{tsx,jsx,js,css,html}', 9 | './src/pages/**/components/**/*.{tsx,jsx,js,css,html}', 10 | ], 11 | theme: { 12 | extend: {}, 13 | }, 14 | plugins: [], 15 | }; 16 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES6", 4 | "baseUrl": ".", 5 | "paths": { "@/*": ["./src/*"] }, 6 | "useDefineForClassFields": true, 7 | "lib": ["DOM", "DOM.Iterable", "ES6"], 8 | "allowJs": false, 9 | "skipLibCheck": true, 10 | "esModuleInterop": false, 11 | "allowSyntheticDefaultImports": true, 12 | "strict": true, 13 | "forceConsistentCasingInFileNames": true, 14 | "module": "ESNext", 15 | "moduleResolution": "Node", 16 | "resolveJsonModule": true, 17 | "isolatedModules": true, 18 | "noEmit": true, 19 | "jsx": "react-jsx", 20 | "types": ["vite/client", "node", "jest"] 21 | }, 22 | "include": ["src", "jest.setup.ts"], 23 | "exclude": [ 24 | "node_modules", 25 | "dist", 26 | "jest.config.ts", 27 | "vite.config.ts", 28 | ".eslintrc", 29 | "tailwind.config.js", 30 | "postcss.config.js" 31 | ], 32 | "references": [{ "path": "./tsconfig.node.json" }] 33 | } 34 | -------------------------------------------------------------------------------- /tsconfig.node.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "composite": true, 4 | "module": "ESNext", 5 | "moduleResolution": "Node", 6 | "allowSyntheticDefaultImports": true 7 | }, 8 | "include": ["vite.config.ts"] 9 | } 10 | -------------------------------------------------------------------------------- /vite.config.ts: -------------------------------------------------------------------------------- 1 | import react from '@vitejs/plugin-react-swc'; 2 | import { resolve } from 'path'; 3 | import { defineConfig, loadEnv } from 'vite'; 4 | 5 | // https://vitejs.dev/config/ 6 | export default ({ mode }: { mode: string }) => { 7 | return defineConfig({ 8 | plugins: [react()], 9 | resolve: { 10 | alias: [{ find: '@', replacement: resolve(__dirname, './src') }], 11 | }, 12 | define: { 13 | 'process.env': { ...loadEnv(mode, process.cwd()) }, 14 | }, 15 | }); 16 | }; 17 | --------------------------------------------------------------------------------