Skip to content

Commit 70b50e8

Browse files
committed
fix/globalConfig/eslint (merge request !180)
Squash merge branch 'fix/globalConfig/eslint' into 'develop' * feat: snap update * feat: fix demo style and test update * Merge branch 'develop' into fix/globalConfig/eslint * feat: edit explicit-function-return-type in ts file * feat: update eslint config
1 parent c819857 commit 70b50e8

File tree

602 files changed

+8863
-13032
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

602 files changed

+8863
-13032
lines changed

.eslintignore

+4-22
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,12 @@
11
snapshot*
2-
dist
3-
lib
4-
es
52
node_modules
63
src/_common
7-
static
8-
cypress
94
script/test/cypress
10-
_site
115
temp*
12-
static/
136

14-
site/*
15-
!site/v3.js
16-
src/addon
17-
src/calendar
18-
src/locale
19-
src/upload
20-
src/dropdown
21-
src/transfer
22-
src/time-picker
23-
src/utils
24-
src/textarea
25-
typings
26-
dist
7+
_site
8+
esm
279
es
2810
lib
29-
types
30-
esm
11+
dist
12+
cjs

.eslintrc

+45-79
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,23 @@
22
"extends": [
33
"plugin:@typescript-eslint/recommended",
44
"eslint-config-airbnb-base",
5-
"plugin:vue/vue3-recommended"
5+
"plugin:vue/vue3-recommended",
6+
"plugin:prettier/recommended"
67
],
78
"env": {
89
"browser": true,
910
"node": true,
1011
"jest": true,
1112
"es6": true
1213
},
13-
"globals": {
14-
"cy": "readonly",
15-
"PKG_VERSION": true
16-
},
1714
"plugins": [
1815
"vue",
1916
"@typescript-eslint"
2017
],
18+
"globals": {
19+
"cy": "readonly",
20+
"PKG_VERSION": true
21+
},
2122
"parserOptions": {
2223
"parser": "@typescript-eslint/parser",
2324
"sourceType": "module",
@@ -35,92 +36,49 @@
3536
]
3637
},
3738
"rules": {
38-
"camelcase": 0,
39-
"no-new": 1,
40-
"new-cap": 0,
41-
"no-underscore-dangle": 0,
42-
"no-confusing-arrow": 0,
43-
"func-style": 0,
39+
// code style config
40+
"no-continue": "off",
41+
"no-console": "off",
42+
"no-restricted-syntax": "off",
43+
"no-plusplus": "off",
44+
"no-param-reassign": "off",
45+
"no-shadow": "off",
46+
"no-underscore-dangle": "off",
4447
"no-unused-vars": "off",
45-
"no-console": [
46-
"error",
47-
{ "allow":
48-
["warn", "error"]
49-
}
50-
],
51-
"@typescript-eslint/no-explicit-any": 0,
48+
"no-unused-expressions": "off",
49+
"no-return-assign": "off",
50+
"no-use-before-define": "off",
51+
"func-names": "off",
52+
"guard-for-in": "off",
53+
"consistent-return": "off",
54+
"no-restricted-globals": "off",
55+
"default-param-last": "off",
56+
"default-case": "off",
57+
"prefer-spread": "off",
58+
59+
// import config
60+
"import/extensions": "off",
61+
"import/no-unresolved": "off",
62+
"import/no-extraneous-dependencies": "off",
63+
"import/prefer-default-export": "off",
64+
"import/no-relative-packages": "off",
65+
66+
// typescript config
67+
"@typescript-eslint/no-explicit-any": "off",
68+
"@typescript-eslint/explicit-module-boundary-types": "off",
5269
"@typescript-eslint/no-require-imports": 0,
5370
"@typescript-eslint/no-var-requires": 0,
5471
"@typescript-eslint/prefer-for-of": 0,
55-
"prefer-default-export": 0,
56-
"max-len": 0,
57-
"@typescript-eslint/ban-ts-ignore": 0,
58-
"no-useless-constructor": "off",
59-
"no-plusplus": [
60-
"error",
61-
{
62-
"allowForLoopAfterthoughts": true
63-
}
64-
],
65-
"import/no-unresolved": 0,
66-
"import/no-named-as-default": 0,
67-
"treatUndefinedAsUnspecified": 0,
68-
"no-use-before-define": [
69-
0,
70-
{
71-
"functions": false,
72-
"classes": false
73-
}
74-
],
75-
"no-shadow": 0,
76-
"no-unused-expressions": 0,
7772
"@typescript-eslint/ban-types": 0,
78-
"no-proto": 0,
79-
"consistent-return": 0,
80-
"@typescript-eslint/explicit-function-return-type": 0,
81-
"@typescript-eslint/explicit-module-boundary-types": 0,
82-
"import/export": 0,
83-
"no-restricted-globals": 0,
8473
"@typescript-eslint/no-unused-vars": 0,
85-
"import/no-cycle": 0,
86-
"default-case": 0,
87-
"import/extensions": 0,
88-
"no-throw-literal": 0,
89-
"no-return-assign": 0,
90-
"no-continue": 0,
91-
"func-names": 0,
92-
"prefer-spread": 0,
9374
"@typescript-eslint/no-empty-function": 0,
9475
"@typescript-eslint/ban-ts-comment": 0,
95-
"import/no-extraneous-dependencies": [
96-
"error",
97-
{
98-
"devDependencies": true
99-
}
100-
],
101-
"import/no-dynamic-require": 0,
102-
"global-require": 0,
103-
"no-constant-condition": [
104-
"error",
105-
{
106-
"checkLoops": false
107-
}
108-
],
109-
"vue/require-default-prop": 0,
110-
"vue/max-attributes-per-line": ["error", {
111-
"singleline": {
112-
"max": 4
113-
}
114-
}]
76+
"vue/require-default-prop": 0
11577
},
11678
"overrides": [
11779
{
11880
"files": ["*.vue"],
11981
"rules": {
120-
"indent": 2,
121-
"vue/html-indent": [2, 2],
122-
"vue/return-in-computed-property": 1,
123-
"vue/order-in-components": 2,
12482
"vue/component-name-in-template-casing": [2, "kebab-case"],
12583
"vue/require-default-prop": 0
12684
}
@@ -142,14 +100,22 @@
142100
}
143101
},
144102
{
145-
// enable the rule specifically for TypeScript files
146103
"files": [
147104
"*.ts",
148105
"*.tsx"
149106
],
150107
"rules": {
151108
"@typescript-eslint/explicit-function-return-type": 0
152109
}
110+
},
111+
{
112+
"files": [
113+
"*.test.js"
114+
],
115+
"rules": {
116+
"import/no-dynamic-require": "off",
117+
"global-require": "off"
118+
}
153119
}
154120
]
155121
}

.prettierrc.js

-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ module.exports = {
1717
trailingComma: 'all',
1818
// 大括号内的首尾需要空格
1919
bracketSpacing: true,
20-
// jsx 标签的反尖括号需要换行
21-
jsxBracketSameLine: false,
2220
// 箭头函数,只有一个参数的时候,也需要括号
2321
arrowParens: 'always',
2422
// 每个文件格式化的范围是文件的全部内容

babel.config.js

+1-4
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,7 @@ module.exports = {
4242
},
4343
],
4444
],
45-
plugins: [
46-
'@vue/babel-plugin-jsx',
47-
'@babel/plugin-transform-runtime',
48-
],
45+
plugins: ['@vue/babel-plugin-jsx', '@babel/plugin-transform-runtime'],
4946
},
5047
},
5148
};

examples/affix/demos/base.vue

+1-5
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
<template>
22
<div class="affix-base">
3-
<t-affix
4-
ref="affix"
5-
:offset-top="40"
6-
:offset-bottom="20"
7-
>
3+
<t-affix ref="affix" :offset-top="40" :offset-bottom="20">
84
<t-button>Base</t-button>
95
</t-affix>
106
</div>

examples/affix/demos/container.vue

+2-10
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,8 @@
11
<template>
22
<div class="affix-container">
3-
<div
4-
ref="affixContainerRef"
5-
class="affix-container-demo1"
6-
>
3+
<div ref="affixContainerRef" class="affix-container-demo1">
74
<div class="background">
8-
<t-affix
9-
:offset-top="50"
10-
:offset-bottom="50"
11-
:container="getContainer"
12-
@fixedChange="handleFixedChange"
13-
>
5+
<t-affix :offset-top="50" :offset-bottom="50" :container="getContainer" @fixedChange="handleFixedChange">
146
<t-button>FixedTop top:{{ fixedTop }}</t-button>
157
</t-affix>
168
</div>

examples/alert/demos/base.vue

+5-17
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,11 @@
11
<template>
22
<div class="tdesign-demo-block">
3-
<t-alert
4-
theme="success"
5-
message="这是一条成功的消息提示"
6-
/>
7-
<t-alert
8-
theme="info"
9-
:message="infoMessage"
10-
/>
3+
<t-alert theme="success" message="这是一条成功的消息提示" />
4+
<t-alert theme="info" :message="infoMessage" />
115
<t-alert theme="warning">
12-
<template #message>
13-
这是一条警示信息
14-
</template>
15-
</t-alert>
16-
<t-alert theme="error">
17-
高危操作/出错信息提示
6+
<template #message> 这是一条警示信息 </template>
187
</t-alert>
8+
<t-alert theme="error"> 高危操作/出错信息提示 </t-alert>
199
</div>
2010
</template>
2111
<script lang="jsx">
@@ -24,9 +14,7 @@ import { defineComponent } from 'vue';
2414
export default defineComponent({
2515
setup() {
2616
return {
27-
infoMessage: () => (
28-
<div>这是一条普通的消息提示</div>
29-
),
17+
infoMessage: () => <div>这是一条普通的消息提示</div>,
3018
};
3119
},
3220
});

examples/alert/demos/close.vue

+4-18
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,16 @@
11
<template>
22
<div class="tdesign-demo-block">
3-
<t-alert
4-
theme="success"
5-
message="这是一条成功的消息提示"
6-
close
7-
/>
8-
<t-alert
9-
theme="info"
10-
message="这是一条普通的消息提示"
11-
close="知道了"
12-
@close="beforeClose"
13-
/>
3+
<t-alert theme="success" message="这是一条成功的消息提示" close />
4+
<t-alert theme="info" message="这是一条普通的消息提示" close="知道了" @close="beforeClose" />
145
<t-alert
156
theme="warning"
167
message="这是一条警示信息"
178
:close="warningClose"
189
@close="beforeClose"
1910
@closed="handleClosed"
2011
/>
21-
<t-alert
22-
theme="error"
23-
message="高危操作/出错信息提示"
24-
>
25-
<template #close>
26-
Slot Close
27-
</template>
12+
<t-alert theme="error" message="高危操作/出错信息提示">
13+
<template #close> Slot Close </template>
2814
</t-alert>
2915
</div>
3016
</template>

examples/alert/demos/collapse.vue

+2-10
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,14 @@
11
<template>
22
<div class="tdesign-demo-block">
3-
<t-alert
4-
theme="success"
5-
close
6-
:max-line="2"
7-
>
3+
<t-alert theme="success" close :max-line="2">
84
<span>这是折叠的第一条消息</span>
95
<span>这是折叠的第二条消息</span>
106
<span>这是折叠的第三条消息</span>
117
<span>这是折叠的第四条消息</span>
128
<span>这是折叠的第五条消息</span>
139
<span>这是折叠的第六条消息</span>
1410
</t-alert>
15-
<t-alert
16-
theme="info"
17-
close
18-
:max-line="2"
19-
>
11+
<t-alert theme="info" close :max-line="2">
2012
<span>这是折叠的第一条消息</span>
2113
<span>这是折叠的第二条消息</span>
2214
<span>这是折叠的第三条消息</span>

examples/alert/demos/icon.vue

+6-25
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,11 @@
11
<template>
22
<div class="tdesign-demo-block">
3-
<t-alert
4-
theme="success"
5-
message="这是一条成功的消息提示"
6-
/>
7-
<t-alert
8-
theme="info"
9-
message="这是一条普通的消息提示"
10-
/>
11-
<t-alert
12-
theme="warning"
13-
message="这是一条警示消息提示"
14-
/>
15-
<t-alert
16-
theme="error"
17-
message="高危操作/出错信息提示"
18-
/>
19-
<t-alert
20-
theme="warning"
21-
:icon="warningIcon"
22-
message="这是一条警示信息(以function形式自定义icon)"
23-
/>
24-
<t-alert
25-
theme="error"
26-
message="高危操作/出错信息提示(以slot形式自定义icon)"
27-
>
3+
<t-alert theme="success" message="这是一条成功的消息提示" />
4+
<t-alert theme="info" message="这是一条普通的消息提示" />
5+
<t-alert theme="warning" message="这是一条警示消息提示" />
6+
<t-alert theme="error" message="高危操作/出错信息提示" />
7+
<t-alert theme="warning" :icon="warningIcon" message="这是一条警示信息(以function形式自定义icon)" />
8+
<t-alert theme="error" message="高危操作/出错信息提示(以slot形式自定义icon)">
289
<template #icon>
2910
<t-icon name="error-circle-filled" />
3011
</template>

0 commit comments

Comments
 (0)