Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[comma-spacing] Cannot read property 'range' of undefined #2906

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
3 tasks done
AriPerkkio opened this issue Dec 28, 2020 · 0 comments · Fixed by #2915
Closed
3 tasks done

[comma-spacing] Cannot read property 'range' of undefined #2906

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

Comments

@AriPerkkio
Copy link

  • 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/comma-spacing": "error"
  }
}
interface A<> {}

TS Playground

Crash report

Rule: comma-spacing

  • Message: Cannot read property 'range' of undefined Occurred while linting <text>:20
  • Path: beyondessential/tupaia/packages/psss-server/src/types.ts
  • Link
}

type PsssRequestBody = Record<string, unknown>;

export interface PsssRequest<>extends Request<ParamsDictionary, unknown,
PsssRequestBody, Query> {
  sessionModel: PsssSessionModel;
  sessionCookie?: SessionCookie;
  session?: PsssSessionType;
}
TypeError: Cannot read property 'range' of undefined
Occurred while linting <text>:20
    at SourceCode.getTokenAfter (/home/runner/work/eslint-remote-tester/eslint-remote-tester/ci/node_modules/eslint/lib/source-code/token-store/index.js:315:18)
    at addTypeParametersTrailingCommaToIgnoreList(/home/runner/work/eslint-remote-tester/eslint-remote-tester/ci/node_modules/@typescript-eslint/eslint-plugin/dist/rules/comma-spacing.js:73:43)
    at /home/runner/work/eslint-remote-tester/eslint-remote-tester/ci/node_modules/eslint/lib/linter/safe-emitter.js:45:58
    at Array.forEach (<anonymous>)
    at Object.emit (/home/runner/work/eslint-remote-tester/eslint-remote-tester/ci/node_modules/eslint/lib/linter/safe-emitter.js:45:38)
    at NodeEventGenerator.applySelector(/home/runner/work/eslint-remote-tester/eslint-remote-tester/ci/node_modules/eslint/lib/linter/node-event-generator.js:254:26)
    at NodeEventGenerator.applySelectors(/home/runner/work/eslint-remote-tester/eslint-remote-tester/ci/node_modules/eslint/lib/linter/node-event-generator.js:283:22)
    at NodeEventGenerator.enterNode(/home/runner/work/eslint-remote-tester/eslint-remote-tester/ci/node_modules/eslint/lib/linter/node-event-generator.js:297:14)
    at CodePathAnalyzer.enterNode(/home/runner/work/eslint-remote-tester/eslint-remote-tester/ci/node_modules/eslint/lib/linter/code-path-analysis/code-path-analyzer.js:711:23)
    at /home/runner/work/eslint-remote-tester/eslint-remote-tester/ci/node_modules/eslint/lib/linter/linter.js:952:32

Expected Result

ESLint rule should not crash.

Actual Result

TypeError: Cannot read property 'range' of undefined
Occurred while linting <text>:20
    at SourceCode.getTokenAfter (/home/runner/work/eslint-remote-tester/eslint-remote-tester/ci/node_modules/eslint/lib/source-code/token-store/index.js:315:18)
    at addTypeParametersTrailingCommaToIgnoreList(/home/runner/work/eslint-remote-tester/eslint-remote-tester/ci/node_modules/@typescript-eslint/eslint-plugin/dist/rules/comma-spacing.js:73:43)

Additional Info

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

Versions

package version
@typescript-eslint/eslint-plugin 4.11.0
@typescript-eslint/parser 4.11.0
TypeScript 4.1.3
ESLint 7.16.0
node 14.15.1
@AriPerkkio AriPerkkio added package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin triage Waiting for team members to take a look labels Dec 28, 2020
@bradzacher bradzacher added bug Something isn't working and removed triage Waiting for team members to take a look labels Dec 28, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 3, 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
Development

Successfully merging a pull request may close this issue.

2 participants