Skip to content

Commit

Permalink
knip config pass 1
Browse files Browse the repository at this point in the history
  • Loading branch information
arietrouw committed Nov 1, 2024
1 parent 71306b8 commit 24584cb
Show file tree
Hide file tree
Showing 29 changed files with 51 additions and 136 deletions.
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@
"jsdelivr",
"keccak",
"keyval",
"knip",
"libauth",
"loong",
"magick",
Expand Down
31 changes: 0 additions & 31 deletions jest.config.ts

This file was deleted.

21 changes: 21 additions & 0 deletions knip.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import type { KnipConfig } from 'knip'

const config: KnipConfig = {
ignoreDependencies: ['@xylabs/ts-scripts-yarn3'],
ignore: ['xy.config.ts'],
workspaces: {
'packages/buffer': { ignoreDependencies: ['buffer'], ignore: ['xy.config.ts'] },
'packages/*': {
entry: ['src/index.ts', 'src/node/index.ts', 'src/browser/index.ts'],
ignore: ['xy.config.ts'],
},
},
typescript: {
config: [
'tsconfig.json',
'packages/**/*/tsconfig.json',
],
},
}

export default config
16 changes: 0 additions & 16 deletions packages/buffer/jest.config.cjs

This file was deleted.

2 changes: 1 addition & 1 deletion packages/buffer/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
"module": "nodenext"
},
"exclude": ["dist", "docs", "packages", "node_modules"],
"extends": "@xylabs/tsconfig-dom"
"extends": "@xylabs/tsconfig"
}
16 changes: 0 additions & 16 deletions packages/crypto/jest.config.cjs

This file was deleted.

3 changes: 1 addition & 2 deletions packages/delay/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
"devDependencies": {
"@xylabs/ts-scripts-yarn3": "^4.2.3",
"@xylabs/tsconfig": "^4.2.3",
"@xylabs/tsconfig-dom": "^4.2.3",
"typescript": "^5.6.3",
"vitest": "^2.1.4"
},
Expand All @@ -51,4 +50,4 @@
"publishConfig": {
"access": "public"
}
}
}
3 changes: 0 additions & 3 deletions packages/delay/src/spec/tsconfig.json

This file was deleted.

2 changes: 1 addition & 1 deletion packages/hex/src/assert.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export type AssertCallback = (value: unknown, message: string) => string | boolean
type AssertCallback = (value: unknown, message: string) => string | boolean

export type AssertConfig = string | AssertCallback | boolean

Expand Down
2 changes: 0 additions & 2 deletions packages/jest-helpers/src/tags/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,3 @@ export const NOT_SYMBOL = '!'
export const AND_SYMBOL = '&&'

export const OR_SYMBOL = '||'

export const RESERVED_COMMANDS = ['--tags']
2 changes: 1 addition & 1 deletion packages/jest-helpers/src/tags/regexps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {
AND_SYMBOL, NOT_SYMBOL, OR_SYMBOL,
} from './config.ts'

export const escape = (str: string) => [...str].map(symbol => `\\${symbol}`).join('')
const escape = (str: string) => [...str].map(symbol => `\\${symbol}`).join('')

export const AND_REGX = new RegExp(`\\s*${escape(AND_SYMBOL)}\\s*`)

Expand Down
8 changes: 0 additions & 8 deletions packages/jest-helpers/src/tags/utils.ts

This file was deleted.

2 changes: 1 addition & 1 deletion packages/meta/src/lib/getMetaAsDict.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export type StringIndexable = { [key: string]: any }

export const propertyDelimiter = ':'
const propertyDelimiter = ':'

export const getMetaAsDict = (obj: StringIndexable, parentKey = ''): Record<string, string> => {
let flatRecord: StringIndexable = {}
Expand Down
3 changes: 2 additions & 1 deletion packages/object/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
"dependencies": {
"@xylabs/assert": "^4.3.4",
"@xylabs/logger": "^4.3.4",
"@xylabs/promise": "^4.3.4"
"@xylabs/promise": "^4.3.4",
"@xylabs/typeof": "workspace:^"
},
"devDependencies": {
"@xylabs/ts-scripts-yarn3": "^4.2.3",
Expand Down
2 changes: 1 addition & 1 deletion packages/object/src/IsObjectFactory.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { TypedObject } from '@xylabs/promise'
import type { ObjectTypeShape } from '@xylabs/typeof'

import type { TypeCheck, TypeCheckConfig } from './AsTypeFactory.ts'
import type { ObjectTypeShape } from './isType.ts'
import { isType } from './isType.ts'

export interface ObjectTypeConfig extends TypeCheckConfig {}
Expand Down
4 changes: 1 addition & 3 deletions packages/object/src/isType.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
export type FieldType = 'string' | 'number' | 'object' | 'symbol' | 'symbol' | 'undefined' | 'null' | 'array' | 'function'

export type ObjectTypeShape = Record<string | number | symbol, FieldType>
import type { FieldType } from '@xylabs/typeof'

export const isType = (value: unknown, expectedType: FieldType) => {
const typeofValue = typeof value
Expand Down
16 changes: 0 additions & 16 deletions packages/platform/jest.config.cjs

This file was deleted.

3 changes: 3 additions & 0 deletions packages/promise/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@
},
"module": "./dist/neutral/index.mjs",
"types": "./dist/neutral/index.d.ts",
"dependencies": {
"@xylabs/typeof": "workspace:^"
},
"devDependencies": {
"@xylabs/ts-scripts-yarn3": "^4.2.3",
"@xylabs/tsconfig": "^4.2.3",
Expand Down
2 changes: 1 addition & 1 deletion packages/promise/src/Typed.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { isType } from './isType.ts'
import { isType } from '@xylabs/typeof'

// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
export type TypedValue = bigint | string | number | boolean | null | TypedObject | TypedArray | Function | symbol | undefined
Expand Down
2 changes: 1 addition & 1 deletion packages/threads/src/master/get-bundle-url.browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ function getBaseURL(url: string): string {
return ('' + url).replace(/^((?:https?|file|ftp|chrome-extension|moz-extension):\/\/.+)?\/[^/]+(?:\?.*)?$/, '$1') + '/'
}

export { getBaseURL, getBundleURLCached as getBundleURL }
export { getBundleURLCached as getBundleURL }
2 changes: 1 addition & 1 deletion packages/threads/src/master/pool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export interface Pool<ThreadType extends Thread> {
terminate(force?: boolean): Promise<void>
}

export interface PoolOptions {
interface PoolOptions {
/** Maximum no. of tasks to run on one worker thread at a time. Defaults to one. */
concurrency?: number

Expand Down
4 changes: 2 additions & 2 deletions packages/threads/src/types/master.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ export type StripAsync<Type> =
: Type extends ObservableLike<infer ObservableBaseType> ? ObservableBaseType
: Type

export type StripTransfer<Type> = Type extends TransferDescriptor<infer BaseType> ? BaseType : Type
type StripTransfer<Type> = Type extends TransferDescriptor<infer BaseType> ? BaseType : Type

export type ModuleMethods = { [methodName: string]: (...args: any) => any }

export type ProxyableArgs<Args extends any[]> =
type ProxyableArgs<Args extends any[]> =
Args extends [arg0: infer Arg0, ...rest: infer RestArgs] ? [Arg0 extends Transferable ? Arg0 | TransferDescriptor<Arg0> : Arg0, ...RestArgs] : Args

export type ProxyableFunction<Args extends any[], ReturnType> =
Expand Down
9 changes: 0 additions & 9 deletions packages/threads/src/types/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ export type MasterJobRunMessage = {
args: any[]
}

export type MasterSentMessage = MasterJobCancelMessage | MasterJobRunMessage

////////////////////////////
// Messages sent by worker:

Expand Down Expand Up @@ -72,10 +70,3 @@ export type WorkerJobStartMessage = {
uid: number
resultType: 'observable' | 'promise'
}

export type WorkerSentMessage =
| WorkerInitMessage
| WorkerJobErrorMessage
| WorkerJobResultMessage
| WorkerJobStartMessage
| WorkerUncaughtErrorMessage
3 changes: 3 additions & 0 deletions packages/typeof/src/ObjectTypeShape.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export type FieldType = 'string' | 'number' | 'object' | 'symbol' | 'symbol' | 'undefined' | 'null' | 'array' | 'function'

export type ObjectTypeShape = Record<string | number | symbol, FieldType>
2 changes: 2 additions & 0 deletions packages/typeof/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
export * from './ifDefined.ts'
export * from './ifTypeOf.ts'
export * from './isType.ts'
export * from './ObjectTypeShape.ts'
export * from './typeOf.ts'
export * from './TypeOfTypes.ts'
export * from './validateType.ts'
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
export type FieldType = 'string' | 'number' | 'object' | 'symbol' | 'symbol' | 'undefined' | 'null' | 'array' | 'function'

export type ObjectTypeShape = Record<string | number | symbol, FieldType>
import type { FieldType } from './ObjectTypeShape.ts'

export const isType = (value: unknown, expectedType: FieldType) => {
const typeofValue = typeof value
Expand Down
16 changes: 0 additions & 16 deletions packages/url/jest.config.cjs

This file was deleted.

4 changes: 4 additions & 0 deletions packages/url/src/browser/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"exclude": ["dist", "docs", "packages", "node_modules"],
"extends": "@xylabs/tsconfig-dom"
}
2 changes: 2 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4244,6 +4244,7 @@ __metadata:
"@xylabs/promise": "npm:^4.3.4"
"@xylabs/ts-scripts-yarn3": "npm:^4.2.3"
"@xylabs/tsconfig": "npm:^4.2.3"
"@xylabs/typeof": "workspace:^"
typescript: "npm:^5.6.3"
languageName: unknown
linkType: soft
Expand Down Expand Up @@ -4275,6 +4276,7 @@ __metadata:
dependencies:
"@xylabs/ts-scripts-yarn3": "npm:^4.2.3"
"@xylabs/tsconfig": "npm:^4.2.3"
"@xylabs/typeof": "workspace:^"
"@xylabs/vitest-extended": "workspace:^"
typescript: "npm:^5.6.3"
vitest: "npm:^2.1.4"
Expand Down

0 comments on commit 24584cb

Please sign in to comment.