Skip to content

Conversation

@stefan-burke
Copy link
Member

The accumulate utility in js-toolkit/fp/array.js was exported but never called in production code, causing 98.04% function coverage. Added tests that exercise the function to achieve 100% coverage.

Also restored the function coverage threshold in bunfig.toml to 1.0.

The accumulate utility in js-toolkit/fp/array.js was exported but never
called in production code, causing 98.04% function coverage. Added tests
that exercise the function to achieve 100% coverage.

Also restored the function coverage threshold in bunfig.toml to 1.0.
This commit addresses exports from packages/js-toolkit/fp/ that were only
used in test files:

Deleted (not used in production):
- accumulate: never used anywhere
- data, toData: moved to test-utils.js (test fixture helpers)
- membershipPredicate: now private (internal impl detail for memberOf/notMemberOf)
- filterObject: now private (internal impl detail for pickTruthy/pickNonNull)

Extended test-only-exports check:
- Now checks packages/js-toolkit/fp/*.js files for test-only exports
- Added PACKAGES_FP_FILES pattern to test-utils.js
- Added PACKAGES_ALL_FILES for import analysis (includes code-quality utilities)
- omit is allowlisted since it's used via relative import in scanner.js

The principle: code should not exist just for testing. Test utilities
belong in test-utils.js, not in the production library.
- SRC_JS_FILES now includes both src/ and packages/js-toolkit/ (excluding
  test-utils/), covering all production code in one pattern
- Add SRC_ONLY_JS_FILES for src/-specific style enforcement (array-push,
  comment-limits, function-length, object-mutation)
- Remove PACKAGES_JS_FILES (redundant with unified SRC_JS_FILES)
- Simplify test-only-exports.test.js to use unified SRC_JS_FILES
- Fix type generator to handle rich-text fields (returns string, not unknown)
- Update line number in ALLOWED_MUTABLE_CONST for test-utils.js
- Remove SRC_ONLY_JS_FILES (packages follows same rules as src)
- Refactor packages/js-toolkit/code-quality/*.js to comply:
  - Remove excessive inline comments (limit: 5)
  - Refactor long functions into smaller helpers
  - Replace .push() with functional patterns (flatMap, filter)
  - Replace object mutation with Object.assign in reduce
  - Use optional chaining
- Update line number in ALLOWED_MUTABLE_CONST for test-utils.js
@stefan-burke stefan-burke merged commit fa12d57 into main Jan 19, 2026
4 checks passed
@stefan-burke stefan-burke deleted the claude/full-array-coverage-EuBBU branch January 19, 2026 06:26
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.

3 participants