Skip to content

Latest commit

 

History

History
78 lines (58 loc) · 1.4 KB

README.md

File metadata and controls

78 lines (58 loc) · 1.4 KB

Getting Started with Create React App

This project was bootstrapped with Create React App.

Available Scripts

In the project directory, you can run:

yarn start

Runs the app in the development mode.
Open http://localhost:3000 to view it in the browser.

The page will reload if you make edits.
You will also see any lint errors in the console.

Todo

  • 嵌套路由;

ts + eslint + pre-commit

  1. 安装 eslint 及 ts 插件
yarn add eslint
yarn add @typescript-eslint/parser @typescript-eslint/eslint-plugin
  1. 配置 eslint 规则: .eslintrc.json
{
  "parser": "@typescript-eslint/parser",
  "plugins": ["@typescript-eslint"],
  "extends": "eslint:recommended",
  "parserOptions": {
    "ecmaVersion": 11
  },
  "rules": {
    "indent": ["error", 2],
    "linebreak-style": ["off", "windows"],
    "quotes": ["error", "single"],
    "semi": ["error", "always"],
    "no-undef": "warn",
    "no-unused-vars": "warn",
    "no-constant-condition": "warn"
  }
}
  1. vscode 配置:
"editor.codeActionsOnSave": {
  "source.fixAll.eslint": true,
},
"eslint.codeAction.disableRuleComment": {
  "enable": false
},
"eslint.debug": true,
  1. 配置 pre-commit 在 package.json 中配置:
"scripts": {
  "lint": "eslint --ext .js,.ts,.tsx  src/",
  ... ...
},
"pre-commit": [
  "lint"
]