Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

indent: Support JSXText indent #378

Open
4 tasks done
Daydreamer-riri opened this issue May 1, 2024 · 3 comments
Open
4 tasks done

indent: Support JSXText indent #378

Daydreamer-riri opened this issue May 1, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@Daydreamer-riri
Copy link
Contributor

Clear and concise description of the problem

‌‌‌‌‌‌Based on my practice, the indent rule can "almost" replace the jsx-indent rule and do a better job. Before I made the fix (#368), there was even a conflict between the two. Moreover, jsx-indent would lack indentation in multiline ternary operations. So now I prefer to turn off the jsx-indent rule and use only the indent rule. However, the reason I used the word "almost" is because indent does not handle the following situation:

<div>
JSXText  // `indent` does not indent for this
  {'Literal in JSXExpressionContainer'} // `indent` will indent for this node
</div>

Suggested solution

‌‌‌‌‌‌‌Support JSXText indentation for the indent rule. Considering that the rule already indents almost all JSX-related nodes (and it handles the overlapping parts of JSX nodes with other nodes quite well), the current lack of support for JSXText might be considered a BUG? I believe this should not be considered a breaking change.

Alternative

No response

Additional context

No response

Validations

Contributes

  • If this feature request is accepted, I am willing to submit a PR to fix this issue
@Daydreamer-riri Daydreamer-riri added the enhancement New feature or request label May 1, 2024
@antfu
Copy link
Member

antfu commented May 2, 2024

Sounds good, feel free to send the PR.

Would you suggest implementing the feature-parity and then deprecating just-indent in favor of indent?

@Daydreamer-riri
Copy link
Contributor Author

Yes, I suggest it. I can attempt to make indent pass all the test cases of jsx-indent to achieve feature parity.

@antfu
Copy link
Member

antfu commented May 3, 2024

Sounds nice if we managed to do that. Feel free to PR, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants