idok / sass-lint-plugin

SASS Lint plugin for Intellij
https://plugins.jetbrains.com/plugin/8171
MIT License
31 stars 5 forks source link

Webstorm error: `StreamException: : input contained no data` #1

Closed dwightjack closed 3 years ago

dwightjack commented 8 years ago

Hi with material UI theme i'm getting the following error:

 : input contained no data
com.thoughtworks.xstream.io.StreamException:  : input contained no data
    at com.thoughtworks.xstream.io.xml.XppReader.pullNextEvent(XppReader.java:126)
    at com.thoughtworks.xstream.io.xml.AbstractPullReader.readRealEvent(AbstractPullReader.java:148)
    at com.thoughtworks.xstream.io.xml.AbstractPullReader.readEvent(AbstractPullReader.java:141)
    at com.thoughtworks.xstream.io.xml.AbstractPullReader.move(AbstractPullReader.java:118)
    at com.thoughtworks.xstream.io.xml.AbstractPullReader.moveDown(AbstractPullReader.java:103)
    at com.thoughtworks.xstream.io.xml.XppReader.<init>(XppReader.java:63)
    at com.thoughtworks.xstream.io.xml.AbstractXppDriver.createReader(AbstractXppDriver.java:54)
    at com.thoughtworks.xstream.XStream.fromXML(XStream.java:1040)
    at com.thoughtworks.xstream.XStream.fromXML(XStream.java:1031)
    at com.sasslint.cli.SassLint.read(SassLint.java:25)
    at com.sasslint.cli.SassLintRunner.lint(SassLintRunner.java:58)
    at com.sasslint.cli.SassLintRunner.lint(SassLintRunner.java:46)
    at com.sasslint.inspection.SassLintExternalAnnotator.doAnnotate(SassLintExternalAnnotator.java:207)
    at com.sasslint.inspection.SassLintExternalAnnotator.doAnnotate(SassLintExternalAnnotator.java:48)
    at com.intellij.codeInsight.daemon.impl.ExternalToolPass.c(ExternalToolPass.java:218)
    at com.intellij.codeInsight.daemon.impl.ExternalToolPass.access$500(ExternalToolPass.java:44)
    at com.intellij.codeInsight.daemon.impl.ExternalToolPass$1.run(ExternalToolPass.java:160)
    at com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:337)
    at com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:327)
    at com.intellij.util.ui.update.MergingUpdateQueue$3.run(MergingUpdateQueue.java:271)
    at com.intellij.util.ui.update.MergingUpdateQueue.flush(MergingUpdateQueue.java:286)
    at com.intellij.util.ui.update.MergingUpdateQueue.flush(MergingUpdateQueue.java:244)
    at com.intellij.util.ui.update.MergingUpdateQueue.run(MergingUpdateQueue.java:234)
    at com.intellij.util.concurrency.QueueProcessor.runSafely(QueueProcessor.java:238)
    at com.intellij.util.Alarm$Request$1.run(Alarm.java:352)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at com.intellij.util.concurrency.QueueProcessor$RunnableConsumer.consume(QueueProcessor.java:298)
    at com.intellij.util.concurrency.QueueProcessor$RunnableConsumer.consume(QueueProcessor.java:295)
    at com.intellij.util.concurrency.QueueProcessor$2$1.run(QueueProcessor.java:110)
    at com.intellij.util.concurrency.QueueProcessor.runSafely(QueueProcessor.java:238)
    at com.intellij.util.concurrency.QueueProcessor$2.consume(QueueProcessor.java:107)
    at com.intellij.util.concurrency.QueueProcessor$2.consume(QueueProcessor.java:104)
    at com.intellij.util.concurrency.QueueProcessor$3$1.run(QueueProcessor.java:215)
    at com.intellij.util.concurrency.QueueProcessor.runSafely(QueueProcessor.java:238)
    at com.intellij.util.concurrency.QueueProcessor$3.run(QueueProcessor.java:212)
    at com.intellij.openapi.application.impl.ApplicationImpl$8.run(ApplicationImpl.java:366)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
    at org.jetbrains.ide.PooledThreadExecutor$1$1.run(PooledThreadExecutor.java:55)
Caused by: java.io.EOFException: input contained no data
    at org.xmlpull.mxp1.MXParser.fillBuf(MXParser.java:3003)
    at org.xmlpull.mxp1.MXParser.more(MXParser.java:3046)
    at org.xmlpull.mxp1.MXParser.parseProlog(MXParser.java:1410)
    at org.xmlpull.mxp1.MXParser.nextImpl(MXParser.java:1395)
    at org.xmlpull.mxp1.MXParser.next(MXParser.java:1093)
    at com.thoughtworks.xstream.io.xml.XppReader.pullNextEvent(XppReader.java:109)
    ... 42 more

If you need any further detail, just ping me :)

idok commented 8 years ago

please try explicitly setting the sass-lint.yml in the settings

dwightjack commented 8 years ago

Ok seems to work. Now it seems the linter gets triggered when ever I type and not just on save.

For example when i type: font-size: I got the following error:


Error: Parsing error at frontend/assets/scss/objects/_ico.scss: Please check validity of the block starting from line #47
    at module.exports (C:\nodist\bin\node_modules\sass-lint\lib\groot.js:21:11)
    at Function.sassLint.lintText (C:\nodist\bin\node_modules\sass-lint\index.js:36:13)
    at C:\nodist\bin\node_modules\sass-lint\index.js:91:21
    at Array.forEach (native)
    at Function.sassLint.lintFiles (C:\nodist\bin\node_modules\sass-lint\index.js:90:9)
    at detectPattern (C:\nodist\bin\node_modules\sass-lint\bin\sass-lint.js:15:18)
    at C:\nodist\bin\node_modules\sass-lint\bin\sass-lint.js:86:5
    at Array.forEach (native)
    at Object. (C:\nodist\bin\node_modules\sass-lint\bin\sass-lint.js:85:16)
    at Module._compile (module.js:435:26)
idok commented 8 years ago

I researched a bit, The first issue is due to a bug in sass-lint, when not specifying a config file, they try to look up package.json, if you don't have one an exception is thrown. So, you need to specify a config file, or have a package.json file and have a .sass-lint.yml file.

dwightjack commented 8 years ago

Hi,

I have both the package.json file (without any reference to sass-lint though) and a .sass-lint.yml file.

Anyway with the latest plugin update I don't experience the first problem anymore. I still get the parsing error before hitting save.

I wonder if those file in groot.js is something related to sass-lint (see https://github.com/sasstools/sass-lint/issues/456). If so, maybe it'd be an option to suppress the parsing error until they update the AST.

DanPurdy commented 8 years ago

Would you mind posting a sample of the code that this is failing on @dwightjack ? I haven't used this plugin yet but if it's linting as you type it will often throw parse errors on incomplete code, once the block is complete though it should lint fine. There's an update for sass-lint coming hopefully today that will report these parse errors specifically as lint errors so it shouldn't be as frustrating as the unhandled errors are at the moment.

If the code is complete and you're still encountering a parse error then unfortunately there's still a few cases where you will see this with the AST we use in its current state. Specifically most types of interpolation or even files using hard tabs. Hopefully these will be sorted soon.

It would be helpful if you could post these types of issues on the sass-lint repo itself so we can better keep track of them! Thanks!