Skip to content

Commit 8f14b62

Browse files
committed
调整类型标注以适应新版Lint
1 parent 8bb75aa commit 8f14b62

19 files changed

Lines changed: 299 additions & 274 deletions

.github/workflows/ci.yml

Lines changed: 55 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,55 @@
1-
on: [push, pull_request]
2-
3-
name: CI
4-
5-
jobs:
6-
lint:
7-
name: Lint
8-
runs-on: ubuntu-latest
9-
steps:
10-
- uses: actions/checkout@v2
11-
- uses: actions/setup-node@v1
12-
with:
13-
node-version: '14'
14-
# see https://github.com/actions/cache/blob/main/examples.md#node---npm
15-
- name: Get npm cache directory
16-
id: npm-cache-dir
17-
run: |
18-
echo "::set-output name=dir::$(npm config get cache)"
19-
- uses: actions/cache@v2
20-
id: npm-cache # use this to check for `cache-hit` ==> if: steps.npm-cache.outputs.cache-hit != 'true'
21-
with:
22-
path: ${{ steps.npm-cache-dir.outputs.dir }}
23-
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
24-
restore-keys: |
25-
${{ runner.os }}-node-
26-
27-
- run: npm update -g npm@latest
28-
- run: npm install
29-
- run: npm run ci-eslint
30-
31-
format:
32-
name: Format
33-
runs-on: ubuntu-latest
34-
steps:
35-
- uses: actions/checkout@v2
36-
- uses: actions/setup-node@v1
37-
with:
38-
node-version: '14'
39-
40-
# see https://github.com/actions/cache/blob/main/examples.md#node---npm
41-
- name: Get npm cache directory
42-
id: npm-cache-dir
43-
run: |
44-
echo "::set-output name=dir::$(npm config get cache)"
45-
- uses: actions/cache@v2
46-
id: npm-cache # use this to check for `cache-hit` ==> if: steps.npm-cache.outputs.cache-hit != 'true'
47-
with:
48-
path: ${{ steps.npm-cache-dir.outputs.dir }}
49-
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
50-
restore-keys: |
51-
${{ runner.os }}-node-
52-
53-
- run: npm update -g npm@latest
54-
- run: npm install
55-
- run: npm run ci-format
1+
on: [push, pull_request]
2+
3+
name: CI
4+
5+
jobs:
6+
lint:
7+
name: Lint
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v2
11+
- uses: actions/setup-node@v1
12+
with:
13+
node-version: "14"
14+
# see https://github.com/actions/cache/blob/main/examples.md#node---npm
15+
- name: Get npm cache directory
16+
id: npm-cache-dir
17+
run: |
18+
echo "::set-output name=dir::$(npm config get cache)"
19+
- uses: actions/cache@v2
20+
id: npm-cache # use this to check for `cache-hit` ==> if: steps.npm-cache.outputs.cache-hit != 'true'
21+
with:
22+
path: ${{ steps.npm-cache-dir.outputs.dir }}
23+
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
24+
restore-keys: |
25+
${{ runner.os }}-node-
26+
27+
- run: npm update -g npm@latest
28+
- run: npm install
29+
- run: npm run ci-eslint
30+
31+
format:
32+
name: Format
33+
runs-on: ubuntu-latest
34+
steps:
35+
- uses: actions/checkout@v2
36+
- uses: actions/setup-node@v1
37+
with:
38+
node-version: "14"
39+
40+
# see https://github.com/actions/cache/blob/main/examples.md#node---npm
41+
- name: Get npm cache directory
42+
id: npm-cache-dir
43+
run: |
44+
echo "::set-output name=dir::$(npm config get cache)"
45+
- uses: actions/cache@v2
46+
id: npm-cache # use this to check for `cache-hit` ==> if: steps.npm-cache.outputs.cache-hit != 'true'
47+
with:
48+
path: ${{ steps.npm-cache-dir.outputs.dir }}
49+
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
50+
restore-keys: |
51+
${{ runner.os }}-node-
52+
53+
- run: npm update -g npm@latest
54+
- run: npm install
55+
- run: npm run ci-format

.github/workflows/release.yaml

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,39 @@
11
name: Publish Docker image
22

33
on:
4-
release:
5-
types: [published]
6-
push:
7-
branches:
8-
- master
9-
- main
10-
- beta/*
11-
- alpha/*
4+
release:
5+
types: [published]
6+
push:
7+
branches:
8+
- master
9+
- main
10+
- beta/*
11+
- alpha/*
1212

1313
jobs:
14-
push_to_registry:
15-
name: Push Docker image to Docker Hub
16-
runs-on: ubuntu-latest
17-
steps:
18-
- name: Check out the repo
19-
uses: actions/checkout@v2
14+
push_to_registry:
15+
name: Push Docker image to Docker Hub
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Check out the repo
19+
uses: actions/checkout@v2
2020

21-
- name: Log in to Docker Hub
22-
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
23-
with:
24-
username: ${{ secrets.DOCKER_HUB_USERNAME }}
25-
password: ${{ secrets.DOCKER_HUB_PASSWORD }}
21+
- name: Log in to Docker Hub
22+
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
23+
with:
24+
username: ${{ secrets.DOCKER_HUB_USERNAME }}
25+
password: ${{ secrets.DOCKER_HUB_PASSWORD }}
2626

27-
- name: Extract metadata (tags, labels) for Docker
28-
id: meta
29-
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
30-
with:
31-
images: thinkspiritlab/heng-client
27+
- name: Extract metadata (tags, labels) for Docker
28+
id: meta
29+
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
30+
with:
31+
images: thinkspiritlab/heng-client
3232

33-
- name: Build and push Docker image
34-
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
35-
with:
36-
context: .
37-
push: true
38-
tags: ${{ steps.meta.outputs.tags }}
39-
labels: ${{ steps.meta.outputs.labels }}
33+
- name: Build and push Docker image
34+
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
35+
with:
36+
context: .
37+
push: true
38+
tags: ${{ steps.meta.outputs.tags }}
39+
labels: ${{ steps.meta.outputs.labels }}

.prettierignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
build
21
dist
2+
node_modules

.prettierrc.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
2-
"tabWidth": 4,
32
"endOfLine": "lf",
4-
"singleQuote": false
3+
"singleQuote": false,
4+
"tabWidth": 4,
5+
"trailingComma": "es5"
56
}

README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,6 @@ npm run start # pm2 start ./dist/index.js --name judger
100100

101101
对于 `Normal``Spj`,用户程序没有正常结束运行时,跳过执行结果判断程序。
102102

103-
104103
## 其他
105104

106105
### spj 返回值及输出结果汇总
@@ -246,7 +245,6 @@ uoj:https://github.com/UniversalOJ/UOJ-System/blob/230738b770022cc6b882c42b67b
246245
247246
pta: https://github.com/pintia/ljudge/tree/master/etc/ljudge
248247
249-
250248
### todo
251249
252250
- spj cache LRU

eslint.config.ts

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,32 @@
11
import js from "@eslint/js";
2-
import ts from "typescript-eslint";
3-
import importX from 'eslint-plugin-import-x';
2+
import ts, { configs } from "typescript-eslint";
3+
import importX from "eslint-plugin-import-x";
44
import prettier from "eslint-plugin-prettier/recommended";
55
export default ts.config({
66
extends: [
77
js.configs.recommended,
8-
...ts.configs.recommendedTypeChecked,
9-
...ts.configs.stylisticTypeChecked,
8+
...configs.recommendedTypeChecked,
9+
...configs.stylisticTypeChecked,
1010
importX.flatConfigs.recommended,
1111
importX.flatConfigs.typescript,
1212
prettier,
1313
],
14-
ignores: ["*.d.ts", "*.js"],
14+
files: ["eslint.config.ts", "src/**/*.ts"],
1515
languageOptions: {
1616
parserOptions: {
1717
projectService: true,
18-
tsconfigRootDir: import.meta.dirname,
18+
tsconfigRootDir: __dirname, // FIXME: CommonJS
1919
},
2020
},
2121
rules: {
2222
"no-unused-vars": "off",
23+
"@typescript-eslint/no-base-to-string": "off",
24+
"@typescript-eslint/no-misused-promises": [
25+
"warn",
26+
{
27+
checksVoidReturn: false,
28+
},
29+
],
2330
"@typescript-eslint/no-unused-vars": ["warn"],
2431
},
2532
});

package-lock.json

Lines changed: 39 additions & 38 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
"@types/unzip-stream": "^0.3.4",
2727
"@types/validator": "^13.12.2",
2828
"@types/ws": "^8.5.13",
29+
"@typescript-eslint/parser": "^8.19.0",
2930
"eslint": "^9.17.0",
3031
"eslint-config-prettier": "^9.1.0",
3132
"eslint-formatter-codeframe": "^7.32.1",
@@ -43,17 +44,17 @@
4344
"name": "heng-client",
4445
"repository": "https://github.com/ThinkSpiritLab/Heng-Client",
4546
"scripts": {
46-
"build": "tsc",
47-
"check:format": "prettier --check src/*.ts src/**/*.ts",
48-
"check:lint": "eslint src -f codeframe",
49-
"ci-eslint": "eslint src -f codeframe",
50-
"ci-format": "prettier --check src/*.ts src/**/*.ts",
47+
"build": "tsc -p tsconfig.build.json",
48+
"check:format": "prettier --check .",
49+
"check:lint": "eslint -f codeframe",
50+
"ci-eslint": "eslint -f codeframe",
51+
"ci-format": "prettier --check .",
5152
"dev": "ts-node-dev --respawn -- src/index.ts",
5253
"docker:build": "docker build -t thinkspiritlab/heng-client .",
5354
"docker:build:fresh": "docker build -t thinkspiritlab/heng-client --no-cache .",
5455
"docker:run": "docker run --cgroupns private --privileged -v $(pwd)/config.toml:/usr/src/app/config.toml heng-client",
5556
"docker:run:dev": "docker run --cgroupns private --privileged --network=\"host\" -v $(pwd)/config.toml:/usr/src/app/config.toml heng-client",
56-
"format": "prettier -c ./src/**/*.ts --write",
57+
"format": "prettier -c . --write",
5758
"lint": "eslint --fix",
5859
"start": "node dist/index.js"
5960
},

0 commit comments

Comments
 (0)