Skip to content

Commit 9eba579

Browse files
authored
Support Typescript 5.5 (#58)
1 parent 6112e99 commit 9eba579

18 files changed

+1414
-932
lines changed

.github/workflows/check-published-scheduled.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,11 @@ on:
77

88
jobs:
99
checkPublished:
10-
runs-on: ubuntu-latest
1110
name: Check Published
11+
runs-on: ubuntu-latest
1212
steps:
13-
- uses: actions/checkout@v4
13+
- name: Checkout Code
14+
uses: actions/checkout@v4
1415
with:
1516
ref: ${{ github.event.pull_request.head.sha }}
1617
- name: Check Published

.github/workflows/ci.yml

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,30 @@ on:
55
branches:
66
- 'main'
77

8+
env:
9+
CI: true
10+
811
jobs:
912
pullRequestBuild:
1013
name: Pull Request Build
1114
runs-on: ubuntu-latest
1215
strategy:
1316
matrix:
14-
node-version: [20.x, 21.x]
17+
node-version: ['20.x', '22.x']
1518
steps:
16-
- uses: actions/checkout@v4
19+
- name: Checkout Code
20+
uses: actions/checkout@v4
1721
- name: Use Node.js ${{ matrix.node-version }}
1822
uses: actions/setup-node@v4
1923
with:
2024
node-version: ${{ matrix.node-version }}
2125
cache: 'npm'
22-
- name: Install dependencies
26+
- name: Install Dependencies
2327
run: npm ci --ignore-scripts
28+
env:
29+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
30+
- name: Prepare
31+
run: npm run prepare
2432
- name: Compile
2533
run: npm run ci:compile
2634
- name: Check Code Style
@@ -31,22 +39,27 @@ jobs:
3139
run: npm run ci:test
3240

3341
branchBuild:
34-
runs-on: ubuntu-latest
3542
name: Branch Build
43+
runs-on: ubuntu-latest
3644
strategy:
3745
matrix:
38-
node-version: [20.x, 21.x]
46+
node-version: ['20.x', '22.x']
3947
steps:
40-
- uses: actions/checkout@v4
48+
- name: Checkout Code
49+
uses: actions/checkout@v4
4150
with:
4251
ref: ${{ github.event.pull_request.head.sha }}
4352
- name: Use Node.js ${{ matrix.node-version }}
4453
uses: actions/setup-node@v4
4554
with:
4655
node-version: ${{ matrix.node-version }}
4756
cache: 'npm'
48-
- name: Install dependencies
57+
- name: Install Dependencies
4958
run: npm ci --ignore-scripts
59+
env:
60+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
61+
- name: Prepare
62+
run: npm run prepare
5063
- name: Compile
5164
run: npm run ci:compile
5265
- name: Check Code Style

.github/workflows/codeql-analysis.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ jobs:
2121
matrix:
2222
language: ['javascript']
2323
steps:
24-
- name: Checkout repository
25-
uses: actions/checkout@v3
24+
- name: Checkout code
25+
uses: actions/checkout@v4
2626
- name: Initialize CodeQL
27-
uses: github/codeql-action/init@v2
27+
uses: github/codeql-action/init@v3
2828
with:
2929
languages: ${{ matrix.language }}
3030
- name: Perform CodeQL Analysis
31-
uses: github/codeql-action/analyze@v2
31+
uses: github/codeql-action/analyze@v3

.github/workflows/publish-beta.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ on:
77

88
jobs:
99
publishBeta:
10-
runs-on: ubuntu-latest
1110
name: Publish Beta
11+
runs-on: ubuntu-latest
1212
steps:
1313
- name: Checkout Code
1414
uses: actions/checkout@v4
@@ -23,6 +23,8 @@ jobs:
2323
uses: checkdigit/github-actions/check-label@main
2424
env:
2525
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
26+
- name: Check Imports
27+
uses: checkdigit/github-actions/check-imports@main
2628
- name: Install latest npm
2729
run: npm install -g npm@latest
2830
- name: Install Dependencies
@@ -38,7 +40,7 @@ jobs:
3840
run: npm publish --tag beta
3941
env:
4042
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN_PUBLISH }}
41-
- name: Comment npm publish result
43+
- name: Comment
4244
uses: checkdigit/github-actions/comment-npm-publish@main
4345
with:
4446
betaPackage: ${{ steps.prepare-beta.outputs.betaPackage }}

.github/workflows/publish.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,16 @@ jobs:
1212
id-token: write
1313
name: Publish to NPM
1414
steps:
15-
- uses: actions/checkout@v4
16-
- uses: actions/setup-node@v4
15+
- name: Checkout Code
16+
uses: actions/checkout@v4
17+
- name: Setup Node.js
18+
uses: actions/setup-node@v4
1719
with:
1820
node-version: '20.x'
1921
registry-url: 'https://registry.npmjs.org'
2022
- name: Install latest npm
2123
run: npm install -g npm@latest
22-
- name: Install dependencies
24+
- name: Install Dependencies
2325
run: npm ci --ignore-scripts
2426
- name: Audit Signatures
2527
run: npm audit signatures

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ This module contains the standard Check Digit Typescript configuration, along wi
1010

1111
### Typescript Configuration
1212

13-
- currently requires Node 20.11 or above.
13+
- currently requires Node 20.13 or above.
1414
- emits `esnext`, with the default libraries, to avoid down-leveling. It is intended that application spec tests pick
15-
up any issues with using newer features unavailable in a particular environment. Browsers and NodeJS are fast-moving
15+
up any issues with using newer features unavailable in a particular environment. Browsers and Node.js are fast-moving
1616
targets, and can add language features at any time.
1717
- uses the `module` type of `esnext`.
1818
- all compiler options set for maximum strictness.
@@ -24,7 +24,7 @@ It is intended to be used when publishing a package to NPM, or to bundle a packa
2424
It uses `tsc` for generating types, and `esbuild` for generating code.
2525

2626
**Note:** the `require` function will be defined as a global variable, to allow
27-
dynamic `require`s by CommonJS submodules. This is not a problem for NodeJS, but will cause issues in a browser environment.
27+
dynamic `require`s by CommonJS submodules. This is not a problem for Node.js, but will cause issues in a browser environment.
2828

2929
#### Options
3030

eslint.config.js

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
// eslint.config.js
2+
3+
import { promises as fs } from 'node:fs';
4+
5+
import eslint from '@eslint/js';
6+
import typescriptEslint from 'typescript-eslint';
7+
import prettier from 'eslint-config-prettier';
8+
9+
const ignores = [
10+
...(await fs.readFile('.gitignore', 'utf-8')).split('\n').filter((path) => path.trim() !== ''),
11+
'eslint.config.js',
12+
];
13+
14+
export default [
15+
{ ignores },
16+
eslint.configs.all,
17+
...typescriptEslint.configs.recommended,
18+
...typescriptEslint.configs.recommendedTypeChecked,
19+
...typescriptEslint.configs.strict,
20+
prettier,
21+
{
22+
languageOptions: {
23+
parserOptions: {
24+
project: './tsconfig.json',
25+
},
26+
},
27+
rules: {
28+
'@typescript-eslint/non-nullable-type-assertion-style': 'error',
29+
'capitalized-comments': 'off',
30+
'one-var': 'off',
31+
'func-names': 'off',
32+
'sort-keys': 'off',
33+
'sort-imports': 'off',
34+
'max-lines': [
35+
'error',
36+
{
37+
max: 500,
38+
skipBlankLines: true,
39+
skipComments: true,
40+
},
41+
],
42+
'func-style': [
43+
'error',
44+
'declaration',
45+
{
46+
allowArrowFunctions: true,
47+
},
48+
],
49+
'no-magic-numbers': [
50+
'error',
51+
{
52+
ignore: [0, 1, 2],
53+
},
54+
],
55+
'no-undefined': 'off',
56+
'no-ternary': 'off',
57+
},
58+
},
59+
{
60+
files: ['**/*.spec.ts', '**/*.test.ts'],
61+
rules: {
62+
'@typescript-eslint/non-nullable-type-assertion-style': 'off',
63+
'@typescript-eslint/ban-types': 'off',
64+
'@typescript-eslint/require-await': 'off',
65+
'@typescript-eslint/consistent-type-definitions': 'off',
66+
'@typescript-eslint/ban-ts-comment': 'off',
67+
'@typescript-eslint/no-unnecessary-condition': 'off',
68+
'@typescript-eslint/consistent-indexed-object-style': 'off',
69+
'@typescript-eslint/no-unused-vars': 'off',
70+
'@typescript-eslint/no-unsafe-member-access': 'off',
71+
'line-comment-position': 'off',
72+
'no-fallthrough': 'off',
73+
'no-inline-comments': 'off',
74+
'no-param-reassign': 'off',
75+
'id-length': 'off',
76+
'no-magic-numbers': 'off',
77+
'no-duplicate-imports': 'off',
78+
'symbol-description': 'off',
79+
'no-invalid-this': 'off',
80+
'max-lines-per-function': 'off',
81+
'max-lines': 'off',
82+
'max-statements': 'off',
83+
'no-await-in-loop': 'off',
84+
},
85+
},
86+
];

0 commit comments

Comments
 (0)