create-react-app创建项目时的初始化配置

基于create-react-app使用typescript开发项目

npx create-react-app jira --template typescript

问题一:项目中目录的引用,避免多个…/…/
在tsconfig.json文件中加入baseUrl: “./src”,

问题二:团队统一的格式化规则,项目中安装格式化插件prettier
// https://prettier.io/docs/en/install.html
//第一步:
yarn add --dev --exact prettier
//第二步:
echo {}> .prettierrc.json

touch .prettierignore
//内容为:
build
coverage
//内容结束,继续
//第三步:
//Pre-commit Hook
npx mrm lint-staged
// prettier与eslint一起工作时,有冲突,需要安排一下eslint-config-prettier
yarn add eslint-config-prettier -D

问题三:提交代码时,自动检查是否按规则提交
// https://github.com/conventional-changelog/commitlint
// https://github.com/conventional-changelog/commitlint/tree/master/@commitlint/config-conventional
//安装
yarn add @commitlint/{config-conventional,cli}
//执行命令
echo “module.exports = {extends: [’@commitlint/config-conventional’]}” > commitlint.config.js

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值