@ackee/styleguide-backend-config 中文文档教程
# Ackee styleguide: Backend config Configuration files for [styleguide](https://github.com/AckeeCZ/styleguide) enforcement tools [![](https://img.shields.io/travis/com/AckeeCZ/styleguide-backend-config?style=flat-square)](https://travis-ci.com/github/AckeeCZ/styleguide-backend-config) [![](https://img.shields.io/npm/v/@ackee/styleguide-backend-config?style=flat-square)](https://www.npmjs.com/package/@ackee/styleguide-backend-config)
Setup
npm i -D @ackee/styleguide-backend-config
ESLint
.eslintrc.js
module.exports = require('@ackee/styleguide-backend-config/eslint')
{
// npm tasks
"cs:eslint:check": "eslint --ignore-path .gitignore '**/*.ts' -f codeframe",
"cs:eslint:fix": "npm run cs:eslint:check -- --fix"
}
详细规则说明见eslint
Prettier
npm install -D prettier
prettier .config.js
module.exports = require('@ackee/styleguide-backend-config/prettier')
{
// npm tasks
"cs:prettier:check": "prettier --ignore-path .gitignore --check '**/*.{ts,js,json,md}'",
"cs:prettier:fix": "npm run cs:prettier:check -- --write '**/*.{ts,js,json,md}'"
}
Editorconfig
npm install -D eclint</
code> 从这个项目中复制.editorconfig
{
// npm tasks
"cs:eclint:check": "eclint check '**/*'",
"cs:eclint:fix": "eclint fix '**/*'"
}
Husky
.huskyrc.json
{
"hooks": {
"pre-commit": "lint-staged",
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
}
}
.lintsagedrc< /code>
{
"*.ts": ["prettier --write", "eslint --fix"],
"*.{ts,js,json,md}": "prettier --write",
"*": ["eclint fix", "eclint check"]
}
Danger
dangerfile.ts
import {
danger,
warn,
message,
fail,
markdown,
schedule,
peril,
results,
} from 'danger'
import { runDangerRules } from '@ackee/styleguide-backend-config/danger'
void runDangerRules(
{ danger, warn, message, fail, markdown, schedule, peril, results },
{
/* pass options */
}
)
License
此项目已根据 MIT 获得许可。
# Ackee styleguide: Backend config Configuration files for [styleguide](https://github.com/AckeeCZ/styleguide) enforcement tools [![](https://img.shields.io/travis/com/AckeeCZ/styleguide-backend-config?style=flat-square)](https://travis-ci.com/github/AckeeCZ/styleguide-backend-config) [![](https://img.shields.io/npm/v/@ackee/styleguide-backend-config?style=flat-square)](https://www.npmjs.com/package/@ackee/styleguide-backend-config)
Setup
npm i -D @ackee/styleguide-backend-config
ESLint
.eslintrc.js
module.exports = require('@ackee/styleguide-backend-config/eslint')
{
// npm tasks
"cs:eslint:check": "eslint --ignore-path .gitignore '**/*.ts' -f codeframe",
"cs:eslint:fix": "npm run cs:eslint:check -- --fix"
}
For detailed rules description, see eslint
Prettier
npm install -D prettier
prettier.config.js
module.exports = require('@ackee/styleguide-backend-config/prettier')
{
// npm tasks
"cs:prettier:check": "prettier --ignore-path .gitignore --check '**/*.{ts,js,json,md}'",
"cs:prettier:fix": "npm run cs:prettier:check -- --write '**/*.{ts,js,json,md}'"
}
Editorconfig
npm install -D eclint
Copy .editorconfig
from this project
{
// npm tasks
"cs:eclint:check": "eclint check '**/*'",
"cs:eclint:fix": "eclint fix '**/*'"
}
Husky
.huskyrc.json
{
"hooks": {
"pre-commit": "lint-staged",
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
}
}
.lintstagedrc
{
"*.ts": ["prettier --write", "eslint --fix"],
"*.{ts,js,json,md}": "prettier --write",
"*": ["eclint fix", "eclint check"]
}
Danger
dangerfile.ts
import {
danger,
warn,
message,
fail,
markdown,
schedule,
peril,
results,
} from 'danger'
import { runDangerRules } from '@ackee/styleguide-backend-config/danger'
void runDangerRules(
{ danger, warn, message, fail, markdown, schedule, peril, results },
{
/* pass options */
}
)
License
This project is licensed under MIT.