feat: Enhance monorepo with cross-platform utilities and advanced ESLint rules#2
Merged
Conversation
- Add .worktrees/ to ESLint ignore patterns for git worktree support - Disable base no-unused-vars in favor of @typescript-eslint/no-unused-vars - Remove unnecessary eslint-disable comments in common.ts - Add explicit rootDir to tsconfig.base.json for better path resolution 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Update package.json build scripts to use tsc --build - Configure TypeScript composite projects in tsconfig.json files - Add tsBuildInfoFile to each package for incremental builds - Update typecheck to use tsc --build --dry --force - Update clean to use tsc --build --clean - Fix ESLint ignore patterns to use **/dist/** for nested directories - Update vibe-validate to 0.18.2 Benefits: - Packages build in dependency order automatically - Incremental builds (only rebuilds what changed) - Better type checking across package boundaries - Single command builds everything correctly 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Add missing rules from vibe-agent-toolkit for better code quality:
TypeScript rules:
- @typescript-eslint/no-redundant-type-constituents: Prevent redundant type unions
- @typescript-eslint/prefer-function-type: Prefer function types over interfaces with call signatures
Unicorn rules:
- unicorn/prefer-number-properties: Use Number.isNaN() instead of isNaN()
- unicorn/no-negated-condition: Prefer positive conditions for readability
- unicorn/prefer-export-from: Simplify re-exports (export {x} from 'y')
- unicorn/prefer-structured-clone: Use structuredClone() over custom implementations
- unicorn/no-zero-fractions: Disallow 1.0 in favor of 1
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Enforce ESM import syntax over CommonJS require(): - Prevents mixing module systems - Ensures consistent ESM usage across the codebase - Aligns with moduleResolution: "NodeNext" in tsconfig This rule helps maintain modern JavaScript/TypeScript practices and prevents accidental use of CommonJS in ESM projects. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Add 'max-params': ['error', 7] rule to catch functions with too many parameters during development (before SonarQube). Matches SonarQube's threshold of 7 parameters max. Discovered in vibe-agent-toolkit when a test helper had 8 parameters and triggered a SonarQube code smell. This rule ensures similar issues are caught early by ESLint.
Add comprehensive cross-platform utilities for handling Windows 8.3 short path names (RUNNER~1) that cause test failures on Windows CI, along with custom ESLint rules to automatically enforce their usage. **New Utilities (packages/example-utils/src/):** - path-utils.ts: normalizePath(), normalizedTmpdir(), mkdirSyncReal(), isAbsolutePath(), toAbsolutePath(), getRelativePath(), toForwardSlash() - test-helpers.ts: getTestOutputDir(), getTestOutputBase() **New ESLint Rules (packages/dev-tools/eslint-local-rules/):** - no-os-tmpdir: Enforces normalizedTmpdir() instead of os.tmpdir() - no-fs-mkdirSync: Enforces mkdirSyncReal() instead of fs.mkdirSync() - no-fs-realpathSync: Enforces normalizePath() instead of fs.realpathSync() - no-unix-shell-commands: Prevents Unix-specific commands (tar, grep, ls, etc.) - no-command-direct-factory.cjs: Shared factory for command execution rules **Tests & Coverage:** - Comprehensive test suite for path-utils (path-utils.test.ts) - Platform-specific tests skip on non-matching platforms (Windows/Unix) - Excluded test-helpers.ts from coverage (test utilities) **Documentation (Progressive Disclosure):** - Detailed API docs in packages/example-utils/README.md - Brief overview in CLAUDE.md with link to README - Explains Windows 8.3 short path problem and solutions **ESLint Configuration:** - Enabled all 4 new cross-platform rules in eslint.config.js - Rules provide clear error messages with alternatives All validation passes: build, typecheck, lint (zero warnings), duplication check (zero duplicates), tests (100% passing), coverage (>80%). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
…ctory Extract helper functions to reduce cognitive complexity from 18 to 6-8: - checkShellFreeExecution(): Handle safeExecSync, spawn, etc. - checkExecSyncExecution(): Handle execSync calls - isShellFreeExecution(): Predicate to check function names - Add early return for empty arguments This refactoring eliminates SonarQube code smell while maintaining the same functionality.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2 +/- ##
============================================
- Coverage 100.00% 85.54% -14.46%
============================================
Files 1 2 +1
Lines 15 83 +68
Branches 7 27 +20
============================================
+ Hits 15 71 +56
- Misses 0 12 +12
🚀 New features to boost your workflow:
|
…platform guide - Fix toAbsolutePath test to handle platform-specific path separators - Update JSDoc to clarify platform behavior and provide usage examples - Add CROSS_PLATFORM_EXAMPLE.md with comprehensive guide demonstrating: * The Windows 8.3 short path problem * How to use each utility function * Real-world examples and use cases * ESLint enforcement explanation * Complete test suite example The test was failing on Windows because toAbsolutePath() returns platform-specific separators (\\ on Windows, / on Unix). Updated test to verify the path is absolute and contains expected components rather than exact string match. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary
This PR significantly enhances the TypeScript monorepo template with cross-platform compatibility utilities and advanced ESLint rules designed for agentic development workflows.
Key Features
🛠️ Cross-Platform Path Utilities
path-utils.tsinexample-utilspackage with Windows 8.3 short path resolutionnormalizedTmpdir()- Resolves Windows RUNNER~1 style pathsmkdirSyncReal()- Creates directories with real path resolutionnormalizePath()- Cross-platform path normalization usingrealpathSync.native()getTestOutputDir()for isolated test environments🔒 Custom ESLint Rules for Agentic Code Safety
Five new custom ESLint rules to prevent AI from reintroducing dangerous patterns:
no-os-tmpdir- EnforcesnormalizedTmpdir()overos.tmpdir()no-fs-mkdirSync- EnforcesmkdirSyncReal()for proper path handlingno-fs-realpathSync- EnforcesnormalizePath()for consistent resolutionno-unix-shell-commands- Prevents Unix-specific commands (tar, ls, grep, etc.)no-command-direct-factory- Factory pattern for creating ESLint rules with auto-fix📚 Enhanced TypeScript Configuration
tsc --buildnoPropertyAccessFromIndexSignature: truefor stricter type safety✨ Additional ESLint Rules
@typescript-eslint/no-require-imports- Enforce ES modules@typescript-eslint/max-params(4 max) - Reduce function complexity📖 Documentation Updates
Why This Matters
For Agentic Development: When working with AI code generation (Claude, Cursor, Copilot), these custom ESLint rules act as automatic guardrails that catch dangerous patterns immediately, preventing security vulnerabilities and cross-platform issues from being reintroduced.
Pattern: Identify dangerous code → Create ESLint rule → Never repeat the mistake
Testing
Files Changed
path-utils.ts,test-helpers.ts, 5 ESLint rulesCLAUDE.md,example-utils/README.md🤖 Generated with Claude Code
Co-Authored-By: Claude Sonnet 4.5 noreply@anthropic.com