Skip to content

Commit 3b55ad3

Browse files
committed
chore: merge branch main
2 parents 2cc7e66 + 622c546 commit 3b55ad3

File tree

79 files changed

+685
-282
lines changed

Some content is hidden

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

79 files changed

+685
-282
lines changed

.github/workflows/claude-code-review.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ jobs:
4040
4141
Use `gh pr comment` with your Bash tool to leave your review as a comment on the PR.
4242
43+
Be succinct. Double-check everything.
44+
4345
# See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
4446
# or https://docs.claude.com/en/docs/claude-code/sdk#command-line for available options
4547
claude_args: '--allowed-tools "Bash(gh issue view:*),Bash(gh search:*),Bash(gh issue list:*),Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*),Bash(gh pr list:*)"'

.github/workflows/main.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ jobs:
2020
- 22
2121
- 20
2222
steps:
23-
- uses: actions/checkout@v5
24-
- uses: actions/setup-node@v5
23+
- uses: actions/checkout@v6
24+
- uses: actions/setup-node@v6
2525
with:
2626
node-version: ${{ matrix.node-version }}
2727
- run: npm install
@@ -34,10 +34,11 @@ jobs:
3434
matrix:
3535
typescript-version:
3636
- 'latest'
37+
- '~6.0.0'
3738
- '~5.9.0'
3839
steps:
39-
- uses: actions/checkout@v5
40-
- uses: actions/setup-node@v5
40+
- uses: actions/checkout@v6
41+
- uses: actions/setup-node@v6
4142
with:
4243
node-version: 24
4344
- run: npm install

.github/workflows/ts-canary.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ jobs:
1515
- next
1616
- latest
1717
steps:
18-
- uses: actions/checkout@v5
19-
- uses: actions/setup-node@v5
18+
- uses: actions/checkout@v6
19+
- uses: actions/setup-node@v6
2020
with:
2121
node-version: lts/*
2222
- run: npm install

lint-processors/jsdoc-codeblocks.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import tsParser from '@typescript-eslint/parser';
55
@import {Linter} from 'eslint';
66
*/
77

8-
const CODEBLOCK_REGEX = /(?<openingFence>(?<indent>^[ \t]*)```(?:ts|typescript)?\n)(?<code>[\s\S]*?)\n\s*```/gm;
8+
const CODEBLOCK_REGEX = /(?<openingFence>(?<indent>^[ \t]*)```(?:ts|typescript)?\n)(?<code>[\s\S]*?)\n\s*```/gmv;
99
/**
1010
@typedef {{lineOffset: number, characterOffset: number, indent: string, unindentedText: string}} CodeblockData
1111
@type {Map<string, CodeblockData[]>}

lint-processors/jsdoc-codeblocks.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1454,7 +1454,7 @@ describe('jsdoc-codeblocks processor', {concurrency: true}, () => {
14541454

14551455
for (const {type, name, code, output, errors = []} of testCases) {
14561456
test(`${type} - ${name}`, async t => {
1457-
const fileName = `test-${type}-${name.replaceAll(/\s+/g, '-')}.d.ts`;
1457+
const fileName = `test-${type}-${name.replaceAll(/\s+/gv, '-')}.d.ts`;
14581458
const filePath = path.join(root, fileName);
14591459
await fs.writeFile(filePath, code);
14601460
t.after(async () => {

lint-rules/validate-jsdoc-codeblocks.js

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import path from 'node:path';
22
import ts from 'typescript';
33
import {createFSBackedSystem, createVirtualTypeScriptEnvironment} from '@typescript/vfs';
44

5-
const CODEBLOCK_REGEX = /(?<openingFence>```(?:ts|typescript)?\n)(?<code>[\s\S]*?)```/g;
5+
const CODEBLOCK_REGEX = /(?<openingFence>```(?:ts|typescript)?\n)(?<code>[\s\S]*?)```/gv;
66
const FILENAME = 'example-codeblock.ts';
77
const TWOSLASH_COMMENT = '//=>';
88

@@ -24,8 +24,7 @@ const compilerOptions = {
2424
exactOptionalPropertyTypes: true,
2525
};
2626

27-
const virtualFsMap = new Map();
28-
virtualFsMap.set(FILENAME, '// Can\'t be empty');
27+
const virtualFsMap = new Map([[FILENAME, '// Can\'t be empty']]);
2928

3029
const rootDir = path.join(import.meta.dirname, '..');
3130
const system = createFSBackedSystem(virtualFsMap, rootDir, ts);
@@ -41,7 +40,7 @@ function parseCompilerOptions(code) {
4140
continue;
4241
}
4342

44-
const match = line.match(/^\s*\/\/ @(\w+): (.*)$/);
43+
const match = line.match(/^\s*\/\/ @(\w+): (.*)$/v);
4544
if (!match) {
4645
// Stop parsing at the first non-matching line
4746
return options;
@@ -265,12 +264,12 @@ function normalizeType(type, onlySortNumbers = false) {
265264

266265
if (onlySortNumbers) {
267266
// Sort only numeric members while keeping non-numeric members at their original positions
268-
const sortedNumericTypes = types.filter(([a]) => isNumeric(a)).sort(([a], [b]) => Number(a) - Number(b));
267+
const sortedNumericTypes = types.filter(([a]) => isNumeric(a)).toSorted(([a], [b]) => Number(a) - Number(b));
269268
let numericIndex = 0;
270269
types = types.map(t => isNumeric(t[0]) ? sortedNumericTypes[numericIndex++][1] : t[1]);
271270
} else {
272271
types = types
273-
.sort(([a], [b]) => a < b ? -1 : (a > b ? 1 : 0))
272+
.toSorted(([a], [b]) => a < b ? -1 : (a > b ? 1 : 0))
274273
.map(t => t[1]);
275274
}
276275

@@ -298,7 +297,7 @@ function normalizeType(type, onlySortNumbers = false) {
298297
return node;
299298
};
300299

301-
return print(visit(typeNode)).replaceAll(/^( +)/gm, indentation => {
300+
return print(visit(typeNode)).replaceAll(/^( +)/gmv, indentation => {
302301
// Replace spaces used for indentation with tabs
303302
const spacesPerTab = 4;
304303
const tabCount = Math.floor(indentation.length / spacesPerTab);
@@ -312,10 +311,10 @@ function getCommentForType(type) {
312311

313312
if (type.length < 80) {
314313
comment = type
315-
.replaceAll(/\r?\n\s*/g, ' ') // Collapse into single line
316-
.replaceAll(/{\s+/g, '{') // Remove spaces after `{`
317-
.replaceAll(/\s+}/g, '}') // Remove spaces before `}`
318-
.replaceAll(/;(?=})/g, ''); // Remove semicolons before `}`
314+
.replaceAll(/\r?\n\s*/gv, ' ') // Collapse into single line
315+
.replaceAll(/\{\s+/gv, '{') // Remove spaces after `{`
316+
.replaceAll(/\s+\}/gv, '}') // Remove spaces before `}`
317+
.replaceAll(/;(?=\})/gv, ''); // Remove semicolons before `}`
319318
}
320319

321320
return `${TWOSLASH_COMMENT} ${comment.replaceAll('\n', '\n// ')}`;

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,13 @@
5959
"@typescript-eslint/parser": "^8.44.0",
6060
"@typescript/vfs": "^1.6.1",
6161
"dedent": "^1.7.0",
62-
"eslint": "^9.35.0",
62+
"eslint": "^10.1.0",
6363
"expect-type": "^1.2.2",
6464
"npm-run-all2": "^8.0.4",
6565
"tsd": "^0.33.0",
6666
"typescript": "^5.9.2",
6767
"typescript-eslint": "^8.47.0",
68-
"xo": "^1.2.2"
68+
"xo": "^2.0.2"
6969
},
7070
"tsd": {
7171
"compilerOptions": {

source/all-union-fields.d.ts

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -69,23 +69,23 @@ function displayPetInfoWithAllUnionFields(petInfo: AllUnionFields<Cat | Dog>) {
6969
@category Union
7070
*/
7171
export type AllUnionFields<Union> =
72-
Extract<Union, NonRecursiveType | ReadonlyMap<unknown, unknown> | ReadonlySet<unknown> | UnknownArray> extends infer SkippedMembers
73-
? Exclude<Union, SkippedMembers> extends infer RelevantMembers
74-
?
75-
| SkippedMembers
76-
| Simplify<
77-
// Include fields that are common in all union members
78-
SharedUnionFields<RelevantMembers> &
79-
// Include readonly fields present in any union member
80-
{
81-
readonly [P in ReadonlyKeysOfUnion<RelevantMembers>]?: ValueOfUnion<RelevantMembers, P & KeysOfUnion<RelevantMembers>>
82-
} &
83-
// Include remaining fields that are neither common nor readonly
84-
{
85-
[P in Exclude<KeysOfUnion<RelevantMembers>, ReadonlyKeysOfUnion<RelevantMembers> | keyof RelevantMembers>]?: ValueOfUnion<RelevantMembers, P>
86-
}
87-
>
88-
: never
89-
: never;
72+
Extract<Union, NonRecursiveType | ReadonlyMap<unknown, unknown> | ReadonlySet<unknown> | UnknownArray> extends infer SkippedMembers
73+
? Exclude<Union, SkippedMembers> extends infer RelevantMembers
74+
? // eslint-disable-line @stylistic/operator-linebreak
75+
| SkippedMembers
76+
| Simplify<
77+
// Include fields that are common in all union members
78+
SharedUnionFields<RelevantMembers>
79+
// Include readonly fields present in any union member
80+
& {
81+
readonly [P in ReadonlyKeysOfUnion<RelevantMembers>]?: ValueOfUnion<RelevantMembers, P & KeysOfUnion<RelevantMembers>>
82+
}
83+
// Include remaining fields that are neither common nor readonly
84+
& {
85+
[P in Exclude<KeysOfUnion<RelevantMembers>, ReadonlyKeysOfUnion<RelevantMembers> | keyof RelevantMembers>]?: ValueOfUnion<RelevantMembers, P>
86+
}
87+
>
88+
: never
89+
: never;
9090

9191
export {};

source/array-splice.d.ts

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ import type {TupleOf} from './tuple-of.d.ts';
88
The implementation of `SplitArrayByIndex` for fixed length arrays.
99
*/
1010
type SplitFixedArrayByIndex<T extends UnknownArray, SplitIndex extends number> =
11-
SplitIndex extends 0
12-
? [[], T]
13-
: T extends readonly [...TupleOf<SplitIndex>, ...infer V]
14-
? T extends readonly [...infer U, ...V]
15-
? [U, V]
16-
: [never, never]
17-
: [never, never];
11+
SplitIndex extends 0
12+
? [[], T]
13+
: T extends readonly [...TupleOf<SplitIndex>, ...infer V]
14+
? T extends readonly [...infer U, ...V]
15+
? [U, V]
16+
: [never, never]
17+
: [never, never];
1818

1919
/**
2020
The implementation of `SplitArrayByIndex` for variable length arrays.
@@ -26,23 +26,23 @@ type SplitVariableArrayByIndex<T extends UnknownArray,
2626
? TupleOf<GreaterThanOrEqual<T1, 0> extends true ? T1 : number, VariablePartOfArray<T>[number]>
2727
: [],
2828
> =
29-
SplitIndex extends 0
30-
? [[], T]
31-
: GreaterThanOrEqual<StaticPartOfArray<T>['length'], SplitIndex> extends true
32-
? [
33-
SplitFixedArrayByIndex<StaticPartOfArray<T>, SplitIndex>[0],
34-
[
35-
...SplitFixedArrayByIndex<StaticPartOfArray<T>, SplitIndex>[1],
36-
...VariablePartOfArray<T>,
37-
],
38-
]
39-
: [
40-
[
41-
...StaticPartOfArray<T>,
42-
...(T2 extends UnknownArray ? T2 : []),
43-
],
44-
VariablePartOfArray<T>,
45-
];
29+
SplitIndex extends 0
30+
? [[], T]
31+
: GreaterThanOrEqual<StaticPartOfArray<T>['length'], SplitIndex> extends true
32+
? [
33+
SplitFixedArrayByIndex<StaticPartOfArray<T>, SplitIndex>[0],
34+
[
35+
...SplitFixedArrayByIndex<StaticPartOfArray<T>, SplitIndex>[1],
36+
...VariablePartOfArray<T>,
37+
],
38+
]
39+
: [
40+
[
41+
...StaticPartOfArray<T>,
42+
...(T2 extends UnknownArray ? T2 : []),
43+
],
44+
VariablePartOfArray<T>,
45+
];
4646

4747
/**
4848
Split the given array `T` by the given `SplitIndex`.

source/camel-case.d.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type {ApplyDefaultOptions} from './internal/index.d.ts';
2-
import type {Words, WordsOptions} from './words.d.ts';
2+
import type {_DefaultWordsOptions, Words, WordsOptions} from './words.d.ts';
33

44
/**
55
CamelCase options.
@@ -15,8 +15,7 @@ export type CamelCaseOptions = WordsOptions & {
1515
preserveConsecutiveUppercase?: boolean;
1616
};
1717

18-
export type _DefaultCamelCaseOptions = {
19-
splitOnNumbers: true;
18+
export type _DefaultCamelCaseOptions = _DefaultWordsOptions & {
2019
preserveConsecutiveUppercase: false;
2120
};
2221

@@ -51,6 +50,7 @@ import type {CamelCase} from 'type-fest';
5150
5251
const someVariable: CamelCase<'foo-bar'> = 'fooBar';
5352
const preserveConsecutiveUppercase: CamelCase<'foo-BAR-baz', {preserveConsecutiveUppercase: true}> = 'fooBARBaz';
53+
const splitOnPunctuation: CamelCase<'foo-bar:BAZ', {splitOnPunctuation: true}> = 'fooBarBaz';
5454
5555
// Advanced
5656

0 commit comments

Comments
 (0)