feat: add useParentheses configuration option#5
Open
steffen-heil-secforge wants to merge 3 commits intomainfrom
Open
feat: add useParentheses configuration option#5steffen-heil-secforge wants to merge 3 commits intomainfrom
steffen-heil-secforge wants to merge 3 commits intomainfrom
Conversation
038d4e4 to
10ec06a
Compare
cf0498a to
740d668
Compare
59db507 to
f6e91f9
Compare
5915a31 to
ae6c0d3
Compare
…t suites Added comprehensive test cases for type assertions in binary expressions to all three useParentheses configuration modes: - Disambiguation: Adds parentheses for clarity - Maintain: Preserves existing parentheses - PreferNone: Removes unnecessary parentheses Tests demonstrate that parentheses around type assertions in binary expressions are not required for operator precedence (type assertions have higher precedence than relational operators like >=), so they can be safely removed when not needed. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Add test case for `(([] as X[])).f(g)` to all three useParentheses modes: - Disambiguation: removes outer parentheses -> `([] as X[]).f(g)` - Maintain: keeps both sets of parentheses -> `(([] as X[])).f(g)` - PreferNone: removes outer parentheses -> `([] as X[]).f(g)` This ensures proper handling of nested parentheses around type assertions followed by member access expressions. 🤖 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.
Adds a new
useParenthesesconfiguration option to control how parentheses are used around expressions.Three modes are supported:
The implementation respects JavaScript operator precedence rules and syntax requirements, ensuring parentheses are kept when needed for unary operators before exponentiation and other precedence-critical cases.