ESLint config for TDesign
Tips: 规则有优先级,注意
extends
中的顺序
- 如果
extends
配置的是一个数组,那么最终会将所有规则项进行合并,出现冲突的时候,后面的会覆盖前面的。- 通过
rules
单独配置的规则,优先级高于extends
。
npm i eslint eslint-config-airbnb-base eslint-plugin-tdesign --save-dev
// .eslintrc.js
{
"extends": [
"tdesign"
]
}
npm i eslint eslint-config-airbnb-base eslint-config-prettier eslint-plugin-import eslint-plugin-tdesign --save-dev
// .eslintrc.js
{
"extends": [
"tdesign",
"tdesign/miniprogram"
]
}
npm install eslint typescript eslint-config-airbnb-base @typescript-eslint/parser @typescript-eslint/eslint-plugin eslint-plugin-tdesign --save-dev
// .eslintrc.js
{
"extends": [
"tdesign",
"tdesign/typescript"
]
}
npm i eslint eslint-config-airbnb-base eslint-config-prettier vue-eslint-parser eslint-plugin-vue @vue/eslint-config-typescript eslint-plugin-tdesign --save-dev
// .eslintrc.js
{
"extends": [
"tdesign",
"tdesign/vue"
]
}
npm i eslint eslint-config-airbnb-base eslint-config-prettier vue-eslint-parser eslint-plugin-vue eslint-plugin-tdesign --save-dev
// .eslintrc.js
{
"extends": [
"tdesign",
"tdesign/vue-next"
]
}
npm i eslint prettier eslint-config-airbnb-base eslint-config-prettier eslint-plugin-react eslint-plugin-react-hooks eslint-plugin-lodash eslint-plugin-tdesign --save-dev
// .eslintrc.js
{
"extends": [
"tdesign",
"tdesign/react"
]
}
npm install eslint typescript eslint-config-airbnb-base eslint-config-prettier @typescript-eslint/parser @typescript-eslint/eslint-plugin eslint-plugin-react eslint-plugin-tdesign --save-dev
// .eslintrc.js
{
"extends": [
"tdesign",
"tdesign/typescript",
"tdesign/react",
]
}