feat: Add validation layer for parsed AST (closes #16)#64
Open
feat: Add validation layer for parsed AST (closes #16)#64
Conversation
This commit implements a comprehensive validation layer for the wiremd AST
that provides:
- Clear, actionable error messages with suggestions for common mistakes
- Position tracking to show line/column information when available
- Comprehensive validation rules for all component types
- Nested structure validation (e.g., buttons can't contain buttons)
- Type-aware property validation (variants, input types, etc.)
- Backward compatible with existing validation function
The enhanced validation can be enabled by passing { enhanced: true } to
the validate() function. This addresses issue #16 requirements for better
validation and error reporting.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Use temp directory with unique filenames to avoid file conflicts - Add existence check before file operations - Handle Windows file system timing issues gracefully This fixes the CI failure on Windows with Node 18.x where the test was failing with ENOENT error when trying to read test-output.html. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <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 implements the validation layer for the parsed AST as described in issue #16. The implementation provides comprehensive validation with clear, actionable error messages and full backward compatibility.
What's Included
Key Features
1. Smart Error Messages
2. Component Validation
3. Accessibility & Best Practices
Usage
Test Plan
npm test- all 488 tests passnpm run build- builds successfullyBreaking Changes
None - the enhanced validation is opt-in via options parameter.
Related
🤖 Generated with Claude Code