Skip to content

Commit 1afa5bb

Browse files
authored
Merge pull request #53 from ccagml/main
2.1.0
2 parents 0e8aab5 + ccb8747 commit 1afa5bb

Some content is hidden

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

83 files changed

+12218
-12513
lines changed

.eslintrc.js

Lines changed: 76 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -1,80 +1,82 @@
11
module.exports = {
2-
'env': {
3-
'browser': true,
4-
'es2020': true,
5-
'node': true
6-
},
7-
'extends': [
8-
'eslint:recommended',
9-
'plugin:@typescript-eslint/recommended'
10-
],
11-
'parser': '@typescript-eslint/parser',
12-
'parserOptions': {
13-
'ecmaVersion': 6,
14-
'sourceType': 'module'
15-
// 'project': './tsconfig.json',
16-
},
17-
'plugins': [
18-
'@typescript-eslint'
19-
],
2+
env: {
3+
browser: true,
4+
es2020: true,
5+
node: true,
6+
},
7+
extends: ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
8+
parser: "@typescript-eslint/parser",
9+
parserOptions: {
10+
ecmaVersion: 6,
11+
sourceType: "module",
12+
// 'project': './tsconfig.json',
13+
},
14+
plugins: ["@typescript-eslint"],
2015

16+
/**
17+
* 规则写法
18+
* 1、'quotes': 0; -- 0关闭,1警告,2错误
19+
* 2、'quotes': 'off'; -- off关闭,warn警告,error错误
20+
* 3、'quotes': ['error', 'single']; 'error'是提示类型,'single'是参数。参数不止一个的时候写成{}
21+
*/
22+
rules: {
23+
// 是否检查变量已申明但未使用:警告。
24+
"@typescript-eslint/no-unused-vars": ["warn"],
25+
// 强制单引号:开启,自动修正
26+
quotes: 0,
27+
// 强制分号:js 关闭,ts 强制分号。
28+
semi: ["off"],
29+
// 'semi': ['off'],
30+
// 定义变量时自动类型推断:关闭
31+
"@typescript-eslint/no-inferrable-types": ["off"],
32+
// 强制const:关闭
33+
"prefer-const": ["off"],
34+
// 不允许空函数:关闭
35+
"@typescript-eslint/no-empty-function": ["off"],
36+
// 禁止特定类型:关闭。 PS:如果打开 Function 类型会报错
37+
"@typescript-eslint/ban-types": ["off"],
38+
// 禁止多余的分号:关闭。 PS:打开后,某些大括号结束加分号会报错
39+
"@typescript-eslint/no-extra-semi": ["off"],
40+
// 检查函数是否有返回值:警告。 PS:有些老代码没有返回值,历史包袱重,暂时不强制报错
41+
"@typescript-eslint/explicit-module-boundary-types": ["warn"],
42+
// 禁止给变量赋值为 this:关闭。
43+
"@typescript-eslint/no-this-alias": ["off"],
44+
// 禁止使用 requires:关闭。
45+
"@typescript-eslint/no-var-requires": ["off"],
46+
// 检测无法访问的代码:关闭。 PS:有时候需要用 return 注释掉后面的代码
47+
"no-unreachable": ["off"],
2148
/**
22-
* 规则写法
23-
* 1、'quotes': 0; -- 0关闭,1警告,2错误
24-
* 2、'quotes': 'off'; -- off关闭,warn警告,error错误
25-
* 3、'quotes': ['error', 'single']; 'error'是提示类型,'single'是参数。参数不止一个的时候写成{}
49+
* 是否可以直接调用对象方法:关闭。
50+
* PS:暂时关闭。目前写法:myObject.hasOwnProperty('name') ,推荐写法:Object.prototype.hasOwnProperty.call(foo, "bar")
2651
*/
27-
'rules': {
28-
// 是否检查变量已申明但未使用:警告。
29-
'@typescript-eslint/no-unused-vars': ['warn'],
30-
// 强制单引号:开启,自动修正
31-
'quotes': 0,
32-
// 强制分号:js 关闭,ts 强制分号。
33-
'semi': ['off'],
34-
// 'semi': ['off'],
35-
// 定义变量时自动类型推断:关闭
36-
'@typescript-eslint/no-inferrable-types': ['off'],
37-
// 强制const:关闭
38-
'prefer-const': ['off'],
39-
// 不允许空函数:关闭
40-
'@typescript-eslint/no-empty-function': ['off'],
41-
// 禁止特定类型:关闭。 PS:如果打开 Function 类型会报错
42-
'@typescript-eslint/ban-types': ['off'],
43-
// 禁止多余的分号:关闭。 PS:打开后,某些大括号结束加分号会报错
44-
'@typescript-eslint/no-extra-semi': ['off'],
45-
// 检查函数是否有返回值:警告。 PS:有些老代码没有返回值,历史包袱重,暂时不强制报错
46-
'@typescript-eslint/explicit-module-boundary-types': ['warn'],
47-
// 禁止给变量赋值为 this:关闭。
48-
'@typescript-eslint/no-this-alias': ['off'],
49-
// 禁止使用 requires:关闭。
50-
'@typescript-eslint/no-var-requires': ['off'],
51-
// 检测无法访问的代码:关闭。 PS:有时候需要用 return 注释掉后面的代码
52-
'no-unreachable': ['off'],
53-
/**
54-
* 是否可以直接调用对象方法:关闭。
55-
* PS:暂时关闭。目前写法:myObject.hasOwnProperty('name') ,推荐写法:Object.prototype.hasOwnProperty.call(foo, "bar")
56-
*/
57-
'no-prototype-builtins': ['off'],
58-
// 是否允许函数内定义函数:关闭。
59-
'no-inner-declarations': ['off'],
60-
// 不允许判断条件写死:关闭。 PS:打开后,if(false){} 这种判断语句会报错
61-
'no-constant-condition': ['off'],
62-
// get 和 set 是否必须放在一起:关闭。
63-
'@typescript-eslint/adjacent-overload-signatures': ['off'],
64-
"no-async-promise-executor": ['off']
52+
"no-prototype-builtins": ["off"],
53+
// 是否允许函数内定义函数:关闭。
54+
"no-inner-declarations": ["off"],
55+
// 不允许判断条件写死:关闭。 PS:打开后,if(false){} 这种判断语句会报错
56+
"no-constant-condition": ["off"],
57+
// get 和 set 是否必须放在一起:关闭。
58+
"@typescript-eslint/adjacent-overload-signatures": ["off"],
59+
"no-async-promise-executor": ["off"],
60+
"prefer-spread": ["off"],
61+
"prefer-rest-params": ["off"],
62+
"@typescript-eslint/no-explicit-any": ["off"],
63+
// "function-paren-newline": ["off", { minItems: 5 }],
64+
"max-len": ["warn", { code: 120 }],
65+
},
66+
// 如果有 js 和 ts 需要分开指定的规则,就 js 写 rules 里,ts 写 overrides 里
67+
overrides: [
68+
{
69+
// enable the rule specifically for TypeScript files
70+
files: ["*.ts", "*.tsx"],
71+
rules: {
72+
// 强制分号:开启,自动修正
73+
semi: ["error", "always"],
74+
// '@typescript-eslint/explicit-module-boundary-types': ['error']
75+
},
6576
},
66-
// 如果有 js 和 ts 需要分开指定的规则,就 js 写 rules 里,ts 写 overrides 里
67-
'overrides': [{
68-
// enable the rule specifically for TypeScript files
69-
'files': ['*.ts', '*.tsx'],
70-
'rules': {
71-
// 强制分号:开启,自动修正
72-
'semi': ['error', 'always'],
73-
// '@typescript-eslint/explicit-module-boundary-types': ['error']
74-
}
75-
}],
76-
// 定义全局变量
77-
'globals': {
78-
'Global': true
79-
}
77+
],
78+
// 定义全局变量
79+
globals: {
80+
Global: true,
81+
},
8082
};

.github/workflows/codeql-analysis.yml

Lines changed: 30 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,7 @@ name: "CodeQL"
1313

1414
on:
1515
push:
16-
branches: [ "main" ]
17-
schedule:
18-
- cron: '45 21 * * 2'
16+
branches: ["release"]
1917

2018
jobs:
2119
analyze:
@@ -29,43 +27,42 @@ jobs:
2927
strategy:
3028
fail-fast: false
3129
matrix:
32-
language: [ 'javascript' ]
30+
language: ["javascript"]
3331
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
3432
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
3533

3634
steps:
37-
- name: Checkout repository
38-
uses: actions/checkout@v3
35+
- name: Checkout repository
36+
uses: actions/checkout@v3
3937

40-
# Initializes the CodeQL tools for scanning.
41-
- name: Initialize CodeQL
42-
uses: github/codeql-action/init@v2
43-
with:
44-
languages: ${{ matrix.language }}
45-
# If you wish to specify custom queries, you can do so here or in a config file.
46-
# By default, queries listed here will override any specified in a config file.
47-
# Prefix the list here with "+" to use these queries and those in the config file.
48-
49-
# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
50-
# queries: security-extended,security-and-quality
38+
# Initializes the CodeQL tools for scanning.
39+
- name: Initialize CodeQL
40+
uses: github/codeql-action/init@v2
41+
with:
42+
languages: ${{ matrix.language }}
43+
# If you wish to specify custom queries, you can do so here or in a config file.
44+
# By default, queries listed here will override any specified in a config file.
45+
# Prefix the list here with "+" to use these queries and those in the config file.
5146

52-
53-
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
54-
# If this step fails, then you should remove it and run the build manually (see below)
55-
- name: Autobuild
56-
uses: github/codeql-action/autobuild@v2
47+
# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
48+
# queries: security-extended,security-and-quality
5749

58-
# ℹ️ Command-line programs to run using the OS shell.
59-
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
50+
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
51+
# If this step fails, then you should remove it and run the build manually (see below)
52+
- name: Autobuild
53+
uses: github/codeql-action/autobuild@v2
6054

61-
# If the Autobuild fails above, remove it and uncomment the following three lines.
62-
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
55+
# ℹ️ Command-line programs to run using the OS shell.
56+
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
6357

64-
# - run: |
65-
# echo "Run, Build Application using script"
66-
# ./location_of_script_within_repo/buildscript.sh
58+
# If the Autobuild fails above, remove it and uncomment the following three lines.
59+
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
6760

68-
- name: Perform CodeQL Analysis
69-
uses: github/codeql-action/analyze@v2
70-
with:
71-
category: "/language:${{matrix.language}}"
61+
# - run: |
62+
# echo "Run, Build Application using script"
63+
# ./location_of_script_within_repo/buildscript.sh
64+
65+
- name: Perform CodeQL Analysis
66+
uses: github/codeql-action/analyze@v2
67+
with:
68+
category: "/language:${{matrix.language}}"

0 commit comments

Comments
 (0)