Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(scss): do not throw if node.source undefined #5394

Merged
merged 1 commit into from Nov 9, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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);
}