Skip to content

Commit

Permalink
fix(scss): do not throw if node.source undefined (#5394)
Browse files Browse the repository at this point in the history
  • Loading branch information
ikatyang committed Nov 9, 2018
1 parent 469a831 commit 32ea48d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/language-css/printer-postcss.js
Expand Up @@ -647,7 +647,11 @@ function genericPrint(path, options, print) {

// Formatting `grid` property
if (isGridValue) {
if (iNode.source.start.line !== iNextNode.source.start.line) {
if (
iNode.source &&
iNextNode.source &&
iNode.source.start.line !== iNextNode.source.start.line
) {
parts.push(hardline);

didBreak = true;
Expand Down
8 changes: 8 additions & 0 deletions tests/css_scss/__snapshots__/jsfmt.spec.js.snap
Expand Up @@ -1044,6 +1044,10 @@ $my-map: (
color: $color-silver;
}
}
.something {
grid-template-columns: 1 2fr (3 + 4);
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@media #{$g-breakpoint-tiny} {
}
Expand Down Expand Up @@ -1994,4 +1998,8 @@ $my-map: (
}
}
.something {
grid-template-columns: 1 2fr (3 + 4);
}
`;
4 changes: 4 additions & 0 deletions tests/css_scss/scss.scss
Expand Up @@ -1034,3 +1034,7 @@ $my-map: (
color: $color-silver;
}
}

.something {
grid-template-columns: 1 2fr (3 + 4);
}

0 comments on commit 32ea48d

Please sign in to comment.