Skip to content
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

[dot-notation] Cannot read property '0' of undefined #1945

Closed
CatsMiaow opened this issue Apr 28, 2020 · 1 comment · Fixed by #1947
Closed

[dot-notation] Cannot read property '0' of undefined #1945

CatsMiaow opened this issue Apr 28, 2020 · 1 comment · Fixed by #1947
Labels
bug Something isn't working package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin

Comments

@CatsMiaow
Copy link

  • Node.js v12.16.2
  • @typescript-eslint/eslint-plugin v2.30.0
  • @typescript-eslint/parser v2.30.0
"rules": {
  "dot-notation": "off",
  "@typescript-eslint/dot-notation": ["error", { "allowPrivateClassPropertyAccess": true }]
}

test.spec.ts

import got from 'got';

test('Test', async () => {
  const body = await got.post('https://google.com');

  expect(typeof body).toBe('object');
});

Occurs when using the allowPrivateClassPropertyAccess option. #1867

eslint --ext .ts test/test.spec.ts
TypeError: Cannot read property '0' of undefined
Occurred while linting /Users/cats/test/test.spec.ts:4
    at MemberExpression (/Users/cats/node_modules/@typescript-eslint/eslint-plugin/dist/rules/dot-notation.js:67:119)
    at /Users/cats/node_modules/eslint/lib/linter/safe-emitter.js:45:58
    at Array.forEach (<anonymous>)
    at Object.emit (/Users/cats/node_modules/eslint/lib/linter/safe-emitter.js:45:38)
    at NodeEventGenerator.applySelector (/Users/cats/node_modules/eslint/lib/linter/node-event-generator.js:254:26)
    at NodeEventGenerator.applySelectors (/Users/cats/node_modules/eslint/lib/linter/node-event-generator.js:283:22)
    at NodeEventGenerator.enterNode (/Users/cats/node_modules/eslint/lib/linter/node-event-generator.js:297:14)
    at CodePathAnalyzer.enterNode (/Users/cats/node_modules/eslint/lib/linter/code-path-analysis/code-path-analyzer.js:635:23)
    at /Users/cats/node_modules/eslint/lib/linter/linter.js:948:32
    at Array.forEach (<anonymous>)
@CatsMiaow CatsMiaow added package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin triage Waiting for maintainers to take a look labels Apr 28, 2020
@bradzacher bradzacher added bug Something isn't working and removed triage Waiting for maintainers to take a look labels Apr 28, 2020
@bradzacher
Copy link
Member

Ugh. This is due to the dodgy types in TypeScript.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 30, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants