Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
alexZ7000 authored Aug 26, 2024
0 parents commit 1193393
Show file tree
Hide file tree
Showing 39 changed files with 16,407 additions and 0 deletions.
Empty file added .env.examples
Empty file.
46 changes: 46 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
module.exports = {
root: true,
env: {
browser: true,
es2023: true,
jest: true
},
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/recommended-type-checked",
"plugin:react-hooks/recommended",
"plugin:prettier/recommended"
],
parserOptions: {
ecmaVersion: "latest",
sourceType: "module",
project: ["./tsconfig.app.json", "./tsconfig.node.json"],
tsconfigRootDir: __dirname
},
overrides: [
{
extends: [
"plugin:@typescript-eslint/disable-type-checked",
"plugin:jest/recommended"
],
plugins: ["jest"],
files: ["./**/*.js", "./**/*.ts", "./**/*.tsx", "tests/**/*"]
}
],
ignorePatterns: [
"dist",
".eslintrc.cjs",
"iac",
".github/",
"src/vite-env.d.ts",
"__tests__"
],
parser: "@typescript-eslint/parser",
plugins: ["react", "react-refresh"],
rules: {
"react-refresh/only-export-components": [
"warn",
{ allowConstantExport: true }
]
}
};
34 changes: 34 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: CI

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '20.11.0'

- name: Install dependencies
run: npm ci

- name: Run linter
run: npm run lint:fix

- name: Run tests
run: npm run test

- name: Build project
run: npm run build
119 changes: 119 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
.env.test

# parcel-bundler cache (https://parceljs.org/)
.cache

# Next.js build output
.next

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and *not* Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port

node_modules
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
2 changes: 2 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
npm run test
npx lint-staged
13 changes: 13 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"tabWidth": 4,
"useTabs": false,
"semi": true,
"singleQuote": false,
"trailingComma": "none",
"printWidth": 80,
"bracketSpacing": true,
"arrowParens": "always",
"proseWrap": "always",
"endOfLine": "lf",
"insertPragma": false
}
30 changes: 30 additions & 0 deletions .swcrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"jsc": {
"parser": {
"syntax": "typescript",
"tsx": true,
"dynamicImport": true
},
"target": "es2023",
"transform": {
"react": {
"runtime": "automatic",
"development": false,
"refresh": true
}
},
"minify": true
},
"module": {
"type": "es2023",
"lazy": true,
"strict": true,
"strictMode": true
},
"env": {
"targets": {
"browsers": [">0.2%", "not dead", "not op_mini all"]
},
"mode": "entry"
}
}
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 Alessandro Pereira Lima FIlho

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
25 changes: 25 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<h1 align="center"> React + TypeScript + SWC + Vite + Tailwind + Eslint + Prettier + Husky + Jest + Testing Library</h1>
<br>

<p align="center">
<img src="https://raw.githubusercontent.com/devicons/devicon/master/icons/react/react-original-wordmark.svg" alt="react" align="center" width="80" height="80"/>
<img src="https://raw.githubusercontent.com/devicons/devicon/master/icons/typescript/typescript-original.svg" alt="typescript" align="center" width="80" height="80"/>
<img src="https://swc.rs/logo.png" alt="swc" align="center" width="120" height="80"/>
<img src="https://github.com/alexZ7000/UsinaEcoCultural/assets/78627928/b82095b6-48ad-42c2-90a3-a2d0ea890da1" alt="vite" align="center" width="80" height="80"/>
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/d/d5/Tailwind_CSS_Logo.svg/1024px-Tailwind_CSS_Logo.svg.png?20230715030042" alt="tailwind" align="center" width="75" height="60" />
<img src="https://external-content.duckduckgo.com/iu/?u=https%3A%2F%2Fmiguelmachado.dev%2Fassets%2Fimg%2F1_3adbbrn3gotbz72xqfo96g.png&f=1&nofb=1&ipt=815bdc1a92129a989194fc10b59209968b7cb74bd6273ab809a219462fffe4e8&ipo=images" alt="ESLint" align="center" width="120" height="80"/>
<img src="https://prettier.io/icon.png" alt="Prettier" align="center" width="80" height="80"/>
🐶
<img src="https://cdn.freebiesupply.com/logos/large/2x/jest-logo-png-transparent.png" alt="jest" width="80" />
<img src="https://seeklogo.com/images/T/testing-library-logo-FFB8C5C0B6-seeklogo.com.png?v=637852764070000000" alt="Testing Library" width="80" /></p>

This template provides a minimal setup to get React working in Vite with HMR
with ESLint/PRETTIER rules, and Husky to automate the process.

In root folder run this command

```node
npm install
```

Template made in NodeJS: 20.11.0
9 changes: 9 additions & 0 deletions __tests__/example-page.spec.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { render, screen } from "@testing-library/react";
import ExamplePage from "../src/app/web/screens/ExamplePage";

describe("ExamplePage", () => {
it("should render correctly", () => {
render(<ExamplePage />);
expect(screen.getByText("Hello world!"));
});
});
5 changes: 5 additions & 0 deletions __tests__/sum.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import sum from "../src/app/utils/functions/sum";

test("adds 1 + 2 to equal 3", () => {
expect(sum()).toBe(3);
});
7 changes: 7 additions & 0 deletions babel.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
presets: [
"@babel/preset-env",
["@babel/preset-react", { runtime: "automatic" }],
"@babel/preset-typescript"
]
};
13 changes: 13 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Clean React Template</title>
</head>
<body class="antialiased">
<div id="root"></div>
<script type="module" src="./src/main.tsx"></script>
</body>
</html>
Loading

0 comments on commit 1193393

Please sign in to comment.