Skip to content

Commit 301e08c

Browse files
committed
Revert "Add whitespace before self-closing tag"
This reverts commit f6cc36a.
1 parent f6cc36a commit 301e08c

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

lib/rules/self-closing-comp.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ module.exports = {
8585

8686
// Replace />.*<\/.*>/ with '/>'
8787
var range = [openingElementEnding, closingElementEnding];
88-
return fixer.replaceTextRange(range, ' />');
88+
return fixer.replaceTextRange(range, '/>');
8989
}
9090
});
9191
}

tests/lib/rules/self-closing-comp.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -107,84 +107,84 @@ ruleTester.run('self-closing-comp', rule, {
107107
invalid: [
108108
{
109109
code: 'var contentContainer = <div className="content"></div>;',
110-
output: 'var contentContainer = <div className="content" />;',
110+
output: 'var contentContainer = <div className="content"/>;',
111111
parserOptions: parserOptions,
112112
errors: [{
113113
message: 'Empty components are self-closing'
114114
}]
115115
}, {
116116
code: 'var contentContainer = <div className="content"></div>;',
117-
output: 'var contentContainer = <div className="content" />;',
117+
output: 'var contentContainer = <div className="content"/>;',
118118
options: [],
119119
parserOptions: parserOptions,
120120
errors: [{
121121
message: 'Empty components are self-closing'
122122
}]
123123
}, {
124124
code: 'var HelloJohn = <Hello name="John"></Hello>;',
125-
output: 'var HelloJohn = <Hello name="John" />;',
125+
output: 'var HelloJohn = <Hello name="John"/>;',
126126
parserOptions: parserOptions,
127127
errors: [{
128128
message: 'Empty components are self-closing'
129129
}]
130130
}, {
131131
code: 'var HelloJohn = <Hello name="John">\n</Hello>;',
132-
output: 'var HelloJohn = <Hello name="John" />;',
132+
output: 'var HelloJohn = <Hello name="John"/>;',
133133
parserOptions: parserOptions,
134134
errors: [{
135135
message: 'Empty components are self-closing'
136136
}]
137137
}, {
138138
code: 'var HelloJohn = <Hello name="John"> </Hello>;',
139-
output: 'var HelloJohn = <Hello name="John" />;',
139+
output: 'var HelloJohn = <Hello name="John"/>;',
140140
parserOptions: parserOptions,
141141
errors: [{
142142
message: 'Empty components are self-closing'
143143
}]
144144
},
145145
{
146146
code: 'var HelloJohn = <Hello name="John"></Hello>;',
147-
output: 'var HelloJohn = <Hello name="John" />;',
147+
output: 'var HelloJohn = <Hello name="John"/>;',
148148
options: [],
149149
parserOptions: parserOptions,
150150
errors: [{
151151
message: 'Empty components are self-closing'
152152
}]
153153
}, {
154154
code: 'var HelloJohn = <Hello name="John">\n</Hello>;',
155-
output: 'var HelloJohn = <Hello name="John" />;',
155+
output: 'var HelloJohn = <Hello name="John"/>;',
156156
options: [],
157157
parserOptions: parserOptions,
158158
errors: [{
159159
message: 'Empty components are self-closing'
160160
}]
161161
}, {
162162
code: 'var HelloJohn = <Hello name="John"> </Hello>;',
163-
output: 'var HelloJohn = <Hello name="John" />;',
163+
output: 'var HelloJohn = <Hello name="John"/>;',
164164
options: [],
165165
parserOptions: parserOptions,
166166
errors: [{
167167
message: 'Empty components are self-closing'
168168
}]
169169
}, {
170170
code: 'var contentContainer = <div className="content"></div>;',
171-
output: 'var contentContainer = <div className="content" />;',
171+
output: 'var contentContainer = <div className="content"/>;',
172172
options: [{html: true}],
173173
parserOptions: parserOptions,
174174
errors: [{
175175
message: 'Empty components are self-closing'
176176
}]
177177
}, {
178178
code: 'var contentContainer = <div className="content">\n</div>;',
179-
output: 'var contentContainer = <div className="content" />;',
179+
output: 'var contentContainer = <div className="content"/>;',
180180
options: [{html: true}],
181181
parserOptions: parserOptions,
182182
errors: [{
183183
message: 'Empty components are self-closing'
184184
}]
185185
}, {
186186
code: 'var contentContainer = <div className="content"> </div>;',
187-
output: 'var contentContainer = <div className="content" />;',
187+
output: 'var contentContainer = <div className="content"/>;',
188188
options: [{html: true}],
189189
parserOptions: parserOptions,
190190
errors: [{

0 commit comments

Comments
 (0)