Skip to content

Commit 52207e4

Browse files
committed
[eslint] enable and autofix object-curly-newline and object-property-newline
1 parent cf71c70 commit 52207e4

File tree

5 files changed

+44
-24
lines changed

5 files changed

+44
-24
lines changed

.eslintrc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@
3030
"function-paren-newline": 0,
3131
"no-plusplus": 1,
3232
"no-param-reassign": 1,
33-
"object-curly-newline": 1,
34-
"object-property-newline": 1,
3533
"no-underscore-dangle": 1,
3634
"no-mixed-operators": 1,
3735
"no-void": 1,

lib/rules/jsx-sort-props.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,15 @@ const generateFixerFunction = (node, context, reservedList) => {
118118
// Sort props according to the context. Only supports ignoreCase.
119119
// Since we cannot safely move JSXSpreadAttribute (due to potential variable overrides),
120120
// we only consider groups of sortable attributes.
121-
const options = {ignoreCase, callbacksLast, shorthandFirst, shorthandLast,
122-
noSortAlphabetically, reservedFirst, reservedList};
121+
const options = {
122+
ignoreCase,
123+
callbacksLast,
124+
shorthandFirst,
125+
shorthandLast,
126+
noSortAlphabetically,
127+
reservedFirst,
128+
reservedList
129+
};
123130
const sortableAttributeGroups = getGroupsOfSortableAttributes(attributes);
124131
const sortedAttributeGroups = sortableAttributeGroups
125132
.slice(0)

tests/lib/rules/forbid-elements.js

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -105,16 +105,20 @@ ruleTester.run('forbid-elements', rule, {
105105
},
106106
{
107107
code: '<dotted.Component />',
108-
options: [{forbid: [
109-
{element: 'dotted.Component', message: 'that ain\'t cool'}
110-
]}],
108+
options: [{
109+
forbid: [
110+
{element: 'dotted.Component', message: 'that ain\'t cool'}
111+
]
112+
}],
111113
errors: [{message: '<dotted.Component> is forbidden, that ain\'t cool'}]
112114
},
113115
{
114116
code: '<button />',
115-
options: [{forbid: [
116-
{element: 'button', message: 'use <Button> instead'}
117-
]}],
117+
options: [{
118+
forbid: [
119+
{element: 'button', message: 'use <Button> instead'}
120+
]
121+
}],
118122
errors: [{message: '<button> is forbidden, use <Button> instead'}]
119123
},
120124
{
@@ -143,10 +147,12 @@ ruleTester.run('forbid-elements', rule, {
143147
},
144148
{
145149
code: '<button />',
146-
options: [{forbid: [
147-
{element: 'button', message: 'use <Button> instead'},
148-
{element: 'button', message: 'use <Button2> instead'}
149-
]}],
150+
options: [{
151+
forbid: [
152+
{element: 'button', message: 'use <Button> instead'},
153+
{element: 'button', message: 'use <Button2> instead'}
154+
]
155+
}],
150156
errors: [{message: '<button> is forbidden, use <Button2> instead'}]
151157
},
152158
{
@@ -164,9 +170,11 @@ ruleTester.run('forbid-elements', rule, {
164170
},
165171
{
166172
code: 'React.createElement(dotted.Component)',
167-
options: [{forbid: [
168-
{element: 'dotted.Component', message: 'that ain\'t cool'}
169-
]}],
173+
options: [{
174+
forbid: [
175+
{element: 'dotted.Component', message: 'that ain\'t cool'}
176+
]
177+
}],
170178
errors: [{message: '<dotted.Component> is forbidden, that ain\'t cool'}]
171179
},
172180
{
@@ -185,9 +193,11 @@ ruleTester.run('forbid-elements', rule, {
185193
},
186194
{
187195
code: 'React.createElement("button")',
188-
options: [{forbid: [
189-
{element: 'button', message: 'use <Button> instead'}
190-
]}],
196+
options: [{
197+
forbid: [
198+
{element: 'button', message: 'use <Button> instead'}
199+
]
200+
}],
191201
errors: [{message: '<button> is forbidden, use <Button> instead'}]
192202
},
193203
{

tests/lib/rules/jsx-boolean-value.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,9 @@ ruleTester.run('jsx-boolean-value', rule, {
5555
output: '<App foo />;',
5656
errors: [{message: 'Value must be omitted for boolean attributes'}]
5757
}, {
58-
code: '<App foo />;', output: '<App foo={true} />;', options: ['always'],
58+
code: '<App foo />;',
59+
output: '<App foo={true} />;',
60+
options: ['always'],
5961
errors: [{message: 'Value must be set for boolean attributes'}]
6062
}, {
6163
code: '<App foo bar baz />;',

tests/lib/rules/react-in-jsx-scope.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ ruleTester.run('react-in-jsx-scope', rule, {
4444
{code: 'var React, App; <App />;'},
4545
{code: '/** @jsx Foo */ var Foo, App; <App />;'},
4646
{code: '/** @jsx Foo.Bar */ var Foo, App; <App />;'},
47-
{code: `
47+
{
48+
code: `
4849
import React from 'react/addons';
4950
const Button = createReactClass({
5051
render() {
@@ -54,7 +55,8 @@ ruleTester.run('react-in-jsx-scope', rule, {
5455
}
5556
});
5657
export default Button;
57-
`},
58+
`
59+
},
5860
{code: 'var Foo, App; <App />;', settings}
5961
],
6062
invalid: [{
@@ -78,6 +80,7 @@ ruleTester.run('react-in-jsx-scope', rule, {
7880
errors: [{message: '\'Foo\' must be in scope when using JSX'}]
7981
}, {
8082
code: 'var React, a = <img />;',
81-
errors: [{message: '\'Foo\' must be in scope when using JSX'}], settings
83+
errors: [{message: '\'Foo\' must be in scope when using JSX'}],
84+
settings
8285
}]
8386
});

0 commit comments

Comments
 (0)