Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .changeset/fix-lint-warnings.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
---
16 changes: 8 additions & 8 deletions packages/bundler/src/utils/clean.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ function makeResolved(
}
}

describe('clean', () => {
describe(clean, () => {
beforeEach(() => {
mkdirSync(testDir, { recursive: true })
})
Expand All @@ -65,8 +65,8 @@ describe('clean', () => {

expect(result.removed).toContain('index.js')
expect(result.removed).toContain('index.js.map')
expect(existsSync(join(testDir, 'index.js'))).toBe(false)
expect(existsSync(join(testDir, 'index.js.map'))).toBe(false)
expect(existsSync(join(testDir, 'index.js'))).toBeFalsy()
expect(existsSync(join(testDir, 'index.js.map'))).toBeFalsy()
})

it('should preserve foreign files and report them', async () => {
Expand All @@ -77,7 +77,7 @@ describe('clean', () => {

expect(result.removed).toContain('index.js')
expect(result.foreign).toContain('README.md')
expect(existsSync(join(testDir, 'README.md'))).toBe(true)
expect(existsSync(join(testDir, 'README.md'))).toBeTruthy()
})

it('should not remove extensionless files when compile is false', async () => {
Expand All @@ -86,7 +86,7 @@ describe('clean', () => {
const result = await clean({ resolved: makeResolved(), compile: false })

expect(result.foreign).toContain('cli-darwin-arm64')
expect(existsSync(join(testDir, 'cli-darwin-arm64'))).toBe(true)
expect(existsSync(join(testDir, 'cli-darwin-arm64'))).toBeTruthy()
})

it('should remove exact binary names when compile is true', async () => {
Expand All @@ -107,9 +107,9 @@ describe('clean', () => {
expect(result.removed).toContain('my-app-darwin-arm64')
expect(result.removed).toContain('my-app-linux-x64')
expect(result.foreign).toContain('README.md')
expect(existsSync(join(testDir, 'my-app-darwin-arm64'))).toBe(false)
expect(existsSync(join(testDir, 'my-app-linux-x64'))).toBe(false)
expect(existsSync(join(testDir, 'README.md'))).toBe(true)
expect(existsSync(join(testDir, 'my-app-darwin-arm64'))).toBeFalsy()
expect(existsSync(join(testDir, 'my-app-linux-x64'))).toBeFalsy()
expect(existsSync(join(testDir, 'README.md'))).toBeTruthy()
})

it('should remove windows .exe binary names in multi-target builds', async () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/lib/config-helpers.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { describe, expect, it } from 'vitest'

import { extractConfig } from './config-helpers.js'

describe('extractConfig', () => {
describe(extractConfig, () => {
it('should return the config from a non-null result', () => {
const result = { config: { entry: './src/main.ts' }, configFile: '/project/kidd.config.ts' }

Expand Down
2 changes: 1 addition & 1 deletion packages/cli/tsdown.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default defineConfig({
clean: true,
deps: {
// Bundle @kidd-cli/* packages so the published CLI is self-contained and
// does not depend on workspace packages being published with correct exports.
// Does not depend on workspace packages being published with correct exports.
alwaysBundle: [/^@kidd-cli\//],
// Keep packages with native bindings external — they cannot be inlined.
neverBundle: ['tsdown', /^@rolldown\//, /^rolldown/],
Expand Down
3 changes: 2 additions & 1 deletion packages/core/src/context/resolve-defaults.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,10 @@ describe('mergeClackOpts()', () => {
})
})

// eslint-disable-next-line vitest/prefer-describe-function-title -- constant, not a function
describe('EMPTY_CLACK_BASE', () => {
it('should be a frozen empty object', () => {
expect(Object.isFrozen(EMPTY_CLACK_BASE)).toBe(true)
expect(Object.isFrozen(EMPTY_CLACK_BASE)).toBeTruthy()
expect(Object.keys(EMPTY_CLACK_BASE)).toEqual([])
})
})
6 changes: 3 additions & 3 deletions packages/core/src/context/status.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ beforeEach(() => {
describe('createContextStatus()', () => {
it('should return a frozen object', () => {
const status = createContextStatus()
expect(Object.isFrozen(status)).toBe(true)
expect(Object.isFrozen(status)).toBeTruthy()
})

it('should have spinner, progress, tasks, and taskLog', () => {
Expand Down Expand Up @@ -200,8 +200,8 @@ describe('createContextStatus()', () => {
it('should convert readonly frames to a mutable array', () => {
const frames = ['a', 'b', 'c'] as const
createContextStatus({ spinnerConfig: { frames } })
const call = (clack.spinner as Mock).mock.calls[0][0]
expect(Array.isArray(call.frames)).toBe(true)
const [[call]] = (clack.spinner as Mock).mock.calls
expect(Array.isArray(call.frames)).toBeTruthy()
expect(call.frames).toEqual(['a', 'b', 'c'])
})

Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/context/status.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export function createContextStatus(options?: CreateContextStatusOptions): Statu

async tasks(tasks: readonly TaskDef[]): Promise<void> {
// Accepted exception: kidd's TaskDef.task returns `Promise<string | void>`,
// clack expects separate `Promise<string> | Promise<void>`. The cast bridges this.
// Clack expects separate `Promise<string> | Promise<void>`. The cast bridges this.
await clack.tasks(
tasks.map((t) => ({
title: t.title,
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/lib/log.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ describe('createLog()', () => {
describe('stream', () => {
it('should call clack.stream.info with iterable', async () => {
const log = createLog()
const iterable = (async function* () {
const iterable = (async function* streamChunks() {
yield 'chunk'
})()

Expand Down Expand Up @@ -227,7 +227,7 @@ describe('createLog()', () => {
it('should return a frozen object', () => {
const log = createLog()

expect(Object.isFrozen(log)).toBe(true)
expect(Object.isFrozen(log)).toBeTruthy()
})
})
})
4 changes: 3 additions & 1 deletion packages/core/src/middleware/config/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,9 @@ function validateConfig(
schema: ZodTypeAny,
context?: string
): Result<ConfigLoadCallResult<unknown>> {
const prefix = context ? `Invalid ${context} config` : 'Invalid config'
const prefix = match(context)
.with(P.string, (ctx) => `Invalid ${ctx} config`)
.otherwise(() => 'Invalid config')
const [validationError, validated] = validate({
createError: ({ message }) => new Error(`${prefix}:\n${message}`),
params: data,
Expand Down
20 changes: 10 additions & 10 deletions packages/core/src/screen/output/screen-log.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ import { describe, expect, it } from 'vitest'
import { createScreenLog } from './screen-log.js'
import { createOutputStore } from './store.js'

describe('createScreenLog', () => {
describe(createScreenLog, () => {
it('should push an info log entry', () => {
const store = createOutputStore()
const log = createScreenLog(store)

log.info('hello')

const entries = store.getSnapshot().entries
const { entries } = store.getSnapshot()
expect(entries).toHaveLength(1)
expect(entries[0]).toMatchObject({ kind: 'log', level: 'info', text: 'hello' })
})
Expand All @@ -21,7 +21,7 @@ describe('createScreenLog', () => {

log.success('done')

const entries = store.getSnapshot().entries
const { entries } = store.getSnapshot()
expect(entries).toHaveLength(1)
expect(entries[0]).toMatchObject({ kind: 'log', level: 'success', text: 'done' })
})
Expand All @@ -32,7 +32,7 @@ describe('createScreenLog', () => {

log.error('fail')

const entries = store.getSnapshot().entries
const { entries } = store.getSnapshot()
expect(entries).toHaveLength(1)
expect(entries[0]).toMatchObject({ kind: 'log', level: 'error', text: 'fail' })
})
Expand All @@ -43,7 +43,7 @@ describe('createScreenLog', () => {

log.warn('careful')

const entries = store.getSnapshot().entries
const { entries } = store.getSnapshot()
expect(entries).toHaveLength(1)
expect(entries[0]).toMatchObject({ kind: 'log', level: 'warn', text: 'careful' })
})
Expand All @@ -54,7 +54,7 @@ describe('createScreenLog', () => {

log.step('installing')

const entries = store.getSnapshot().entries
const { entries } = store.getSnapshot()
expect(entries).toHaveLength(1)
expect(entries[0]).toMatchObject({ kind: 'log', level: 'step', text: 'installing' })
})
Expand All @@ -65,7 +65,7 @@ describe('createScreenLog', () => {

log.message('note', { symbol: '>' })

const entries = store.getSnapshot().entries
const { entries } = store.getSnapshot()
expect(entries).toHaveLength(1)
expect(entries[0]).toMatchObject({
kind: 'log',
Expand All @@ -81,7 +81,7 @@ describe('createScreenLog', () => {

log.message('bare')

const entries = store.getSnapshot().entries
const { entries } = store.getSnapshot()
expect(entries).toHaveLength(1)
expect(entries[0]).toMatchObject({ kind: 'log', level: 'message', text: 'bare' })
expect(entries[0]).toHaveProperty('symbol', undefined)
Expand All @@ -93,7 +93,7 @@ describe('createScreenLog', () => {

log.newline()

const entries = store.getSnapshot().entries
const { entries } = store.getSnapshot()
expect(entries).toHaveLength(1)
expect(entries[0]).toMatchObject({ kind: 'newline' })
})
Expand All @@ -104,7 +104,7 @@ describe('createScreenLog', () => {

log.raw('raw text')

const entries = store.getSnapshot().entries
const { entries } = store.getSnapshot()
expect(entries).toHaveLength(1)
expect(entries[0]).toMatchObject({ kind: 'raw', text: 'raw text' })
})
Expand Down
10 changes: 5 additions & 5 deletions packages/core/src/screen/output/screen-report.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ import { describe, expect, it } from 'vitest'
import { createScreenReport } from './screen-report.js'
import { createOutputStore } from './store.js'

describe('createScreenReport', () => {
describe(createScreenReport, () => {
it('should push a check entry to the store', () => {
const store = createOutputStore()
const report = createScreenReport(store)
const input = { name: 'lint check', status: 'pass' as const }

report.check(input)

const entries = store.getSnapshot().entries
const { entries } = store.getSnapshot()
expect(entries).toHaveLength(1)
expect(entries[0]).toMatchObject({ kind: 'check', input })
})
Expand All @@ -27,7 +27,7 @@ describe('createScreenReport', () => {

report.finding(input)

const entries = store.getSnapshot().entries
const { entries } = store.getSnapshot()
expect(entries).toHaveLength(1)
expect(entries[0]).toMatchObject({ kind: 'finding', input })
})
Expand All @@ -45,7 +45,7 @@ describe('createScreenReport', () => {

report.summary(input)

const entries = store.getSnapshot().entries
const { entries } = store.getSnapshot()
expect(entries).toHaveLength(1)
expect(entries[0]).toMatchObject({ kind: 'summary', input })
})
Expand All @@ -60,7 +60,7 @@ describe('createScreenReport', () => {

report.summary(input)

const entries = store.getSnapshot().entries
const { entries } = store.getSnapshot()
expect(entries).toHaveLength(1)
expect(entries[0]).toMatchObject({ kind: 'summary', input })
})
Expand Down
8 changes: 4 additions & 4 deletions packages/core/src/screen/output/screen-spinner.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,15 @@ describe('createScreenSpinner()', () => {
const store = createOutputStore()
const spinner = createScreenSpinner(store)

expect(spinner.isCancelled).toBe(false)
expect(spinner.isCancelled).toBeFalsy()

spinner.start()
expect(spinner.isCancelled).toBe(false)
expect(spinner.isCancelled).toBeFalsy()

spinner.cancel()
expect(spinner.isCancelled).toBe(true)
expect(spinner.isCancelled).toBeTruthy()

spinner.clear()
expect(spinner.isCancelled).toBe(false)
expect(spinner.isCancelled).toBeFalsy()
})
})
4 changes: 2 additions & 2 deletions packages/core/src/screen/output/store.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ describe('createOutputStore()', () => {

const snapshot = store.getSnapshot()

expect(Object.isFrozen(snapshot)).toBe(true)
expect(Object.isFrozen(snapshot.entries)).toBe(true)
expect(Object.isFrozen(snapshot)).toBeTruthy()
expect(Object.isFrozen(snapshot.entries)).toBeTruthy()
})
})
11 changes: 6 additions & 5 deletions packages/core/src/stories/check.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { z } from 'zod'
import { MAX_EDITABLE_FIELDS, checkStories } from './check.js'
import type { Story, StoryEntry, StoryGroup } from './types.js'

// eslint-disable-next-line vitest/prefer-describe-function-title -- constant, not a function
describe('MAX_EDITABLE_FIELDS', () => {
it('should equal 6', () => {
expect(MAX_EDITABLE_FIELDS).toBe(6)
Expand Down Expand Up @@ -37,7 +38,7 @@ describe('checkStories()', () => {
const result = checkStories(entries)

expect(result.storyCount).toBe(1)
expect(result.passed).toBe(true)
expect(result.passed).toBeTruthy()
expect(result.diagnostics).toHaveLength(0)
})

Expand Down Expand Up @@ -193,7 +194,7 @@ describe('checkStories()', () => {

const entries = new Map<string, StoryEntry>([['ok', okStory]])
const passingResult = checkStories(entries)
expect(passingResult.passed).toBe(true)
expect(passingResult.passed).toBeTruthy()

const schema = z.object({ n: z.number() })
const badStory = withTag(
Expand All @@ -211,14 +212,14 @@ describe('checkStories()', () => {

const failEntries = new Map<string, StoryEntry>([['bad', badStory]])
const failingResult = checkStories(failEntries)
expect(failingResult.passed).toBe(false)
expect(failingResult.passed).toBeFalsy()
})

it('should return a frozen result', () => {
const entries = new Map<string, StoryEntry>()
const result = checkStories(entries)

expect(Object.isFrozen(result)).toBe(true)
expect(Object.isFrozen(result.diagnostics)).toBe(true)
expect(Object.isFrozen(result)).toBeTruthy()
expect(Object.isFrozen(result.diagnostics)).toBeTruthy()
})
})
4 changes: 2 additions & 2 deletions packages/core/src/ui/keys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ export function normalizeKey(input: string, key: Key): NormalizedKeyEvent {
return {
key: resolvedKey,
ctrl: key.ctrl,
// Terminal escape (\x1b) doubles as the meta prefix — clear the meta
// flag when the resolved key is 'escape' since it is protocol noise.
// Terminal escape (\x1b) doubles as the meta prefix — Clear the meta
// Flag when the resolved key is 'escape' since it is protocol noise.
meta: match(resolvedKey)
.with('escape', () => false)
.otherwise(() => key.meta),
Expand Down
Loading
Loading