Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
armanatz committed Sep 6, 2022
0 parents commit 28046a7
Show file tree
Hide file tree
Showing 27 changed files with 596 additions and 0 deletions.
22 changes: 22 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
max_line_length = 80
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
max_line_length = 0
trim_trailing_whitespace = false

[*.{js,jsx,ts,tsx}]
charset = utf-8

[{package.json}]
indent_style = space
indent_size = 2
27 changes: 27 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
module.exports = {
env: {
browser: true,
es2021: true,
},
extends: [
'airbnb',
'airbnb-typescript',
'airbnb/hooks',
'plugin:react/recommended',
'plugin:@typescript-eslint/recommended',
'plugin:prettier/recommended',
],
ignorePatterns: ['node_modules/'],
overrides: [],
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
project: './tsconfig.json',
},
plugins: ['react', '@typescript-eslint', 'prettier'],
rules: {
'react/react-in-jsx-scope': 0,
'react-hooks/exhaustive-deps': 'warn',
},
};
26 changes: 26 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

# Linter cache files
.eslintcache
.stylelintcache
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npm run lint-staged
6 changes: 6 additions & 0 deletions .postcssrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"syntax": "postcss-scss",
"plugins": {
"autoprefixer": {}
}
}
6 changes: 6 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.vscode/
node_modules/
package-lock.json
package.json
README.md
.eslintignore
10 changes: 10 additions & 0 deletions .prettierrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module.exports = {
printWidth: 60,
tabWidth: 2,
useTabs: false,
semi: true,
singleQuote: true,
trailingComma: 'all',
bracketSpacing: true,
arrowParens: 'avoid',
};
23 changes: 23 additions & 0 deletions .stylelintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"plugins": ["stylelint-scss"],
"extends": [
"stylelint-config-standard-scss",
"stylelint-config-prettier-scss"
],
"rules": {
"font-family-name-quotes": null,
"scss/at-rule-no-unknown": [
true,
{
"ignoreAtRules": ["layer"]
}
],
"selector-class-pattern": null
},
"overrides": [
{
"customSyntax": "postcss-scss",
"files": ["**/*.scss"]
}
]
}
8 changes: 8 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"recommendations": [
"esbenp.prettier-vscode",
"dbaeumer.vscode-eslint",
"Syler.sass-indented",
"ZixuanChen.vitest-explorer"
]
}
36 changes: 36 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"editor.quickSuggestions": {
"strings": true
},
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true,
"editor.formatOnPaste": true
},
"[json]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true,
"editor.formatOnPaste": true
},
"[jsonc]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true,
"editor.formatOnPaste": true
},
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true,
"editor.formatOnPaste": true
},
"[typescriptreact]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true,
"editor.formatOnPaste": true
},
"[markdown]": {
"editor.wordWrap": "on",
"editor.formatOnSave": true,
"editor.renderWhitespace": "all",
"editor.acceptSuggestionOnEnter": "off"
}
}
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) 2022 Gabriel Pereira Woitechen

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.
65 changes: 65 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# [Reactivite](https://github.com/armanatz/Reactivite)

A minimal starter for React with TypeScript support with out of the box formatting and linting. Utilizes the blazing fast Vite build tool.

## Features

- [React](https://reactjs.org) with [TypeScript](https://www.typescriptlang.org) using the [Vite](https://vitejs.dev) build tool.
- Supports [Sass](https://sass-lang.com/) with [automatic type declaration file creation](https://github.com/activeguild/vite-plugin-sass-dts) when using SCSS Modules.
- Utilizes [PostCSS](https://postcss.org/) with the [Autoprefixer](https://github.com/postcss/autoprefixer) plugin to optimize CSS and SCSS code.
- Supports TypeScript [absolute imports](https://github.com/aleclarson/vite-tsconfig-paths).
- Uses [ESLint](https://eslint.org) (with ESLint AirBnB Config), [stylelint](https://stylelint.io) and [Prettier](https://prettier.io) for code linting and formatting.
- Runs pre-commit command using [Husky](https://github.com/typicode/husky) to run [lint-staged](https://github.com/okonet/lint-staged).
- Unit and integration testing using [Vitest](https://vitest.dev/) and [Testing Library](https://testing-library.com/).
- Comes with a light VSCode setting file to enable formatting on save for JSON, JavaScript, TypeScript, TypeScript React, and Markdown files.
- Recommends useful extensions to install when using VSCode as your editor.

## Getting Started

Either use this repo as a [GitHub template](https://github.com/armanatz/Reactivite) or use [degit](https://github.com/Rich-Harris/degit) to make a clean copy of this repo:

```
npx degit armanatz/Reactivite#master my-app
```

After that, navigate to your project folder and install dependencies:

```
// If using NPM as your package manager
npm i
// If using Yarn as your package manager
yarn
```

Then you can run the local development server using:

```
// If using NPM as your package manager
npm run dev
// If using Yarn as your package manager
yarn dev
```

To build your application, run:

```
// If using NPM as your package manager
npm build
// If using Yarn as your package manager
yarn build
```

Build files will be located in the `dist` folder once generated.

## Available Scripts

- `format`: Formats all files with Prettier.
- `lint`: Type-checks all files with TypeScript, and then lints all files using ESLint and StyleLint.
- `preview`: Allows for a local preview of the production build of the application.
- `test`: Runs unit and integration tests based on file changes tracked in git using Vitest.
- `test:ci`: Runs all unit and integration tests in CI mode using Vitest.
- `test:watch`: Runs Vitest test runner in watch mode.
- `validate`: Runs all linting commands defined in `lint`, and then runs `test:ci` for testing.
29 changes: 29 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link
rel="icon"
type="image/svg+xml"
href="/favicon.svg"
/>
<meta
name="viewport"
content="width=device-width, initial-scale=1.0"
/>
<meta name="theme-color" content="#000000" />
<meta
name="description"
content="My App's Description"
/>
<title>My App</title>
</head>
<body>
<noscript
>You need to enable JavaScript to run this
app.</noscript
>
<div id="root"></div>
<script type="module" src="/src/index.tsx"></script>
</body>
</html>
82 changes: 82 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
{
"name": "my-app",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"build": "tsc && vite build",
"dev": "vite --port 3000 --strictPort --host",
"format": "prettier -uw --cache --ignore-path .gitignore \"./**/*.{js,ts,tsx,json,cjs}\"",
"lint": "run-p run-tsc run-eslint run-stylelint",
"lint-staged": "lint-staged",
"prepare": "husky install",
"preview": "vite preview",
"run-eslint": "eslint --cache --fix --ignore-path .gitignore --ext .js,.cjs,.ts,.tsx .",
"run-stylelint": "stylelint --cache --fix --ignore-path .gitignore **/*.{css,scss}",
"run-tsc": "tsc",
"test": "vitest",
"test:ci": "vitest run",
"test:watch": "vitest watch",
"validate": "run-p lint test:ci"
},
"dependencies": {
"classnames": "^2.3.2",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"devDependencies": {
"@nabla/vite-plugin-eslint": "^1.4.1",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^14.4.3",
"@types/react": "^18.0.17",
"@types/react-dom": "^18.0.6",
"@typescript-eslint/eslint-plugin": "^5.38.1",
"@typescript-eslint/parser": "^5.38.1",
"@vitejs/plugin-react": "^2.1.0",
"autoprefixer": "^10.4.12",
"eslint": "^8.24.0",
"eslint-config-airbnb": "^19.0.4",
"eslint-config-airbnb-typescript": "^17.0.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-jsx-a11y": "^6.6.1",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-react": "^7.31.8",
"eslint-plugin-react-hooks": "^4.6.0",
"husky": "^8.0.1",
"jsdom": "^20.0.0",
"lint-staged": "^13.0.3",
"npm-run-all": "^4.1.5",
"postcss": "^8.4.16",
"postcss-scss": "^4.0.5",
"postcss-syntax": "^0.36.2",
"prettier": "^2.7.1",
"sass": "^1.55.0",
"stylelint": "^14.13.0",
"stylelint-config-prettier-scss": "^0.0.1",
"stylelint-config-standard-scss": "^5.0.0",
"stylelint-scss": "^4.3.0",
"ts-node": "^10.9.1",
"typescript": "^4.6.4",
"vite": "^3.1.0",
"vite-plugin-sass-dts": "^1.1.42",
"vite-tsconfig-paths": "^3.5.1",
"vitest": "^0.23.4"
},
"browserslist": {
"production": "Edge >= 18, Firefox >= 60, Chrome >= 61, Safari >= 11, Opera >= 48",
"development": [
"last 1 chrome version",
"last 1 firefox version"
]
},
"lint-staged": {
"*": "prettier -uw --cache",
"*.{css,scss}": "stylelint --cache --fix",
"*.{ts,tsx}": [
"eslint --cache --fix",
"vitest related --run --coverage=false"
]
}
}
16 changes: 16 additions & 0 deletions public/favicon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 28046a7

Please sign in to comment.