Skip to content

Commit

Permalink
Add back the support for the previous config
Browse files Browse the repository at this point in the history
  • Loading branch information
fatfisz committed Jun 11, 2017
1 parent 5515130 commit 6903f18
Show file tree
Hide file tree
Showing 2 changed files with 613 additions and 10 deletions.
43 changes: 33 additions & 10 deletions lib/rules/jsx-curly-spacing.js
Expand Up @@ -61,19 +61,39 @@ module.exports = {
}
},

allOf: [{
$ref: '#/definitions/basicConfig'
oneOf: [{
allOf: [{
$ref: '#/definitions/basicConfig'
}, {
type: 'object',
properties: {
attributes: {
$ref: '#/definitions/basicConfigOrBoolean'
},
children: {
$ref: '#/definitions/basicConfigOrBoolean'
}
}
}]
}, {
type: 'object',
properties: {
attributes: {
$ref: '#/definitions/basicConfigOrBoolean'
},
children: {
$ref: '#/definitions/basicConfigOrBoolean'
enum: SPACING_VALUES
}]
}, {
type: 'object',
properties: {
allowMultiline: {
type: 'boolean'
},
spacing: {
type: 'object',
properties: {
objectLiterals: {
enum: SPACING_VALUES
}
}
}
}]
},
additionalProperties: false
}]
},

Expand Down Expand Up @@ -104,6 +124,9 @@ module.exports = {

var sourceCode = context.getSourceCode();
var originalConfig = context.options[0] || {};
if (SPACING_VALUES.indexOf(originalConfig) !== -1) {
originalConfig = Object.assign({when: context.options[0]}, context.options[1]);
}
var defaultConfig = normalizeConfig(originalConfig, {
when: DEFAULT_WHEN,
allowMultiline: DEFAULT_ALLOW_MULTILINE
Expand Down

0 comments on commit 6903f18

Please sign in to comment.