Skip to content

rule consistent-output crashing when invalid tests array has missing element. #37

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

Closed
aladdin-add opened this issue Sep 5, 2017 · 2 comments
Labels

Comments

@aladdin-add
Copy link
Contributor

aladdin-add commented Sep 5, 2017

test case:

// invalid
invalid: [
  {code:"foo"},
  ,
  {code: "bar"}
]

error:

TypeError: Cannot read property 'type' of null
    at testRun.invalid.filter.testCase (C:\repo\eslint\node_modules\eslint-plugin-eslint-plugin\lib\rules\consistent-output.js:36:7
6)
    at Array.filter (native)
    at Program.utils.getTestInfo.forEach.testRun (C:\repo\eslint\node_modules\eslint-plugin-eslint-plugin\lib\rules\consistent-outp
ut.js:36:49)
    at Array.forEach (native)
    at EventEmitter.Program (C:\repo\eslint\node_modules\eslint-plugin-eslint-plugin\lib\rules\consistent-output.js:32:41)
    at emitOne (events.js:120:20)
    at EventEmitter.emit (events.js:210:7)
    at NodeEventGenerator.applySelector (C:\repo\eslint\lib\util\node-event-generator.js:265:26)
    at NodeEventGenerator.applySelectors (C:\repo\eslint\lib\util\node-event-generator.js:294:22)
    at NodeEventGenerator.enterNode (C:\repo\eslint\lib\util\node-event-generator.js:308:14)
@aladdin-add aladdin-add added the bug label Sep 5, 2017
@aladdin-add
Copy link
Contributor Author

similar to #35

@not-an-aardvark
Copy link
Contributor

I wonder if it would be better to filter out missing elements in utils.getTestInfo. I can't imagine that rules would ever care about missing elements, and this would prevent rules from always having to do a null check.

aladdin-add added a commit to aladdin-add/eslint-plugin-eslint-plugin that referenced this issue Sep 5, 2017
aladdin-add added a commit to aladdin-add/eslint-plugin-eslint-plugin that referenced this issue Sep 5, 2017
aladdin-add added a commit to aladdin-add/eslint-plugin-eslint-plugin that referenced this issue Sep 5, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants