Skip to content

Commit ada2af9

Browse files
authored
Update Tooling (#560)
* Update tooling Signed-off-by: Frank Jogeleit <frank.jogeleit@lovoo.com>
1 parent 34bfcb0 commit ada2af9

28 files changed

+10534
-9369
lines changed

.eslintignore

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1-
dist/
21
lib/
3-
node_modules/
2+
dist/
3+
node_modules/
4+
coverage/

.eslintrc.json

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

.github/linters/.eslintrc.yaml

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
env:
2+
node: true
3+
es6: true
4+
jest: true
5+
6+
globals:
7+
Atomics: readonly
8+
SharedArrayBuffer: readonly
9+
10+
ignorePatterns:
11+
- '!.*'
12+
- '**/node_modules/.*'
13+
- '**/dist/.*'
14+
- '**/coverage/.*'
15+
- '*.json'
16+
17+
parser: '@typescript-eslint/parser'
18+
19+
parserOptions:
20+
ecmaVersion: 2023
21+
sourceType: module
22+
project:
23+
- './.github/linters/tsconfig.json'
24+
- './tsconfig.json'
25+
26+
plugins:
27+
- jest
28+
- '@typescript-eslint'
29+
30+
extends:
31+
- eslint:recommended
32+
- plugin:@typescript-eslint/eslint-recommended
33+
- plugin:@typescript-eslint/recommended
34+
- plugin:github/recommended
35+
- plugin:jest/recommended
36+
37+
rules:
38+
{
39+
'camelcase': 'off',
40+
'no-shadow': 'off',
41+
'eslint-comments/no-use': 'off',
42+
'eslint-comments/no-unused-disable': 'off',
43+
'i18n-text/no-en': 'off',
44+
'import/no-namespace': 'off',
45+
'no-console': 'off',
46+
'no-unused-vars': 'off',
47+
'prettier/prettier': 'error',
48+
'semi': 'off',
49+
'@typescript-eslint/array-type': 'error',
50+
'@typescript-eslint/await-thenable': 'error',
51+
'@typescript-eslint/ban-ts-comment': 'error',
52+
'@typescript-eslint/consistent-type-assertions': 'error',
53+
'@typescript-eslint/explicit-member-accessibility':
54+
['error', { 'accessibility': 'no-public' }],
55+
'@typescript-eslint/explicit-function-return-type':
56+
['error', { 'allowExpressions': true }],
57+
'@typescript-eslint/func-call-spacing': ['error', 'never'],
58+
'@typescript-eslint/no-array-constructor': 'error',
59+
'@typescript-eslint/no-empty-interface': 'error',
60+
'@typescript-eslint/no-explicit-any': 'error',
61+
'@typescript-eslint/no-extraneous-class': 'error',
62+
'@typescript-eslint/no-for-in-array': 'error',
63+
'@typescript-eslint/no-inferrable-types': 'error',
64+
'@typescript-eslint/no-misused-new': 'error',
65+
'@typescript-eslint/no-namespace': 'error',
66+
'@typescript-eslint/no-non-null-assertion': 'warn',
67+
'@typescript-eslint/no-require-imports': 'error',
68+
'@typescript-eslint/no-unnecessary-qualifier': 'error',
69+
'@typescript-eslint/no-unnecessary-type-assertion': 'error',
70+
'@typescript-eslint/no-unused-vars': 'error',
71+
'@typescript-eslint/no-useless-constructor': 'error',
72+
'@typescript-eslint/no-var-requires': 'error',
73+
'@typescript-eslint/prefer-for-of': 'warn',
74+
'@typescript-eslint/prefer-function-type': 'warn',
75+
'@typescript-eslint/prefer-includes': 'error',
76+
'@typescript-eslint/prefer-string-starts-ends-with': 'error',
77+
'@typescript-eslint/promise-function-async': 'error',
78+
'@typescript-eslint/require-array-sort-compare': 'error',
79+
'@typescript-eslint/restrict-plus-operands': 'error',
80+
'@typescript-eslint/semi': ['error', 'never'],
81+
'@typescript-eslint/space-before-function-paren': 'off',
82+
'@typescript-eslint/type-annotation-spacing': 'error',
83+
'@typescript-eslint/unbound-method': 'error'
84+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Unordered list style
2+
MD004:
3+
style: dash
4+
5+
# Ordered list item prefix
6+
MD029:
7+
style: one

.github/linters/.yaml-lint.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
rules:
2+
document-end: disable
3+
document-start:
4+
level: warning
5+
present: false
6+
line-length:
7+
level: warning
8+
max: 80
9+
allow-non-breakable-words: true
10+
allow-non-breakable-inline-mappings: true

.github/linters/tsconfig.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"$schema": "https://json.schemastore.org/tsconfig",
3+
"extends": "../../tsconfig.json",
4+
"compilerOptions": {
5+
"noEmit": true
6+
},
7+
"include": ["../../__tests__/**/*", "../../src/**/*"],
8+
"exclude": ["../../dist", "../../node_modules", "../../coverage", "*.json"]
9+
}

.github/workflows/check-dist.yaml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Check Transpiled JavaScript
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
check-dist:
14+
name: Check dist/
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- name: Checkout
19+
id: checkout
20+
uses: actions/checkout@v4
21+
22+
- name: Setup Node.js
23+
id: setup-node
24+
uses: actions/setup-node@v4
25+
with:
26+
node-version-file: .node-version
27+
cache: npm
28+
29+
- name: Install Dependencies
30+
id: install
31+
run: npm ci
32+
33+
- name: Build dist/ Directory
34+
id: build
35+
run: npm run bundle
36+
37+
# This will fail the workflow if the PR wasn't created by Dependabot.
38+
- name: Compare Directories
39+
id: diff
40+
run: |
41+
if [ "$(git diff --ignore-space-at-eol --text dist/ | wc -l)" -gt "0" ]; then
42+
echo "Detected uncommitted changes after build. See status below:"
43+
git diff --ignore-space-at-eol --text dist/
44+
exit 1
45+
fi
46+
47+
# If `dist/` was different than expected, and this was not a Dependabot
48+
# PR, upload the expected version as a workflow artifact.
49+
- if: ${{ failure() && steps.diff.outcome == 'failure' }}
50+
name: Upload Artifact
51+
id: upload
52+
uses: actions/upload-artifact@v4
53+
with:
54+
name: dist
55+
path: dist/

.github/workflows/ci.yaml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Continuous Integration
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- main
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
test-typescript:
14+
name: TypeScript Tests
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- name: Checkout
19+
id: checkout
20+
uses: actions/checkout@v4
21+
22+
- name: Setup Node.js
23+
id: setup-node
24+
uses: actions/setup-node@v4
25+
with:
26+
node-version-file: .node-version
27+
cache: npm
28+
29+
- name: Install Dependencies
30+
id: npm-ci
31+
run: npm ci
32+
33+
- name: Check Format
34+
id: npm-format-check
35+
run: npm run format:check
36+
37+
- name: Lint
38+
id: npm-lint
39+
run: npm run lint
40+
41+
- name: Test
42+
id: npm-ci-test
43+
run: npm run ci-test

.github/workflows/test.yml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,6 @@ on:
99
- main
1010

1111
jobs:
12-
build:
13-
runs-on: ubuntu-latest
14-
steps:
15-
- uses: actions/checkout@v3
16-
- run: |
17-
npm install
18-
- run: |
19-
npm run all
2012
test:
2113
runs-on: ubuntu-latest
2214
steps:

.node-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
20.6.0

0 commit comments

Comments
 (0)