Skip to content

Commit 88b764d

Browse files
committed
chore: lint fix
1 parent 72c1bc5 commit 88b764d

File tree

60 files changed

+79
-64
lines changed

Some content is hidden

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

60 files changed

+79
-64
lines changed

eslint.config.mjs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,14 @@ const srcRules = {
1818
await genModuleAbsolutePathIfExists(projectDir, 'node_modules/@mwcp/share') ?? '.',
1919
],
2020
}],
21+
'id-length': 0,
22+
"@typescript-eslint/no-unused-vars": 0,
23+
'@typescript-eslint/prefer-ts-expect-error': 0,
24+
'@typescript-eslint/no-duplicate-enum-values': 0,
25+
'node/no-extraneous-import': 0,
26+
'unicorn/filename-case': 0,
27+
"linebreak-style": 0,
28+
'node/shebang': 0,
2129
}
2230
const testRules = {
2331
'@typescript-eslint/no-explicit-any': 0,

packages/win32-api/src/lib/comctl32/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ import { Comctl32 } from './api.types.js'
88

99

1010
export {
11-
DefComctl32, Comctl32,
11+
Comctl32,
12+
DefComctl32,
1213
}
1314

1415
export const dllName = DllNames.comctl32

packages/win32-api/src/lib/user32/mapper/GetClassInfoExW.mapper.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ export const GetClassInfoExW_mapper: MultipleChoiceMapper<Params, DefParams> = (
2323
assert(Array.isArray(row))
2424
const defArg = row[1]
2525

26+
// eslint-disable-next-line @typescript-eslint/switch-exhaustiveness-check
2627
switch (typeof lpszClass) {
2728
case 'string': {
2829
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition

packages/win32-api/src/lib/winspool/api.types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable @typescript-eslint/no-unnecessary-type-parameters */
12
/* c8 ignore start */
23
import type * as S from 'win32-def/struct'
34
import type * as T from 'win32-def/types'

packages/win32-api/src/util/winspool/winspool.index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
export * from './winspool.types.js'
2+
export type * from './winspool.types.js'
33
export * from './ClosePrinter.js'
44
export * from './EndDocPrinter.js'
55
export * from './EnumPrinters.js'

packages/win32-api/test/0.dummy.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { fileShortPath } from '@waiting/shared-core'
44

55
import { testConfig } from '#@/root.config.js'
66

7+
78
describe(fileShortPath(import.meta.url), () => {
89

910
describe('should work', () => {

packages/win32-api/test/lib/kernel32/2000.GetModuleHandleW.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import assert from 'node:assert/strict'
33
import { fileShortPath } from '@waiting/shared-core'
44
import { ucsBufferFrom } from 'win32-def'
55

6-
import { Kernel32 as Lib, DllNames } from '##/index.js'
6+
import { DllNames, Kernel32 as Lib } from '##/index.js'
77

88

99
describe(fileShortPath(import.meta.url), () => {

packages/win32-api/test/lib/kernel32/2001.GetModuleHandleExW.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import assert from 'node:assert/strict'
33
import { fileShortPath } from '@waiting/shared-core'
44
import { ucsBufferFrom } from 'win32-def'
55

6-
import { Kernel32 as Lib, DllNames, ffi } from '##/index.js'
6+
import { DllNames, Kernel32 as Lib, ffi } from '##/index.js'
77

88

99
describe(fileShortPath(import.meta.url), () => {

packages/win32-api/test/lib/user32/1000.RegisterClassExW.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { fileShortPath } from '@waiting/shared-core'
44
import { WNDCLASSEXW_Factory } from 'win32-def/struct'
55
import type { WNDCLASSEXW_Type } from 'win32-def/struct'
66

7-
import { User32 as Lib, Kernel32 } from '##/index.js'
7+
import { Kernel32, User32 as Lib } from '##/index.js'
88

99

1010
describe(fileShortPath(import.meta.url), () => {

packages/win32-api/test/lib/user32/1001.GetClassInfoExW.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { ucsBufferFrom } from 'win32-def'
55
import { WNDCLASSEXW_Factory } from 'win32-def/struct'
66
import type { WNDCLASSEXW_Type } from 'win32-def/struct'
77

8-
import { User32 as Lib, Kernel32 } from '##/index.js'
8+
import { Kernel32, User32 as Lib } from '##/index.js'
99

1010

1111
describe(fileShortPath(import.meta.url), () => {

packages/win32-api/test/lib/user32/1002.GetClassNameW.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { spawn } from 'node:child_process'
44
import { fileShortPath, sleep } from '@waiting/shared-core'
55
import { ucsBufferToString } from 'win32-def'
66

7-
import { User32 as Lib, Kernel32 } from '##/index.js'
7+
import { Kernel32, User32 as Lib } from '##/index.js'
88
import { FindWindowEx } from '##/index.util.js'
99

1010

packages/win32-api/test/util/winspool/203.GetPrinter.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import assert from 'node:assert/strict'
22

33
import { fileShortPath, sleep } from '@waiting/shared-core'
44

5-
import { OpenPrinter, GetPrinter, ClosePrinter } from '##/index.util.js'
5+
import { ClosePrinter, GetPrinter, OpenPrinter } from '##/index.util.js'
66

77

88
describe(fileShortPath(import.meta.url), () => {

packages/win32-api/test/util/winspool/204.StartDocPrinter-EndDocPrinter.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ import assert from 'node:assert'
22
import { rm } from 'node:fs/promises'
33
import { homedir } from 'node:os'
44

5-
import { fileShortPath, sleep, isFileExists } from '@waiting/shared-core'
5+
import { fileShortPath, isFileExists, sleep } from '@waiting/shared-core'
66
import { PRINTER_STATUS } from 'win32-def/consts'
77
import { DOC_INFO_1_Factory } from 'win32-def/struct'
88

9-
import { EndDocPrinter, OpenPrinter, GetPrinter, ClosePrinter, StartDocPrinter } from '##/index.util.js'
9+
import { ClosePrinter, EndDocPrinter, GetPrinter, OpenPrinter, StartDocPrinter } from '##/index.util.js'
1010
import { testConfig } from '#@/root.config.js'
1111

1212

packages/win32-def/demo/EnumPrintersW.mts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env tsx
2-
/* eslint-disable import/no-extraneous-dependencies */
2+
33

44
import ffi from 'koffi'
55
import { PrinterEnumFlags } from 'win32-def/consts'

packages/win32-def/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,11 @@
5656
},
5757
"license": "MIT",
5858
"dependencies": {
59-
"@waiting/shared-core": "^23.19.0",
60-
"koffi": "^2.8.11"
59+
"@waiting/shared-core": "^23.25.3",
60+
"koffi": "^2.9.2"
6161
},
6262
"engines": {
63-
"node": ">=16.12.0"
63+
"node": ">=18.11.0"
6464
},
6565
"files": [
6666
"README.*.md",

packages/win32-def/src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ import ffi from 'koffi'
1111
export * from './lib/config.js'
1212
export * from './lib/def.enum.js'
1313

14-
export * from './lib/common.types.js'
14+
export type * from './lib/common.types.js'
1515
export * from './lib/loader/loader.js'
1616
export * from './lib/ffi.types.js'
1717
export * from './lib/struct/struct.helper.js'
1818
export * from './lib/struct/struct.factory-map.js'
19-
export * from './lib/types.js'
19+
export type * from './lib/types.js'
2020
export * from './lib/util.js'
2121

2222
export { ffi }

packages/win32-def/src/index.types.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

2-
export * from './lib/common.types.js'
2+
export type * from './lib/common.types.js'
33
export * from './lib/ffi.types.js'
4-
export * from './lib/types.js'
4+
export type * from './lib/types.js'
55

66
export type{
77
EnumPrinters_Level,

packages/win32-def/src/lib/consts/virtual-key.enum.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* eslint-disable @typescript-eslint/no-duplicate-enum-values */
1+
22
/**
33
* Virtual-Key Codes
44
*

packages/win32-def/src/lib/def.enum.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* eslint-disable id-length */
21

32
/**
43
* @link https://koffi.dev/input

packages/win32-def/src/lib/ffi.types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* eslint-disable @typescript-eslint/no-explicit-any */
2-
/* eslint-disable @typescript-eslint/prefer-ts-expect-error */
2+
33
import type { BigIntStr, MethodTypeUnknown } from '@waiting/shared-types'
44

55

packages/win32-def/src/lib/loader/loader.helper.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@ import koffi from 'koffi'
66
import { loadOptionsDefault } from '##/lib/config.js'
77
import { Def } from '##/lib/def.enum.js'
88
import { CallingConvention } from '##/lib/ffi.types.js'
9-
import type { FuncDefListInner, FnDefArgs, FnDefFullParams } from '##/lib/ffi.types.js'
9+
import type { FnDefArgs, FnDefFullParams, FuncDefListInner } from '##/lib/ffi.types.js'
1010
import { structFactoryMap } from '##/lib/struct/struct.factory-map.js'
1111
import type {
1212
FLib,
1313
IKoffiLib,
1414
KoffiFunction,
1515
LoadOptions,
1616
MultipleChoiceMapperList,
17-
UpdateMultipleChoiceMapperOptions,
1817
StructFactory,
18+
UpdateMultipleChoiceMapperOptions,
1919
} from '##/lib/types.js'
2020

2121
import { LoaderCache } from './loader.cache.js'
@@ -245,7 +245,7 @@ function retrieveStructTypeStringFromParams(params: string[]): string[] {
245245
// '_Inout_ POINT*' or 'POINT *' or 'POINT*'
246246
const regex = /\b(\w+)\s?\*$/u
247247
params.map((val) => {
248-
const match = val.match(regex)
248+
const match = regex.exec(val)
249249
const key = match?.[1]?.trim()
250250
if (key) {
251251
// if Def contains key, then skip

packages/win32-def/src/lib/loader/loader.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import assert from 'node:assert'
22

33
import type { DllFuncsType } from '##/lib/ffi.types.js'
4-
import type { LoadOptions, FLib } from '##/lib/types.js'
4+
import type { FLib, LoadOptions } from '##/lib/types.js'
55

66
import { processDefList } from './def.helper.js'
77
import { LoaderCache } from './loader.cache.js'

packages/win32-def/src/lib/loader/loader.types.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
/* eslint-disable @typescript-eslint/no-explicit-any */
33
import type { AsyncMethodType, MethodType } from '@waiting/shared-types'
44

5-
import type { CallingConvention, FnDefCallParams, FuncDefListInner, DllFuncsType, FnDefFullParams, FnDefRetType, FnDefParam } from '##/lib/ffi.types.js'
6-
import type { IKoffiLib, FLib, LoadOptions, MultipleChoiceMapperList } from '##/lib/types.js'
5+
import type { CallingConvention, DllFuncsType, FnDefCallParams, FnDefFullParams, FnDefParam, FnDefRetType, FuncDefListInner } from '##/lib/ffi.types.js'
6+
import type { FLib, IKoffiLib, LoadOptions, MultipleChoiceMapperList } from '##/lib/types.js'
77

88

99
export interface BindOptions<T extends object = DllFuncsType> {

packages/win32-def/src/lib/loader/multiple-choice-param.helper.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1+
/* eslint-disable @typescript-eslint/no-unnecessary-type-parameters */
12
import assert from 'node:assert'
23

34
import type { FnDefArgs } from '##/lib/ffi.types.js'
45
import type { IKoffiLib, MultipleChoiceMapperList, MultipleChoiceMapperSet } from '##/lib/types.js'
56

67
import { LoaderCache } from './loader.cache.js'
7-
import type { CreateProxyMethodOptions, CreateKoffiFunctionOpts, KoffiFunctionLike } from './loader.types.js'
8+
import type { CreateKoffiFunctionOpts, CreateProxyMethodOptions, KoffiFunctionLike } from './loader.types.js'
89

910

1011
export function createProxyMethod(options: CreateProxyMethodOptions): KoffiFunctionLike {
@@ -31,7 +32,7 @@ interface CreateFnOptions {
3132
args: unknown[]
3233
}
3334

34-
function createExecutionFn<R>(options: CreateFnOptions): R {
35+
function createExecutionFn<R = unknown>(options: CreateFnOptions): R {
3536
const { lib, name, args, type } = options
3637

3738
// args includes the last callback function for async call

packages/win32-def/src/lib/struct/struct.util.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ export type PRINTER_INFO_X_Ptr_Type<X extends PRINTER_INFO_LEVEL> = X extends 1
3333

3434

3535
export function getPRINTER_INFO_X_Ptr<X extends PRINTER_INFO_LEVEL>(level: X): PRINTER_INFO_X_Ptr_Type<X> {
36+
// eslint-disable-next-line @typescript-eslint/switch-exhaustiveness-check
3637
switch (level) {
3738
case 1: return PPRINTER_INFO_1 as PRINTER_INFO_X_Ptr_Type<X>
3839

@@ -53,6 +54,7 @@ export function getPRINTER_INFO_X_Ptr<X extends PRINTER_INFO_LEVEL>(level: X): P
5354
}
5455

5556
export function PRINTER_INFO_X_Factory<X extends PRINTER_INFO_LEVEL>(level: X): StructFactoryResult<PRINTER_INFO_X_Type<X>> {
57+
// eslint-disable-next-line @typescript-eslint/switch-exhaustiveness-check
5658
switch (level) {
5759
case 1: return PRINTER_INFO_1_Factory() as StructFactoryResult<PRINTER_INFO_X_Type<X>>
5860

packages/win32-def/src/lib/types.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
/* eslint-disable @typescript-eslint/no-explicit-any */
22
import type { ToAsyncFunction } from '@waiting/shared-types'
3-
import type { IKoffiLib, IKoffiCType, TypeSpecWithAlignment } from 'koffi'
3+
import type { IKoffiCType, IKoffiLib, TypeSpecWithAlignment } from 'koffi'
44

55
import type {
66
CallingConvention,
77
DllFuncsType,
8-
FnDefName,
98
FnDefFullParams,
9+
FnDefName,
1010
FuncDefList,
1111
} from './ffi.types.js'
1212

packages/win32-def/test/0.dummy.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { fileShortPath } from '@waiting/shared-core'
44

55
import { testConfig } from '#@/root.config.js'
66

7+
78
describe(fileShortPath(import.meta.url), () => {
89

910
describe('should work', () => {

packages/win32-def/test/def.class/20.loader.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import type { LoadOptions } from '##/index.js'
77
import { POINT_Factory } from '##/index.struct.js'
88
import type { POINT_Type } from '##/index.struct.js'
99

10-
import { DefWin32Fake, DefWin32 } from './api.helper.js'
10+
import { DefWin32, DefWin32Fake } from './api.helper.js'
1111
import type { Win32 } from './api.helper.js'
1212

1313

packages/win32-def/test/def.const/20c.loader.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import type { LoadOptions } from '##/index.js'
77
import { POINT_Factory } from '##/index.struct.js'
88
import type { POINT_Type } from '##/index.struct.js'
99

10-
import { defWin32Fake, defWin32 } from './api.helper.js'
10+
import { defWin32, defWin32Fake } from './api.helper.js'
1111
import type { Win32Fns } from './api.helper.js'
1212

1313

packages/win32-def/test/lib/24.LoaderCache.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import assert from 'node:assert'
33
import { fileShortPath } from '@waiting/shared-core'
44

55
import type { KoffiFunction } from '##/index.js'
6-
import type { MultipleChoiceMapperList, MultipleChoiceMapper, MultipleChoiceMapperSet } from '##/index.types.js'
6+
import type { MultipleChoiceMapper, MultipleChoiceMapperList, MultipleChoiceMapperSet } from '##/index.types.js'
77
import { LoaderCache } from '##/lib/loader/loader.cache.js'
88
import { loadIKoffiLib } from '##/lib/loader/loader.helper.js'
99

packages/win32-def/test/lib/31.ucsBufferToString.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import assert from 'node:assert'
22

33
import { fileShortPath } from '@waiting/shared-core'
44

5-
import { ucsBufferToString, ucsBufferFrom } from '##/lib/util.js'
5+
import { ucsBufferFrom, ucsBufferToString } from '##/lib/util.js'
66

77

88
describe(fileShortPath(import.meta.url), () => {

packages/win32-def/test/lib/struct/41.genSimpleStruct.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import assert from 'node:assert'
33
import { fileShortPath } from '@waiting/shared-core'
44

55
import type { StructInitPlainType } from '##/index.js'
6-
import { POINT_Init, LPPOINT, genSimpleStruct } from '##/index.struct.js'
6+
import { LPPOINT, POINT_Init, genSimpleStruct } from '##/index.struct.js'
77

88

99
describe(fileShortPath(import.meta.url), () => {

packages/win32-def/test/lib/struct/42.genComplexStruct.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import assert from 'node:assert'
22

33
import { fileShortPath } from '@waiting/shared-core'
44

5-
import { POINT_Init, LPPOINT, genComplexStruct } from '##/index.struct.js'
5+
import { LPPOINT, POINT_Init, genComplexStruct } from '##/index.struct.js'
66

77

88
describe(fileShortPath(import.meta.url), () => {

packages/win32-def/test/lib/struct/45.StructUnionCache.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { fileShortPath } from '@waiting/shared-core'
44

55
import * as D from '##/index.def.js'
66
import type { StructInitPlainType } from '##/index.js'
7-
import { genSimpleStruct, genUnion, POINT_Init } from '##/index.struct.js'
7+
import { POINT_Init, genSimpleStruct, genUnion } from '##/index.struct.js'
88
import { StructUnionCache } from '##/lib/struct/struct.cache.js'
99

1010

packages/win32-def/test/lib/struct/48.decodeInt16Array.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import assert from 'node:assert'
22

33
import { fileShortPath, sleep } from '@waiting/shared-core'
44

5-
import { load, decodeInt16Array } from '##/index.js'
5+
import { decodeInt16Array, load } from '##/index.js'
66
import type { LoadOptions } from '##/index.js'
77
import { DISPLAY_DEVICEW_Factory } from '##/index.struct.js'
88
import { DefWin32 } from '#@/def.class/api.helper.js'

packages/win32-def/test/lib/struct/minwinbase/402.SYSTEMTIME.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { fileShortPath } from '@waiting/shared-core'
22

3-
import { SYSTEMTIME_Factory, LPSYSTEMTIME } from '##/index.struct.js'
3+
import { LPSYSTEMTIME, SYSTEMTIME_Factory } from '##/index.struct.js'
44
import { assertStructUnion } from '#@/helper.js'
55

66

packages/win32-def/test/lib/struct/windef/301.RECT.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import assert from 'node:assert/strict'
22

33
import { fileShortPath } from '@waiting/shared-core'
44

5-
import { RECT_Factory, LPRECT } from '##/index.struct.js'
5+
import { LPRECT, RECT_Factory } from '##/index.struct.js'
66
import { assertStructUnion } from '#@/helper.js'
77

88

packages/win32-def/test/lib/struct/windef/302.POINT.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import assert from 'node:assert/strict'
22

33
import { fileShortPath } from '@waiting/shared-core'
44

5-
import { POINT_Factory, LPPOINT } from '##/index.struct.js'
5+
import { LPPOINT, POINT_Factory } from '##/index.struct.js'
66
import { assertStructUnion } from '#@/helper.js'
77

88

0 commit comments

Comments
 (0)