standard / semistandard

:icecream: All the goodness of `standard/standard` with semicolons sprinkled on top.
MIT License
1.41k stars 124 forks source link

Error while loading rule 'spaced-comment' #20

Closed larsthorup closed 9 years ago

larsthorup commented 9 years ago

I get this error after re-installing semistandard with rm node_modules/semistandard && npm install semistandard:

TypeError: Error while loading rule 'spaced-comment': Cannot read property 'length' of undefined at module.exports (C:\r\larsthorup\amaze\node_modules\semistandard\node_modules\standard-engine\node_modules\eslint\lib\rules\spaced-comment.js:26:28) at C:\r\larsthorup\amaze\node_modules\semistandard\node_modules\standard-engine\node_modules\eslint\lib\eslint.js:629:32 at Array.forEach (native) at EventEmitter.module.exports.api.verify (C:\r\larsthorup\amaze\node_modules\semistandard\node_modules\standard-engine\node_modules\eslint\lib\eslint.js:620:16) at processText (C:\r\larsthorup\amaze\node_modules\semistandard\node_modules\standard-engine\node_modules\eslint\lib\cli-engine.js:200:27) at processFile (C:\r\larsthorup\amaze\node_modules\semistandard\node_modules\standard-engine\node_modules\eslint\lib\cli-engine.js:225:12) at C:\r\larsthorup\amaze\node_modules\semistandard\node_modules\standard-engine\node_modules\eslint\lib\cli-engine.js:317:26 at walk (C:\r\larsthorup\amaze\node_modules\semistandard\node_modules\standard-engine\node_modules\eslint\lib\util\traverse.js:81:9) at C:\r\larsthorup\amaze\node_modules\semistandard\node_modules\standard-engine\node_modules\eslint\lib\util\traverse.js:102:9 at Array.forEach (native)

It looks like semistandard will use the latest eslint (0.24.0) but the embedded standard-engine will use a specific commit off of 0.22.1, as npm ls eslint gives:

amaze@0.1.0 C:\r\larsthorup\temp\amaze
└─┬ semistandard@6.1.1
  ├── eslint@0.24.0
  └─┬ standard-engine@1.8.1
    └── eslint@0.22.1  (git://github.com/eslint/eslint.git#fff52aecaf1d073952201b3f128e6664f529a24e)

If I update node_modules/semistandard/node_modules/standard-engine/node_modules/eslint to a copy of the one in node_modules/semistandard/node_modules/eslint this error goes away.

To reproduce:

git clone git://github.com/larsthorup/amaze.git
cd amaze
git checkout 7fb4c3
npm install
npm test

Let me know if you need me to assemble a smaller repro scenario.

joeframbach commented 9 years ago

:+1: Also experiencing this issue.

joeframbach commented 9 years ago

I went ahead and updated the eslint dependency in ~/.nvm/v0.12.5/lib/node_modules/semistandard/node_modules/standard-engine/package.json. Works just fine. It looks like standard-engine is just behind a bit on its eslint dependency. It's pinned to a specific commit hash for some reason. I hope Flet can comment on that.

Here is a PR: https://github.com/Flet/standard-engine/pull/7

Flet commented 9 years ago

Thanks, I've landed that PR and published a new version of standard-engine. Could one or both of you re-install semistandard and try it again?

joeframbach commented 9 years ago

Awesome. Looks great, and package.json is cleaned up!

larsthorup commented 9 years ago

Works. Thanks!