Skip to content

Commit dde9448

Browse files
committed
enable no-else-return
1 parent 9a24db0 commit dde9448

File tree

5 files changed

+31
-27
lines changed

5 files changed

+31
-27
lines changed

extract.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,10 +205,11 @@ function literalParser(source, opts, styles) {
205205

206206
return path;
207207
}
208+
208209
// If this is not an object but a function returning an object, we want to parse the
209210
// object that is in the body of the function. We will only parse it if the body only
210211
// consist of an object and nothing else.
211-
else if (path.isArrowFunctionExpression()) {
212+
if (path.isArrowFunctionExpression()) {
212213
const body = path.get('body');
213214

214215
if (body) {

object-parser.js

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -269,34 +269,34 @@ class objectParser {
269269
raw(atRule);
270270

271271
return atRule;
272-
} else {
273-
let decl;
274-
275-
if (key.raw) {
276-
decl = postcss.decl({
277-
prop: key.value,
278-
value: value.value,
279-
raws: {
280-
prop: key,
281-
},
282-
});
283-
} else {
284-
decl = postcss.decl({
285-
prop: unCamelCase(key.value),
286-
value: value.value,
287-
});
272+
}
288273

289-
defineRaws(decl, 'prop', key.prefix, key.suffix, {
290-
raw: 'camel',
291-
});
292-
}
274+
let decl;
293275

294-
defineRaws(decl, 'value', value.prefix, value.suffix);
295-
raw(decl);
276+
if (key.raw) {
277+
decl = postcss.decl({
278+
prop: key.value,
279+
value: value.value,
280+
raws: {
281+
prop: key,
282+
},
283+
});
284+
} else {
285+
decl = postcss.decl({
286+
prop: unCamelCase(key.value),
287+
value: value.value,
288+
});
296289

297-
return decl;
290+
defineRaws(decl, 'prop', key.prefix, key.suffix, {
291+
raw: 'camel',
292+
});
298293
}
299294

295+
defineRaws(decl, 'value', value.prefix, value.suffix);
296+
raw(decl);
297+
298+
return decl;
299+
300300
function raw(postcssNode) {
301301
postcssNode.raws.between = between;
302302
postcssNode.raws.node = node;

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@
5555
"rules": {
5656
"array-callback-return": "off",
5757
"no-confusing-arrow": "off",
58-
"no-else-return": "off",
5958
"prefer--template": "off",
6059
"prefer-object-spread": "off",
6160
"prefer-rest-params": "off",

template-parser-helper.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,9 @@ class LocalFixer {
200200
} catch (error) {
201201
if (style.ignoreErrors) {
202202
return;
203-
} else if (!style.skipConvert) {
203+
}
204+
205+
if (!style.skipConvert) {
204206
this.error(error);
205207
}
206208

template-tokenize.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ function templateTokenize(input) {
1717
(returned.length && token[0] === returned[0][0])
1818
) {
1919
return true;
20-
} else if (returned.length) {
20+
}
21+
22+
if (returned.length) {
2123
back(token);
2224
}
2325
}

0 commit comments

Comments
 (0)