Skip to content

Commit

Permalink
Add the "children" property of the config
Browse files Browse the repository at this point in the history
  • Loading branch information
fatfisz committed Jun 11, 2017
1 parent 65135b8 commit 408e1b1
Show file tree
Hide file tree
Showing 2 changed files with 654 additions and 74 deletions.
9 changes: 8 additions & 1 deletion lib/rules/jsx-curly-spacing.js
Expand Up @@ -68,6 +68,9 @@ module.exports = {
properties: {
attributes: {
$ref: '#/definitions/basicConfigOrBoolean'
},
children: {
$ref: '#/definitions/basicConfigOrBoolean'
}
}
}]
Expand Down Expand Up @@ -97,6 +100,7 @@ module.exports = {
var DEFAULT_WHEN = SPACING.never;
var DEFAULT_ALLOW_MULTILINE = true;
var DEFAULT_ATTRIBUTES = true;
var DEFAULT_CHILDREN = false;

var sourceCode = context.getSourceCode();
var originalConfig = context.options[0] || {};
Expand All @@ -106,6 +110,8 @@ module.exports = {
});
var attributes = has(originalConfig, 'attributes') ? originalConfig.attributes : DEFAULT_ATTRIBUTES;
var attributesConfig = attributes ? normalizeConfig(attributes, defaultConfig, true) : null;
var children = has(originalConfig, 'children') ? originalConfig.children : DEFAULT_CHILDREN;
var childrenConfig = children ? normalizeConfig(children, defaultConfig, true) : null;

// --------------------------------------------------------------------------
// Helpers
Expand Down Expand Up @@ -247,7 +253,8 @@ module.exports = {
break;

case 'JSXElement':
return;
config = childrenConfig;
break;

default:
return;
Expand Down

0 comments on commit 408e1b1

Please sign in to comment.