Skip to content

Commit 2e9d9bd

Browse files
Initial commit
0 parents  commit 2e9d9bd

32 files changed

+11222
-0
lines changed

.eslintignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
lib/
2+
dist/
3+
node_modules/
4+
coverage/

.gitattributes

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
* text=auto eol=lf
2+
3+
dist/** -diff linguist-generated=true

.github/dependabot.yml

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: github-actions
4+
directory: /
5+
schedule:
6+
interval: weekly
7+
groups:
8+
actions-minor:
9+
update-types:
10+
- minor
11+
- patch
12+
13+
- package-ecosystem: npm
14+
directory: /
15+
schedule:
16+
interval: weekly
17+
groups:
18+
npm-development:
19+
dependency-type: development
20+
update-types:
21+
- minor
22+
- patch
23+
npm-production:
24+
dependency-type: production
25+
update-types:
26+
- patch

.github/linters/.eslintrc.yml

+83
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', 'never'],
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

+7
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

+10
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

+9
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

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# In TypeScript actions, `dist/` is a special directory. When you reference
2+
# an action with the `uses:` property, `dist/index.js` is the code that will be
3+
# run. For this project, the `dist/index.js` file is transpiled from other
4+
# source files. This workflow ensures the `dist/` directory contains the
5+
# expected transpiled code.
6+
#
7+
# If this workflow is run from a feature branch, it will act as an additional CI
8+
# check and fail if the checked-in `dist/` directory does not match what is
9+
# expected from the build.
10+
name: Check Transpiled JavaScript
11+
12+
on:
13+
push:
14+
branches:
15+
- main
16+
pull_request:
17+
18+
permissions:
19+
contents: read
20+
21+
jobs:
22+
check-dist:
23+
name: Check dist/
24+
runs-on: ubuntu-latest
25+
26+
steps:
27+
- name: Checkout
28+
id: checkout
29+
uses: actions/checkout@v4
30+
31+
- name: Setup Node.js
32+
id: setup-node
33+
uses: actions/setup-node@v4
34+
with:
35+
node-version-file: .node-version
36+
cache: npm
37+
38+
- name: Install Dependencies
39+
id: install
40+
run: npm ci
41+
42+
- name: Build dist/ Directory
43+
id: build
44+
run: npm run bundle
45+
46+
# This will fail the workflow if the PR wasn't created by Dependabot.
47+
- name: Compare Directories
48+
id: diff
49+
run: |
50+
if [ "$(git diff --ignore-space-at-eol --text dist/ | wc -l)" -gt "0" ]; then
51+
echo "Detected uncommitted changes after build. See status below:"
52+
git diff --ignore-space-at-eol --text dist/
53+
exit 1
54+
fi
55+
56+
# If `dist/` was different than expected, and this was not a Dependabot
57+
# PR, upload the expected version as a workflow artifact.
58+
- if: ${{ failure() && steps.diff.outcome == 'failure' }}
59+
name: Upload Artifact
60+
id: upload
61+
uses: actions/upload-artifact@v4
62+
with:
63+
name: dist
64+
path: dist/

.github/workflows/ci.yml

+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
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
44+
45+
test-action:
46+
name: GitHub Actions Test
47+
runs-on: ubuntu-latest
48+
49+
steps:
50+
- name: Checkout
51+
id: checkout
52+
uses: actions/checkout@v4
53+
54+
- name: Test Local Action
55+
id: test-action
56+
uses: ./
57+
with:
58+
milliseconds: 2000
59+
60+
- name: Print Output
61+
id: output
62+
run: echo "${{ steps.test-action.outputs.time }}"

.github/workflows/codeql-analysis.yml

+48
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@v4
34+
35+
- name: Initialize CodeQL
36+
id: initialize
37+
uses: github/codeql-action/init@v3
38+
with:
39+
languages: ${{ matrix.language }}
40+
source-root: src
41+
42+
- name: Autobuild
43+
id: autobuild
44+
uses: github/codeql-action/autobuild@v3
45+
46+
- name: Perform CodeQL Analysis
47+
id: analyze
48+
uses: github/codeql-action/analyze@v3

.github/workflows/linter.yml

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

0 commit comments

Comments
 (0)