sass-lint: SCSS - Parser breaks on lines with 2 string interpolations

Example: https://github.com/zurb/foundation-sites/blob/develop/scss/grid/_classes.scss#L85 https://github.com/zurb/foundation-sites/blob/develop/scss/grid/_flex-grid.scss#L195

.#{$-zf-size}-#{$i} { }

Here’s a slightly different string interpolation that also throws a fatal error: https://github.com/zurb/foundation-sites/blob/develop/scss/grid/_layout.scss#L25

&:nth-of-type(#{$n}n+1) { }

Interestingly, the 3 interpolated strings in one line here don’t break the parser: https://github.com/zurb/foundation-sites/blob/develop/scss/grid/_classes.scss#L70

.#{$column}.#{$row}.#{$row} { }

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 2
  • Comments: 20 (8 by maintainers)

Most upvoted comments

Thanks for the offer @scottyeck ! Only just came up for air… so I’ve fixed the AST output and have tests for the following pseudo combos:

:nth-child(#{$i})
:nth-child(#{$i}n)
:nth-child(#{$i}n+1)
:nth-child(#{$i}n-1)
:nth-child(-#{$i}n)
:nth-child(-#{$i}n+1)
:nth-child(-#{$i}n+#{$j})
:nth-child(-#{$i}n-1)
:nth-child(-#{$i}n-#{$j})

Hopefully be able to get a patch out to gonzales in next few days.

FWIW, as per @colin-marshall 's second example, I’ve encountered it as well as follows.

&:nth-of-type(#{$per-row}n+1) {
    clear: both;
}

No error is thrown if the string-concatenation is performed in the interpolated block.

&:nth-of-type(#{$per-row + "n+1"}) {
    clear: both;
}

Hoping this is productive. Otherwise, sorry for the unnecessary communication bloat.

There goes the hope that we’d knocked all those interpolation parse errors on the head! Thanks for the report 👍

I also encountered this issue after updating today, is there any work around for this issue?

#{$btn-namespace}-#{$btn-name} {
    @include button($btn-color-set);
}