Skip to content

Commit 6903f18

Browse files
committed
Add back the support for the previous config
1 parent 5515130 commit 6903f18

File tree

2 files changed

+613
-10
lines changed

2 files changed

+613
-10
lines changed

lib/rules/jsx-curly-spacing.js

Lines changed: 33 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -61,19 +61,39 @@ module.exports = {
6161
}
6262
},
6363

64-
allOf: [{
65-
$ref: '#/definitions/basicConfig'
64+
oneOf: [{
65+
allOf: [{
66+
$ref: '#/definitions/basicConfig'
67+
}, {
68+
type: 'object',
69+
properties: {
70+
attributes: {
71+
$ref: '#/definitions/basicConfigOrBoolean'
72+
},
73+
children: {
74+
$ref: '#/definitions/basicConfigOrBoolean'
75+
}
76+
}
77+
}]
6678
}, {
67-
type: 'object',
68-
properties: {
69-
attributes: {
70-
$ref: '#/definitions/basicConfigOrBoolean'
71-
},
72-
children: {
73-
$ref: '#/definitions/basicConfigOrBoolean'
79+
enum: SPACING_VALUES
80+
}]
81+
}, {
82+
type: 'object',
83+
properties: {
84+
allowMultiline: {
85+
type: 'boolean'
86+
},
87+
spacing: {
88+
type: 'object',
89+
properties: {
90+
objectLiterals: {
91+
enum: SPACING_VALUES
92+
}
7493
}
7594
}
76-
}]
95+
},
96+
additionalProperties: false
7797
}]
7898
},
7999

@@ -104,6 +124,9 @@ module.exports = {
104124

105125
var sourceCode = context.getSourceCode();
106126
var originalConfig = context.options[0] || {};
127+
if (SPACING_VALUES.indexOf(originalConfig) !== -1) {
128+
originalConfig = Object.assign({when: context.options[0]}, context.options[1]);
129+
}
107130
var defaultConfig = normalizeConfig(originalConfig, {
108131
when: DEFAULT_WHEN,
109132
allowMultiline: DEFAULT_ALLOW_MULTILINE

0 commit comments

Comments
 (0)