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

[explicit-function-return-type] allowExpressions false positives and incorrect documentation #387

Closed
gilbsgilbs opened this issue Mar 28, 2019 · 0 comments · Fixed by #388
Labels
bug Something isn't working package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin

Comments

@gilbsgilbs
Copy link
Contributor

gilbsgilbs commented Mar 28, 2019

Repro

{
  "rules": {
    "typescript/explicit-function-return-type": ["error", {allowExpressions: true}]
  }
}
node.addEventListener('click', () => {});

Expected Result

No error

Actual Result

Reported as missing return type

Additional Info

I can see at least two issues:

  • As indicated here the default value for allowExpressions should be false but it's not
  • As the option is all borked, even when enabled (which is the actual default), the rule reports a ton of false positives which lets the user think that the option is disabled even when it's enabled (explicitly or implicitly). This is probably why we didn't had this reported before.

I investigated a bit and was able to figure out why tests are not failing: filename key is either not set or set to 'something.js' in tests with allowExpressions. This tells eslint to skip all typescript rules somehow. I am easily able to reproduce in tests by setting the filename to 'test.ts'.

Versions

package version
@typescript-eslint/eslint-plugin cebcfe64
@typescript-eslint/parser cebcfe64
TypeScript 3.3.3
ESLint 5.14.1
node 11.12.0
npm 6.9.0
@gilbsgilbs gilbsgilbs added package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin triage Waiting for maintainers to take a look labels Mar 28, 2019
@gilbsgilbs gilbsgilbs changed the title [explicit-function-return-type] allowExpressions false positives and incorrect documentations [explicit-function-return-type] allowExpressions false positives and incorrect documentation Mar 28, 2019
gilbsgilbs added a commit to gilbsgilbs/typescript-eslint that referenced this issue Mar 28, 2019
@bradzacher bradzacher added bug Something isn't working and removed triage Waiting for maintainers to take a look labels Mar 28, 2019
bradzacher pushed a commit that referenced this issue Mar 28, 2019
…t-function-return-type and incorrect documentation (#388)

Fixes #387
@typescript-eslint typescript-eslint locked as resolved and limited conversation to collaborators Feb 21, 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
2 participants