Skip to content

Commit 54461cc

Browse files
armanozakelchininet
authored andcommitted
Check raws.before while replacing new lines at cleanRuleRawsBefore
1 parent e697985 commit 54461cc

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/utilities/rules.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,8 @@ export const appendParentRuleToStore = (
162162

163163
export const cleanRuleRawsBefore = (node: Node | void): void => {
164164
if (node && node.type === RULE_TYPE) {
165-
node.raws.before = '\n\n' + node.raws.before.replace(/\n/g, '');
165+
const { before } = node.raws;
166+
node.raws.before = '\n\n' + (before ? before.replace(/\n/g, '') : '');
166167
}
167168
};
168169

0 commit comments

Comments
 (0)