Skip to content

Commit a53c1af

Browse files
committed
chore: initial commit
0 parents  commit a53c1af

30 files changed

+11295
-0
lines changed

.eslintignore

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

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
dist/** -diff linguist-generated=true

.github/linters/.eslintrc.yml

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
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+
'eslint-comments/no-use': 'off',
41+
'eslint-comments/no-unused-disable': 'off',
42+
'i18n-text/no-en': 'off',
43+
'import/no-namespace': 'off',
44+
'no-console': 'off',
45+
'no-unused-vars': 'off',
46+
'prettier/prettier': 'error',
47+
'semi': 'off',
48+
'@typescript-eslint/array-type': 'error',
49+
'@typescript-eslint/await-thenable': 'error',
50+
'@typescript-eslint/ban-ts-comment': 'error',
51+
'@typescript-eslint/consistent-type-assertions': 'error',
52+
'@typescript-eslint/explicit-member-accessibility':
53+
['error', { 'accessibility': 'no-public' }],
54+
'@typescript-eslint/explicit-function-return-type':
55+
['error', { 'allowExpressions': true }],
56+
'@typescript-eslint/func-call-spacing': ['error', 'never'],
57+
'@typescript-eslint/no-array-constructor': 'error',
58+
'@typescript-eslint/no-empty-interface': 'error',
59+
'@typescript-eslint/no-explicit-any': 'error',
60+
'@typescript-eslint/no-extraneous-class': 'error',
61+
'@typescript-eslint/no-for-in-array': 'error',
62+
'@typescript-eslint/no-inferrable-types': 'error',
63+
'@typescript-eslint/no-misused-new': 'error',
64+
'@typescript-eslint/no-namespace': 'error',
65+
'@typescript-eslint/no-non-null-assertion': 'warn',
66+
'@typescript-eslint/no-require-imports': 'error',
67+
'@typescript-eslint/no-unnecessary-qualifier': 'error',
68+
'@typescript-eslint/no-unnecessary-type-assertion': 'error',
69+
'@typescript-eslint/no-unused-vars': 'error',
70+
'@typescript-eslint/no-useless-constructor': 'error',
71+
'@typescript-eslint/no-var-requires': 'error',
72+
'@typescript-eslint/prefer-for-of': 'warn',
73+
'@typescript-eslint/prefer-function-type': 'warn',
74+
'@typescript-eslint/prefer-includes': 'error',
75+
'@typescript-eslint/prefer-string-starts-ends-with': 'error',
76+
'@typescript-eslint/promise-function-async': 'error',
77+
'@typescript-eslint/require-array-sort-compare': 'error',
78+
'@typescript-eslint/restrict-plus-operands': 'error',
79+
'@typescript-eslint/semi': 'error',
80+
'@typescript-eslint/space-before-function-paren': 'off',
81+
'@typescript-eslint/type-annotation-spacing': 'error',
82+
'@typescript-eslint/unbound-method': 'error'
83+
}

.github/linters/.markdown-lint.yml

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.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# In TypeScript actions, `dist/index.js` is a special file. When you reference
2+
# an action with `uses:`, `dist/index.js` is the code that will be run. For this
3+
# project, the `dist/index.js` file is generated from other source files through
4+
# the build process. We need to make sure that the checked-in `dist/index.js`
5+
# file matches what is expected from the build.
6+
#
7+
# This workflow will fail if the checked-in `dist/index.js` file does not match
8+
# what is expected from the build.
9+
name: Check dist/
10+
11+
on:
12+
push:
13+
branches:
14+
- main
15+
paths-ignore:
16+
- '**.md'
17+
pull_request:
18+
paths-ignore:
19+
- '**.md'
20+
workflow_dispatch:
21+
22+
jobs:
23+
check-dist:
24+
name: Check dist/
25+
runs-on: ubuntu-latest
26+
27+
permissions:
28+
contents: read
29+
statuses: write
30+
31+
steps:
32+
- name: Checkout
33+
id: checkout
34+
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0
35+
36+
- name: Setup Node.js
37+
uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1
38+
with:
39+
node-version: 18
40+
cache: npm
41+
42+
- name: Install Dependencies
43+
id: install
44+
run: npm ci
45+
46+
- name: Build dist/ Directory
47+
id: build
48+
run: npm run bundle
49+
50+
- name: Compare Expected and Actual Directories
51+
id: diff
52+
run: |
53+
if [ "$(git diff --ignore-space-at-eol --text dist/ | wc -l)" -gt "0" ]; then
54+
echo "Detected uncommitted changes after build. See status below:"
55+
git diff --ignore-space-at-eol --text dist/
56+
exit 1
57+
fi
58+
59+
# If index.js was different than expected, upload the expected version as
60+
# a workflow artifact.
61+
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
62+
if: ${{ failure() && steps.diff.conclusion == 'failure' }}
63+
with:
64+
name: dist
65+
path: dist/

.github/workflows/ci.yml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: Continuous Integration
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- main
8+
- 'releases/*'
9+
10+
jobs:
11+
test-typescript:
12+
name: TypeScript Tests
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Checkout
17+
id: checkout
18+
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0
19+
20+
- name: Setup Node.js
21+
id: setup-node
22+
uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1
23+
with:
24+
node-version: 18
25+
cache: npm
26+
27+
- name: Install Dependencies
28+
id: npm-ci
29+
run: npm ci
30+
31+
- name: Check Format
32+
id: npm-format-check
33+
run: npm run format:check
34+
35+
- name: Lint
36+
id: npm-lint
37+
run: npm run lint
38+
39+
- name: Test
40+
id: npm-ci-test
41+
run: npm run ci-test
42+
43+
test-action:
44+
name: GitHub Actions Test
45+
runs-on: ubuntu-latest
46+
47+
steps:
48+
- name: Checkout
49+
id: checkout
50+
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0
51+
52+
- name: Test Local Action
53+
id: test-action
54+
uses: ./
55+
with:
56+
milliseconds: 1000
57+
58+
- name: Print Output
59+
id: output
60+
run: echo "${{ steps.test-action.outputs.time }}"
61+
62+
release:
63+
name: release
64+
runs-on: ubuntu-latest
65+
needs: test-typescript
66+
if: github.ref == 'refs/heads/main'
67+
permissions:
68+
contents: write
69+
steps:
70+
- name: Checkout
71+
id: checkout
72+
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
73+
- run: npx semantic-release
74+
env:
75+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/codeql-analysis.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: CodeQL
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
schedule:
11+
- cron: '31 7 * * 3'
12+
13+
jobs:
14+
analyze:
15+
name: Analyze
16+
runs-on: ubuntu-latest
17+
18+
permissions:
19+
actions: read
20+
checks: write
21+
contents: read
22+
security-events: write
23+
24+
strategy:
25+
fail-fast: false
26+
matrix:
27+
language:
28+
- TypeScript
29+
30+
steps:
31+
- name: Checkout
32+
id: checkout
33+
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0
34+
35+
- name: Initialize CodeQL
36+
id: initialize
37+
uses: github/codeql-action/init@a09933a12a80f87b87005513f0abb1494c27a716 # v2.21.4
38+
with:
39+
languages: ${{ matrix.language }}
40+
source-root: src
41+
42+
- name: Autobuild
43+
id: autobuild
44+
uses: github/codeql-action/autobuild@a09933a12a80f87b87005513f0abb1494c27a716 # v2.21.4
45+
46+
- name: Perform CodeQL Analysis
47+
id: analyze
48+
uses: github/codeql-action/analyze@a09933a12a80f87b87005513f0abb1494c27a716 # v2.21.4

.github/workflows/linter.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Lint Code Base
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
push:
8+
branches-ignore:
9+
- main
10+
11+
jobs:
12+
lint:
13+
name: Lint Code Base
14+
runs-on: ubuntu-latest
15+
16+
permissions:
17+
contents: read
18+
packages: read
19+
statuses: write
20+
21+
steps:
22+
- name: Checkout
23+
id: checkout
24+
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0
25+
26+
- name: Setup Node.js
27+
id: setup-node
28+
uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1
29+
with:
30+
node-version: 18
31+
cache: npm
32+
33+
- name: Install Dependencies
34+
id: install
35+
run: npm ci
36+
37+
- name: Lint Code Base
38+
id: super-linter
39+
uses: super-linter/super-linter/slim@962a6409c1b303d0e53a9d34ada577a0362f4fae # v5.2.1
40+
env:
41+
DEFAULT_BRANCH: main
42+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
43+
TYPESCRIPT_DEFAULT_STYLE: prettier
44+
VALIDATE_JSCPD: false

0 commit comments

Comments
 (0)