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

jsx-newline: support for checking newline at the start and end of children #3678

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions lib/rules/jsx-newline.js
Expand Up @@ -46,6 +46,10 @@ module.exports = {
default: false,
type: 'boolean',
},
checkStartEnd: {
default: false,
type: 'boolean',
},
Comment on lines +49 to +52
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ljharb this makes sense but I wonder if we shouldn't also include option for banning start/end newlines while forcing empty lines between children 🤔

So this might actually become an enum of force | prevent rather than boolean. What do you think, what should I go with?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Or we might go with:

undefined and false = do nothing
true = behaves same as between children (as per prevent)
force = forces an empty line
prevent = prevents empty line

And it will still take allowMultilines into account

},
additionalProperties: false,
if: {
Expand Down