sass-lint: Unable to parse some of sass files

Hi Team,

I start using sass-lint to my sass application but I am unable parse the bellow sass file using Gonzales.parse() method, so could you please help me for this.

Edit-product.sass:

//- Edit product ------------------------------------------------------------

%table-nested-parent

.edit-product-link color: $link-blue font-size: 13px

.edit-product-dialog

@extend %dialog-610-width-basic

.edit-product-header @extend %dialog-header-basic

.edit-product-form @extend %dialog-form

label
  font-weight: normal
  width: auto

.subheading font-weight: bold margin-top: 10px

.save-state font-weight: bold height: 30px position: relative

&.success
  .success-text
    +opacity(1)

  .error-text
    display: none

&.error
  .error-text
    +opacity(1)

  .success-text
    display: none

.success-text,
.error-text
  position: absolute
  top: 0
  +opacity(0)
  +transition(opacity .5s ease)

.success-text
  color: $text-green

.error-text
  color: $score-red

and groot.js:

////////////////////////////// // Tree Abstraction ////////////////////////////// ‘use strict’;

var gonzales = require(‘gonzales-pe’);

module.exports = function (text, syntax, filename) { var fileInfo = filename ? ’ at ’ + filename : ‘’, tree;

// Run .toString() to allow Buffers to be passed in text = text.toString();

try { tree = gonzales.parse(text, { ………………………………….> I am getting error in this page , here text value is above mention edit-product.sass file ‘syntax’: syntax }); } catch (e) { throw new Error(‘Parsing error’ + fileInfo + ': ’ + e.message); ……> this error is displaying }

if (typeof tree === ‘undefined’) { throw new Error(‘Undefined tree’ + fileInfo + ': ’ + text.toString() + ’ => ’ + tree.toString()); }

return tree; };

Exception: D:\Hiring\writer\src>gulp sassprepare [15:35:43] Using gulpfile D:\Hiring\writer\src\Gulpfile.js [15:35:43] Starting ‘sasslint’… text: @import “edit-product” tree: @import “edit-product”

app\sass\modules\acl\acl.sass 1:9 warning Strings must use single quotes quotes 1:22 warning Files must end with a new line final-newline

? 2 problems (0 errors, 2 warnings)

text: //- Edit product ------------------------------------------------------------ %table-nested-parent

.edit-product-link color: $link-blue font-size: 13px

.edit-product-dialog

@extend %dialog-610-width-basic

.edit-product-header @extend %dialog-header-basic

.edit-product-form @extend %dialog-form

label
  font-weight: normal
  width: auto

.subheading font-weight: bold margin-top: 10px

.save-state font-weight: bold height: 30px position: relative

&.success
  .success-text
    +opacity(1)

  .error-text
    display: none

&.error
  .error-text
    +opacity(1)

  .success-text
    display: none

.success-text,
.error-text
  position: absolute
  top: 0
  +opacity(0)
  +transition(opacity .5s ease)

.success-text
  color: $text-green

.error-text
  color: $score-red

D:\Hiring\writer\src\node_modules\sass-lint\lib\groot.js:25 throw new Error(‘Parsing error’ + fileInfo + ': ’ + e.message); ^ Error: Parsing error at app\sass\modules\acl\edit-product.sass: Please check validity of the block at module.exports (D:\Hiring\writer\src\node_modules\sass-lint\lib\groot.js:25:11) at Function.sassLint.lintText (D:\Hiring\writer\src\node_modules\sass-lint\index.js:23:13) at DestroyableTransform._transform (D:\Hiring\writer\src\node_modules\gulp-sass-lint\index.js:32:27) at DestroyableTransform.Transform._read (D:\Hiring\writer\src\node_modules\through2\node_modules\readable-stream\lib_stream_transform.js:172:10) at DestroyableTransform.Transform.write (D:\Hiring\writer\src\node_modules\through2\node_modules\readable-stream\lib_stream_transform.js:160:12) at doWrite (D:\Hiring\writer\src\node_modules\through2\node_modules\readable-stream\lib_stream_writable.js:326:12) at writeOrBuffer (D:\Hiring\writer\src\node_modules\through2\node_modules\readable-stream\lib_stream_writable.js:312:5) at DestroyableTransform.Writable.write (D:\Hiring\writer\src\node_modules\through2\node_modules\readable-stream\lib_stream_writable.js:239:11) at write (D:\Hiring\writer\src\node_modules\vinyl-fs\node_modules\through2\node_modules\readable-stream\lib_stream_readable.js:623:24) at flow (D:\Hiring\writer\src\node_modules\vinyl-fs\node_modules\through2\node_modules\readable-stream\lib_stream_readable.js:632:7) at Transform.pipeOnReadable (D:\Hiring\writer\src\node_modules\vinyl-fs\node_modules\through2\node_modules\readable-stream\lib_stream_readable.js:664:5) at Transform.emit (events.js:104:17) at emitReadable (D:\Hiring\writer\src\node_modules\vinyl-fs\node_modules\through2\node_modules\readable-stream\lib_stream_readable.js:448:10) at emitReadable (D:\Hiring\writer\src\node_modules\vinyl-fs\node_modules\through2\node_modules\readable-stream\lib_stream_readable.js:444:5) at readableAddChunk (D:\Hiring\writer\src\node_modules\vinyl-fs\node_modules\through2\node_modules\readable-stream\lib_stream_readable.js:187:9) at Transform.Readable.push (D:\Hiring\writer\src\node_modules\vinyl-fs\node_modules\through2\node_modules\readable-stream\lib_stream_readable.js:149:10) at Transform.push (D:\Hiring\writer\src\node_modules\vinyl-fs\node_modules\through2\node_modules\readable-stream\lib_stream_transform.js:145:32) at afterTransform (D:\Hiring\writer\src\node_modules\vinyl-fs\node_modules\through2\node_modules\readable-stream\lib_stream_transform.js:101:12) at TransformState.afterTransform (D:\Hiring\writer\src\node_modules\vinyl-fs\node_modules\through2\node_modules\readable-stream\lib_stream_transform.js:79:12) at Transform.noop as _transform at Transform._read (D:\Hiring\writer\src\node_modules\vinyl-fs\node_modules\through2\node_modules\readable-stream\lib_stream_transform.js:184:10) at Transform._write (D:\Hiring\writer\src\node_modules\vinyl-fs\node_modules\through2\node_modules\readable-stream\lib_stream_transform.js:172:12) at doWrite (D:\Hiring\writer\src\node_modules\vinyl-fs\node_modules\through2\node_modules\readable-stream\lib_stream_writable.js:237:10) at writeOrBuffer (D:\Hiring\writer\src\node_modules\vinyl-fs\node_modules\through2\node_modules\readable-stream\lib_stream_writable.js:227:5) at Transform.Writable.write (D:\Hiring\writer\src\node_modules\vinyl-fs\node_modules\through2\node_modules\readable-stream\lib_stream_writable.js:194:11) at Stream.ondata (stream.js:51:26) at Stream.emit (events.js:107:17) at queueData (D:\Hiring\writer\src\node_modules\vinyl-fs\node_modules\map-stream\index.js:43:21) at next (D:\Hiring\writer\src\node_modules\vinyl-fs\node_modules\map-stream\index.js:71:7) at D:\Hiring\writer\src\node_modules\vinyl-fs\node_modules\map-stream\index.js:85:7 at D:\Hiring\writer\src\node_modules\vinyl-fs\lib\src\getContents\bufferFile.js:12:5 at evalmachine.<anonymous>:334:14 at D:\Hiring\writer\src\node_modules\vinyl-fs\node_modules\graceful-fs\graceful-fs.js:102:5 at FSReqWrap.oncomplete (evalmachine.<anonymous>:95:15)

D:\Hiring\writer\src>

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Comments: 15 (8 by maintainers)

Most upvoted comments

@samuelhorwitz Your example is working in sass-lint 1.6.0 @traktraktrugui everything apart from the following block in your code is now working fine with the latest release of the AST we have

@for $i from 1 through length($listColors) {
    #{$i*(100/length($listColors))}% {
      fill: nth($listColors, $i);
    }
  }

On it’s own this is due to the fact that the modulo operator is present which seems to be causing an issue still, even if you remove this though the whole block is causing an issue when placed in the context you had it so we’ll have too look into why the AST falls over with this.

The good news is all the other examples are passing so i’m going to close this and add an issue to the AST instead with the above example