Lint-mc
方便 git hook、prettier、 eslint、commlint 快速便捷的使用,拷贝推荐配置,提交时 prettier 格式化,检测并修复git 改动的文件可修复错误,输出并在 push 到仓库时上报 eslint 报错。
Install
npm i -D lint-mc
// package.json"lint-staged": ,"husky":
git add . && git commit -m 'feat: commit new feat'
使用
包在安装时默认会初始化, 在 git 提交默认会自动修复,在 push 到仓库时会自动上报。
也可使用指令
mclint init // 初始化
mclint // 默认当前目录mclint lint -p 指定相对目录 // 指定项目目录检查修复
也可使用 npm 命令在提交前检查修复
npm run eslint -s // eslint 检查npm run prettier -s // prettier 格式化
配置文件
默认是基础配置, 有 vue、react、reactnative、typescript 等推荐配置。
// eslintrc.js moduleexports = extends: 'mcfe' // 基础配置 moduleexports = extends: 'mcfe/react' // react moduleexports = extends: 'mcfe/vue' // vuemoduleexports = extends: 'mcfe/react-native' // reactnative moduleexports = extends: 'mcfe/mini' // 小程序