Giter Club home page Giter Club logo

configs's Introduction

@zpcscc/configs

NPM version NPM downloads

简介

通用配置库

安装

npm install --save-dev @zpcscc/configs

使用

eslint

.eslintrc.js

基础配置

module.exports = {
  extends: [require.resolve('@zpcscc/configs/eslint-config')],
};

react的eslint配置

module.exports = {
  extends: [require.resolve('@zpcscc/configs/eslint-config/react')],
};

vue的eslint配置

module.exports = {
  extends: [require.resolve('@zpcscc/configs/eslint-config/vue')],
};

node的eslint配置

module.exports = {
  extends: [require.resolve('@zpcscc/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

'@zpcscc/configs/prettier-config';

.prettierrc.js

module.exports = {
  ...require('@zpcscc/configs/prettier-config'),
};

stylelint

.stylelintrc

{
  "extends": "@zpcscc/configs/stylelint-config"
}

stylelint.config.js

module.exports = { 
  extends: ['@zpcscc/configs/stylelint-config'],
}

tsconfig

tsconfig.json

基础配置

{
  "extends": "@zpcscc/configs/tsconfig/tsconfig.base.json",
}

react的tsconfig配置

{
  "extends": "@zpcscc/configs/tsconfig/tsconfig.react.json",
}

vue的tsconfig配置

{
  "extends": "@zpcscc/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: ['@zpcscc/configs/commitlint-config'],
};

上述文件设置好后,提交代码时使用下列命令

npm run commit

若要默认使用git cz则需全局安装相关依赖

npm i -g commitizen  inquirer@8 @commitlint/cz-commitlint

types

types.d.ts

// 基础配置
/// <reference types="@zpcscc/configs/types" />
// react配置
/// <reference types="@zpcscc/configs/types/react" />
// vue配置
/// <reference types="@zpcscc/configs/types/vue" />

License

MIT © zpcscc

configs's People

Contributors

zpcscc avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.