@dxsixpc/configs
v1.2.7
Published
项目通用配置
Downloads
26
Maintainers
Readme
@dxsixpc/configs
简介
通用配置库
安装
npm install --save-dev @dxsixpc/configs
使用
eslint
.eslintrc.js
基础配置
module.exports = {
extends: [require.resolve('@dxsixpc/configs/eslint-config')],
};
react的eslint配置
module.exports = {
extends: [require.resolve('@dxsixpc/configs/eslint-config/react')],
};
vue的eslint配置
module.exports = {
extends: [require.resolve('@dxsixpc/configs/eslint-config/vue')],
};
node的eslint配置
module.exports = {
extends: [require.resolve('@dxsixpc/configs/eslint-config/node')],
};
补充配置
module.exports = {
// 由于使用了eslint-config-standard-with-typescript插件对ts的支持
// 部分规则需要tsconfig.json配置,需要在这里引入tsconfig.json文件
parserOptions: {
project: ['./tsconfig.json'],
},
};
tsconfig.json
tsconfig.json 文件中,也需要在 include 中引入.eslintrc.js 文件
{
"include": [".eslintrc.js"]
}
prettier
.prettierrc
'@dxsixpc/configs/prettier-config';
.prettierrc.js
module.exports = {
...require('@dxsixpc/configs/prettier-config'),
};
stylelint
.stylelintrc
{
"extends": "@dxsixpc/configs/stylelint-config"
}
stylelint.config.js
module.exports = {
extends: ['@dxsixpc/configs/stylelint-config'],
}
tsconfig
tsconfig.json
基础配置
{
"extends": "@dxsixpc/configs/tsconfig/tsconfig.base.json",
}
react的tsconfig配置
{
"extends": "@dxsixpc/configs/tsconfig/tsconfig.react.json",
}
vue的tsconfig配置
{
"extends": "@dxsixpc/configs/tsconfig/tsconfig.vue.json",
}
commitlint
package.json
"scripts": {
"commit": "git add . && git-cz",
},
.czrc
{
"path": "@commitlint/cz-commitlint"
}
commitlint.config.js
module.exports = {
extends: ['@dxsixpc/configs/commitlint-config'],
};
上述文件设置好后,提交代码时使用下列命令
npm run commit
若要默认使用git cz
则需全局安装相关依赖
npm i -g commitizen inquirer@8 @commitlint/cz-commitlint
types
types.d.ts
// 基础配置
/// <reference types="@dxsixpc/configs/types" />
// react配置
/// <reference types="@dxsixpc/configs/types/react" />
// vue配置
/// <reference types="@dxsixpc/configs/types/vue" />
License
MIT © dxsixpc