eslint-plugin-light 1.0.3 → 1.0.4
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 +66 -50
- package/LICENSE +9 -0
- package/README.md +11 -2
- package/lib/configs/base.js +16 -0
- package/lib/configs/essential.js +5 -0
- package/lib/configs/recommended.js +7 -0
- package/lib/index.js +15 -0
- package/lib/rules/json-parse-try-catch.js +58 -0
- package/lib/rules/no-complex-key.js +62 -0
- package/lib/rules/no-import-vant.js +70 -0
- package/lib/rules/no-plus-turn-number.js +47 -0
- package/lib/rules/no-this-tip-uid.js +33 -0
- package/lib/rules/valid-vue-comp-import.js +282 -0
- package/package.json +19 -18
package/CHANGELOG.md
CHANGED
|
@@ -1,158 +1,174 @@
|
|
|
1
|
-
##
|
|
1
|
+
## <small>1.0.4 (2025-04-18)</small>
|
|
2
|
+
|
|
3
|
+
* chore: update license ([5ba3e91](https://github.com/novlan1/plugin-light/commits/5ba3e91))
|
|
4
|
+
* chore: update license ([7f6a9d9](https://github.com/novlan1/plugin-light/commits/7f6a9d9))
|
|
5
|
+
* docs: update docs ([f055bcd](https://github.com/novlan1/plugin-light/commits/f055bcd))
|
|
6
|
+
* docs: update docs ([ddced10](https://github.com/novlan1/plugin-light/commits/ddced10))
|
|
7
|
+
* docs: update docs ([761f6c4](https://github.com/novlan1/plugin-light/commits/761f6c4))
|
|
8
|
+
* docs: update docs ([bba000b](https://github.com/novlan1/plugin-light/commits/bba000b))
|
|
9
|
+
* docs: update docs ([34dde24](https://github.com/novlan1/plugin-light/commits/34dde24))
|
|
10
|
+
* refactor: use eslint import/order rule ([41afa85](https://github.com/novlan1/plugin-light/commits/41afa85))
|
|
11
|
+
* feat(eslint): add eslint-config-light ([b7af1f7](https://github.com/novlan1/plugin-light/commits/b7af1f7))
|
|
12
|
+
* feat(eslint): use json-parse-try-catch rule ([eca21da](https://github.com/novlan1/plugin-light/commits/eca21da))
|
|
13
|
+
* ci: update build script ([b7ad1e3](https://github.com/novlan1/plugin-light/commits/b7ad1e3))
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
## [1.0.0](https://github.com/novlan1/eslint-plugin-light/compare/v0.0.16...v1.0.0) (2023-07-12)
|
|
2
18
|
|
|
3
19
|
|
|
4
20
|
### ✨ Features | 新功能
|
|
5
21
|
|
|
6
|
-
* 添加规则不能使用this.tip_uid,但是没有开启 ([d913d2b](https://
|
|
7
|
-
* 新增no-import-vant ([c5b8722](https://
|
|
8
|
-
* 优化插件 ([505f17f](https://
|
|
22
|
+
* 添加规则不能使用this.tip_uid,但是没有开启 ([d913d2b](https://github.com/novlan1/eslint-plugin-light/commit/d913d2be33aaa44dbb6615f2d4ac98d4a7acebb0))
|
|
23
|
+
* 新增no-import-vant ([c5b8722](https://github.com/novlan1/eslint-plugin-light/commit/c5b87222db44111338cd1d9d4356695efa20cb93))
|
|
24
|
+
* 优化插件 ([505f17f](https://github.com/novlan1/eslint-plugin-light/commit/505f17f2191fdd6a9f32c67d64420ae115909af2))
|
|
9
25
|
|
|
10
26
|
|
|
11
27
|
### ♻️ Code Refactoring | 代码重构
|
|
12
28
|
|
|
13
|
-
* 插件重命名为light ([21c1dd9](https://
|
|
29
|
+
* 插件重命名为light ([21c1dd9](https://github.com/novlan1/eslint-plugin-light/commit/21c1dd93dcd5e31265767cf53121a718826abaad))
|
|
14
30
|
|
|
15
31
|
|
|
16
32
|
### ✏️ Documentation | 文档
|
|
17
33
|
|
|
18
|
-
* 文档更新 ([4f33c36](https://
|
|
19
|
-
* 优化readme ([f0183d0](https://
|
|
34
|
+
* 文档更新 ([4f33c36](https://github.com/novlan1/eslint-plugin-light/commit/4f33c36f40bd8c872c586d05cd6ffbd0d21b5f62))
|
|
35
|
+
* 优化readme ([f0183d0](https://github.com/novlan1/eslint-plugin-light/commit/f0183d0b7cd66af9c47d3e389ccc11c572e1f54a))
|
|
20
36
|
|
|
21
37
|
|
|
22
38
|
### ✅ Tests | 测试
|
|
23
39
|
|
|
24
|
-
* 测试用例修正 ([70e9f36](https://
|
|
40
|
+
* 测试用例修正 ([70e9f36](https://github.com/novlan1/eslint-plugin-light/commit/70e9f36fdad34b72d94b85c2590bbb06489fd6aa))
|
|
25
41
|
|
|
26
42
|
|
|
27
43
|
### 🚀 Chore | 构建/工程依赖/工具
|
|
28
44
|
|
|
29
|
-
* 删除无效注释 ([96d5e9d](https://
|
|
45
|
+
* 删除无效注释 ([96d5e9d](https://github.com/novlan1/eslint-plugin-light/commit/96d5e9d158c10df93c6f714805eaf8d670d39eeb))
|
|
30
46
|
|
|
31
|
-
### [0.0.16](https://
|
|
47
|
+
### [0.0.16](https://github.com/novlan1/eslint-plugin-light/compare/v0.0.15...v0.0.16) (2022-07-26)
|
|
32
48
|
|
|
33
49
|
|
|
34
50
|
### ✨ Features | 新功能
|
|
35
51
|
|
|
36
|
-
* 去掉打印信息 ([bde64c7](https://
|
|
52
|
+
* 去掉打印信息 ([bde64c7](https://github.com/novlan1/eslint-plugin-light/commit/bde64c765562f5842aa988ee07d2caac27786a6c))
|
|
37
53
|
|
|
38
|
-
### [0.0.15](https://
|
|
54
|
+
### [0.0.15](https://github.com/novlan1/eslint-plugin-light/compare/v0.0.14...v0.0.15) (2022-07-26)
|
|
39
55
|
|
|
40
56
|
|
|
41
57
|
### ✨ Features | 新功能
|
|
42
58
|
|
|
43
|
-
* 优化包 ([906bcd7](https://
|
|
59
|
+
* 优化包 ([906bcd7](https://github.com/novlan1/eslint-plugin-light/commit/906bcd7a2ff0291d331feef961b479135f11c526))
|
|
44
60
|
|
|
45
|
-
### [0.0.14](https://
|
|
61
|
+
### [0.0.14](https://github.com/novlan1/eslint-plugin-light/compare/v0.0.13...v0.0.14) (2022-07-26)
|
|
46
62
|
|
|
47
63
|
|
|
48
64
|
### ✨ Features | 新功能
|
|
49
65
|
|
|
50
|
-
* 脚本优化 ([d1e8172](https://
|
|
51
|
-
* 脚本优化 ([9c6d844](https://
|
|
52
|
-
* **complex-key:** 不要使用复杂的key ([00e981b](https://
|
|
66
|
+
* 脚本优化 ([d1e8172](https://github.com/novlan1/eslint-plugin-light/commit/d1e8172ac3777f1377864d3de76a50c55e4122dd))
|
|
67
|
+
* 脚本优化 ([9c6d844](https://github.com/novlan1/eslint-plugin-light/commit/9c6d844aad15475e1af7d97728dfcae84bd99693))
|
|
68
|
+
* **complex-key:** 不要使用复杂的key ([00e981b](https://github.com/novlan1/eslint-plugin-light/commit/00e981b8d81e097576163fa8078a09a315a22cba))
|
|
53
69
|
|
|
54
|
-
### [0.0.13](https://
|
|
70
|
+
### [0.0.13](https://github.com/novlan1/eslint-plugin-light/compare/v0.0.12...v0.0.13) (2022-07-26)
|
|
55
71
|
|
|
56
72
|
|
|
57
73
|
### ✨ Features | 新功能
|
|
58
74
|
|
|
59
|
-
* 优化脚本 ([ad9b142](https://
|
|
75
|
+
* 优化脚本 ([ad9b142](https://github.com/novlan1/eslint-plugin-light/commit/ad9b142ee87aba73d45adcef3aa94ac3d5988b31))
|
|
60
76
|
|
|
61
|
-
### [0.0.12](https://
|
|
77
|
+
### [0.0.12](https://github.com/novlan1/eslint-plugin-light/compare/v0.0.11...v0.0.12) (2022-07-26)
|
|
62
78
|
|
|
63
79
|
|
|
64
80
|
### ✨ Features | 新功能
|
|
65
81
|
|
|
66
|
-
* 脚本优化 ([62f1181](https://
|
|
82
|
+
* 脚本优化 ([62f1181](https://github.com/novlan1/eslint-plugin-light/commit/62f11815bb458201991cca99716e773a3281c65b))
|
|
67
83
|
|
|
68
|
-
### [0.0.11](https://
|
|
84
|
+
### [0.0.11](https://github.com/novlan1/eslint-plugin-light/compare/v0.0.10...v0.0.11) (2022-07-26)
|
|
69
85
|
|
|
70
86
|
|
|
71
87
|
### ✨ Features | 新功能
|
|
72
88
|
|
|
73
|
-
* 脚本优化 ([3047f01](https://
|
|
74
|
-
* 优化发布脚本 ([a072ae8](https://
|
|
89
|
+
* 脚本优化 ([3047f01](https://github.com/novlan1/eslint-plugin-light/commit/3047f01b89fdbdb8c72b0c5e511afb587d8ffc99))
|
|
90
|
+
* 优化发布脚本 ([a072ae8](https://github.com/novlan1/eslint-plugin-light/commit/a072ae8715352c9452072e8dfa9c85a343cf4f26))
|
|
75
91
|
|
|
76
|
-
### [0.0.10](https://
|
|
92
|
+
### [0.0.10](https://github.com/novlan1/eslint-plugin-light/compare/v0.0.9...v0.0.10) (2022-07-26)
|
|
77
93
|
|
|
78
94
|
|
|
79
95
|
### ✨ Features | 新功能
|
|
80
96
|
|
|
81
|
-
* 优化发布脚本 ([470a35f](https://
|
|
82
|
-
* 优化error信息 ([453430f](https://
|
|
97
|
+
* 优化发布脚本 ([470a35f](https://github.com/novlan1/eslint-plugin-light/commit/470a35fc55153d41a362cf61492fde120a9ed3f7))
|
|
98
|
+
* 优化error信息 ([453430f](https://github.com/novlan1/eslint-plugin-light/commit/453430ff437d062cd1efa7bff96b87e975b2b414))
|
|
83
99
|
|
|
84
|
-
### [0.0.9](https://
|
|
100
|
+
### [0.0.9](https://github.com/novlan1/eslint-plugin-light/compare/v0.0.8...v0.0.9) (2022-07-22)
|
|
85
101
|
|
|
86
102
|
|
|
87
103
|
### ✨ Features | 新功能
|
|
88
104
|
|
|
89
|
-
* 优化插件 ([13a84d5](https://
|
|
105
|
+
* 优化插件 ([13a84d5](https://github.com/novlan1/eslint-plugin-light/commit/13a84d5ce25788f5d3b3b63b84a0731f179ff12d))
|
|
90
106
|
|
|
91
107
|
|
|
92
108
|
### ✏️ Documentation | 文档
|
|
93
109
|
|
|
94
|
-
* 用法更新 ([78e344d](https://
|
|
110
|
+
* 用法更新 ([78e344d](https://github.com/novlan1/eslint-plugin-light/commit/78e344d61c026f7c38960d41d7038888664ecb85))
|
|
95
111
|
|
|
96
|
-
### [0.0.8](https://
|
|
112
|
+
### [0.0.8](https://github.com/novlan1/eslint-plugin-light/compare/v0.0.7...v0.0.8) (2022-07-22)
|
|
97
113
|
|
|
98
114
|
|
|
99
115
|
### ✏️ Documentation | 文档
|
|
100
116
|
|
|
101
|
-
* 更新文档 ([d6e3a23](https://
|
|
117
|
+
* 更新文档 ([d6e3a23](https://github.com/novlan1/eslint-plugin-light/commit/d6e3a23205244f41ecb8b8fff3bb9d9a07a2c734))
|
|
102
118
|
|
|
103
119
|
|
|
104
120
|
### 🚀 Chore | 构建/工程依赖/工具
|
|
105
121
|
|
|
106
|
-
* eslint ([63e2398](https://
|
|
122
|
+
* eslint ([63e2398](https://github.com/novlan1/eslint-plugin-light/commit/63e2398387b466c4e188a7f12a2d08586583f527))
|
|
107
123
|
|
|
108
124
|
|
|
109
125
|
### ✨ Features | 新功能
|
|
110
126
|
|
|
111
|
-
* **number:** 优化插件 ([003f290](https://
|
|
127
|
+
* **number:** 优化插件 ([003f290](https://github.com/novlan1/eslint-plugin-light/commit/003f290563b15d4cc1e8a6585a629bbfba2fce1e))
|
|
112
128
|
|
|
113
|
-
### [0.0.7](https://
|
|
129
|
+
### [0.0.7](https://github.com/novlan1/eslint-plugin-light/compare/v0.0.6...v0.0.7) (2022-07-22)
|
|
114
130
|
|
|
115
131
|
|
|
116
132
|
### ✏️ Documentation | 文档
|
|
117
133
|
|
|
118
|
-
* 文档优化 ([e7f5bfb](https://
|
|
119
|
-
* 优化文档 ([44e7b1e](https://
|
|
134
|
+
* 文档优化 ([e7f5bfb](https://github.com/novlan1/eslint-plugin-light/commit/e7f5bfb9e67ac3f7cb9ea182200886feb22c9798))
|
|
135
|
+
* 优化文档 ([44e7b1e](https://github.com/novlan1/eslint-plugin-light/commit/44e7b1e5f5e230363dcfd6923d325e96db9509f4))
|
|
120
136
|
|
|
121
137
|
|
|
122
138
|
### ✨ Features | 新功能
|
|
123
139
|
|
|
124
|
-
* **no-plus-turn-number:** 转化+字符串 ([aa69796](https://
|
|
140
|
+
* **no-plus-turn-number:** 转化+字符串 ([aa69796](https://github.com/novlan1/eslint-plugin-light/commit/aa69796620c554d745c2b5133b9699c9be363805))
|
|
125
141
|
|
|
126
|
-
### [0.0.6](https://
|
|
142
|
+
### [0.0.6](https://github.com/novlan1/eslint-plugin-light/compare/v0.0.5...v0.0.6) (2022-07-22)
|
|
127
143
|
|
|
128
144
|
|
|
129
145
|
### ✨ Features | 新功能
|
|
130
146
|
|
|
131
|
-
* 优化插件 ([c0e28fd](https://
|
|
147
|
+
* 优化插件 ([c0e28fd](https://github.com/novlan1/eslint-plugin-light/commit/c0e28fda4d5ba7c6c90a0ad7fe799342b79e9b49))
|
|
132
148
|
|
|
133
|
-
### [0.0.5](https://
|
|
149
|
+
### [0.0.5](https://github.com/novlan1/eslint-plugin-light/compare/v0.0.4...v0.0.5) (2022-07-22)
|
|
134
150
|
|
|
135
|
-
### [0.0.4](https://
|
|
151
|
+
### [0.0.4](https://github.com/novlan1/eslint-plugin-light/compare/v0.0.3...v0.0.4) (2022-07-22)
|
|
136
152
|
|
|
137
153
|
|
|
138
154
|
### 🐛 Bug Fixes | Bug 修复
|
|
139
155
|
|
|
140
|
-
* 兼容性处理 ([ba123c2](https://
|
|
156
|
+
* 兼容性处理 ([ba123c2](https://github.com/novlan1/eslint-plugin-light/commit/ba123c26093d66008e459cdc3bfaf5fea74588e1))
|
|
141
157
|
|
|
142
|
-
### [0.0.3](https://
|
|
158
|
+
### [0.0.3](https://github.com/novlan1/eslint-plugin-light/compare/v0.0.2...v0.0.3) (2022-07-22)
|
|
143
159
|
|
|
144
160
|
|
|
145
161
|
### 🚀 Chore | 构建/工程依赖/工具
|
|
146
162
|
|
|
147
|
-
* 增加versionrc ([1a8b239](https://
|
|
148
|
-
* version ([dda6406](https://
|
|
163
|
+
* 增加versionrc ([1a8b239](https://github.com/novlan1/eslint-plugin-light/commit/1a8b2393618cbb16003298a1ec5e8b9bf44fb779))
|
|
164
|
+
* version ([dda6406](https://github.com/novlan1/eslint-plugin-light/commit/dda640604dd0bd34bf8937692781edd95b99d6ed))
|
|
149
165
|
|
|
150
166
|
### 0.0.2 (2022-07-22)
|
|
151
167
|
|
|
152
168
|
|
|
153
169
|
### Features
|
|
154
170
|
|
|
155
|
-
* 安装version ([a295b91](https://
|
|
156
|
-
* 优化插件 ([803d743](https://
|
|
157
|
-
* init ([44f3cb3](https://
|
|
158
|
-
* vue组件规则 ([80b3690](https://
|
|
171
|
+
* 安装version ([a295b91](https://github.com/novlan1/eslint-plugin-light/commit/a295b91936a3eaeeda3bbc53d3221d0c0ee4c6f8))
|
|
172
|
+
* 优化插件 ([803d743](https://github.com/novlan1/eslint-plugin-light/commit/803d7434d653776dd70d0ec85b8eb0c20bdbc578))
|
|
173
|
+
* init ([44f3cb3](https://github.com/novlan1/eslint-plugin-light/commit/44f3cb326e7fca1b4b4b54ec8f361b491b84f996))
|
|
174
|
+
* vue组件规则 ([80b3690](https://github.com/novlan1/eslint-plugin-light/commit/80b36908061aab76995f6b7bf1d7f6930bb6f7eb))
|
package/LICENSE
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 novlan1
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
6
|
+
|
|
7
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,7 +1,16 @@
|
|
|
1
|
-
##
|
|
1
|
+
## ESLint Plugin Light
|
|
2
2
|
|
|
3
|
-
Simple Eslint plugin.
|
|
4
3
|
|
|
4
|
+
<p align="center">
|
|
5
|
+
<img src="https://img.shields.io/npm/dw/eslint-plugin-light">
|
|
6
|
+
<img src="https://img.shields.io/npm/unpacked-size/eslint-plugin-light">
|
|
7
|
+
<img src="https://img.shields.io/npm/v/eslint-plugin-light">
|
|
8
|
+
<img src="https://img.shields.io/npm/l/eslint-plugin-light">
|
|
9
|
+
<img src="https://img.shields.io/github/last-commit/novlan1/plugin-light">
|
|
10
|
+
<img src="https://img.shields.io/github/created-at/novlan1/plugin-light">
|
|
11
|
+
</p>
|
|
12
|
+
|
|
13
|
+
Simple Eslint plugin.
|
|
5
14
|
|
|
6
15
|
### 1. Installation
|
|
7
16
|
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
plugins: ['eslint-plugin-light', 'vue'],
|
|
3
|
+
parser: require.resolve('vue-eslint-parser'),
|
|
4
|
+
parserOptions: {
|
|
5
|
+
ecmaVersion: 2020,
|
|
6
|
+
sourceType: 'module',
|
|
7
|
+
},
|
|
8
|
+
env: {
|
|
9
|
+
browser: true,
|
|
10
|
+
es6: true,
|
|
11
|
+
},
|
|
12
|
+
rules: {
|
|
13
|
+
'light/valid-vue-comp-import': 2,
|
|
14
|
+
'light/no-plus-turn-number': 2,
|
|
15
|
+
},
|
|
16
|
+
};
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const requireIndex = require('requireindex');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
module.exports = {
|
|
7
|
+
rules: requireIndex(`${__dirname}/rules`),
|
|
8
|
+
configs: {
|
|
9
|
+
base: require('./configs/base'),
|
|
10
|
+
essential: require('./configs/essential'),
|
|
11
|
+
recommended: require('./configs/recommended'),
|
|
12
|
+
},
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
// 用于检测 JSON.parse 没有用 try catch
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
const desc = 'JSON.parse need try catch';
|
|
5
|
+
|
|
6
|
+
module.exports = {
|
|
7
|
+
meta: {
|
|
8
|
+
type: 'suggestion',
|
|
9
|
+
docs: {
|
|
10
|
+
description: desc,
|
|
11
|
+
category: 'Best Practices',
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
schema: [{
|
|
15
|
+
type: 'object',
|
|
16
|
+
properties: {
|
|
17
|
+
strict: {
|
|
18
|
+
type: 'boolean',
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
}],
|
|
22
|
+
create(context) {
|
|
23
|
+
const options = context.options?.[0];
|
|
24
|
+
let strict = options?.strict;
|
|
25
|
+
if (typeof strict === 'undefined') {
|
|
26
|
+
strict = false;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return {
|
|
30
|
+
CallExpression(node) {
|
|
31
|
+
const calleeObjectName = node.callee?.object?.name;
|
|
32
|
+
const calleePropertyName = node.callee?.property?.name;
|
|
33
|
+
|
|
34
|
+
const subNode = node.arguments?.[0];
|
|
35
|
+
const sbCalleeObjectName = subNode?.callee?.object?.name;
|
|
36
|
+
const subCalleePropertyName = subNode?.callee?.property?.name;
|
|
37
|
+
|
|
38
|
+
if (calleeObjectName === 'JSON'
|
|
39
|
+
&& calleePropertyName === 'parse'
|
|
40
|
+
&& (strict || !(sbCalleeObjectName === 'JSON' && subCalleePropertyName === 'stringify'))
|
|
41
|
+
) {
|
|
42
|
+
let p = node.parent;
|
|
43
|
+
let hasTryFlg = false;
|
|
44
|
+
|
|
45
|
+
while (p && !hasTryFlg) {
|
|
46
|
+
if (p.type === 'TryStatement') hasTryFlg = true;
|
|
47
|
+
p = p.parent;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
if (!hasTryFlg) {
|
|
51
|
+
context.report(node, desc);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
};
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
meta: {
|
|
3
|
+
type: 'problem',
|
|
4
|
+
schema: [],
|
|
5
|
+
docs: {
|
|
6
|
+
description: 'vue模板中不要使用复杂的key',
|
|
7
|
+
},
|
|
8
|
+
messages: {
|
|
9
|
+
error: 'Do not use complex key',
|
|
10
|
+
funcError: 'Do not use function as key',
|
|
11
|
+
stringError: 'Do not use string concatenation as key',
|
|
12
|
+
tplError: 'Do not use template string as key',
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
|
|
16
|
+
create(context) {
|
|
17
|
+
const fileName = context.getFilename();
|
|
18
|
+
if (!fileName.endsWith('.vue')) {
|
|
19
|
+
return {};
|
|
20
|
+
}
|
|
21
|
+
if (!context.parserServices?.defineTemplateBodyVisitor) {
|
|
22
|
+
return {
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return context.parserServices.defineTemplateBodyVisitor({
|
|
27
|
+
VAttribute(node) {
|
|
28
|
+
if (!node.key
|
|
29
|
+
|| node.key.type !== 'VDirectiveKey'
|
|
30
|
+
|| node.key?.argument?.type !== 'VIdentifier'
|
|
31
|
+
|| node.key?.argument?.name !== 'key'
|
|
32
|
+
) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
if (node?.value?.type === 'VExpressionContainer') {
|
|
37
|
+
if (node.value.expression?.type === 'CallExpression') {
|
|
38
|
+
// :key="getHoldKey(item)"
|
|
39
|
+
context.report({
|
|
40
|
+
node,
|
|
41
|
+
messageId: 'funcError',
|
|
42
|
+
});
|
|
43
|
+
} else if (node.value.expression?.type === 'BinaryExpression') {
|
|
44
|
+
// :key="index + 'hold'"
|
|
45
|
+
context.report({
|
|
46
|
+
node,
|
|
47
|
+
messageId: 'stringError',
|
|
48
|
+
});
|
|
49
|
+
} else if (node.value.expression?.type === 'TemplateLiteral') {
|
|
50
|
+
// :key="`${index}hold`"
|
|
51
|
+
context.report({
|
|
52
|
+
node,
|
|
53
|
+
messageId: 'tplError',
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// 合法的是MemberExpression,比如item.key
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
});
|
|
61
|
+
},
|
|
62
|
+
};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
meta: {
|
|
3
|
+
type: 'problem',
|
|
4
|
+
schema: [],
|
|
5
|
+
docs: {
|
|
6
|
+
description: '不要直接引用vant',
|
|
7
|
+
},
|
|
8
|
+
fixable: 'code',
|
|
9
|
+
messages: {
|
|
10
|
+
error: 'Do not import vant',
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
|
|
14
|
+
create(context) {
|
|
15
|
+
const fileName = context.getFilename();
|
|
16
|
+
if (!fileName.endsWith('.vue')) {
|
|
17
|
+
return {};
|
|
18
|
+
}
|
|
19
|
+
return {
|
|
20
|
+
ImportDeclaration: (node) => {
|
|
21
|
+
if (node.source.value === 'vant') {
|
|
22
|
+
context.report({
|
|
23
|
+
node,
|
|
24
|
+
messageId: 'error',
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
// if (!context.parserServices?.defineTemplateBodyVisitor) {
|
|
30
|
+
// return {
|
|
31
|
+
// };
|
|
32
|
+
// }
|
|
33
|
+
|
|
34
|
+
// return context.parserServices.defineTemplateBodyVisitor({
|
|
35
|
+
// VAttribute(node) {
|
|
36
|
+
// if (!node.key
|
|
37
|
+
// || node.key.type !== 'VDirectiveKey'
|
|
38
|
+
// || node.key?.argument?.type !== 'VIdentifier'
|
|
39
|
+
// || node.key?.argument?.name !== 'key'
|
|
40
|
+
// ) {
|
|
41
|
+
// return;
|
|
42
|
+
// }
|
|
43
|
+
|
|
44
|
+
// if (node?.value?.type === 'VExpressionContainer') {
|
|
45
|
+
// if (node.value.expression?.type === 'CallExpression') {
|
|
46
|
+
// // :key="getHoldKey(item)"
|
|
47
|
+
// context.report({
|
|
48
|
+
// node,
|
|
49
|
+
// messageId: 'funcError',
|
|
50
|
+
// });
|
|
51
|
+
// } else if (node.value.expression?.type === 'BinaryExpression') {
|
|
52
|
+
// // :key="index + 'hold'"
|
|
53
|
+
// context.report({
|
|
54
|
+
// node,
|
|
55
|
+
// messageId: 'stringError',
|
|
56
|
+
// });
|
|
57
|
+
// } else if (node.value.expression?.type === 'TemplateLiteral') {
|
|
58
|
+
// // :key="`${index}hold`"
|
|
59
|
+
// context.report({
|
|
60
|
+
// node,
|
|
61
|
+
// messageId: 'tplError',
|
|
62
|
+
// });
|
|
63
|
+
// }
|
|
64
|
+
|
|
65
|
+
// // 合法的是MemberExpression,比如item.key
|
|
66
|
+
// }
|
|
67
|
+
// },
|
|
68
|
+
// });
|
|
69
|
+
},
|
|
70
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
meta: {
|
|
3
|
+
type: 'problem',
|
|
4
|
+
schema: [],
|
|
5
|
+
docs: {
|
|
6
|
+
description: 'vue模板中不能使用+号转换字符串',
|
|
7
|
+
},
|
|
8
|
+
fixable: 'code',
|
|
9
|
+
messages: {
|
|
10
|
+
error: 'Do not use plus symbol to transfer string',
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
|
|
14
|
+
create(context) {
|
|
15
|
+
const fileName = context.getFilename();
|
|
16
|
+
if (!fileName.endsWith('.vue')) {
|
|
17
|
+
return {};
|
|
18
|
+
}
|
|
19
|
+
if (!context.parserServices?.defineTemplateBodyVisitor) {
|
|
20
|
+
return {
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
return context.parserServices.defineTemplateBodyVisitor({
|
|
25
|
+
VAttribute(node) {
|
|
26
|
+
if (node.value && node.value.type === 'VExpressionContainer' && node.value.expression) {
|
|
27
|
+
const { operator } = node.value.expression;
|
|
28
|
+
const { argument } = node.value.expression;
|
|
29
|
+
|
|
30
|
+
// console.log('operator',operator)
|
|
31
|
+
// console.log('argument',argument && argument.type)
|
|
32
|
+
|
|
33
|
+
if (operator === '+' && argument && argument.type === 'Identifier') {
|
|
34
|
+
const { name } = node.value.expression.argument;
|
|
35
|
+
context.report({
|
|
36
|
+
node,
|
|
37
|
+
messageId: 'error',
|
|
38
|
+
fix(fixer) {
|
|
39
|
+
return fixer.replaceTextRange(node.value.expression.range, `parseInt(${name},10)`);
|
|
40
|
+
},
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
});
|
|
46
|
+
},
|
|
47
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
/** @type {import('eslint').Rule.RuleModule} */
|
|
5
|
+
module.exports = {
|
|
6
|
+
meta: {
|
|
7
|
+
type: 'problem',
|
|
8
|
+
schema: [],
|
|
9
|
+
docs: {
|
|
10
|
+
description: '不能使用this.tip_uid',
|
|
11
|
+
},
|
|
12
|
+
fixable: null, // Or `code` or `whitespace`,
|
|
13
|
+
messages: {
|
|
14
|
+
noUseTipUidId: '不能使用this.tip_uid',
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
|
|
18
|
+
create(context) {
|
|
19
|
+
return {
|
|
20
|
+
MemberExpression: (node) => {
|
|
21
|
+
if (node.object.type === 'ThisExpression'
|
|
22
|
+
&& node.property.type === 'Identifier'
|
|
23
|
+
&& node.property.name === 'tip_uid') {
|
|
24
|
+
context.report({
|
|
25
|
+
node,
|
|
26
|
+
messageId: 'noUseTipUidId',
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
// visitor functions for different types of nodes
|
|
31
|
+
};
|
|
32
|
+
},
|
|
33
|
+
};
|
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
|
|
4
|
+
const jsParser = require('@babel/eslint-parser');
|
|
5
|
+
|
|
6
|
+
const ROOT_PATH = process.cwd();
|
|
7
|
+
|
|
8
|
+
const VALID_FILES = ['js', 'ts', 'vue'];
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* 获取引入文件的真实位置,如果是目录,返回目录,如果是文件,返回带后缀的文件
|
|
12
|
+
*/
|
|
13
|
+
function findCompDir(source = '', dirname = '') {
|
|
14
|
+
let compFile;
|
|
15
|
+
if (source.startsWith('.')) {
|
|
16
|
+
compFile = path.resolve(dirname, source);
|
|
17
|
+
} else if (source.startsWith('src')) {
|
|
18
|
+
compFile = path.resolve(process.cwd(), source);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
if (fs.existsSync(compFile)) {
|
|
22
|
+
return compFile;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
for (let i = 0; i < VALID_FILES.length; i++) {
|
|
26
|
+
const postfix = VALID_FILES[i];
|
|
27
|
+
const wholeFileName = `${compFile}.${postfix}`;
|
|
28
|
+
if (fs.existsSync(wholeFileName)) {
|
|
29
|
+
return wholeFileName;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
console.log('\x1B[31m%s\x1B[0m', '未找到引入文件');
|
|
33
|
+
return compFile;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function getSourceAST(sourceFile) {
|
|
37
|
+
const jsData = fs.readFileSync(sourceFile, {
|
|
38
|
+
encoding: 'utf-8',
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
let scriptAST = undefined;
|
|
42
|
+
|
|
43
|
+
const opts = {
|
|
44
|
+
sourceType: 'module',
|
|
45
|
+
requireConfigFile: false,
|
|
46
|
+
babelOptions: {
|
|
47
|
+
configFile: false,
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
try {
|
|
52
|
+
scriptAST = jsParser.parse(jsData, opts);
|
|
53
|
+
delete scriptAST.tokens;
|
|
54
|
+
} catch (e) {
|
|
55
|
+
console.log('出错了:', e);
|
|
56
|
+
}
|
|
57
|
+
return scriptAST;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
function getDefaultExportComp(ast) {
|
|
62
|
+
if (!ast) return '';
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
const namedDeclarationNodes = ast.body.filter(item => item.type === 'ExportNamedDeclaration');
|
|
66
|
+
|
|
67
|
+
const namedObj = {};
|
|
68
|
+
// console.log('namedDeclarationNodes',namedDeclarationNodes.length)
|
|
69
|
+
for (let i = 0;i < namedDeclarationNodes.length;i++) {
|
|
70
|
+
const node = namedDeclarationNodes[i];
|
|
71
|
+
// console.log('node',node)
|
|
72
|
+
if (!node.specifiers || !node.specifiers.length) {
|
|
73
|
+
continue;
|
|
74
|
+
}
|
|
75
|
+
// console.log('i',node)
|
|
76
|
+
const { value } = node.source;
|
|
77
|
+
const { name } = node.specifiers[0].exported;
|
|
78
|
+
namedObj[name] = value;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// console.log('namedObj', namedObj);
|
|
82
|
+
|
|
83
|
+
if (namedObj.default) {
|
|
84
|
+
return namedObj;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
const nodes = ast.body.filter(item => item.type === 'ExportDefaultDeclaration') || [];
|
|
88
|
+
if (nodes[0] && nodes[0].declaration.type === 'Identifier') {
|
|
89
|
+
// 是一个变量,代表从上面导入的
|
|
90
|
+
const { name } = nodes[0].declaration;
|
|
91
|
+
const importAst = ast.body.filter(item => item.type === 'ImportDeclaration' && !!item.specifiers.find(it => it.local.name === name));
|
|
92
|
+
// console.log('importAst', importAst)
|
|
93
|
+
namedObj.default = importAst[0].source.value;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
return namedObj;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
function getRelativePath(originPath = '') {
|
|
100
|
+
return originPath.replace(`${path.resolve(ROOT_PATH)}/`, '');
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function getDefaultExportPathFromSouceFile(sourceFile) {
|
|
104
|
+
const scriptAST = getSourceAST(sourceFile);
|
|
105
|
+
// console.log('scriptAST', scriptAST)
|
|
106
|
+
|
|
107
|
+
const defaultExportComp = getDefaultExportComp(scriptAST);
|
|
108
|
+
// console.log('defaultExportComp',defaultExportComp)
|
|
109
|
+
if (!defaultExportComp) return;
|
|
110
|
+
|
|
111
|
+
const obj = {};
|
|
112
|
+
const keys = Object.keys(defaultExportComp);
|
|
113
|
+
for (let i = 0;i < keys.length;i++) {
|
|
114
|
+
const name = keys[i];
|
|
115
|
+
const value = defaultExportComp[name];
|
|
116
|
+
const defaultFilePath = findCompDir(value, path.dirname(sourceFile));
|
|
117
|
+
const relativePath = getRelativePath(defaultFilePath);
|
|
118
|
+
obj[name] = relativePath;
|
|
119
|
+
}
|
|
120
|
+
// console.log('defaultFilePath',defaultFilePath)
|
|
121
|
+
|
|
122
|
+
// console.log('relativePath',relativePath)
|
|
123
|
+
return obj;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
function handleError({
|
|
128
|
+
specifiers,
|
|
129
|
+
sourceFile,
|
|
130
|
+
context,
|
|
131
|
+
node: one,
|
|
132
|
+
}) {
|
|
133
|
+
if (!specifiers || !specifiers.length) return;
|
|
134
|
+
const componentList = [];
|
|
135
|
+
let statementString = '\n';
|
|
136
|
+
const relativePath = getDefaultExportPathFromSouceFile(sourceFile);
|
|
137
|
+
|
|
138
|
+
const isJSError = sourceFile.endsWith('.js');
|
|
139
|
+
|
|
140
|
+
for (let i = 0;i < specifiers.length;i++) {
|
|
141
|
+
const specifier = specifiers[i];
|
|
142
|
+
const componentName = specifier.local.name;
|
|
143
|
+
// console.log('componentName', componentName);
|
|
144
|
+
componentList.push(componentName);
|
|
145
|
+
if (relativePath[componentName]) {
|
|
146
|
+
statementString += `import ${componentName} from '${relativePath[componentName]}';\n`;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
// console.log('relativePath', relativePath);
|
|
151
|
+
context.report({
|
|
152
|
+
node: one,
|
|
153
|
+
messageId: isJSError ? 'jsError' : 'tsError',
|
|
154
|
+
fix(fixer) {
|
|
155
|
+
/**
|
|
156
|
+
* 默认导入,比如:
|
|
157
|
+
*
|
|
158
|
+
* import BottomTipBarComp from 'xxx';
|
|
159
|
+
*
|
|
160
|
+
*/
|
|
161
|
+
const defaultCompStr = relativePath.default;
|
|
162
|
+
if (defaultCompStr && specifiers.length === 1 && specifiers[0].type === 'ImportDefaultSpecifier') {
|
|
163
|
+
return fixer.replaceTextRange(one.source.range, `'${defaultCompStr}'`);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* 具名导入,比如:
|
|
168
|
+
* import { xx, yy } from 'xxx';
|
|
169
|
+
*/
|
|
170
|
+
return [
|
|
171
|
+
fixer.insertTextBeforeRange(one.range, statementString),
|
|
172
|
+
fixer.removeRange(one.range),
|
|
173
|
+
];
|
|
174
|
+
},
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
module.exports = {
|
|
179
|
+
meta: {
|
|
180
|
+
type: 'problem',
|
|
181
|
+
schema: [],
|
|
182
|
+
docs: {
|
|
183
|
+
description: '不能从js/ts文件中引入组件',
|
|
184
|
+
},
|
|
185
|
+
fixable: 'code',
|
|
186
|
+
messages: {
|
|
187
|
+
jsError: 'Do not import component from JS file',
|
|
188
|
+
tsError: 'Do not import component from TS file',
|
|
189
|
+
},
|
|
190
|
+
},
|
|
191
|
+
|
|
192
|
+
create(context) {
|
|
193
|
+
// const sourceCode = context.getSourceCode();
|
|
194
|
+
// const cwd = context.getCwd();
|
|
195
|
+
const fileName = context.getFilename();
|
|
196
|
+
|
|
197
|
+
// console.log('cwd', cwd)
|
|
198
|
+
// console.log('fileName', fileName)
|
|
199
|
+
const dirname = path.dirname(fileName);
|
|
200
|
+
// console.log('dirname', dirname);
|
|
201
|
+
if (!fileName.endsWith('.vue')) {
|
|
202
|
+
return {};
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
return {
|
|
206
|
+
Program: (node) => {
|
|
207
|
+
const exportAst = node.body.find(item => item.type === 'ExportDefaultDeclaration');
|
|
208
|
+
if (!exportAst || !exportAst.declaration) return;
|
|
209
|
+
|
|
210
|
+
const properties = exportAst.declaration.properties || [];
|
|
211
|
+
const componentsNode = properties.find(item => item.key && item.key.name === 'components');
|
|
212
|
+
|
|
213
|
+
// console.log('componentsNode',componentsNode)
|
|
214
|
+
if (!componentsNode || !componentsNode.value
|
|
215
|
+
|| !componentsNode.value.properties
|
|
216
|
+
|| !componentsNode.value.properties.length
|
|
217
|
+
) return;
|
|
218
|
+
const components = componentsNode.value.properties.map(item => ((item.value && item.value.name) || ''));
|
|
219
|
+
|
|
220
|
+
// console.log('components', components);
|
|
221
|
+
|
|
222
|
+
if (!components || !components.length) return;
|
|
223
|
+
|
|
224
|
+
const importAst = node.body.filter(item => item.type === 'ImportDeclaration');
|
|
225
|
+
const realImport = importAst.filter(item => !!item.specifiers.find((it) => {
|
|
226
|
+
const name = (it.imported && it.imported.name) || (it.local && it.local.name);
|
|
227
|
+
return components.includes(name);
|
|
228
|
+
}));
|
|
229
|
+
// console.log('realImport',realImport, realImport.length)
|
|
230
|
+
|
|
231
|
+
for (let i = 0;i < realImport.length;i++) {
|
|
232
|
+
const one = realImport[i];
|
|
233
|
+
const { specifiers } = one;
|
|
234
|
+
const source = one.source.value;
|
|
235
|
+
|
|
236
|
+
if (source.endsWith('.vue')) {
|
|
237
|
+
continue;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
if (source.endsWith('.js') || source.endsWith('.ts')) {
|
|
241
|
+
const compFile = findCompDir(source, dirname);
|
|
242
|
+
|
|
243
|
+
handleError({
|
|
244
|
+
specifiers,
|
|
245
|
+
sourceFile: compFile,
|
|
246
|
+
node: one,
|
|
247
|
+
context,
|
|
248
|
+
});
|
|
249
|
+
continue;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
const compFile = findCompDir(source, dirname);
|
|
253
|
+
|
|
254
|
+
if (fs.existsSync(compFile)) {
|
|
255
|
+
const stat = fs.lstatSync(compFile);
|
|
256
|
+
if (stat.isDirectory()) {
|
|
257
|
+
const indexJs = path.resolve(compFile, 'index.js');
|
|
258
|
+
const indexTs = path.resolve(compFile, 'index.ts');
|
|
259
|
+
if (fs.existsSync(indexJs)) {
|
|
260
|
+
handleError({
|
|
261
|
+
specifiers,
|
|
262
|
+
sourceFile: indexJs,
|
|
263
|
+
node: one,
|
|
264
|
+
context,
|
|
265
|
+
});
|
|
266
|
+
continue;
|
|
267
|
+
}
|
|
268
|
+
if (fs.existsSync(indexTs)) {
|
|
269
|
+
handleError({
|
|
270
|
+
specifiers,
|
|
271
|
+
sourceFile: indexTs,
|
|
272
|
+
node: one,
|
|
273
|
+
context,
|
|
274
|
+
});
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
},
|
|
280
|
+
};
|
|
281
|
+
},
|
|
282
|
+
};
|
package/package.json
CHANGED
|
@@ -1,35 +1,32 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-light",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "1.0.4",
|
|
4
|
+
"description": "Simple Eslint Plugin",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eslint",
|
|
7
7
|
"eslint plugin",
|
|
8
8
|
"eslint-plugin",
|
|
9
9
|
"eslint-plugin-light"
|
|
10
10
|
],
|
|
11
|
+
"homepage": "https://novlan1.github.io/plugin-light/zh/eslint-plugin-light.html",
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/novlan1/plugin-light/issues"
|
|
14
|
+
},
|
|
15
|
+
"repository": {
|
|
16
|
+
"type": "git",
|
|
17
|
+
"url": "https://github.com/novlan1/plugin-light"
|
|
18
|
+
},
|
|
19
|
+
"license": "MIT",
|
|
20
|
+
"author": "novlan1",
|
|
21
|
+
"main": "lib/index.js",
|
|
11
22
|
"files": [
|
|
12
23
|
"lib/",
|
|
13
24
|
"README.md",
|
|
14
25
|
"CHANGELOG.md"
|
|
15
26
|
],
|
|
16
|
-
"main": "lib/index.js",
|
|
17
|
-
"repository": {
|
|
18
|
-
"type": "git",
|
|
19
|
-
"url": "https://github.com/novlan1/plugin-light"
|
|
20
|
-
},
|
|
21
|
-
"author": "guowangyang",
|
|
22
|
-
"homepage": "https://novlan1.github.io/plugin-light/",
|
|
23
|
-
"bugs": {
|
|
24
|
-
"url": "https://github.com/novlan1/plugin-light/issues"
|
|
25
|
-
},
|
|
26
27
|
"dependencies": {
|
|
27
28
|
"requireindex": "^1.2.0"
|
|
28
29
|
},
|
|
29
|
-
"peerDependencies": {
|
|
30
|
-
"eslint": ">=6",
|
|
31
|
-
"@babel/eslint-parser": ">=6"
|
|
32
|
-
},
|
|
33
30
|
"devDependencies": {
|
|
34
31
|
"@babel/core": "^7.18.9",
|
|
35
32
|
"@babel/eslint-parser": "^7.18.9",
|
|
@@ -41,13 +38,17 @@
|
|
|
41
38
|
"mocha": "^9.1.3",
|
|
42
39
|
"standard-version": "^9.5.0"
|
|
43
40
|
},
|
|
41
|
+
"peerDependencies": {
|
|
42
|
+
"@babel/eslint-parser": ">=6",
|
|
43
|
+
"eslint": ">=6"
|
|
44
|
+
},
|
|
44
45
|
"engines": {
|
|
45
46
|
"node": "12.x || 14.x || >= 16"
|
|
46
47
|
},
|
|
47
48
|
"scripts": {
|
|
48
|
-
"build": "
|
|
49
|
-
"changelog": "node ../../script/monorepo/changelog $PWD",
|
|
49
|
+
"build": "rm -rf lib && node script/build",
|
|
50
50
|
"bump": "node ../../script/monorepo/version-simple $PWD",
|
|
51
|
+
"changelog": "node ../../script/monorepo/changelog $PWD",
|
|
51
52
|
"release": "node ../../script/monorepo/release $PWD"
|
|
52
53
|
}
|
|
53
54
|
}
|