jscs-dev / node-jscs

:arrow_heading_up: JavaScript Code Style checker (unmaintained)
https://jscs-dev.github.io
MIT License
4.96k stars 513 forks source link

React - Decorator - class ES2015 #2147

Closed thomashermant closed 8 years ago

thomashermant commented 8 years ago

Hi everyone,

Since I add parameters to my decorator (high order component) @withOwn('media', ['user_id']) class MediaEdit extends React.Component { ... }

I see this error (stack trace below)


WARNING in ./app/views/MediaEdit/MediaEdit.jsx jscs results in errors internalError @ line 1 char 0 Error running rule validateQuoteMarks: This is an issue with JSCS and not your codebase. Please file an issue (with the stack trace below) at: https://github.com/jscs-dev/node-jscs/issues/new

TypeError: Cannot read property 'type' of null at /Users/tom/Desktop/nh/node_modules/jscs/lib/rules/validate-quote-marks.js:118:63 at /Users/tom/Desktop/nh/node_modules/jscs/lib/js-file.js:614:17 at Object.JsFile._forEachToken (/Users/tom/Desktop/nh/node_modules/jscs/lib/js-file.js:651:13) at Object.JsFile.iterateTokensByType (/Users/tom/Desktop/nh/node_modules/jscs/lib/js-file.js:612:14) at Object.module.exports.check (/Users/tom/Desktop/nh/node_modules/jscs/lib/rules/validate-quote-marks.js:115:14) at null. (/Users/tom/Desktop/nh/node_modules/jscs/lib/string-checker.js:165:22) at Array.forEach (native) at StringChecker._checkJsFile (/Users/tom/Desktop/nh/node_modules/jscs/lib/string-checker.js:161:31) at StringChecker.checkString (/Users/tom/Desktop/nh/node_modules/jscs/lib/string-checker.js:106:14) at Object.checkSource (/Users/tom/Desktop/nh/node_modules/jscs-loader/index.js:91:24) at Object. (/Users/tom/Desktop/nh/node_modules/jscs-loader/index.js:140:19) at /Users/tom/Desktop/nh/node_modules/jscs-loader/index.js:62:7 at FSReqWrap.readFileAfterClose as oncomplete

Best regards, Thomas

hzoo commented 8 years ago

@markelog Need to account for null parent? https://github.com/jscs-dev/node-jscs/blob/2.x/lib/rules/validate-quote-marks.js#L118

markelog commented 8 years ago

Yeah, sounds like an easy fix

Skywalker13 commented 8 years ago

duplicate of #2141

markelog commented 8 years ago

Indeed