Skip to content

Commit f8c9985

Browse files
authored
Merge pull request #2 from MysteryCode/feature/patch-1
Several updates & optimizations
2 parents 2ba755d + 58cf165 commit f8c9985

Some content is hidden

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

46 files changed

+4098
-3420
lines changed

.eslintrc.js

Lines changed: 41 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,43 @@
11
module.exports = {
2-
root: true,
3-
parser: "@typescript-eslint/parser",
4-
parserOptions: {
5-
tsconfigRootDir: __dirname,
6-
project: ["./tsconfig.json"]
7-
},
8-
plugins: ["@typescript-eslint"],
9-
extends: [
10-
"eslint:recommended",
11-
"plugin:@typescript-eslint/recommended",
12-
"plugin:@typescript-eslint/recommended-requiring-type-checking",
13-
"prettier",
14-
"prettier/@typescript-eslint"
15-
],
16-
rules: {
17-
"@typescript-eslint/ban-types": [
18-
"error", {
19-
types: {
20-
"object": false
21-
},
22-
extendDefaults: true
23-
}
24-
],
25-
"@typescript-eslint/no-explicit-any": 0,
26-
"@typescript-eslint/no-non-null-assertion": 0,
27-
"@typescript-eslint/no-unsafe-assignment": 0,
28-
"@typescript-eslint/no-unsafe-call": 0,
29-
"@typescript-eslint/no-unsafe-member-access": 0,
30-
"@typescript-eslint/no-unsafe-return": 0,
31-
"@typescript-eslint/no-unused-vars": [
32-
"error", {
33-
"argsIgnorePattern": "^_"
34-
}
35-
],
36-
"@typescript-eslint/no-misused-promises": [
37-
"error", {
38-
"checksVoidReturn": false
39-
}
40-
]
41-
}
2+
root: true,
3+
parser: "@typescript-eslint/parser",
4+
parserOptions: {
5+
tsconfigRootDir: __dirname,
6+
project: ["./tsconfig.json"]
7+
},
8+
plugins: ["@typescript-eslint"],
9+
extends: [
10+
"eslint:recommended",
11+
"plugin:@typescript-eslint/recommended",
12+
"plugin:@typescript-eslint/recommended-requiring-type-checking",
13+
"prettier"
14+
],
15+
rules: {
16+
"@typescript-eslint/ban-types": [
17+
"error", {
18+
types: {
19+
"object": false
20+
},
21+
extendDefaults: true
22+
}
23+
],
24+
"@typescript-eslint/no-explicit-any": 0,
25+
"@typescript-eslint/no-non-null-assertion": 0,
26+
"@typescript-eslint/no-unsafe-argument": 0,
27+
"@typescript-eslint/no-unsafe-assignment": 0,
28+
"@typescript-eslint/no-unsafe-call": 0,
29+
"@typescript-eslint/no-unsafe-member-access": 0,
30+
"@typescript-eslint/no-unsafe-return": 0,
31+
"@typescript-eslint/no-unused-vars": [
32+
"error", {
33+
"argsIgnorePattern": "^_",
34+
"varsIgnorePattern": "^_"
35+
}
36+
],
37+
"@typescript-eslint/no-misused-promises": [
38+
"error", {
39+
"checksVoidReturn": false
40+
}
41+
]
42+
}
4243
};

.github/diff.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"problemMatcher": [
3+
{
4+
"owner": "diff",
5+
"pattern": [
6+
{
7+
"regexp": "--- a/(.*)",
8+
"file": 1,
9+
"message": 1
10+
}
11+
]
12+
}
13+
]
14+
}

.github/workflows/codestyle.yml

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,43 @@ name: Code Style
22

33
on:
44
push:
5+
branches:
6+
- main
57
pull_request:
68

79
jobs:
810
php:
9-
name: PHP CodeSniffer
11+
name: PHP
1012
runs-on: ubuntu-latest
1113
steps:
12-
- uses: actions/checkout@v2
13-
- run: git clone --branch=master --depth=1 --quiet git://github.com/WoltLab/WCF.git WCF
14-
- uses: chekalsky/phpcs-action@e269c2f264f400adcda7c6b24c8550302350d495
14+
- uses: actions/checkout@v3
15+
- name: Setup PHP with tools
16+
uses: shivammathur/setup-php@v2
17+
with:
18+
php-version: '7.4'
19+
extensions: ctype, dom, exif, gd, gmp, hash, intl, json, libxml, mbstring, opcache, pcre, pdo, pdo_mysql, zlib
20+
tools: cs2pr, phpcs, php-cs-fixer
21+
- name: phpcs
22+
run: phpcs -n -q --report=checkstyle | cs2pr
23+
- name: php-cs-fixer
24+
run: php-cs-fixer fix --dry-run --diff
25+
ts:
26+
name: TS Prettier
27+
runs-on: ubuntu-latest
28+
steps:
29+
- uses: actions/checkout@v3
30+
- name: Set up node.js
31+
uses: actions/setup-node@v3
32+
with:
33+
node-version: "16"
34+
cache: "npm"
35+
- run: npm install
36+
- name: Run prettier
37+
run: |
38+
shopt -s globstar
39+
npx prettier -w ts/**/*.ts
40+
- run: echo "::add-matcher::.github/diff.json"
41+
- name: Show diff
42+
run: |
43+
git checkout -- package-lock.json
44+
git diff --exit-code

.github/workflows/javascript.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ name: JavaScript
22

33
on:
44
push:
5+
branches:
6+
- main
57
pull_request:
68

79
jobs:
@@ -11,11 +13,11 @@ jobs:
1113
strategy:
1214
fail-fast: false
1315
steps:
16+
- uses: actions/checkout@v3
1417
- name: Set up node.js
15-
uses: actions/setup-node@v1
18+
uses: actions/setup-node@v3
1619
with:
17-
node-version: "12"
18-
- uses: actions/checkout@v2
20+
node-version: "16"
1921
- run: echo "::add-matcher::.github/javascript-syntax.json"
2022
- name: Remove files to be ignored
2123
run: |

.github/workflows/php.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ name: PHP
22

33
on:
44
push:
5+
branches:
6+
- main
57
pull_request:
68

79
jobs:
@@ -12,16 +14,16 @@ jobs:
1214
fail-fast: false
1315
matrix:
1416
php:
15-
- '7.2'
16-
- '7.3'
1717
- '7.4'
1818
- '8.0'
19+
- '8.1'
20+
- '8.2'
1921
steps:
2022
- name: Set up PHP
2123
uses: shivammathur/setup-php@v2
2224
with:
2325
php-version: ${{ matrix.php }}
24-
- uses: actions/checkout@v2
26+
- uses: actions/checkout@v3
2527
- run: echo "::add-matcher::.github/php-syntax.json"
2628
- name: Remove files to be ignored
2729
run: |

.github/workflows/pull_request.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Pull Requests
2+
3+
on:
4+
pull_request:
5+
types:
6+
- opened
7+
- edited
8+
- reopened
9+
- synchronize
10+
- ready_for_review
11+
- review_requested
12+
13+
jobs:
14+
commit_message:
15+
name: Check Commit Message
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Check for GitHub's default message.
19+
uses: gsactions/commit-message-checker@c61c81192182bbc0d5e41b4796e3b71684228c77
20+
with:
21+
pattern: '^(?!Update\s+\S*$).*$'
22+
error: 'Please use a meaningful commit message.'
23+
excludeDescription: 'true'
24+
excludeTitle: 'true'
25+
checkAllCommitMessages: 'true'
26+
accessToken: ${{ secrets.GITHUB_TOKEN }}
27+
- name: Check for unsquashed `fixup!` commits.
28+
if: ${{ ! github.event.pull_request.draft }}
29+
uses: gsactions/commit-message-checker@c61c81192182bbc0d5e41b4796e3b71684228c77
30+
with:
31+
pattern: '^(?!fixup!(\s|$))'
32+
error: 'A `fixup!` commit was found.'
33+
excludeDescription: 'true'
34+
excludeTitle: 'true'
35+
checkAllCommitMessages: 'true'
36+
accessToken: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/release.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags: ['*']
6+
workflow_dispatch:
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: write
13+
14+
steps:
15+
- uses: actions/checkout@v3
16+
17+
- uses: actions/setup-node@v3
18+
with:
19+
node-version: 16
20+
21+
- name: Create package
22+
run: |
23+
rm -rf *.tar.gz
24+
npx --yes wspackager
25+
26+
- name: Check file existence
27+
id: check_files
28+
uses: andstor/file-existence-action@v1
29+
with:
30+
files: "${{ github.event.repository.name }}_*.tar.gz"
31+
32+
- name: On Build Failure
33+
if: steps.check_files.outputs.files_exists == 'false'
34+
run: |
35+
echo "Packaging FAILED" && exit 1
36+
37+
- name: Release
38+
uses: softprops/action-gh-release@v1
39+
if: startsWith(github.ref, 'refs/tags/') && steps.check_files.outputs.files_exists == 'true'
40+
with:
41+
files: "${{ github.event.repository.name }}_*.tar.gz"

.github/workflows/typescript.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: TypeScript
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
9+
jobs:
10+
tsc:
11+
name: "TSC"
12+
runs-on: ubuntu-latest
13+
strategy:
14+
fail-fast: false
15+
steps:
16+
- uses: actions/checkout@v3
17+
- name: Set up node.js
18+
uses: actions/setup-node@v3
19+
with:
20+
node-version: "16"
21+
cache: "npm"
22+
- run: npm install
23+
- run: npx tsc --noEmit
24+
eslint:
25+
name: "eslint"
26+
runs-on: ubuntu-latest
27+
strategy:
28+
fail-fast: false
29+
steps:
30+
- uses: actions/checkout@v3
31+
- name: Set up node.js
32+
uses: actions/setup-node@v3
33+
with:
34+
node-version: "16"
35+
cache: "npm"
36+
- run: npm install
37+
- run: npx eslint .
38+
javascript_sync:
39+
name: "Check for outdated JavaScript"
40+
needs: tsc
41+
runs-on: ubuntu-latest
42+
strategy:
43+
fail-fast: false
44+
steps:
45+
- uses: actions/checkout@v3
46+
- name: Set up node.js
47+
uses: actions/setup-node@v3
48+
with:
49+
node-version: "16"
50+
cache: "npm"
51+
- run: npm install
52+
- run: rm -r files/js/MysteryCode/
53+
- run: npx tsc
54+
- run: echo "::add-matcher::.github/diff.json"
55+
- name: Show diff
56+
run: |
57+
git checkout -- package-lock.json
58+
git diff --exit-code

.gitlab-ci.yml

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)