为 yyl-ts 项目提供 eslint 文件
npm i eslint-config-yyl-ts --save-dev
npm i typescript --save
npm i prettier eslint --save-dev
修改 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
rules 来修改
{
"eslintConfig": {
"rules": {
"prettier/prettier": ["error", {
"semi": true
}]
}
},
"prettier": {
"semi": true
}
}
**/js/lib/**
dist/**
node_modules/**
**/*.json
**/*.scss
**/*.yml
**/*.md