mm_machine 2.1.5 → 2.1.7
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/item.js +12 -12
- package/package.json +18 -30
- package/.gitattributes +0 -5
- package/.prettierrc +0 -8
- package/app/test1/config_demo.json +0 -10
- package/app/test1/demo.json +0 -10
- package/app/test1/index.js +0 -63
- package/app/test2/after.js +0 -13
- package/app/test2/config_demo.json +0 -10
- package/app/test2/demo.json +0 -10
- package/app/test2/index.js +0 -16
- package/app/test2/main.js +0 -36
- package/debug_config.js +0 -37
- package/debug_detailed.js +0 -75
- package/debug_test.js +0 -65
- package/demo/test1/config_demo.json +0 -34
- package/demo/test1/demo.json +0 -34
- package/demo/test1/index.js +0 -33
- package/demo/test2/after.js +0 -15
- package/demo/test2/config_demo.json +0 -70
- package/demo/test2/demo.json +0 -70
- package/demo/test2/index.js +0 -34
- package/demo/test2/main.js +0 -16
- package/demo2/test1/demo.json +0 -34
- package/demo2/test1/index.js +0 -33
- package/demo2/test2/after.js +0 -15
- package/demo2/test2/demo.json +0 -70
- package/demo2/test2/main.js +0 -16
- package/eslint.config.js +0 -209
- package/methods_documentation.md +0 -225
- package/nodemon.json +0 -25
- package/test.js +0 -151
- package/test_easy.js +0 -52
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
[
|
|
2
|
-
{
|
|
3
|
-
/**
|
|
4
|
-
* 名称, 由中英文和下“_”组成, 用于卸载接口 例如: demo
|
|
5
|
-
*/
|
|
6
|
-
"name": "demo2",
|
|
7
|
-
/**
|
|
8
|
-
* 标题, 介绍作用
|
|
9
|
-
*/
|
|
10
|
-
"title": "示例脚本2",
|
|
11
|
-
/**
|
|
12
|
-
* 描述, 用于描述该有什么用的
|
|
13
|
-
*/
|
|
14
|
-
"description": "用于测试动态加载、更新、卸载、删除脚本",
|
|
15
|
-
/**
|
|
16
|
-
* 文件路径, 当调用函数不存在时,会先从文件中加载
|
|
17
|
-
*/
|
|
18
|
-
"func_file": "./main.js",
|
|
19
|
-
/**
|
|
20
|
-
* 回调函数名 用于决定调用脚本的哪个函数
|
|
21
|
-
*/
|
|
22
|
-
"func_name": "",
|
|
23
|
-
/**
|
|
24
|
-
* 排序
|
|
25
|
-
*/
|
|
26
|
-
"sort": 10,
|
|
27
|
-
/**
|
|
28
|
-
* 状态, 0表示未启用, 1表示启用
|
|
29
|
-
*/
|
|
30
|
-
"state": 1,
|
|
31
|
-
/**
|
|
32
|
-
* 显示, 0表示不显示, 1表示显示
|
|
33
|
-
*/
|
|
34
|
-
"show": 0
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
/**
|
|
38
|
-
* 名称, 由中英文和下“_”组成, 用于卸载接口 例如: demo
|
|
39
|
-
*/
|
|
40
|
-
"name": "demo3",
|
|
41
|
-
/**
|
|
42
|
-
* 标题, 介绍作用
|
|
43
|
-
*/
|
|
44
|
-
"title": "示例脚本3",
|
|
45
|
-
/**
|
|
46
|
-
* 描述, 用于描述该有什么用的
|
|
47
|
-
*/
|
|
48
|
-
"description": "用于测试动态加载、更新、卸载、删除脚本",
|
|
49
|
-
/**
|
|
50
|
-
* 文件路径, 当调用函数不存在时,会先从文件中加载
|
|
51
|
-
*/
|
|
52
|
-
"func_file": "./after.js",
|
|
53
|
-
/**
|
|
54
|
-
* 回调函数名 用于决定调用脚本的哪个函数
|
|
55
|
-
*/
|
|
56
|
-
"func_name": "main",
|
|
57
|
-
/**
|
|
58
|
-
* 排序
|
|
59
|
-
*/
|
|
60
|
-
"sort": 10,
|
|
61
|
-
/**
|
|
62
|
-
* 状态, 0表示未启用, 1表示启用
|
|
63
|
-
*/
|
|
64
|
-
"state": 1,
|
|
65
|
-
/**
|
|
66
|
-
* 显示, 0表示不显示, 1表示显示
|
|
67
|
-
*/
|
|
68
|
-
"show": 0
|
|
69
|
-
}
|
|
70
|
-
]
|
package/demo/test2/demo.json
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
[
|
|
2
|
-
{
|
|
3
|
-
/**
|
|
4
|
-
* 名称, 由中英文和下“_”组成, 用于卸载接口 例如: demo
|
|
5
|
-
*/
|
|
6
|
-
"name": "demo2",
|
|
7
|
-
/**
|
|
8
|
-
* 标题, 介绍作用
|
|
9
|
-
*/
|
|
10
|
-
"title": "示例脚本2",
|
|
11
|
-
/**
|
|
12
|
-
* 描述, 用于描述该有什么用的
|
|
13
|
-
*/
|
|
14
|
-
"description": "用于测试动态加载、更新、卸载、删除脚本",
|
|
15
|
-
/**
|
|
16
|
-
* 文件路径, 当调用函数不存在时,会先从文件中加载
|
|
17
|
-
*/
|
|
18
|
-
"func_file": "./main.js",
|
|
19
|
-
/**
|
|
20
|
-
* 回调函数名 用于决定调用脚本的哪个函数
|
|
21
|
-
*/
|
|
22
|
-
"func_name": "",
|
|
23
|
-
/**
|
|
24
|
-
* 排序
|
|
25
|
-
*/
|
|
26
|
-
"sort": 10,
|
|
27
|
-
/**
|
|
28
|
-
* 状态, 0表示未启用, 1表示启用
|
|
29
|
-
*/
|
|
30
|
-
"state": 1,
|
|
31
|
-
/**
|
|
32
|
-
* 显示, 0表示不显示, 1表示显示
|
|
33
|
-
*/
|
|
34
|
-
"show": 0
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
/**
|
|
38
|
-
* 名称, 由中英文和下“_”组成, 用于卸载接口 例如: demo
|
|
39
|
-
*/
|
|
40
|
-
"name": "demo3",
|
|
41
|
-
/**
|
|
42
|
-
* 标题, 介绍作用
|
|
43
|
-
*/
|
|
44
|
-
"title": "示例脚本",
|
|
45
|
-
/**
|
|
46
|
-
* 描述, 用于描述该有什么用的
|
|
47
|
-
*/
|
|
48
|
-
"description": "用于测试动态加载、更新、卸载、删除脚本",
|
|
49
|
-
/**
|
|
50
|
-
* 文件路径, 当调用函数不存在时,会先从文件中加载
|
|
51
|
-
*/
|
|
52
|
-
"func_file": "./after.js",
|
|
53
|
-
/**
|
|
54
|
-
* 回调函数名 用于决定调用脚本的哪个函数
|
|
55
|
-
*/
|
|
56
|
-
"func_name": "main",
|
|
57
|
-
/**
|
|
58
|
-
* 排序
|
|
59
|
-
*/
|
|
60
|
-
"sort": 10,
|
|
61
|
-
/**
|
|
62
|
-
* 状态, 0表示未启用, 1表示启用
|
|
63
|
-
*/
|
|
64
|
-
"state": 1,
|
|
65
|
-
/**
|
|
66
|
-
* 显示, 0表示不显示, 1表示显示
|
|
67
|
-
*/
|
|
68
|
-
"show": 0
|
|
69
|
-
}
|
|
70
|
-
]
|
package/demo/test2/index.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Demo类
|
|
3
|
-
* @class
|
|
4
|
-
*/
|
|
5
|
-
class Demo {
|
|
6
|
-
constructor() {}
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* 计数器
|
|
11
|
-
* @type {number}
|
|
12
|
-
*/
|
|
13
|
-
var counter = 0;
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* 主函数
|
|
17
|
-
* @returns {number} 返回计数器值
|
|
18
|
-
*/
|
|
19
|
-
Demo.prototype.main = function () {
|
|
20
|
-
console.log('我很好7654321', counter++);
|
|
21
|
-
return counter;
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* 初始化函数
|
|
26
|
-
* @returns {void}
|
|
27
|
-
*/
|
|
28
|
-
Demo.prototype.init = function () {
|
|
29
|
-
console.log('初始化test2');
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
module.exports = new Demo();
|
|
33
|
-
|
|
34
|
-
console.log('引用了test2');
|
package/demo/test2/main.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
class Demo {
|
|
2
|
-
constructor() {}
|
|
3
|
-
}
|
|
4
|
-
var i = 0;
|
|
5
|
-
Demo.prototype.main = function () {
|
|
6
|
-
console.log('test2 main', i++);
|
|
7
|
-
return i;
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
Demo.prototype.init = function () {
|
|
11
|
-
console.log('test2 init');
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
module.exports = new Demo();
|
|
15
|
-
|
|
16
|
-
console.log('引用了test2 main');
|
package/demo2/test1/demo.json
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
/**
|
|
3
|
-
* 名称, 由中英文和下“_”组成, 用于卸载接口 例如: demo
|
|
4
|
-
*/
|
|
5
|
-
"name": "demo1",
|
|
6
|
-
/**
|
|
7
|
-
* 标题, 介绍作用
|
|
8
|
-
*/
|
|
9
|
-
"title": "示例脚本1",
|
|
10
|
-
/**
|
|
11
|
-
* 描述, 用于描述该有什么用的
|
|
12
|
-
*/
|
|
13
|
-
"description": "用于测试动态加载、更新、卸载、删除脚本",
|
|
14
|
-
/**
|
|
15
|
-
* 文件路径, 当调用函数不存在时,会先从文件中加载
|
|
16
|
-
*/
|
|
17
|
-
"func_file": "./index.js",
|
|
18
|
-
/**
|
|
19
|
-
* 回调函数名 用于决定调用脚本的哪个函数
|
|
20
|
-
*/
|
|
21
|
-
"func_name": "",
|
|
22
|
-
/**
|
|
23
|
-
* 排序
|
|
24
|
-
*/
|
|
25
|
-
"sort": 10,
|
|
26
|
-
/**
|
|
27
|
-
* 状态, 0表示未启用, 1表示启用
|
|
28
|
-
*/
|
|
29
|
-
"state": 0,
|
|
30
|
-
/**
|
|
31
|
-
* 显示, 0表示不显示, 1表示显示
|
|
32
|
-
*/
|
|
33
|
-
"show": 0
|
|
34
|
-
}
|
package/demo2/test1/index.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
var i = 0;
|
|
2
|
-
|
|
3
|
-
function test() {
|
|
4
|
-
console.log('你好123', i++);
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
*
|
|
9
|
-
*/
|
|
10
|
-
function main() {
|
|
11
|
-
test();
|
|
12
|
-
return i;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
exports.main = main;
|
|
16
|
-
|
|
17
|
-
exports.main_before = function () {
|
|
18
|
-
console.log('test1请求前');
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
exports.main_after = async function (ret) {
|
|
22
|
-
console.log('test1请求后', ret);
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
exports.load = function () {
|
|
26
|
-
console.log('加载test1');
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
exports.init = function () {
|
|
30
|
-
console.log('初始化test1');
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
console.log('引用了test1');
|
package/demo2/test2/after.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
class Demo {
|
|
2
|
-
constructor() {}
|
|
3
|
-
}
|
|
4
|
-
var i = 0;
|
|
5
|
-
Demo.prototype.main = function () {
|
|
6
|
-
console.log('我很好123', i++);
|
|
7
|
-
return i;
|
|
8
|
-
};
|
|
9
|
-
Demo.prototype.init = function () {
|
|
10
|
-
console.log('初始化test2');
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
module.exports = new Demo();
|
|
14
|
-
|
|
15
|
-
console.log('引用了test2 after');
|
package/demo2/test2/demo.json
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
[
|
|
2
|
-
{
|
|
3
|
-
/**
|
|
4
|
-
* 名称, 由中英文和下“_”组成, 用于卸载接口 例如: demo
|
|
5
|
-
*/
|
|
6
|
-
"name": "demo2",
|
|
7
|
-
/**
|
|
8
|
-
* 标题, 介绍作用
|
|
9
|
-
*/
|
|
10
|
-
"title": "示例脚本2",
|
|
11
|
-
/**
|
|
12
|
-
* 描述, 用于描述该有什么用的
|
|
13
|
-
*/
|
|
14
|
-
"description": "用于测试动态加载、更新、卸载、删除脚本",
|
|
15
|
-
/**
|
|
16
|
-
* 文件路径, 当调用函数不存在时,会先从文件中加载
|
|
17
|
-
*/
|
|
18
|
-
"func_file": "./main.js",
|
|
19
|
-
/**
|
|
20
|
-
* 回调函数名 用于决定调用脚本的哪个函数
|
|
21
|
-
*/
|
|
22
|
-
"func_name": "",
|
|
23
|
-
/**
|
|
24
|
-
* 排序
|
|
25
|
-
*/
|
|
26
|
-
"sort": 10,
|
|
27
|
-
/**
|
|
28
|
-
* 状态, 0表示未启用, 1表示启用
|
|
29
|
-
*/
|
|
30
|
-
"state": 1,
|
|
31
|
-
/**
|
|
32
|
-
* 显示, 0表示不显示, 1表示显示
|
|
33
|
-
*/
|
|
34
|
-
"show": 0
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
/**
|
|
38
|
-
* 名称, 由中英文和下“_”组成, 用于卸载接口 例如: demo
|
|
39
|
-
*/
|
|
40
|
-
"name": "demo3",
|
|
41
|
-
/**
|
|
42
|
-
* 标题, 介绍作用
|
|
43
|
-
*/
|
|
44
|
-
"title": "示例脚本",
|
|
45
|
-
/**
|
|
46
|
-
* 描述, 用于描述该有什么用的
|
|
47
|
-
*/
|
|
48
|
-
"description": "用于测试动态加载、更新、卸载、删除脚本",
|
|
49
|
-
/**
|
|
50
|
-
* 文件路径, 当调用函数不存在时,会先从文件中加载
|
|
51
|
-
*/
|
|
52
|
-
"func_file": "./after.js",
|
|
53
|
-
/**
|
|
54
|
-
* 回调函数名 用于决定调用脚本的哪个函数
|
|
55
|
-
*/
|
|
56
|
-
"func_name": "main",
|
|
57
|
-
/**
|
|
58
|
-
* 排序
|
|
59
|
-
*/
|
|
60
|
-
"sort": 10,
|
|
61
|
-
/**
|
|
62
|
-
* 状态, 0表示未启用, 1表示启用
|
|
63
|
-
*/
|
|
64
|
-
"state": 1,
|
|
65
|
-
/**
|
|
66
|
-
* 显示, 0表示不显示, 1表示显示
|
|
67
|
-
*/
|
|
68
|
-
"show": 0
|
|
69
|
-
}
|
|
70
|
-
]
|
package/demo2/test2/main.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
class Demo {
|
|
2
|
-
constructor() {}
|
|
3
|
-
}
|
|
4
|
-
var i = 0;
|
|
5
|
-
Demo.prototype.main = function () {
|
|
6
|
-
console.log('test2 main', i++);
|
|
7
|
-
return i;
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
Demo.prototype.init = function () {
|
|
11
|
-
console.log('test2 init');
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
module.exports = new Demo();
|
|
15
|
-
|
|
16
|
-
console.log('引用了test2 main');
|
package/eslint.config.js
DELETED
|
@@ -1,209 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const namingConventionPlugin = require('mm_eslint');
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* 基于个人规则的ESLint配置
|
|
7
|
-
* 符合最新ESLint Flat Config格式
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
module.exports = [
|
|
11
|
-
{
|
|
12
|
-
files: ['**/*.js'],
|
|
13
|
-
plugins: {
|
|
14
|
-
'naming-convention': namingConventionPlugin,
|
|
15
|
-
'jsdoc': require('eslint-plugin-jsdoc')
|
|
16
|
-
},
|
|
17
|
-
languageOptions: {
|
|
18
|
-
ecmaVersion: 'latest',
|
|
19
|
-
sourceType: 'module',
|
|
20
|
-
parserOptions: {
|
|
21
|
-
ecmaVersion: 'latest',
|
|
22
|
-
sourceType: 'module'
|
|
23
|
-
}
|
|
24
|
-
},
|
|
25
|
-
|
|
26
|
-
// 命名规范规则 - 由自定义插件处理
|
|
27
|
-
rules: {
|
|
28
|
-
// 自定义命名规范插件规则(优先使用)
|
|
29
|
-
'naming-convention/class-name': 'error',
|
|
30
|
-
'naming-convention/function-name': 'error',
|
|
31
|
-
'naming-convention/method-name': 'error',
|
|
32
|
-
'naming-convention/variable-name': 'warn',
|
|
33
|
-
'naming-convention/constant-name': 'error',
|
|
34
|
-
'naming-convention/private-method-naming': 'warn',
|
|
35
|
-
'naming-convention/private-variable-naming': 'warn',
|
|
36
|
-
'naming-convention/param-name': 'warn',
|
|
37
|
-
'naming-convention/property-name': 'warn',
|
|
38
|
-
|
|
39
|
-
// 禁用与命名规范插件冲突的默认规则
|
|
40
|
-
'camelcase': 'off',
|
|
41
|
-
'id-match': 'off',
|
|
42
|
-
'new-cap': 'off',
|
|
43
|
-
'id-length': 'off',
|
|
44
|
-
'id-denylist': 'off',
|
|
45
|
-
'id-blacklist': 'off'
|
|
46
|
-
}
|
|
47
|
-
},
|
|
48
|
-
|
|
49
|
-
{
|
|
50
|
-
// 代码风格规则
|
|
51
|
-
rules: {
|
|
52
|
-
// 最大行长度100字符
|
|
53
|
-
'max-len': ['error', {
|
|
54
|
-
code: 100,
|
|
55
|
-
ignoreComments: true,
|
|
56
|
-
ignoreUrls: true,
|
|
57
|
-
ignoreStrings: true,
|
|
58
|
-
ignoreTemplateLiterals: true
|
|
59
|
-
}],
|
|
60
|
-
|
|
61
|
-
// 缩进2空格
|
|
62
|
-
'indent': ['error', 2, {
|
|
63
|
-
SwitchCase: 1,
|
|
64
|
-
VariableDeclarator: 1,
|
|
65
|
-
outerIIFEBody: 1,
|
|
66
|
-
MemberExpression: 1,
|
|
67
|
-
FunctionDeclaration: { parameters: 1, body: 1 },
|
|
68
|
-
FunctionExpression: { parameters: 1, body: 1 },
|
|
69
|
-
CallExpression: { arguments: 1 },
|
|
70
|
-
ArrayExpression: 1,
|
|
71
|
-
ObjectExpression: 1,
|
|
72
|
-
ImportDeclaration: 1,
|
|
73
|
-
flatTernaryExpressions: false,
|
|
74
|
-
ignoreComments: false
|
|
75
|
-
}],
|
|
76
|
-
|
|
77
|
-
// 单引号
|
|
78
|
-
'quotes': ['error', 'single', {
|
|
79
|
-
avoidEscape: true,
|
|
80
|
-
allowTemplateLiterals: true
|
|
81
|
-
}],
|
|
82
|
-
|
|
83
|
-
// 禁止制表符
|
|
84
|
-
'no-tabs': 'error',
|
|
85
|
-
|
|
86
|
-
// 行尾分号
|
|
87
|
-
'semi': ['error', 'always'],
|
|
88
|
-
|
|
89
|
-
// 逗号风格
|
|
90
|
-
'comma-style': ['error', 'last'],
|
|
91
|
-
|
|
92
|
-
// 逗号间距
|
|
93
|
-
'comma-spacing': ['error', {
|
|
94
|
-
before: false,
|
|
95
|
-
after: true
|
|
96
|
-
}]
|
|
97
|
-
}
|
|
98
|
-
},
|
|
99
|
-
|
|
100
|
-
{
|
|
101
|
-
// 错误处理规则
|
|
102
|
-
rules: {
|
|
103
|
-
// 必须进行参数校验
|
|
104
|
-
'no-unused-vars': ['error', {
|
|
105
|
-
args: 'none',
|
|
106
|
-
caughtErrors: 'all',
|
|
107
|
-
caughtErrorsIgnorePattern: '^_',
|
|
108
|
-
destructuredArrayIgnorePattern: '^_',
|
|
109
|
-
varsIgnorePattern: '^_',
|
|
110
|
-
ignoreRestSiblings: true
|
|
111
|
-
}],
|
|
112
|
-
|
|
113
|
-
// 建议使用try-catch
|
|
114
|
-
'no-unsafe-finally': 'warn',
|
|
115
|
-
|
|
116
|
-
// 禁止直接抛出字符串
|
|
117
|
-
'no-throw-literal': 'error'
|
|
118
|
-
}
|
|
119
|
-
},
|
|
120
|
-
|
|
121
|
-
{
|
|
122
|
-
// 最佳实践规则
|
|
123
|
-
rules: {
|
|
124
|
-
// 优先使用async/await
|
|
125
|
-
'prefer-promise-reject-errors': 'error',
|
|
126
|
-
|
|
127
|
-
// 避免副作用
|
|
128
|
-
'no-param-reassign': ['error', {
|
|
129
|
-
props: true,
|
|
130
|
-
ignorePropertyModificationsFor: [
|
|
131
|
-
'acc', // for reduce accumulators
|
|
132
|
-
'accumulator', // for reduce accumulators
|
|
133
|
-
'e', // for e.returnvalue
|
|
134
|
-
'ctx', // for Koa routing
|
|
135
|
-
'context', // for Koa routing
|
|
136
|
-
'req', // for Express requests
|
|
137
|
-
'request', // for Express requests
|
|
138
|
-
'res', // for Express responses
|
|
139
|
-
'response', // for Express responses
|
|
140
|
-
'$scope', // for Angular 1 scopes
|
|
141
|
-
'static_context' // for ReactRouter context
|
|
142
|
-
]
|
|
143
|
-
}],
|
|
144
|
-
|
|
145
|
-
// 优先链式编程
|
|
146
|
-
'prefer-object-spread': 'error',
|
|
147
|
-
|
|
148
|
-
// 优先函数式编程
|
|
149
|
-
'prefer-arrow-callback': 'error',
|
|
150
|
-
|
|
151
|
-
// 方法长度限制
|
|
152
|
-
'max-lines-per-function': ['warn', {
|
|
153
|
-
max: 40,
|
|
154
|
-
skipBlankLines: true,
|
|
155
|
-
skipComments: true
|
|
156
|
-
}],
|
|
157
|
-
|
|
158
|
-
// 复杂度限制
|
|
159
|
-
'complexity': ['warn', 10]
|
|
160
|
-
}
|
|
161
|
-
},
|
|
162
|
-
|
|
163
|
-
{
|
|
164
|
-
// JSDoc规则
|
|
165
|
-
rules: {
|
|
166
|
-
// 要求公开方法有JSDoc注释
|
|
167
|
-
'jsdoc/require-jsdoc': ['warn', {
|
|
168
|
-
publicOnly: true,
|
|
169
|
-
require: {
|
|
170
|
-
FunctionDeclaration: true,
|
|
171
|
-
MethodDefinition: true,
|
|
172
|
-
ClassDeclaration: true,
|
|
173
|
-
ArrowFunctionExpression: false,
|
|
174
|
-
FunctionExpression: false
|
|
175
|
-
}
|
|
176
|
-
}],
|
|
177
|
-
|
|
178
|
-
// 检查JSDoc语法
|
|
179
|
-
'jsdoc/check-alignment': 'warn',
|
|
180
|
-
'jsdoc/check-indentation': 'warn',
|
|
181
|
-
'jsdoc/check-param-names': 'warn',
|
|
182
|
-
'jsdoc/check-syntax': 'warn',
|
|
183
|
-
'jsdoc/check-tag-names': 'warn',
|
|
184
|
-
'jsdoc/check-types': 'warn',
|
|
185
|
-
'jsdoc/no-undefined-types': 'warn',
|
|
186
|
-
'jsdoc/require-description': 'warn',
|
|
187
|
-
'jsdoc/require-param': 'warn',
|
|
188
|
-
'jsdoc/require-param-description': 'warn',
|
|
189
|
-
'jsdoc/require-param-name': 'warn',
|
|
190
|
-
'jsdoc/require-param-type': 'warn',
|
|
191
|
-
'jsdoc/require-returns': 'warn',
|
|
192
|
-
'jsdoc/require-returns-check': 'warn',
|
|
193
|
-
'jsdoc/require-returns-description': 'warn',
|
|
194
|
-
'jsdoc/require-returns-type': 'warn',
|
|
195
|
-
'jsdoc/valid-types': 'warn'
|
|
196
|
-
}
|
|
197
|
-
},
|
|
198
|
-
|
|
199
|
-
{
|
|
200
|
-
// 忽略规则
|
|
201
|
-
ignores: [
|
|
202
|
-
'node_modules/**',
|
|
203
|
-
'dist/**',
|
|
204
|
-
'build/**',
|
|
205
|
-
'coverage/**',
|
|
206
|
-
'*.min.js'
|
|
207
|
-
]
|
|
208
|
-
}
|
|
209
|
-
];
|