prefer-to-be-null TypeError with TSAsExpression
See original GitHub issueESLint: 6.1.0 @typescript-eslint/parser: 1.12.0 eslint-plugin-jest: 22.12.0
Code:
(expect('Model must be bound to an array if the multiple property is true') as any).toHaveBeenTipped()
Error in methodName
:
TypeError: Cannot read property 'name' of undefined
Occurred while linting /home/kael/Documents/vuetifyjs/vuetify/packages/vuetify/src/components/VItemGroup/__tests__/VItemGroup.spec.ts:53
at methodName (/home/kael/Documents/vuetifyjs/vuetify/node_modules/eslint-plugin-jest/lib/rules/util.js:70:12)
at expectNotCase (/home/kael/Documents/vuetifyjs/vuetify/node_modules/eslint-plugin-jest/lib/rules/util.js:23:101)
at expectToBeCase (/home/kael/Documents/vuetifyjs/vuetify/node_modules/eslint-plugin-jest/lib/rules/util.js:43:41)
at CallExpression (/home/kael/Documents/vuetifyjs/vuetify/node_modules/eslint-plugin-jest/lib/rules/prefer-to-be-null.js:25:45)
at /home/kael/Documents/vuetifyjs/vuetify/node_modules/eslint/lib/linter/safe-emitter.js:45:58
at Array.forEach (<anonymous>)
at Object.emit (/home/kael/Documents/vuetifyjs/vuetify/node_modules/eslint/lib/linter/safe-emitter.js:45:38)
at NodeEventGenerator.applySelector (/home/kael/Documents/vuetifyjs/vuetify/node_modules/eslint/lib/linter/node-event-generator.js:253:26)
at NodeEventGenerator.applySelectors (/home/kael/Documents/vuetifyjs/vuetify/node_modules/eslint/lib/linter/node-event-generator.js:282:22)
at NodeEventGenerator.enterNode (/home/kael/Documents/vuetifyjs/vuetify/node_modules/eslint/lib/linter/node-event-generator.js:296:14)
node.parent.property
is undefined
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:7 (4 by maintainers)
Top Results From Across the Web
No results found
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yes 😃
We can have a separate
RuleTester
for these ones in the same test file. I’d like to keep most tests with the default parserBamn - TS conversion fixed this.
Do we want to add a test case for this?
It’s a generic problem, and in order to have a test for it we’ll have to set the
parser
forRuleTester
toRuleTester
parser to be set to@typescript-eslint/parser
, b/c of theas
:If we want a test case, I think ideally it should be added to the “standard tests” object I’m going to look to make, in which case all tests should be run using
@typescript-eslint/parser
.I’ve got no problem w/ this, but don’t know what the impacts to performance & co might be 😂