Skip to content

Commit

Permalink
Fix jsx-curly-spacing reporting on JSX content (fixes #671)
Browse files Browse the repository at this point in the history
  • Loading branch information
yannickcr committed Jul 23, 2016
1 parent 0f4ec75 commit 1614cc6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/rules/jsx-curly-spacing.js
Expand Up @@ -155,6 +155,10 @@ module.exports = function(context) {
* @returns {void}
*/
function validateBraceSpacing(node) {
// Only validate attributes
if (node.parent.type === 'JSXElement') {
return;
}
var first = context.getFirstToken(node);
var last = sourceCode.getLastToken(node);
var second = context.getTokenAfter(first);
Expand Down
4 changes: 4 additions & 0 deletions tests/lib/rules/jsx-curly-spacing.js
Expand Up @@ -182,6 +182,10 @@ ruleTester.run('jsx-curly-spacing', rule, {
code: '<App foo={3} bar={ {a: 2} } />',
options: ['never', {spacing: {objectLiterals: 'always'}}],
parserOptions: parserOptions
}, {
code: '<div foo={ bar }>{bar}</div>',
options: ['always'],
parserOptions: parserOptions
}],

invalid: [{
Expand Down

0 comments on commit 1614cc6

Please sign in to comment.