1.1.3 • Published 2 years ago

@bairong/fabric v1.1.3

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

@bairong/fabric

  • 前端代码规范配置集合: eslint、prettierrc、stylelint

使用方式

安装

// 安装到devDependencies
cnpm install -D @bairong/fabric

配置文件设置

.eslintrc.js

// 注意react、vue、node工程参数不同, js和jsx使用'react'参数,ts和tsx使用'react-ts'参数
const { getESLintConfig } = require('@bairong/fabric');
// getESLintConfig(rule: 'react'|'react-ts'|'vue'|node , customConfig?)
module.exports = getESLintConfig('react-ts', {
  parserOptions: {
    // ...
  }
});

.stylelintrc.js

// .stylelintrc.js
const { getStylelintConfig } = require('@bairong/fabric');

// getStylelintConfig(rule: ''react'|'vue', customConfig?);
module.exports = getStylelintConfig('react');

.prettierrc.js

const { getPrettierConfig } = require('@bairong/fabric');
// getPrettierConfig(rule: 'react'|'vue', customConfig?);
module.exports = getPrettierConfig('react', { printWidth: 120 });

vscode 格式配置

.editorconfig

# http://editorconfig.org
root = true

[*]
indent_style = space
# 缩进4个空格
indent_size = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false

[Makefile]
indent_style = tab