0.1.0 • Published 4 years ago
eslint-config-yyl-ts v0.1.0
eslint-config-yyl-ts
为 yyl-ts 项目提供 eslint 文件
install
npm i eslint-config-yyl-ts --save-dev
依赖包
npm i typescript --save
npm i prettier eslint --save-dev
usage
修改 package.json
文件
{
"eslintConfig": {
"extends": ["yyl-ts"]
},
"eslintIgnore": [
"node_modules",
"/dist",
"/test",
"**/js/lib"
],
"prettier": {
"tabWidth": 2,
"semi": false,
"singleQuote": true,
"jsxSingleQuote": true,
"parser": "typescript",
"quoteProps": "consistent",
"trailingComma": "none",
"printWidth": 100
},
"scripts": {
"eslint": "eslint --ext=jsx,ts,tsx ./",
"prettier": "prettier --write ./**/*.{ts,tsx,js}"
}
}
为了和 prettier 不打架,请按照
package.json
的prettier
属性进行配置
自定义 prettier
可以通过定义 prettier/prettier
rules 来修改
{
"eslintConfig": {
"rules": {
"prettier/prettier": ["error", {
"semi": true
}]
}
},
"prettier": {
"semi": true
}
}
定义 .prettierignore
**/js/lib/**
dist/**
node_modules/**
**/*.json
**/*.scss
**/*.yml
**/*.md
0.1.0
4 years ago