eslint / typescript-eslint-parser

An ESLint custom parser which leverages TypeScript ESTree to allow for ESLint to lint TypeScript source code.
Other
915 stars 75 forks source link

arrow-parens: false positive for generic arrow function #475

Closed OliverJAsh closed 5 years ago

OliverJAsh commented 6 years ago

What version of TypeScript are you using? 2.8.3

What version of typescript-eslint-parser are you using? 15.0.0

What code were you trying to parse?

// Unexpected error: arrow-parens
const bar = <T>(t: T) => {};
// No error as expected
const bar2 = function <T>(t: T) {};
JamesHenry commented 6 years ago

This makes sense, a custom rule will need to be created in the plugin to handle this. It would be fantastic if one of the people affected by this issue could contribute to it.

knpwrs commented 5 years ago

For the time being I'm following this two-step plan:

First: Disable eslint no-unused-vars for typescript files:

  "overrides": [{
    "files": ["src/**/*.ts{,x}"],
    "parser": "typescript-eslint-parser",
    "rules": {
      "no-unused-vars": "off"
    },
  }],

Second: Enable unused variable errors in TypeScript:

    "noUnusedLocals": true,
JamesHenry commented 5 years ago

This issue has been migrated to the new project here: https://github.com/typescript-eslint/typescript-eslint/issues/14

Thanks!