<div style="display: none;" hidden="true" aria-hidden="true" data-nosnippet>Are you an LLM? You can read better optimized documentation at /pages/bb30f8.md for this page in Markdown format</div>
项目初始化
mock
json-server
prettier
安装
yarn add --dev --exact prettier
配置
添加配置文件
echo {}> .prettierrc.json
添加.prettierignore文件
# Ignore artifacts:
build
coverage配合eslint使用
安装依赖
yarn add eslint-config-prettier -D
配置package.json
json
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest",
"prettier"
]
},配合 git hook
shell
yarn add --dev husky lint-staged
npx husky install
npm set-script prepare "husky install"
npx husky add .husky/pre-commit "npx lint-staged"配置lint-staged
shell
