Skip to content

Commit

Permalink
feat: init
Browse files Browse the repository at this point in the history
  • Loading branch information
wwwenjie committed Apr 14, 2021
1 parent 486f1ea commit ba1cdf4
Show file tree
Hide file tree
Showing 50 changed files with 7,298 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .cspell.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"version": "0.1",
"$schema": "https://raw.githubusercontent.com/streetsidesoftware/cspell/master/cspell.schema.json",
"language": "en",
"words": [
"vite"
],
"flagWords": [],
"ignorePaths": [
"package.json",
"yarn.lock",
"tsconfig.json",
"node_modules/**",
"src/public/**",
]
}
68 changes: 68 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
{
"env": {
"jest": true
},
"extends": [
"react-app",
"plugin:react/recommended",
"plugin:react-hooks/recommended",
"plugin:prettier/recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"plugin:functional/lite",
"airbnb",
"prettier"
],
"parser": "@typescript-eslint/parser",
"plugins": [
"react",
"@typescript-eslint",
"functional"
],
"rules": {
"prettier/prettier": "error",
"no-unused-vars": "warn",
"no-use-before-define": "off",
"jsx-a11y/anchor-is-valid": "warn",
"jsx-a11y/alt-text": "warn",
"functional/no-return-void": "off",
"functional/no-mixed-type": "off",
"react/button-has-type": "off",
"react/prop-types": "off",
"react/jsx-props-no-spreading": "off",
"react/jsx-filename-extension": [
"error",
{
"extensions": [
".ts",
".tsx"
]
}
],
"import/prefer-default-export": "off",
"import/no-unresolved": "off",
"import/extensions": [
"error",
"ignorePackages",
{
"js": "never",
"jsx": "never",
"ts": "never",
"tsx": "never"
}
],
"import/no-extraneous-dependencies": "off"
},
"settings": {
"import/resolver": {
"node": {
"extensions": [
".js",
".jsx",
".ts",
".tsx"
]
}
}
}
}
134 changes: 134 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
coverage
dist

# Created by https://www.toptal.com/developers/gitignore/api/react,webstorm,vscode
# Edit at https://www.toptal.com/developers/gitignore?templates=react,webstorm,vscode

### react ###
.DS_*
*.log
logs
**/*.backup.*
**/*.back.*

node_modules
bower_components

*.sublime*

psd
thumb
sketch

### vscode ###
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
*.code-workspace

### WebStorm ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf

# Generated files
.idea/**/contentModel.xml

# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml

# Gradle
.idea/**/gradle.xml
.idea/**/libraries

# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/artifacts
# .idea/compiler.xml
# .idea/jarRepositories.xml
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# *.iml
# *.ipr

# CMake
cmake-build-*/

# Mongo Explorer plugin
.idea/**/mongoSettings.xml

# File-based project format
*.iws

# IntelliJ
out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Cursive Clojure plugin
.idea/replstate.xml

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

# Editor-based Rest Client
.idea/httpRequests

# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser

### WebStorm Patch ###
# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721

# *.iml
# modules.xml
# .idea/misc.xml
# *.ipr

# Sonarlint plugin
# https://plugins.jetbrains.com/plugin/7973-sonarlint
.idea/**/sonarlint/

# SonarQube Plugin
# https://plugins.jetbrains.com/plugin/7238-sonarqube-community-plugin
.idea/**/sonarIssues.xml

# Markdown Navigator plugin
# https://plugins.jetbrains.com/plugin/7896-markdown-navigator-enhanced
.idea/**/markdown-navigator.xml
.idea/**/markdown-navigator-enh.xml
.idea/**/markdown-navigator/

# Cache file creation bug
# See https://youtrack.jetbrains.com/issue/JBR-2257
.idea/$CACHE_FILE$

# CodeStream plugin
# https://plugins.jetbrains.com/plugin/12206-codestream
.idea/codestream.xml

# End of https://www.toptal.com/developers/gitignore/api/react,webstorm,vscode
6 changes: 6 additions & 0 deletions .huskyrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"hooks": {
"pre-commit": "echo \"git commit trigger husky pre-commit hook\" && lint-staged",
"post-commit": "git update-index --again"
}
}
6 changes: 6 additions & 0 deletions .idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions .idea/react.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions .lintstagedrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"src/**/*.{ts,tsx}": "eslint"
}
7 changes: 7 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"trailingComma": "all",
"printWidth": 100,
"semi": false,
"singleQuote": true,
"tabWidth": 2
}
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='favicon.svg' />
<meta name='viewport' content='width=device-width, initial-scale=1.0' />
<title>React Starter</title>
</head>
<body>
<div id='root'></div>
<script type='module' src='/src/main.tsx'></script>
</body>
</html>
20 changes: 20 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// eslint-disable-next-line functional/immutable-data
module.exports = {
preset: 'ts-jest',
testEnvironment: 'jsdom',
// nobody like @/components when @components is available
// https://stackoverflow.com/questions/50748152/jest-cannot-locate-babel-code-frame-when-trying-to-use-alias
moduleNameMapper: {
'^@assets(.*?)$': '<rootDir>/src/assets/$1',
'^@components(.*?)$': '<rootDir>/src/components/$1',
'^@constants(.*?)$': '<rootDir>/src/constants/$1',
'^@data(.*?)$': '<rootDir>/src/data/$1',
'^@hooks(.*?)$': '<rootDir>/src/hooks/$1',
'^@interface(.*?)$': '<rootDir>/src/interface/$1',
'^@pages(.*?)$': '<rootDir>/src/pages/$1',
'^@utils(.*?)$': '<rootDir>/src/utils/$1',
},
coverageDirectory: 'coverage',
coverageReporters: ['html', 'lcov', 'text'],
collectCoverageFrom: ['src/**/*.{ts,tsx}', '!**/node_modules/**'],
}
69 changes: 69 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
{
"name": "react-starter",
"version": "1.0.0",
"license": "MIT",
"author": "wwwenjie",
"description": "React Starter",
"scripts": {
"dev": "vite --open",
"build": "tsc && vite build",
"serve": "vite preview",
"test": "run-s test:*",
"test:lint": "eslint src --ext .ts,.tsx",
"test:prettier": "prettier \"src/**/*.ts\" --list-different",
"test:spelling": "cspell \"{README.md,.github/*.md,src/**/**}\"",
"test:build": "tsc",
"test:unit": "jest --collectCoverage",
"watch": "run-p watch:*",
"watch:test": "jest --watch",
"cov": "run-s test:unit && open-cli coverage/lcov-report/index.html",
"fix": "run-s fix:*",
"fix:prettier": "prettier \"src/**/*.ts\" --write",
"fix:lint": "eslint src --ext .ts,.tsx --fix"
},
"dependencies": {
"classnames": "^2.3.1",
"i18next": "^20.2.1",
"react": "^17.0.0",
"react-dom": "^17.0.0",
"react-i18next": "^11.8.13",
"react-icons": "^4.2.0",
"react-use": "^17.2.3"
},
"devDependencies": {
"@testing-library/react": "^11.2.6",
"@types/classnames": "^2.2.11",
"@types/jest": "^26.0.22",
"@types/node": "^14.14.31",
"@types/react": "^17.0.0",
"@types/react-dom": "^17.0.0",
"@typescript-eslint/eslint-plugin": "^4.16.1",
"@typescript-eslint/parser": "^4.16.1",
"@vitejs/plugin-react-refresh": "^1.3.1",
"autoprefixer": "^10.2.5",
"cspell": "^5.3.12",
"eslint": "^7.23.0",
"eslint-config-airbnb": "^18.2.1",
"eslint-config-prettier": "^8.1.0",
"eslint-config-react-app": "^6.0.0",
"eslint-plugin-flowtype": "^5.3.1",
"eslint-plugin-functional": "^3.2.1",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-jsx-a11y": "^6.4.1",
"eslint-plugin-prettier": "^3.3.1",
"eslint-plugin-react": "^7.22.0",
"eslint-plugin-react-hooks": "^4.2.0",
"husky": "^5.1.3",
"jest": "^26.6.3",
"lint-staged": "^10.5.4",
"npm-run-all": "^4.1.5",
"open-cli": "^6.0.1",
"postcss": "^8.2.10",
"prettier": "^2.2.1",
"tailwindcss": "^2.1.1",
"ts-jest": "^26.5.4",
"typescript": "^4.1.2",
"vite": "^2.0.5",
"vite-tsconfig-paths": "^2.5.0"
}
}
7 changes: 7 additions & 0 deletions postcss.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// eslint-disable-next-line functional/immutable-data
module.exports = {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
}

0 comments on commit ba1cdf4

Please sign in to comment.