-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
[new] [jsx-curly-brace-presence] Disallow unnecessary JSX expressions or enforce them #1349
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
Merged
ljharb
merged 37 commits into
jsx-eslint:master
from
jackyho112:add-new-rule-no-unnecessary-curly-brace-squashed
Aug 30, 2017
Merged
Changes from 1 commit
Commits
Show all changes
37 commits
Select commit
Hold shift + click to select a range
5605a36
Add optional rule to disallow unnecessary JSX expressions
jackyho112 d5e5a2e
Support adding ability to enfore curly brace presence
jackyho112 0b5e95d
Add docs
jackyho112 5bd5a7f
Change doc name
jackyho112 52aaa54
Fix tests
jackyho112 1a0cac1
Fix tests
jackyho112 6ea4972
Account for when there are more than one child
jackyho112 2d695c4
Refactor according to feedback
jackyho112 ba3dc83
Account for template literal and a single string option to set default
jackyho112 b8c6698
Update docs
jackyho112 b647ac8
Add a few more tests
jackyho112 2397a16
Do a bit of refactoring
jackyho112 50cc416
Merge branch 'master' into add-new-rule-no-unnecessary-curly-brace
jackyho112 c237913
Change constant variable names to maintain consistency
jackyho112 3a03eea
Add ability to fix for missing curly and option for quotes
jackyho112 78e2ee2
Accounting for quotes
jackyho112 d87c53f
Account for edge cases
jackyho112 0f0e292
Add more tests
jackyho112 82fe18e
Update docs
jackyho112 03cf18b
Improve docs
jackyho112 dfddc4d
Fix a lint error
jackyho112 50b3ae8
Add comments
jackyho112 fe850fb
Get rid of deconstruction for older node version compatibility
jackyho112 35cb961
Add a comment
jackyho112 c299551
Add two more test cases
jackyho112 b180919
Remove ability to handle quotes
jackyho112 c66def5
Change tests
jackyho112 0554b49
Fix docs
jackyho112 cb93f6b
Fix an error in the doc
jackyho112 8adfb8c
Improve jsx-curly-brace-presence docs
jackyho112 0203b70
Add more tests for more than one prop
jackyho112 d2b2aac
Further improve docs about jsx-curly-brace-presence rule fixing
jackyho112 401e341
Account for feedback and add more tests
jackyho112 f2a4d03
Improve docs
jackyho112 2439068
Change a variable name
jackyho112 d3df38b
Change a function name
jackyho112 990daca
Fix an edge case
jackyho112 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,8 +27,8 @@ module.exports = { | |
{ | ||
type: 'object', | ||
properties: { | ||
props: {enum: optionValues}, | ||
children: {enum: optionValues} | ||
props: {enum: optionValues, default: optionNever}, | ||
children: {enum: optionValues, default: optionNever} | ||
}, | ||
additionalProperties: false | ||
} | ||
|
@@ -116,15 +116,15 @@ module.exports = { | |
// -------------------------------------------------------------------------- | ||
|
||
return { | ||
JSXExpressionContainer: function(node) { | ||
JSXExpressionContainer: node => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I made the change to maintain consistencies across files, but I guess it doesn't matter anyway. I have changed it back to using the arrow function. |
||
const {expression: {type}, parent} = node; | ||
|
||
if (shouldCheckForUnnecessaryCurly(type, parent, userConfig)) { | ||
lintUnnecessaryCurly(node); | ||
} | ||
}, | ||
|
||
Literal: function(node) { | ||
Literal: node => { | ||
const {parent: {type: parentType}} = node; | ||
|
||
if (shouldCheckForMissingCurly(parentType, userConfig)) { | ||
|
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed the default by mistake. They are back now.