jscs-dev/node-jscs

Error running rule disallowQuotedKeysInObjects

gocreating opened this issue · 3 comments

image

Error running rule disallowQuotedKeysInObjects: 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 undefined
    at C:\Users\go-creating\.atom\packages\linter-jscs\node_modules\jscs\lib\rules\disallow-quoted-keys-in-objects.js:72:24
    at Array.forEach (native)
    at Object. (C:\Users\go-creating\.atom\packages\linter-jscs\node_modules\jscs\lib\rules\disallow-quoted-keys-in-objects.js:70:29)
    at Array.forEach (native)
    at Object.JsFile.iterateNodesByType (C:\Users\go-creating\.atom\packages\linter-jscs\node_modules\jscs\lib\js-file.js:331:42)
    at Object.module.exports.check (C:\Users\go-creating\.atom\packages\linter-jscs\node_modules\jscs\lib\rules\disallow-quoted-keys-in-objects.js:69:14)
    at [object Object]. (C:\Users\go-creating\.atom\packages\linter-jscs\node_modules\jscs\lib\string-checker.js:154:22)
    at Array.forEach (native)
    at [object Object].StringChecker._checkJsFile (C:\Users\go-creating\.atom\packages\linter-jscs\node_modules\jscs\lib\string-checker.js:150:31)
    at [object Object].StringChecker.checkString (C:\Users\go-creating\.atom\packages\linter-jscs\node_modules\jscs\lib\string-checker.js:92:14)
    at Object.lint (C:/Users/go-creating/.atom/packages/linter-jscs/src/linter-jscs.js:167:14)
    at promises.push.Promise.then._this.emitter.emit.linter (C:/Users/go-creating/.atom/packages/linter/lib/linter-registry.js:63:26)
    at C:/Users/go-creating/.atom/packages/linter/lib/linter-registry.js:62:23
    at Set.forEach (native)
    at LinterRegistry.lint (C:/Users/go-creating/.atom/packages/linter/lib/linter-registry.js:60:18)
    at file:///C:/Users/go-creating/.atom/packages/linter/lib/linter.coffee:98:16
    at Function.module.exports.Emitter.simpleDispatch (C:\Users\go-creating\AppData\Local\atom\app-1.7.3\resources\app.asar\node_modules\event-kit\lib\emitter.js:25:14)
    at Emitter.module.exports.Emitter.emit (C:\Users\go-creating\AppData\Local\atom\app-1.7.3\resources\app.asar\node_modules\event-kit\lib\emitter.js:125:28)
    at C:/Users/go-creating/.atom/packages/linter/lib/editor-linter.js:80:22
    at file:///C:/Users/go-creating/.atom/packages/linter/lib/helpers.coffee:23:18at line 1 col 1

.jscsrc

{
  "preset": "node-style-guide",
  "fileExtensions": [".js"],
  "excludeFiles": [
    "node_modules/**",
    "build/**"
  ],
  "maximumLineLength": {
    "value": 80,
    "allExcept": ["comments", "urlComments", "require"]
  },
  "requireCapitalizedComments": null,
  "requireSemicolons": true,
  "validateQuoteMarks": null,
  "validateLineBreaks": null
}

What version do you use? Also need a code example

@markelog I met the problem in atom's package linter-jscs@4.0.0. It seems using node-jscs@3.0.3.

Here is the broken code in the screenshot: userReducer.js

So i see - you using spread operator on objects which is es7 feature, need to add support for it in cst first - cst/cst#114