Skip to content

fix: audit fixes — deps, CI, types, a11y, dead code, and edge cases#13

Open
dnvt wants to merge 18 commits intomainfrom
claude/evaluate-pretext-height-eMFq5
Open

fix: audit fixes — deps, CI, types, a11y, dead code, and edge cases#13
dnvt wants to merge 18 commits intomainfrom
claude/evaluate-pretext-height-eMFq5

Conversation

@dnvt
Copy link
Copy Markdown
Owner

@dnvt dnvt commented Mar 30, 2026

  • Move esbuild/postcss-preset-env from dependencies to devDependencies
    (saves ~9MB for consumers)
  • Fix CI lint step that was running typecheck twice instead of lint
  • Fix useVirtual declaration ordering (updateRange/updateRangeThrottled
    declared before use) and remove brittle .block magic selector
  • Add aria-hidden="true" to Baseline and Guide overlay components
  • Guard normalizeValue against base=0 (prevents NaN)
  • Gate console.warn/error behind NODE_ENV === 'development'
  • Export missing public types: SnappingMode, BaselineVariant,
    PaddingValue, Variant
  • Remove dead handleGapCalculations code in Guide; use columnsCount
    from useGuide directly
  • Support 3-element padding arrays (CSS shorthand: top, inline, bottom)
  • Update tests to match corrected column counts and NODE_ENV gating

https://claude.ai/code/session_01AVnTtoUi9mcd1d7vtWG915

claude added 6 commits March 30, 2026 12:12
- Move esbuild/postcss-preset-env from dependencies to devDependencies
  (saves ~9MB for consumers)
- Fix CI lint step that was running typecheck twice instead of lint
- Fix useVirtual declaration ordering (updateRange/updateRangeThrottled
  declared before use) and remove brittle .block magic selector
- Add aria-hidden="true" to Baseline and Guide overlay components
- Guard normalizeValue against base=0 (prevents NaN)
- Gate console.warn/error behind NODE_ENV === 'development'
- Export missing public types: SnappingMode, BaselineVariant,
  PaddingValue, Variant
- Remove dead handleGapCalculations code in Guide; use columnsCount
  from useGuide directly
- Support 3-element padding arrays (CSS shorthand: top, inline, bottom)
- Update tests to match corrected column counts and NODE_ENV gating

https://claude.ai/code/session_01AVnTtoUi9mcd1d7vtWG915
Dependency updates (all latest within compatible major versions):
- @changesets/cli: 2.28 → 2.30
- @eslint/js: 9.21 → 9.39
- @testing-library/jest-dom: 6.6 → 6.9
- @testing-library/react: 16.2 → 16.3
- @types/node: 22.13 → 22.19
- @types/react: 19.0 → 19.2
- @types/react-dom: 19.0 → 19.2
- @typescript-eslint/*: 8.26 → 8.57
- @vitejs/plugin-react-swc: 3.8 → 4.3
- @vitest/coverage-v8: 3.0 → 3.2
- autoprefixer: 10.4.20 → 10.4.27
- cssnano: 7.0 → 7.1
- esbuild: 0.25.0 → 0.25.12
- eslint: 9.0 → 9.39
- eslint-config-prettier: 10.1.1 → 10.1.8
- eslint-plugin-prettier: 5.2 → 5.5
- eslint-plugin-react: 7.37.4 → 7.37.5
- jsdom: 26.0 → 26.1
- postcss-preset-env: 10.1 → 10.6
- prettier: 3.5 → 3.8
- rollup: 4.34 → 4.41
- rollup-plugin-dts: 6.1 → 6.4
- vite: 6.2 → 6.4
- vite-plugin-static-copy: 2.3.0 → 2.3.2
- vitest: 3.0 → 3.2

Also adds react/react-dom as explicit devDependencies for testing,
adds @testing-library/dom as explicit dependency, and widens
typescript peer dep range to include ^5.9.0.

https://claude.ai/code/session_01AVnTtoUi9mcd1d7vtWG915
…nv 11

Major version bumps:
- vite: 6.4 → 8.0 (rolldown-based bundler)
- vitest: 3.2 → 4.1
- @vitest/coverage-v8: 3.2 → 4.1
- postcss-preset-env: 10.6 → 11.2
- vite-plugin-static-copy: 2.3 → 4.0

Breaking changes fixed:
- Vite 8/rolldown: CSS from non-module files (base.css, reset.css) no longer
  auto-bundled — added explicit core.css import to src/index.ts
- vite-plugin-static-copy v4: dest path handling changed — use
  rename.stripBase for flat copy
- Vitest 4: vi.fn() arrow functions no longer usable as constructors —
  converted IntersectionObserver/ResizeObserver mocks to class syntax
- Removed esbuild from devDependencies (bundled with Vite 8 via rolldown)

ESLint stays at v9 because eslint-plugin-react and
eslint-plugin-react-hooks don't yet support ESLint 10.

https://claude.ai/code/session_01AVnTtoUi9mcd1d7vtWG915
The old name is deprecated in Vite 8 and will be removed in a future
version.

https://claude.ai/code/session_01AVnTtoUi9mcd1d7vtWG915
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e3740f89f2

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

<div
ref={containerRef}
data-testid="guide"
aria-hidden="true"
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Stop hiding Guide children from assistive tech

Applying aria-hidden="true" to the root Guide container removes all descendants from the accessibility tree, so any content passed via children becomes unreadable by screen readers when Guide is used as a wrapper. This regression affects real usage because GuideProps explicitly supports children; keep aria-hidden only on decorative overlay elements, not on the container that renders app content.

Useful? React with 👍 / 👎.

claude added 12 commits March 30, 2026 20:43
… packages

Restructure the codebase into three layered packages:
- @baseline-kit/core: Pure TypeScript types, utilities, config, and validation (zero deps)
- @baseline-kit/dom: DOM utilities for timing, SSR detection (depends on core)
- @baseline-kit/react: React adapter with hooks, components, and React-specific utils

All 178 tests pass, typecheck clean, build succeeds. Root src/index.ts
re-exports from @baseline-kit/react for backwards compatibility.

https://claude.ai/code/session_01AVnTtoUi9mcd1d7vtWG915
…tion

- Delete 57 old src/ files (all duplicated in packages/)
- Remove dead CSS import files (styles.ts, theme.ts, components/styles/index.ts)
- Remove dead validation re-export (Guide/validation.ts)
- Inline color constants in core/config/defaults.ts
- Hoist CSS_UNITS array out of isGuideValue function (core/validation/guide.ts)
- Import BaselineVariant and SnappingMode from core instead of redefining
- Remove unused testUtils import from useVirtual test
- Update vitest coverage exclude to reference packages/

https://claude.ai/code/session_01AVnTtoUi9mcd1d7vtWG915
Core purity improvements:
- convert.ts: lazy viewport resolution instead of module-load-time window access
- convert.ts: use mapping object for relative unit resolution (replaces switch)
- normalize.ts: remove console.warn/error and process.env.NODE_ENV coupling
- padding.ts: simplify parsePaddingValue with CSS-like shorthand logic
- config/merge.ts: use loop for repetitive shallow merges
- config/schema.ts: rename Colors → DebugColors for clarity
- validation/guide.ts: use direct imports to avoid circular dependency

Extract pure logic from React hooks to core:
- Move 130-line grid calculation from useGuide hook → core calculateGuideTemplate()
- useGuide hook reduced to 5 lines (useMemo wrapping the core function)
- useBaseline: remove console.warn/process.env, deprecate warnOnMisalignment
- GuideResult type now lives in core (re-exported from react)

Bundle size reduced ~5% (ESM: 36.09→34.28 kB, CJS: 26.49→25.23 kB)

https://claude.ai/code/session_01AVnTtoUi9mcd1d7vtWG915
…ctly

- Delete packages/react/src/components/Guide/types.ts (150 lines)
- Guide.tsx now imports GuideConfig from @baseline-kit/core directly
- Remove type cast (as CoreGuideConfig) — no longer needed
- Simplify createGridConfig: flatten params, remove intermediate type wrapper

https://claude.ai/code/session_01AVnTtoUi9mcd1d7vtWG915
Extract all render computation into pure descriptor functions in
@baseline-kit/core. React components become thin wiring layers that
call hooks and pass results to descriptors. This enables future
framework adapters (Vue, Svelte, Web Components) to reuse all
layout/style logic without React dependency.

- Add 7 descriptor functions: createBaselineDescriptor, createBoxDescriptor,
  createGuideDescriptor, createLayoutDescriptor, createPadderDescriptor,
  createSpacerDescriptor, createStackDescriptor
- Refactor all React components to use descriptors instead of inline computation
- Fix createStyleOverride return type to Record<string, string>
- All 177 tests pass, typecheck clean, bundle: 35.61 kB ESM

https://claude.ai/code/session_01AVnTtoUi9mcd1d7vtWG915
- baseline: remove redundant color fallback in getRowStyle
- layout: extract duplicate grid template default to constant
- stack: remove redundant direct width/height properties (CSS vars suffice)
- padder: remove unreachable || fallback in conditional assignments

https://claude.ai/code/session_01AVnTtoUi9mcd1d7vtWG915
…kens

CSS Variable Convention:
- Consistent --bk{CC}-{prop} pattern across all components
  (bl=baseline, bx=box, gd=guide, ly=layout, pd=padder, sp=spacer, sk=stack)
- Fix Box descriptor/CSS mismatch (--bkbox* vs --bkx* → unified --bkbx-*)
- System vars: --bk-base, --bk-zi, --bk-zio, --bk-wf, --bk-hf

Class Name Utility:
- Rename mergeClasses → cx (standard convention, lighter API)

Framework-Agnostic Class Tokens:
- All 7 descriptors now return classTokens: string[] arrays
- React components map tokens to CSS module classes via
  cx(...descriptor.classTokens.map(t => styles[t]), className)
- Class logic decisions (visibility, variant) moved from React to core

All 177 tests pass, typecheck clean, build: 36.25 kB ESM

https://claude.ai/code/session_01AVnTtoUi9mcd1d7vtWG915
…ead code

- Remove window access from core convert.ts (static 1920x1080 defaults)
- Extract resolveDebugState to core, simplify useDebug hook
- Remove unused functions: moduloize, round, 5 guide validators
- Remove console.error from mergeRefs, simplify assignRef
- Remove redundant resize listeners from Baseline and Guide
- Eliminate all `as React.CSSProperties` casts from components
- Hoist Padder static grid styles as constants
- Update test expectations for static viewport defaults

https://claude.ai/code/session_01AVnTtoUi9mcd1d7vtWG915
…nents

1. @baseline-kit/dom — imperative DOM observers:
   - createMeasureObserver: ResizeObserver wrapper with disconnect handle
   - createVirtualTracker: virtual scroll range tracker with IntersectionObserver

2. React hooks refactored to use dom observers:
   - useMeasure now wraps createMeasureObserver (~40 lines → thin wrapper)
   - useVirtual now wraps createVirtualTracker (~90 lines → thin wrapper)

3. @baseline-kit/lit — Lit web components (decorator-free):
   - <bk-config>: context provider (ContextProvider from @lit/context)
   - <bk-baseline>: baseline grid overlay with virtual scrolling
   - <bk-guide>: column guide overlay with responsive measurement
   - <bk-box>: debug-bordered container
   - <bk-stack>: flex layout with directional stacking
   - <bk-layout>: CSS grid layout container
   - <bk-padder>: padding container with spacer visualization
   - <bk-spacer>: visual spacing indicator
   - BkBase: shared base class with config context consumption

All components use core descriptors and dom observers — zero logic duplication.

https://claude.ai/code/session_01AVnTtoUi9mcd1d7vtWG915
- Refactor createGuideConfig to take options object (eslint max-params)
- Remove unused imports: nothing, ConfigSchema, BaselineVariant, GuideVariant, Variant, i
- Remove lit/@lit/context from root package.json (belongs in packages/lit only)

https://claude.ai/code/session_01AVnTtoUi9mcd1d7vtWG915
Bun workspaces need these hoisted at root for typecheck to find
the lit type declarations in CI. Also adds missing @lit/context
to packages/lit/package.json.

https://claude.ai/code/session_01AVnTtoUi9mcd1d7vtWG915
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants