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

[method-signature-style] Cannot read property 'typeAnnotation' of undefined #2834

Closed
3 tasks done
AriPerkkio opened this issue Dec 1, 2020 · 0 comments · Fixed by #2836
Closed
3 tasks done

[method-signature-style] Cannot read property 'typeAnnotation' of undefined #2834

AriPerkkio opened this issue Dec 1, 2020 · 0 comments · Fixed by #2836
Labels
bug Something isn't working package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin

Comments

@AriPerkkio
Copy link

AriPerkkio commented Dec 1, 2020

Hello, I'm testing stability of well known community ESlint plugins with eslint-remote-tester. This ESLint plugin seems to contain a rule which causes linter to crash. ESlint rules should not crash in any condition since this makes all valid linting problems disappear. If this is a false flag please let me know.

  • I have tried restarting my IDE and the issue persists.
  • I have updated to the latest version of the packages.
  • I have read the FAQ and my problem is not listed.

Repro

{
  "rules": {
   "@typescript-eslint/method-signature-style": "error"
  }
}
// An interface defining method which implicitly returns `any`
interface MyInterface {
    methodReturningImplicitAny();
}
Error report from ci/eslint-remote-tester-results/adobe_react-spectrum.md

Rule: method-signature-style

  • Message: Cannot read property 'typeAnnotation' of undefined Occurred while linting <text>:25
  • Path: adobe/react-spectrum/packages/@react-stately/color/src/useColorWheelState.ts
  • Link
  readonly hue: number,
  setHue(value: number): void,

  increment(minStepSize?: number),
  decrement(minStepSize?: number),

  isDragging: boolean,
  setDragging(value: boolean): void
}
TypeError: Cannot read property 'typeAnnotation' of undefined
Occurred while linting <text>:25
    at getMethodReturnType (/<root-path-removed>/eslint-remote-tester/ci/node_modules/@typescript-eslint/eslint-plugin/dist/rules/method-signature-style.js:74:55)
    at Object.fix (/<root-path-removed>/eslint-remote-tester/ci/node_modules/@typescript-eslint/eslint-plugin/dist/rules/method-signature-style.js:163:48)
    at normalizeFixes (/<root-path-removed>/eslint-remote-tester/node_modules/eslint/lib/linter/report-translator.js:178:28)
    at /<root-path-removed>/eslint-remote-tester/node_modules/eslint/lib/linter/report-translator.js:347:49
    at Object.report (/<root-path-removed>/eslint-remote-tester/node_modules/eslint/lib/linter/linter.js:920:41)
    at TSMethodSignature (/<root-path-removed>/eslint-remote-tester/ci/node_modules/@typescript-eslint/eslint-plugin/dist/rules/method-signature-style.js:157:29)
    at /<root-path-removed>/eslint-remote-tester/node_modules/eslint/lib/linter/safe-emitter.js:45:58
    at Array.forEach (<anonymous>)
    at Object.emit (/<root-path-removed>/eslint-remote-tester/node_modules/eslint/lib/linter/safe-emitter.js:45:38)
    at NodeEventGenerator.applySelector (/<root-path-removed>/eslint-remote-tester/node_modules/eslint/lib/linter/node-event-generator.js:254:26)

Expected Result

ESLint rule should not crash.

Actual Result

TypeError: Cannot read property 'typeAnnotation' of undefined
Occurred while linting <text>:25
    at getMethodReturnType (/<root-path-removed>/eslint-remote-tester/ci/node_modules/@typescript-eslint/eslint-plugin/dist/rules/method-signature-style.js:74:55)

Additional Info

This is not blocking my development or anything. This was spotted on automated CI run: https://github.com/AriPerkkio/eslint-remote-tester/actions/runs/390047365

2020-11-29T19:20:45.9576188Z [WARN] adobe/react-spectrum crashed: method-signature-style

Versions

package version
@typescript-eslint/eslint-plugin 4.9.0
@typescript-eslint/parser 4.9.0
TypeScript 4.0.2
ESLint 7.9.0
node 14.15.1
@AriPerkkio AriPerkkio added package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin triage Waiting for maintainers to take a look labels Dec 1, 2020
@bradzacher bradzacher added bug Something isn't working and removed triage Waiting for maintainers to take a look labels Dec 1, 2020
bradzacher added a commit that referenced this issue Dec 1, 2020
bradzacher added a commit that referenced this issue Dec 1, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 1, 2021
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
2 participants