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

Skip to content

Bug: [@typescript-eslint/comma-dangle] ruleListener is not a function error when using generics: ignore setting #7220

@erik-slovak

Description

@erik-slovak

Before You File a Bug Report Please Confirm You Have Done The Following...

  • I have tried restarting my IDE and the issue persists.
  • I have updated to the latest version of the packages.
  • I have searched for related issues and found none that matched my issue.
  • I have read the FAQ and my problem is not listed.

Playground Link

https://typescript-eslint.io/play/#ts=5.1.6&fileType=.tsx&code=MYewdgzgLgBAhjAvDAPAFQJoAUCiAaAPgAoBKJAmAbwF8g&eslintrc=N4KABGBEBOCuA2BTAzpAXGUEKQAIBcBPABxQGNoBLY-AWhXkoDt8B6MgewFsuBDWgCa8mAcyTowAbUiJo0DtEgAaTOGw4RiJrMplUGSJRFMFiSGogBfALprLIS0A&tsconfig=N4KABGBEDGD2C2AHAlgGwKYCcDyiAuysAdgM6QBcYoEEkJemy0eAcgK6qoDCAFutAGsylBm3TgwAXxCSgA&tokens=false

Repro Code

const a = <TYPE,>() => {}

ESLint Config

module.exports = {
  parser: "@typescript-eslint/parser",
  rules: {
    "@typescript-eslint/comma-dangle": ["error", {"generics": "ignore"}],
  },
};

tsconfig

{
  "compilerOptions": {
    // ...
  }
}

Expected Result

I expected eslint to not crash.

Actual Result

Eslint crashes in linter.js, exact error (credits for the stack trace @sharpdressedcodes):

TypeError: ruleListener is not a function
Occurred while linting /home/node/app/custom.d.ts:32
Rule: "@typescript-eslint/comma-dangle"
    at ruleErrorHandler (/home/node/app/node_modules/eslint/lib/linter/linter.js:1061:28)
    at /home/node/app/node_modules/eslint/lib/linter/safe-emitter.js:45:58
    at Array.forEach (<anonymous>)
    at Object.emit (/home/node/app/node_modules/eslint/lib/linter/safe-emitter.js:45:38)
    at NodeEventGenerator.applySelector (/home/node/app/node_modules/eslint/lib/linter/node-event-generator.js:297:26)
    at NodeEventGenerator.applySelectors (/home/node/app/node_modules/eslint/lib/linter/node-event-generator.js:326:22)
    at NodeEventGenerator.enterNode (/home/node/app/node_modules/eslint/lib/linter/node-event-generator.js:340:14)
    at CodePathAnalyzer.enterNode (/home/node/app/node_modules/eslint/lib/linter/code-path-analysis/code-path-analyzer.js:795:23)
    at /home/node/app/node_modules/eslint/lib/linter/linter.js:1096:32
    at Array.forEach (<anonymous>)

Additional Info

The change in comma-dangle.ts in this commit is causing the issue: 42fe29f#diff-511375b235a2f19339f4938328ad1f97c7da71d62736b0701cf9ea4eaf5e54aa

Metadata

Metadata

Labels

accepting prsGo ahead, send a pull request that resolves this issuebugSomething isn't workingpackage: eslint-pluginIssues related to @typescript-eslint/eslint-plugin

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions