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

Unable to parse some of sass files #333

Closed
vegisivaramanjaneyulu opened this issue Oct 19, 2015 · 15 comments
Closed

Unable to parse some of sass files #333

vegisivaramanjaneyulu opened this issue Oct 19, 2015 · 15 comments

Comments

@vegisivaramanjaneyulu
Copy link

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.:334:14
at D:\Hiring\writer\src\node_modules\vinyl-fs\node_modules\graceful-fs\graceful-fs.js:102:5
at FSReqWrap.oncomplete (evalmachine.:95:15)

D:\Hiring\writer\src>

@DanPurdy
Copy link
Member

Few things

  • Can you sort the formatting in your issue so it's at least readable
  • Follow our guidelines for submitting an issue, you can find them here
  • Please don't email the developers directly asking for a resolution date to your issues, this is an open source project that we all work on in our free time, The licence is clear on what our responsibilities are.

Until then I wouldn't even know where to begin with this I'm afraid..

@BPScott
Copy link

BPScott commented Oct 19, 2015

Hi @vegisivaramanjaneyulu, can you please try and isolate what part of this file is causing the issue (delete half the file, see if the problem still occurs, if not try deleting another bit and continue till you've got it down to about 1-3 lines that cause the problem), and only post that. Currently you've posted the whole file which makes it hard to work out what the root cause is.

@vegisivaramanjaneyulu
Copy link
Author

Thanks for your response, we are getting the parsing exception while executing bellow code on particular sassfiles, have a look once and could you please provide the solution for this.

company-mention.sass:
.company-mentions-empty
color: $no-data-text
font:
size: 24px
letter-spacing: 10px
line-height: 35px
padding-top: 10px
text:
align: center
transform: uppercase

abstract.sass

&:before
color: $b
content: "\d7"
font:
size: 34px
weight: 700
line-height: 16px
@include stretch(2px, 2px, false, false)

@bgriffith
Copy link
Member

Hey @vegisivaramanjaneyulu . Could you please wrap your code with three backticks like this https://github.com/jasononeil/mdown/wiki/Github-Code-Blocks and add the correct indentations. Thanks!

@samuelhorwitz
Copy link

I'm running into this issue as well and it seems to be tied to with inline calculations. For example:

border: #{$spinner-diameter/10}px solid $orange;

The fact we do $spinner-diameter/10 inside of a #{} block is what causes the issue. If I do that calculation outside and assign it to an intermediate variable it's fine.

@DanPurdy
Copy link
Member

@samuelhorwitz, your issue is unfortunately due to an issue with our AST gonzales-pe, we're currently awaiting the latest release and your issue is in the pipeline to be fixed, we've been liaising with the developer who is currently working really hard over there to get these fixed. You can find the issue I created here

Once the AST is at a place we feel stable then we will be updating sass-lint to take full advantage of it.

@vegisivaramanjaneyulu do you happen to be using tabs? If so they will be fixed in the upcoming AST release too.

@samuelhorwitz
Copy link

@DanPurdy sounds good :) Thanks

@vegisivaramanjaneyulu
Copy link
Author

Thanks for your support, is it possible to share the release date of upcoming AST release too, please share the date.

Awaiting for your favorable response.

@Snugug
Copy link
Member

Snugug commented Oct 26, 2015

@vegisivaramanjaneyulu we do not control the release of the AST, we only consume it. Once it's been updated, we can work on incorporating, testing, and releasing our own update. We don't have a release date for this at the moment.

@vegisivaramanjaneyulu
Copy link
Author

Hi Team,

we are unable to parse sass file using gonzales.parse(..) method the bellow code only.

font:
size: 20px
weight: 100

could you please fix the above problem and update sass-lint .

Awaiting for your favorable response.

@DanPurdy
Copy link
Member

We keep saying this to you but can you please start submitting these issues properly, just pasting them randomly around isn't helping anyone.. You've provided nearly 0 information, You haven't answered my previous question either.

Please follow the contribution guide here

@traktraktrugui
Copy link

I'm running into this issue too.

"gulp-sass": "^2.1.0",
"gulp-sass-lint": "^1.1.0"

demo.scss
from https://css-tricks.com/

$pathNumber: 18;
$firstColor: #0057B8;
$listColors: #F11E4A, #F8A527, #266D7F, #82A, $firstColor;
$delayCoeff: 0.1s;

body {
  background-color: #0057B8;
  text-align: center;
  line-height: 100vh;
}

.svg {
  display: inline-block;
  height: 200px;
  width: 200px;
  line-height: 200px;
  text-align: center;
  background-color: #FFF;
  border-radius: 50%;
}

#svg {
  display: inline-block;
  vertical-align: middle;
  fill: $firstColor;

  @for $i from 1 through 18 {

      path:nth-child(#{$i}) {
        animation: pweek $delayCoeff*$pathNumber linear infinite;
        animation-delay: $i*$delayCoeff;

        &:hover {
          animation-play-state: paused;

        }
      }
   }
}

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

Run my task, this exception

C:\Projetos\BaseGulp\node_modules\gulp-print\node_modules\map-stream\index.js:103
        throw err
        ^

Error: Parsing error at src\client\styles\scss\demo.scss: Please check validity of the block starting from line #101
    at module.exports (C:\Projetos\BaseGulp\node_modules\sass-lint\lib\groot.js:21:11)
    at Function.sassLint.lintText (C:\Projetos\BaseGulp\node_modules\sass-lint\index.js:36:13)
    at DestroyableTransform._transform (C:\Projetos\BaseGulp\node_modules\gulp-sass-lint\index.js:38:27)
    at DestroyableTransform.Transform._read (C:\Projetos\BaseGulp\node_modules\through2\node_modules\readable-stream\lib\_stream_transform.js:172:10)
    at DestroyableTransform.Transform._write (C:\Projetos\BaseGulp\node_modules\through2\node_modules\readable-stream\lib\_stream_transform.js:160:12)
    at doWrite (C:\Projetos\BaseGulp\node_modules\through2\node_modules\readable-stream\lib\_stream_writable.js:333:12)
    at writeOrBuffer (C:\Projetos\BaseGulp\node_modules\through2\node_modules\readable-stream\lib\_stream_writable.js:319:5)
    at DestroyableTransform.Writable.write (C:\Projetos\BaseGulp\node_modules\through2\node_modules\readable-stream\lib\_stream_writable.js:246:11)
    at Stream.ondata (stream.js:31:26)
    at emitOne (events.js:77:13)

I did some changes in file, another exception.

body {
  background-color: #0057B8;
  text-align: center;
  line-height: 100vh;
}

.svg {
  display: inline-block;
  height: 200px;
  width: 200px;
  line-height: 200px;
  text-align: center;
  background-color: #FFF;
  border-radius: 50%;
}

#svg {
  display: inline-block;
  vertical-align: middle;
  fill: $firstColor;
}
C:\Projetos\BaseGulp\node_modules\gulp-print\node_modules\map-stream\index.js:103
    throw err
    ^
TypeError: Cannot read property 'start' of undefined
at processNode (C:\Projetos\BaseGulp\node_modules\sass-lint\lib\rules\indentation.js:57:46)
at processNode (C:\Projetos\BaseGulp\node_modules\sass-lint\lib\rules\indentation.js:96:9)
at processNode (C:\Projetos\BaseGulp\node_modules\sass-lint\lib\rules\indentation.js:96:9)
at Object.module.exports.detect (C:\Projetos\BaseGulp\node_modules\sass-lint\lib\rules\indentation.js:100:5)
at C:\Projetos\BaseGulp\node_modules\sass-lint\index.js:44:27
at Array.forEach (native)
at Function.sassLint.lintText (C:\Projetos\BaseGulp\node_modules\sass-lint\index.js:43:11)
at DestroyableTransform._transform (C:\Projetos\BaseGulp\node_modules\gulp-sass-lint\index.js:38:27)
at DestroyableTransform.Transform._read (C:\Projetos\BaseGulp\node_modules\through2\node_modules\readable-stream\lib\_stream_transform.js:172:10)
at DestroyableTransform.Transform._write (C:\Projetos\BaseGulp\node_modules\through2\node_modules\readable-stream\lib\_stream_transform.js:160:12)

@DanPurdy
Copy link
Member

Hi @traktraktrugui your first issue is to do with a problem in the current version of our AST which you can see here #210 and #321 as well as a few other places

The next issue is probably something related to #382

We're hoping to have them sorted soon.

@DanPurdy
Copy link
Member

@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

@DanPurdy
Copy link
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants