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

TypeError: Cannot read property 'start' of undefined #389

Closed
hochitom opened this issue Nov 11, 2015 · 7 comments · Fixed by #612
Closed

TypeError: Cannot read property 'start' of undefined #389

hochitom opened this issue Nov 11, 2015 · 7 comments · Fixed by #612

Comments

@hochitom
Copy link

just installed latest sass-lint version. but it throws an error, when I start it

node_modules\sass-lint\lib\rules\indentation.js:57:46

@DanPurdy
Copy link
Member

Hi @hochitom. Can you give us a little more information here please, such as whether you're using tabs or spaces and what types of line endings you're using, I've got a feeling it's going to be related to #373 and #382

@SrTobi
Copy link

SrTobi commented Nov 15, 2015

We got the same problem in our Project (https://github.com/HelfenKannJeder/come2help-web). It appears on Windows 10 but not on Ubuntu 15.10. Here is the .sass-lint.yml.

C:\Users\Tobias\Documents\Work\come2help-web\node_modules\sass-lint\lib\rules\indentation.js:57
                  'line': node.content[i + 1].start.line,
                                             ^
TypeError: Cannot read property 'start' of undefined
    at processNode (C:\Users\Tobias\Documents\Work\come2help-web\node_modules\sass-lint\lib\rules\indentation.js:57:46)
    at Object.module.exports.detect (C:\Users\Tobias\Documents\Work\come2help-web\node_modules\sass-lint\lib\rules\indentation.js:100:5)
    at C:\Users\Tobias\Documents\Work\come2help-web\node_modules\sass-lint\index.js:44:27
    at Array.forEach (native)
    at Function.sassLint.lintText (C:\Users\Tobias\Documents\Work\come2help-web\node_modules\sass-lint\index.js:43:11)
    at C:\Users\Tobias\Documents\Work\come2help-web\node_modules\sass-lint\index.js:91:21
    at Array.forEach (native)
    at Function.sassLint.lintFiles (C:\Users\Tobias\Documents\Work\come2help-web\node_modules\sass-lint\index.js:90:9)
    at detectPattern (C:\Users\Tobias\Documents\Work\come2help-web\node_modules\sass-lint\bin\sass-lint.js:15:18)
    at Object.<anonymous> (C:\Users\Tobias\Documents\Work\come2help-web\node_modules\sass-lint\bin\sass-lint.js:77:3)

We fixed the problem by changing the line ending from crlf to lf of the scss files.

@DanPurdy
Copy link
Member

Thanks @SrTobi this is something I've noted in #382 the error you're seeing is hiding another error and as you rightly say, changing from crlf to lf fixes the issue.

@kvz
Copy link

kvz commented Jan 20, 2016

Ran into the same thing. I had to run both dos2unix and tab2space -unix -t2 on my scss files to work around this. I do agree I should only have \n and for whitespace in my files, but maybe this can be turned into another check.

waterfoul added a commit to waterfoul/sass-lint that referenced this issue Jan 20, 2016
@DanPurdy
Copy link
Member

Hi @kvz Our problem is that we're limited by our AST's support of tabs in general at the moment and we're a little reluctant to keep updating the indentation rule. We'd like to support all line endings and whitespaces but we need to wait on our AST becoming stable in it's latest incarnation.

There's also an issue setup to create a rule to check for these line endings #408 which we've not got round to looking into yet but as with everything we'd accept PR's 😄

@Snugug Snugug added this to the 1.5.1 - Latest Gonzales milestone Feb 7, 2016
@abritinthebay
Copy link

Simple fix for this would be changing

if (count !== spaceLength) on line 57 of indentation.js to if (count !== spaceLength && node.content[i + 1])

little bit hacky I know but it does mean that it actually appears to... you know... work. Right now it's just unusable :(

@mischkl
Copy link

mischkl commented Apr 13, 2016

Any chance this will be fixed in the next release? Even with the indentation rule turned off I get this error, so sass-lint is completely useless for us (on Windows) atm.

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

Successfully merging a pull request may close this issue.

7 participants