Skip to content

Latest commit

 

History

History
118 lines (110 loc) · 2.23 KB

README.md

File metadata and controls

118 lines (110 loc) · 2.23 KB

eslint-config-tdesign

ESLint config for TDesign

Tips: 规则有优先级,注意 extends 中的顺序

  1. 如果 extends 配置的是一个数组,那么最终会将所有规则项进行合并,出现冲突的时候,后面的会覆盖前面的。
  2. 通过 rules 单独配置的规则,优先级高于 extends

Base Usage

Installation

npm i eslint eslint-config-airbnb-base eslint-plugin-tdesign --save-dev

Use

// .eslintrc.js
{
	"extends": [
		"tdesign"
	]
}

Miniprogram Usage

Installation

npm i eslint eslint-config-airbnb-base eslint-config-prettier eslint-plugin-import eslint-plugin-tdesign --save-dev

Use

// .eslintrc.js
{
	"extends": [
		"tdesign",
		"tdesign/miniprogram"
	]
}

TypeScript Usage

Installation

npm install eslint typescript eslint-config-airbnb-base @typescript-eslint/parser @typescript-eslint/eslint-plugin eslint-plugin-tdesign --save-dev

Use

// .eslintrc.js
{
	"extends": [
		"tdesign",
		"tdesign/typescript"
	]
}

Vue Usage

Installation

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

Use

// .eslintrc.js
{
	"extends": [
		"tdesign",
		"tdesign/vue"
	]
}

Vue-next Usage

Installation

npm i eslint eslint-config-airbnb-base eslint-config-prettier vue-eslint-parser eslint-plugin-vue  eslint-plugin-tdesign --save-dev

Use

// .eslintrc.js
{
	"extends": [
		"tdesign",
		"tdesign/vue-next"
	]
}

React Usage

Installation

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

Use

// .eslintrc.js
{
	"extends": [
		"tdesign",
		"tdesign/react"
	]
}

TypeScript React Usage

Installation

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

Use

// .eslintrc.js
{
	"extends": [
		"tdesign",
		"tdesign/typescript",
		"tdesign/react",
	]
}