eslint-plugin-light 0.0.18 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1 -128
- package/README.md +26 -24
- package/lib/configs/base.js +3 -3
- package/lib/configs/recommended.js +2 -2
- package/lib/index.js +0 -13
- package/lib/rules/no-this-tip-uid.js +1 -8
- package/package.json +16 -4
package/CHANGELOG.md
CHANGED
|
@@ -2,131 +2,4 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
### ✨ Features | 新功能
|
|
9
|
-
|
|
10
|
-
* 去掉打印信息 ([bde64c7](https://git.woa.com/pmd-mobile/support/eslint-plugin-pmd/commit/bde64c765562f5842aa988ee07d2caac27786a6c))
|
|
11
|
-
|
|
12
|
-
### [0.0.15](https://git.woa.com/pmd-mobile/support/eslint-plugin-pmd/compare/v0.0.14...v0.0.15) (2022-07-26)
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
### ✨ Features | 新功能
|
|
16
|
-
|
|
17
|
-
* 优化包 ([906bcd7](https://git.woa.com/pmd-mobile/support/eslint-plugin-pmd/commit/906bcd7a2ff0291d331feef961b479135f11c526))
|
|
18
|
-
|
|
19
|
-
### [0.0.14](https://git.woa.com/pmd-mobile/support/eslint-plugin-pmd/compare/v0.0.13...v0.0.14) (2022-07-26)
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
### ✨ Features | 新功能
|
|
23
|
-
|
|
24
|
-
* 脚本优化 ([d1e8172](https://git.woa.com/pmd-mobile/support/eslint-plugin-pmd/commit/d1e8172ac3777f1377864d3de76a50c55e4122dd))
|
|
25
|
-
* 脚本优化 ([9c6d844](https://git.woa.com/pmd-mobile/support/eslint-plugin-pmd/commit/9c6d844aad15475e1af7d97728dfcae84bd99693))
|
|
26
|
-
* **complex-key:** 不要使用复杂的key ([00e981b](https://git.woa.com/pmd-mobile/support/eslint-plugin-pmd/commit/00e981b8d81e097576163fa8078a09a315a22cba))
|
|
27
|
-
|
|
28
|
-
### [0.0.13](https://git.woa.com/pmd-mobile/support/eslint-plugin-pmd/compare/v0.0.12...v0.0.13) (2022-07-26)
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
### ✨ Features | 新功能
|
|
32
|
-
|
|
33
|
-
* 优化脚本 ([ad9b142](https://git.woa.com/pmd-mobile/support/eslint-plugin-pmd/commit/ad9b142ee87aba73d45adcef3aa94ac3d5988b31))
|
|
34
|
-
|
|
35
|
-
### [0.0.12](https://git.woa.com/pmd-mobile/support/eslint-plugin-pmd/compare/v0.0.11...v0.0.12) (2022-07-26)
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
### ✨ Features | 新功能
|
|
39
|
-
|
|
40
|
-
* 脚本优化 ([62f1181](https://git.woa.com/pmd-mobile/support/eslint-plugin-pmd/commit/62f11815bb458201991cca99716e773a3281c65b))
|
|
41
|
-
|
|
42
|
-
### [0.0.11](https://git.woa.com/pmd-mobile/support/eslint-plugin-pmd/compare/v0.0.10...v0.0.11) (2022-07-26)
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
### ✨ Features | 新功能
|
|
46
|
-
|
|
47
|
-
* 脚本优化 ([3047f01](https://git.woa.com/pmd-mobile/support/eslint-plugin-pmd/commit/3047f01b89fdbdb8c72b0c5e511afb587d8ffc99))
|
|
48
|
-
* 优化发布脚本 ([a072ae8](https://git.woa.com/pmd-mobile/support/eslint-plugin-pmd/commit/a072ae8715352c9452072e8dfa9c85a343cf4f26))
|
|
49
|
-
|
|
50
|
-
### [0.0.10](https://git.woa.com/pmd-mobile/support/eslint-plugin-pmd/compare/v0.0.9...v0.0.10) (2022-07-26)
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
### ✨ Features | 新功能
|
|
54
|
-
|
|
55
|
-
* 优化发布脚本 ([470a35f](https://git.woa.com/pmd-mobile/support/eslint-plugin-pmd/commit/470a35fc55153d41a362cf61492fde120a9ed3f7))
|
|
56
|
-
* 优化error信息 ([453430f](https://git.woa.com/pmd-mobile/support/eslint-plugin-pmd/commit/453430ff437d062cd1efa7bff96b87e975b2b414))
|
|
57
|
-
|
|
58
|
-
### [0.0.9](https://git.woa.com/pmd-mobile/support/eslint-plugin-pmd/compare/v0.0.8...v0.0.9) (2022-07-22)
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
### ✨ Features | 新功能
|
|
62
|
-
|
|
63
|
-
* 优化插件 ([13a84d5](https://git.woa.com/pmd-mobile/support/eslint-plugin-pmd/commit/13a84d5ce25788f5d3b3b63b84a0731f179ff12d))
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
### ✏️ Documentation | 文档
|
|
67
|
-
|
|
68
|
-
* 用法更新 ([78e344d](https://git.woa.com/pmd-mobile/support/eslint-plugin-pmd/commit/78e344d61c026f7c38960d41d7038888664ecb85))
|
|
69
|
-
|
|
70
|
-
### [0.0.8](https://git.woa.com/pmd-mobile/support/eslint-plugin-pmd/compare/v0.0.7...v0.0.8) (2022-07-22)
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
### ✏️ Documentation | 文档
|
|
74
|
-
|
|
75
|
-
* 更新文档 ([d6e3a23](https://git.woa.com/pmd-mobile/support/eslint-plugin-pmd/commit/d6e3a23205244f41ecb8b8fff3bb9d9a07a2c734))
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
### 🚀 Chore | 构建/工程依赖/工具
|
|
79
|
-
|
|
80
|
-
* eslint ([63e2398](https://git.woa.com/pmd-mobile/support/eslint-plugin-pmd/commit/63e2398387b466c4e188a7f12a2d08586583f527))
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
### ✨ Features | 新功能
|
|
84
|
-
|
|
85
|
-
* **number:** 优化插件 ([003f290](https://git.woa.com/pmd-mobile/support/eslint-plugin-pmd/commit/003f290563b15d4cc1e8a6585a629bbfba2fce1e))
|
|
86
|
-
|
|
87
|
-
### [0.0.7](https://git.woa.com/pmd-mobile/support/eslint-plugin-pmd/compare/v0.0.6...v0.0.7) (2022-07-22)
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
### ✏️ Documentation | 文档
|
|
91
|
-
|
|
92
|
-
* 文档优化 ([e7f5bfb](https://git.woa.com/pmd-mobile/support/eslint-plugin-pmd/commit/e7f5bfb9e67ac3f7cb9ea182200886feb22c9798))
|
|
93
|
-
* 优化文档 ([44e7b1e](https://git.woa.com/pmd-mobile/support/eslint-plugin-pmd/commit/44e7b1e5f5e230363dcfd6923d325e96db9509f4))
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
### ✨ Features | 新功能
|
|
97
|
-
|
|
98
|
-
* **no-plus-turn-number:** 转化+字符串 ([aa69796](https://git.woa.com/pmd-mobile/support/eslint-plugin-pmd/commit/aa69796620c554d745c2b5133b9699c9be363805))
|
|
99
|
-
|
|
100
|
-
### [0.0.6](https://git.woa.com/pmd-mobile/support/eslint-plugin-pmd/compare/v0.0.5...v0.0.6) (2022-07-22)
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
### ✨ Features | 新功能
|
|
104
|
-
|
|
105
|
-
* 优化插件 ([c0e28fd](https://git.woa.com/pmd-mobile/support/eslint-plugin-pmd/commit/c0e28fda4d5ba7c6c90a0ad7fe799342b79e9b49))
|
|
106
|
-
|
|
107
|
-
### [0.0.5](https://git.woa.com/pmd-mobile/support/eslint-plugin-pmd/compare/v0.0.4...v0.0.5) (2022-07-22)
|
|
108
|
-
|
|
109
|
-
### [0.0.4](https://git.woa.com/pmd-mobile/support/eslint-plugin-pmd/compare/v0.0.3...v0.0.4) (2022-07-22)
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
### 🐛 Bug Fixes | Bug 修复
|
|
113
|
-
|
|
114
|
-
* 兼容性处理 ([ba123c2](https://git.woa.com/pmd-mobile/support/eslint-plugin-pmd/commit/ba123c26093d66008e459cdc3bfaf5fea74588e1))
|
|
115
|
-
|
|
116
|
-
### [0.0.3](https://git.woa.com/pmd-mobile/support/eslint-plugin-pmd/compare/v0.0.2...v0.0.3) (2022-07-22)
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
### 🚀 Chore | 构建/工程依赖/工具
|
|
120
|
-
|
|
121
|
-
* 增加versionrc ([1a8b239](https://git.woa.com/pmd-mobile/support/eslint-plugin-pmd/commit/1a8b2393618cbb16003298a1ec5e8b9bf44fb779))
|
|
122
|
-
* version ([dda6406](https://git.woa.com/pmd-mobile/support/eslint-plugin-pmd/commit/dda640604dd0bd34bf8937692781edd95b99d6ed))
|
|
123
|
-
|
|
124
|
-
### 0.0.2 (2022-07-22)
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
### Features
|
|
128
|
-
|
|
129
|
-
* 安装version ([a295b91](https://git.woa.com/pmd-mobile/support/eslint-plugin-pmd/commit/a295b91936a3eaeeda3bbc53d3221d0c0ee4c6f8))
|
|
130
|
-
* 优化插件 ([803d743](https://git.woa.com/pmd-mobile/support/eslint-plugin-pmd/commit/803d7434d653776dd70d0ec85b8eb0c20bdbc578))
|
|
131
|
-
* init ([44f3cb3](https://git.woa.com/pmd-mobile/support/eslint-plugin-pmd/commit/44f3cb326e7fca1b4b4b54ec8f361b491b84f996))
|
|
132
|
-
* vue组件规则 ([80b3690](https://git.woa.com/pmd-mobile/support/eslint-plugin-pmd/commit/80b36908061aab76995f6b7bf1d7f6930bb6f7eb))
|
|
5
|
+
## 1.0.0 (2023-07-12)
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
# eslint-plugin-
|
|
1
|
+
# eslint-plugin-light
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Eslint plugin.
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
## 1. Installation
|
|
@@ -11,20 +11,20 @@ You'll first need to install [ESLint](https://eslint.org/):
|
|
|
11
11
|
npm i eslint --save-dev
|
|
12
12
|
```
|
|
13
13
|
|
|
14
|
-
Next, install `eslint-plugin-
|
|
14
|
+
Next, install `eslint-plugin-light`:
|
|
15
15
|
|
|
16
16
|
```sh
|
|
17
|
-
npm install
|
|
17
|
+
npm install eslint-plugin-light --save-dev
|
|
18
18
|
```
|
|
19
19
|
|
|
20
20
|
## 2. Usage
|
|
21
21
|
|
|
22
|
-
Add `
|
|
22
|
+
Add `light` to the plugins section of your `.eslintrc` configuration file. You can omit the `eslint-plugin-` prefix:
|
|
23
23
|
|
|
24
24
|
```json
|
|
25
25
|
{
|
|
26
26
|
"plugins": [
|
|
27
|
-
"
|
|
27
|
+
"light"
|
|
28
28
|
]
|
|
29
29
|
}
|
|
30
30
|
```
|
|
@@ -35,7 +35,7 @@ Then configure the rules you want to use under the rules section.
|
|
|
35
35
|
```json
|
|
36
36
|
{
|
|
37
37
|
"rules": {
|
|
38
|
-
"
|
|
38
|
+
"light/rule-name": 2
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
```
|
|
@@ -44,21 +44,21 @@ or use extends:
|
|
|
44
44
|
|
|
45
45
|
```json
|
|
46
46
|
{
|
|
47
|
-
extends: [
|
|
47
|
+
"extends": ["plugin:light/recommended"],
|
|
48
48
|
}
|
|
49
49
|
```
|
|
50
50
|
|
|
51
51
|
|
|
52
52
|
## 3. Supported Rules
|
|
53
53
|
|
|
54
|
-
### 3.1.
|
|
54
|
+
### 3.1. light/valid-vue-comp-import
|
|
55
55
|
|
|
56
|
-
|
|
56
|
+
禁止从`js`文件中加载`Vue`组件
|
|
57
57
|
|
|
58
58
|
比如,
|
|
59
59
|
|
|
60
60
|
|
|
61
|
-
1.
|
|
61
|
+
1. 导入地址是`js/ts`文件
|
|
62
62
|
|
|
63
63
|
```js
|
|
64
64
|
import SomeComp from 'src/local-component/ui/pages/user/account-manage/index.js';
|
|
@@ -67,7 +67,7 @@ import SomeComp from 'src/local-component/ui/pages/user/account-manage/index.js'
|
|
|
67
67
|
import SomeComp from 'src/local-component/ui/pages/user/account-manage/index';
|
|
68
68
|
```
|
|
69
69
|
|
|
70
|
-
|
|
70
|
+
如果加了`--fix`,会被转换为:
|
|
71
71
|
|
|
72
72
|
```js
|
|
73
73
|
import SomeComp from 'src/local-component/ui/pages/user/account-manage/xxx.vue';
|
|
@@ -77,7 +77,7 @@ import SomeComp from 'src/local-component/ui/pages/user/account-manage/xxx.vue';
|
|
|
77
77
|
|
|
78
78
|
|
|
79
79
|
|
|
80
|
-
2.
|
|
80
|
+
2. 导入一个目录,但目录存在`index.js`,这时候不管存不存在`index.vue`,`uni-app`转换都会失败
|
|
81
81
|
|
|
82
82
|
```js
|
|
83
83
|
import SomeComp from 'src/local-component/ui/pages/user/account-manage';
|
|
@@ -109,9 +109,9 @@ import CComp from 'src/local-component/module/tip-match/tip-match-schedule-tree-
|
|
|
109
109
|
import DComp from 'src/local-component/module/tip-match/tip-match-schedule-tree-new/comp/d.vue';
|
|
110
110
|
```
|
|
111
111
|
|
|
112
|
-
### 3.2.
|
|
112
|
+
### 3.2. light/no-plus-turn-number
|
|
113
113
|
|
|
114
|
-
|
|
114
|
+
禁止在`vue`的`template`中用`+`号转换字符串为数字
|
|
115
115
|
|
|
116
116
|
比如:
|
|
117
117
|
|
|
@@ -121,7 +121,7 @@ import DComp from 'src/local-component/module/tip-match/tip-match-schedule-tree-
|
|
|
121
121
|
/>
|
|
122
122
|
```
|
|
123
123
|
|
|
124
|
-
|
|
124
|
+
如果加了`--fix`,会被转化成:
|
|
125
125
|
|
|
126
126
|
```html
|
|
127
127
|
<ScheduleItem
|
|
@@ -131,20 +131,23 @@ import DComp from 'src/local-component/module/tip-match/tip-match-schedule-tree-
|
|
|
131
131
|
|
|
132
132
|
### 3.3 no-complex-key
|
|
133
133
|
|
|
134
|
-
|
|
134
|
+
不要在`vue`模板中使用复杂的`key`。包括:
|
|
135
135
|
|
|
136
136
|
1. 字符串拼接,如:
|
|
137
137
|
|
|
138
|
-
```
|
|
138
|
+
```vue
|
|
139
139
|
:key="`hold` + index"`
|
|
140
140
|
```
|
|
141
|
+
|
|
141
142
|
2. 模板字符串,如:
|
|
142
|
-
|
|
143
|
+
|
|
144
|
+
```vue
|
|
143
145
|
:key="`hold-${index}`"
|
|
144
146
|
```
|
|
145
|
-
3. 将key提到一个函数中,如:
|
|
146
147
|
|
|
147
|
-
|
|
148
|
+
3. 将`key`提到一个函数中,如:
|
|
149
|
+
|
|
150
|
+
```vue
|
|
148
151
|
:key="getHoldKey(index)"
|
|
149
152
|
|
|
150
153
|
getHoldKey(index) {
|
|
@@ -152,7 +155,7 @@ getHoldKey(index) {
|
|
|
152
155
|
}
|
|
153
156
|
```
|
|
154
157
|
|
|
155
|
-
|
|
158
|
+
最佳方式其实是提前处理好数据,这样性能会更好,也避免了`key`重复。
|
|
156
159
|
|
|
157
160
|
```ts
|
|
158
161
|
getData() {
|
|
@@ -163,5 +166,4 @@ getData() {
|
|
|
163
166
|
}
|
|
164
167
|
```
|
|
165
168
|
|
|
166
|
-
|
|
167
|
-
uniapp中,key重复的话,会造成挂载在组件上面的事件参数为undefined,从而不成功。
|
|
169
|
+
`uni-app`中,`key`重复的话,会造成挂载在组件上面的事件参数为`undefined`,从而不成功。
|
package/lib/configs/base.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
module.exports = {
|
|
2
|
-
plugins: ['
|
|
2
|
+
plugins: ['eslint-plugin-light', 'vue'],
|
|
3
3
|
parser: require.resolve('vue-eslint-parser'),
|
|
4
4
|
parserOptions: {
|
|
5
5
|
ecmaVersion: 2020,
|
|
@@ -10,7 +10,7 @@ module.exports = {
|
|
|
10
10
|
es6: true,
|
|
11
11
|
},
|
|
12
12
|
rules: {
|
|
13
|
-
'
|
|
14
|
-
'
|
|
13
|
+
'light/valid-vue-comp-import': 2,
|
|
14
|
+
'light/no-plus-turn-number': 2,
|
|
15
15
|
},
|
|
16
16
|
};
|
package/lib/index.js
CHANGED
|
@@ -1,21 +1,8 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fileoverview test
|
|
3
|
-
* @author
|
|
4
|
-
*/
|
|
5
1
|
'use strict';
|
|
6
2
|
|
|
7
|
-
// ------------------------------------------------------------------------------
|
|
8
|
-
// Requirements
|
|
9
|
-
// ------------------------------------------------------------------------------
|
|
10
|
-
|
|
11
3
|
const requireIndex = require('requireindex');
|
|
12
4
|
|
|
13
|
-
// ------------------------------------------------------------------------------
|
|
14
|
-
// Plugin Definition
|
|
15
|
-
// ------------------------------------------------------------------------------
|
|
16
|
-
|
|
17
5
|
|
|
18
|
-
// import all rules in lib/rules
|
|
19
6
|
module.exports = {
|
|
20
7
|
rules: requireIndex(`${__dirname}/rules`),
|
|
21
8
|
configs: {
|
|
@@ -1,12 +1,5 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fileoverview no use this.tip_uid
|
|
3
|
-
* @author junshao
|
|
4
|
-
*/
|
|
5
|
-
'use strict';
|
|
6
1
|
|
|
7
|
-
|
|
8
|
-
// Rule Definition
|
|
9
|
-
// ------------------------------------------------------------------------------
|
|
2
|
+
'use strict';
|
|
10
3
|
|
|
11
4
|
/** @type {import('eslint').Rule.RuleModule} */
|
|
12
5
|
module.exports = {
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-light",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "eslint插件",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eslint",
|
|
7
7
|
"eslint plugin",
|
|
8
8
|
"eslint-plugin",
|
|
9
|
-
"eslint-plugin-
|
|
9
|
+
"eslint-plugin-light"
|
|
10
10
|
],
|
|
11
11
|
"files": [
|
|
12
12
|
"lib/",
|
|
@@ -15,6 +15,18 @@
|
|
|
15
15
|
],
|
|
16
16
|
"author": "GuoWangYang",
|
|
17
17
|
"main": "lib/index.js",
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "https://github.com/novlan1/eslint-plugin-light"
|
|
21
|
+
},
|
|
22
|
+
"bugs": {
|
|
23
|
+
"url": "https://github.com/novlan1/eslint-plugin-light/issues"
|
|
24
|
+
},
|
|
25
|
+
"publishConfig": {
|
|
26
|
+
"access": "public",
|
|
27
|
+
"registry": "https://registry.npmjs.org/"
|
|
28
|
+
},
|
|
29
|
+
"homepage": "https://github.com/novlan1/eslint-plugin-light#readme",
|
|
18
30
|
"scripts": {
|
|
19
31
|
"lint": "eslint --ext .js,.vue .",
|
|
20
32
|
"lint:fix": "eslint --fix --ext .js,.vue .",
|
|
@@ -36,9 +48,9 @@
|
|
|
36
48
|
"devDependencies": {
|
|
37
49
|
"@babel/core": "^7.18.9",
|
|
38
50
|
"@babel/eslint-parser": "^7.18.9",
|
|
39
|
-
"@tencent/eslint-config-light": "^1.4.6",
|
|
40
51
|
"axios": "^0.27.2",
|
|
41
52
|
"eslint": "^8.0.1",
|
|
53
|
+
"eslint-config-light": "^1.4.7",
|
|
42
54
|
"eslint-plugin-eslint-plugin": "^4.0.1",
|
|
43
55
|
"eslint-plugin-node": "^11.1.0",
|
|
44
56
|
"mocha": "^9.1.3",
|
|
@@ -48,4 +60,4 @@
|
|
|
48
60
|
"node": "12.x || 14.x || >= 16"
|
|
49
61
|
},
|
|
50
62
|
"license": "ISC"
|
|
51
|
-
}
|
|
63
|
+
}
|