Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
kangood committed Feb 5, 2024
0 parents commit a1a74a9
Show file tree
Hide file tree
Showing 317 changed files with 29,614 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.github
.husky
.vscode/
dist/
node_modules/
19 changes: 19 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
root = true

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

[*.{yml,yaml,json}]
indent_style = space
indent_size = 2

[*.md]
trim_trailing_whitespace = false

[Makefile]
indent_style = tab
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
VITE_GLOB_APP_TITLE = Vite React TS Template
2 changes: 2 additions & 0 deletions .env.development
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
VITE_APP_BASE_API=/api
VITE_APP_HOMEPAGE=/dashboard/workbench
2 changes: 2 additions & 0 deletions .env.production
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
VITE_APP_BASE_API=/api
VITE_APP_HOMEPAGE=/dashboard/workbench
22 changes: 22 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
*.sh
node_modules
*.lock
**/*.svg
**/*.md
**/*.svg
**/*.ejs
**/*.html
**/*.png
**/*.toml
**/*.md
.vscode
.idea
dist
/public
/docs
.husky
.local
/bin
Dockerfile
pnpm-lock.yaml
tsconfig.node.json
144 changes: 144 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
module.exports = {
root: true, // 表示当前目录即为根目录,ESLint 规则将被限制到该目录下
env: { browser: true, es2020: true, node: true },
/* 解析器 */
parser: '@typescript-eslint/parser', // 指定ESLint解析器
parserOptions: {
project: './tsconfig.json', // tsconfig.json的路径
ecmaVersion: 'latest',
sourceType: 'module',
ecmaFeatures: {
jsx: true, // 启用JSX
},
extraFileExtensions: ['.json'],
},
settings: {
// 识别 @ # alias
'import/resolver': {
alias: {
map: [
['@', './src'],
['#', './types'],
],
extensions: ['.ts', '.tsx', '.js', '.jsx', '.json'],
},
},
},
/* ESLint 中基础配置需要继承的配置 */
extends: [
'airbnb',
'airbnb-typescript',
'airbnb/hooks',
'plugin:@typescript-eslint/recommended', // 使用@typescript-eslint/eslint-plugin推荐的规则
'plugin:jsx-a11y/recommended',
'plugin:import/errors',
'plugin:import/warnings',
'prettier', // 增加 prettier 相关的校验规则
'plugin:prettier/recommended', // 开启 Prettier 插件推荐的规则
],
/* ESLint文件所依赖的插件 */
plugins: [
'@typescript-eslint',
'prettier',
'react',
'react-hooks',
'jsx-a11y',
'import',
'unused-imports',
],
/**
* 定义规则
* "off" 或 0 - 关闭规则
* "warn" 或 1 - 开启规则,使用警告级别的错误:warn (不会导致程序退出)
* "error" 或 2 - 开启规则,使用错误级别的错误:error (当被触发的时候,程序会退出)
*/
rules: {
'no-console': 'off',
'no-unused-vars': 'off',
'no-case-declarations': 'off',
'no-use-before-define': 'off',
'no-param-reassign': 'off',
'space-before-function-paren': 'off',
'class-methods-use-this': 'off',

'jsx-a11y/click-events-have-key-events': 'off',
'jsx-a11y/interactive-supports-focus': 'off',
'jsx-a11y/no-noninteractive-element-interactions': 'off',
'jsx-a11y/no-static-element-interactions': 'off',

// 不用手动引入react
'react/react-in-jsx-scope': 'off',
'react/button-has-type': 'off',
'react/require-default-props': 'off',
'react/no-array-index-key': 'off',
'react/jsx-props-no-spreading': 'off',

'import/first': 'warn',
'import/newline-after-import': 'warn',
'import/no-duplicates': 'warn',
'import/no-extraneous-dependencies': 'off',
'import/prefer-default-export': 'off',
'import/order': [
'warn',
{
groups: [
'builtin', // Node.js内置模块
'external', // 第三方模块
'internal', // 应用程序内部的模块
'parent', // 父级目录中导入的模块
['sibling', 'index'], // 具有相同或更高目录的兄弟模块
'object',
'type',
],
pathGroups: [
{
pattern: '@/**',
group: 'internal',
},
{
pattern: '#/**',
group: 'type',
},
{
pattern: '*.{scss,css,less,styl,stylus}',
group: 'parent',
},
{
pattern: '*.{js,jsx,ts,tsx}',
group: 'sibling',
},
],
'newlines-between': 'always', // 在组之间插入空行
pathGroupsExcludedImportTypes: ['sibling', 'index'],
warnOnUnassignedImports: true,
alphabetize: { order: 'asc', caseInsensitive: true }, // 对于每个组,按字母表顺序排序。
},
],

'unused-imports/no-unused-imports-ts': 'warn',
'unused-imports/no-unused-vars-ts': [
'warn',
{ vars: 'all', varsIgnorePattern: '^_', args: 'after-used', argsIgnorePattern: '^_' },
],

'@typescript-eslint/no-unused-vars': [
'warn',
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
},
],
'@typescript-eslint/no-unused-expressions': 'off',
'@typescript-eslint/ban-ts-ignore': 'off',
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/ban-types': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-var-requires': 'off',
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/no-use-before-define': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-shadow': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
},
};
46 changes: 46 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: CI

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
build-and-deploy:

runs-on: ubuntu-latest

strategy:
matrix:
node-version: [16.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
- name: Checkout 🛎️
uses: actions/checkout@v3

- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: 8

- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'

- name: Install and Build 🔧
run: |
pnpm install
pnpm build
- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@v4
with:
TOKEN: ${{ secrets.ACCESS_TOKEN }}
FOLDER: dist
CLEAN: true


25 changes: 25 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# 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?

# vite 打包分析产物
stats.html
4 changes: 4 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx --no-install commitlint --edit "$1"
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"

npx lint-staged
5 changes: 5 additions & 0 deletions .lintstagedrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"src/**/*.{js,jsx,ts,tsx}": ["eslint --fix"],
"src/**/*.{css,scss}": ["stylelint --fix"],
"*.{json,md}": ["prettier --write"]
}
21 changes: 21 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
*.sh
node_modules
*.lock
**/*.svg
**/*.md
**/*.svg
**/*.ejs
**/*.html
**/*.png
**/*.toml
**/*.md
.vscode
.idea
dist
/public
/docs
.husky
.local
/bin
Dockerfile
pnpm-lock.yaml
21 changes: 21 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"printWidth": 100,
"semi": true,
"tabWidth": 2,
"singleQuote": true,
"trailingComma": "all",
"proseWrap": "never",
"htmlWhitespaceSensitivity": "strict",
"endOfLine": "auto",
"overrides": [
{
"files": "*rc",
"options": {
"parser": "json"
}
}
],
"plugins": [
"prettier-plugin-tailwindcss"
]
}
8 changes: 8 additions & 0 deletions .stylelintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
node_modules/
dist/
build/
*.min.css
*.js
*.tsx
*.ts
*.json
Loading

0 comments on commit a1a74a9

Please sign in to comment.