Skip to content

2.1.0 #53

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 28 commits into from
Nov 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
150 changes: 76 additions & 74 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,80 +1,82 @@
module.exports = {
'env': {
'browser': true,
'es2020': true,
'node': true
},
'extends': [
'eslint:recommended',
'plugin:@typescript-eslint/recommended'
],
'parser': '@typescript-eslint/parser',
'parserOptions': {
'ecmaVersion': 6,
'sourceType': 'module'
// 'project': './tsconfig.json',
},
'plugins': [
'@typescript-eslint'
],
env: {
browser: true,
es2020: true,
node: true,
},
extends: ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
parser: "@typescript-eslint/parser",
parserOptions: {
ecmaVersion: 6,
sourceType: "module",
// 'project': './tsconfig.json',
},
plugins: ["@typescript-eslint"],

/**
* 规则写法
* 1、'quotes': 0; -- 0关闭,1警告,2错误
* 2、'quotes': 'off'; -- off关闭,warn警告,error错误
* 3、'quotes': ['error', 'single']; 'error'是提示类型,'single'是参数。参数不止一个的时候写成{}
*/
rules: {
// 是否检查变量已申明但未使用:警告。
"@typescript-eslint/no-unused-vars": ["warn"],
// 强制单引号:开启,自动修正
quotes: 0,
// 强制分号:js 关闭,ts 强制分号。
semi: ["off"],
// 'semi': ['off'],
// 定义变量时自动类型推断:关闭
"@typescript-eslint/no-inferrable-types": ["off"],
// 强制const:关闭
"prefer-const": ["off"],
// 不允许空函数:关闭
"@typescript-eslint/no-empty-function": ["off"],
// 禁止特定类型:关闭。 PS:如果打开 Function 类型会报错
"@typescript-eslint/ban-types": ["off"],
// 禁止多余的分号:关闭。 PS:打开后,某些大括号结束加分号会报错
"@typescript-eslint/no-extra-semi": ["off"],
// 检查函数是否有返回值:警告。 PS:有些老代码没有返回值,历史包袱重,暂时不强制报错
"@typescript-eslint/explicit-module-boundary-types": ["warn"],
// 禁止给变量赋值为 this:关闭。
"@typescript-eslint/no-this-alias": ["off"],
// 禁止使用 requires:关闭。
"@typescript-eslint/no-var-requires": ["off"],
// 检测无法访问的代码:关闭。 PS:有时候需要用 return 注释掉后面的代码
"no-unreachable": ["off"],
/**
* 规则写法
* 1、'quotes': 0; -- 0关闭,1警告,2错误
* 2、'quotes': 'off'; -- off关闭,warn警告,error错误
* 3、'quotes': ['error', 'single']; 'error'是提示类型,'single'是参数。参数不止一个的时候写成{}
* 是否可以直接调用对象方法:关闭。
* PS:暂时关闭。目前写法:myObject.hasOwnProperty('name') ,推荐写法:Object.prototype.hasOwnProperty.call(foo, "bar")
*/
'rules': {
// 是否检查变量已申明但未使用:警告。
'@typescript-eslint/no-unused-vars': ['warn'],
// 强制单引号:开启,自动修正
'quotes': 0,
// 强制分号:js 关闭,ts 强制分号。
'semi': ['off'],
// 'semi': ['off'],
// 定义变量时自动类型推断:关闭
'@typescript-eslint/no-inferrable-types': ['off'],
// 强制const:关闭
'prefer-const': ['off'],
// 不允许空函数:关闭
'@typescript-eslint/no-empty-function': ['off'],
// 禁止特定类型:关闭。 PS:如果打开 Function 类型会报错
'@typescript-eslint/ban-types': ['off'],
// 禁止多余的分号:关闭。 PS:打开后,某些大括号结束加分号会报错
'@typescript-eslint/no-extra-semi': ['off'],
// 检查函数是否有返回值:警告。 PS:有些老代码没有返回值,历史包袱重,暂时不强制报错
'@typescript-eslint/explicit-module-boundary-types': ['warn'],
// 禁止给变量赋值为 this:关闭。
'@typescript-eslint/no-this-alias': ['off'],
// 禁止使用 requires:关闭。
'@typescript-eslint/no-var-requires': ['off'],
// 检测无法访问的代码:关闭。 PS:有时候需要用 return 注释掉后面的代码
'no-unreachable': ['off'],
/**
* 是否可以直接调用对象方法:关闭。
* PS:暂时关闭。目前写法:myObject.hasOwnProperty('name') ,推荐写法:Object.prototype.hasOwnProperty.call(foo, "bar")
*/
'no-prototype-builtins': ['off'],
// 是否允许函数内定义函数:关闭。
'no-inner-declarations': ['off'],
// 不允许判断条件写死:关闭。 PS:打开后,if(false){} 这种判断语句会报错
'no-constant-condition': ['off'],
// get 和 set 是否必须放在一起:关闭。
'@typescript-eslint/adjacent-overload-signatures': ['off'],
"no-async-promise-executor": ['off']
"no-prototype-builtins": ["off"],
// 是否允许函数内定义函数:关闭。
"no-inner-declarations": ["off"],
// 不允许判断条件写死:关闭。 PS:打开后,if(false){} 这种判断语句会报错
"no-constant-condition": ["off"],
// get 和 set 是否必须放在一起:关闭。
"@typescript-eslint/adjacent-overload-signatures": ["off"],
"no-async-promise-executor": ["off"],
"prefer-spread": ["off"],
"prefer-rest-params": ["off"],
"@typescript-eslint/no-explicit-any": ["off"],
// "function-paren-newline": ["off", { minItems: 5 }],
"max-len": ["warn", { code: 120 }],
},
// 如果有 js 和 ts 需要分开指定的规则,就 js 写 rules 里,ts 写 overrides 里
overrides: [
{
// enable the rule specifically for TypeScript files
files: ["*.ts", "*.tsx"],
rules: {
// 强制分号:开启,自动修正
semi: ["error", "always"],
// '@typescript-eslint/explicit-module-boundary-types': ['error']
},
},
// 如果有 js 和 ts 需要分开指定的规则,就 js 写 rules 里,ts 写 overrides 里
'overrides': [{
// enable the rule specifically for TypeScript files
'files': ['*.ts', '*.tsx'],
'rules': {
// 强制分号:开启,自动修正
'semi': ['error', 'always'],
// '@typescript-eslint/explicit-module-boundary-types': ['error']
}
}],
// 定义全局变量
'globals': {
'Global': true
}
],
// 定义全局变量
globals: {
Global: true,
},
};
63 changes: 30 additions & 33 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ name: "CodeQL"

on:
push:
branches: [ "main" ]
schedule:
- cron: '45 21 * * 2'
branches: ["release"]

jobs:
analyze:
Expand All @@ -29,43 +27,42 @@ jobs:
strategy:
fail-fast: false
matrix:
language: [ 'javascript' ]
language: ["javascript"]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support

steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Checkout repository
uses: actions/checkout@v3

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.

# 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
# queries: security-extended,security-and-quality
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.


# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2
# 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
# queries: security-extended,security-and-quality

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

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

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

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
category: "/language:${{matrix.language}}"
# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
category: "/language:${{matrix.language}}"
Loading