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

Space after Comma syntax error… #89

Closed
tbremer opened this issue Sep 3, 2015 · 8 comments
Closed

Space after Comma syntax error… #89

tbremer opened this issue Sep 3, 2015 · 8 comments
Labels

Comments

@tbremer
Copy link

tbremer commented Sep 3, 2015

Calling module within JS file

/sass-lib/node_modules/sass-lint/lib/rules/space-after-comma.js:18
        if (next.is('space')) {
                ^
TypeError: Cannot read property 'is' of undefined
    at /sass-lib/node_modules/sass-lint/lib/rules/space-after-comma.js:18:17
    at RootNode.traverseByType (/sass-lib/node_modules/sass-lint/node_modules/gonzales-pe/lib/node/root-node.js:1:1739)
    at Object.module.exports.detect (/sass-lib/node_modules/sass-lint/lib/rules/space-after-comma.js:13:9)
    at /sass-lib/node_modules/sass-lint/index.js:30:25
    at Array.forEach (native)
    at Function.sassLint.lintText (/sass-lib/node_modules/sass-lint/index.js:29:9)
    at /sass-lib/node_modules/sass-lint/index.js:73:21
    at Array.forEach (native)
    at Function.sassLint.lintFiles (/sass-lib/node_modules/sass-lint/index.js:72:9)
    at Object.<anonymous> (/sass-lib/index.js:5:17)

Using Gulp task

/sass-lib/node_modules/sass-lint/lib/rules/space-after-comma.js:18
        if (next.is('space')) {
                ^
TypeError: Cannot read property 'is' of undefined
    at /sass-lib/node_modules/sass-lint/lib/rules/space-after-comma.js:18:17
    at RootNode.traverseByType (/sass-lib/node_modules/sass-lint/node_modules/gonzales-pe/lib/node/root-node.js:1:1739)
    at Object.module.exports.detect (/sass-lib/node_modules/sass-lint/lib/rules/space-after-comma.js:13:9)
    at /sass-lib/node_modules/sass-lint/index.js:30:25
    at Array.forEach (native)
    at Function.sassLint.lintText (/sass-lib/node_modules/sass-lint/index.js:29:9)
    at DestroyableTransform._transform (/sass-lib/node_modules/gulp-sass-lint/index.js:32:27)
    at DestroyableTransform.Transform._read (/sass-lib/node_modules/gulp-sass-lint/node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js:172:10)
    at DestroyableTransform.Transform._write (/sass-lib/node_modules/gulp-sass-lint/node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js:160:12)
    at doWrite (/sass-lib/node_modules/gulp-sass-lint/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:326:12)
@DanPurdy
Copy link
Member

DanPurdy commented Sep 3, 2015

Could you send us some of your sass/scss to reproduce this please?

@tbremer
Copy link
Author

tbremer commented Sep 3, 2015

@DanPurdy trying to track that down now, lots of files… Any quick way to see what file is failing?

@tbremer
Copy link
Author

tbremer commented Sep 3, 2015

Sorry, that was easier than I thought, found the file…

It is failing on $border: true, //

Sass is:

@mixin app-sidebar-nav-item (
    $border: true, // Determines if the nav should have a border
    $font-size: $app-sidebar-font-size, // Sets the font size
    $padding: true, // Determines if padding should be applied
    $truncate : true, // Determines if text should be truncated
    $hover: true, // Determines if hover state should be applied
    $active: true, // Determines if active state should be applied
    $hilite: true, // Determines if hilite (hilite = currently selected or is-active state) state should be applied
    $animate: true // Determines if transition should be applied
  ) {

@DanPurdy
Copy link
Member

DanPurdy commented Sep 3, 2015

@tbremer Thanks! Have you just moved over to using sass-lint or was it only when you added the above that it broke?

@tbremer
Copy link
Author

tbremer commented Sep 3, 2015

Testing out moving from Ruby sass-lint to your module… So, this all currently passes in brigade/scss-lint

@DanPurdy
Copy link
Member

DanPurdy commented Sep 3, 2015

Awesome, will take a look. Thanks.

@tbremer
Copy link
Author

tbremer commented Sep 3, 2015

It appears to be failing, essentially, because there isn't a 'next' on that same line (I could be reading the source wrong and I don't know much about this AST).

It'd be simple enough (but I'd worry about missing something) to wrap add another condition to the if() statement:

ast.traverseByType('operator', function (operator, i, parent) {
  var next;

  if (operator.content === ',') {
    next = parent.content[i + 1];

    if (next !== undefined && next.is('space')) {
      
    } else {
      
    }
    
  }
});

return result;

@minamarkham
Copy link

I think this issue was related to tonyganch/gonzales-pe#88.

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

No branches or pull requests

3 participants