Add ESLint rules for cross-platform path normalization#3
Merged
Conversation
Add three new custom ESLint rules to catch path operation issues before CI:
1. no-manual-path-normalize: Detects manual .split(path.sep).join('/')
- Suggests using toForwardSlash() utility instead
- Auto-fix replaces manual normalization with utility call
2. no-path-sep-in-strings: Prevents using path.sep in string operations
- Catches split(), includes(), indexOf(), etc. with path.sep
- Prevents platform-specific separator issues
3. no-path-operations-in-comparisons: Requires normalizing path operations
- Detects path.relative/dirname/basename/join in string comparisons
- Prevents Windows backslash vs. Unix forward slash mismatches
These rules shift-left cross-platform path bugs from CI to lint time.
Ported from vibe-agent-toolkit where they caught real Windows CI failures.
All validation passed: lint, typecheck, tests, duplication check.
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3 +/- ##
=======================================
Coverage 85.54% 85.54%
=======================================
Files 2 2
Lines 83 83
Branches 17 17
=======================================
Hits 71 71
Misses 12 12 🚀 New features to boost your workflow:
|
|
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
Adds three new custom ESLint rules to catch cross-platform path operation issues during development, before they reach CI.
These rules were proven effective in vibe-agent-toolkit, where they caught real Windows CI failures related to path separator mismatches.
New Rules
1.
no-manual-path-normalize.split(path.sep).join('/')toForwardSlash()from@ts-monorepo-template/example-utils2.
no-path-sep-in-stringspath.sepin string operations (split(),includes(), etc.)\\vs Unix/)toForwardSlash()before string operations3.
no-path-operations-in-comparisonscontent.includes(path.relative(baseDir, file))fails on WindowstoForwardSlash()before comparisonsBenefits
Validation
All checks passed:
Related
Ported from vibe-agent-toolkit commit 3506451 which fixed Windows CI failures.
🤖 Generated with Claude Code