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

[Fix] jsx-newline: No newline between comments and jsx elements #3493

Merged
merged 1 commit into from
Nov 21, 2022
Merged

[Fix] jsx-newline: No newline between comments and jsx elements #3493

merged 1 commit into from
Nov 21, 2022

Conversation

justmejulian
Copy link
Contributor

Fixes #3478 and #2926 and adds a couple more tests to show what was failing.

From what I can gather this should be the default behaviour. If not then then this can be hidden behind an option.

I was not sure about the behaviour of multiple Block comments before a Multiline Component. Decided the comments should stick together, based on sujan-s comment in #3478.

@codecov
Copy link

codecov bot commented Nov 17, 2022

Codecov Report

Merging #3493 (34a9d4f) into master (54c56a1) will decrease coverage by 0.12%.
The diff coverage is 100.00%.

❗ Current head 34a9d4f differs from pull request most recent head 12e9838. Consider uploading reports for the commit 12e9838 to get more accurate results

@@            Coverage Diff             @@
##           master    #3493      +/-   ##
==========================================
- Coverage   97.57%   97.44%   -0.13%     
==========================================
  Files         129      129              
  Lines        9200     9210      +10     
  Branches     3336     3341       +5     
==========================================
- Hits         8977     8975       -2     
- Misses        223      235      +12     
Impacted Files Coverage Δ
lib/rules/jsx-newline.js 100.00% <100.00%> (ø)
lib/rules/no-arrow-function-lifecycle.js 89.06% <0.00%> (-9.38%) ⬇️
lib/rules/jsx-curly-spacing.js 91.17% <0.00%> (-2.95%) ⬇️
lib/rules/jsx-props-no-spreading.js 95.65% <0.00%> (-2.18%) ⬇️
lib/util/componentUtil.js 97.33% <0.00%> (-1.34%) ⬇️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

Copy link
Member

@ljharb ljharb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test cases look great!

tests/lib/rules/jsx-newline.js Outdated Show resolved Hide resolved
lib/rules/jsx-newline.js Outdated Show resolved Hide resolved
lib/rules/jsx-newline.js Outdated Show resolved Hide resolved
@ljharb ljharb merged commit 12e9838 into jsx-eslint:master Nov 21, 2022
@justmejulian justmejulian deleted the no-newline-between-comments-and-jsx-elements branch November 21, 2022 07:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

jsx-newline puts line breaks between comments and new JSX elements
2 participants