-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
[promise-function-async] False positives with functions that return any
#369
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
Comments
This is technically correct since an object of type |
While it might be technically correct, I don't see how it's ever wanted behavior for this rule. It would mean you would have to add |
Does the lint trigger on Edit: Never mind. This rule intends to solve functions 'either returning a Promise or something else' as well as 'returning a rejected Promise and throwing an error'. If a function returns 'any', the user disables type checking in Typescript and relies on manually checked logic. I think the expected behaviour is thus that it doesn't lint in the specific case of |
That’s why i suggested adding an option that would allow |
I've got the same problem with
This gets flagged as |
Also seeing this in a (note: this is from a project that has a mixed codebase of JS and TS files, and the webpack config is Javascript) function extractCss(hashFilename) {
return new MiniCssExtractPlugin({filename: hashFilename ? "[name]-[chunkhash:6].css" : "[name].css"});
}
function defineAppConfig(maxDataAgeDays) {
return new webpack.DefinePlugin({MAX_DATA_AGE_DAYS: maxDataAgeDays});
} Both of the above functions trigger |
I'm getting similar error on import { Reducer } from 'redux';
const reducer: Reducer<Record<string, string>> = (state = {}, _action) => state; Versions
|
have you tried the |
(closing as this didn't get closed when #553 was merged) |
Repro
Expected Result
I expected the rule to only report on functions that return a promise.
Actual Result
It reports on functions returning
any
.Additional Info
Versions
@typescript-eslint/eslint-plugin
1.5.0
@typescript-eslint/parser
1.5.0
TypeScript
3.3.3333
ESLint
5.15.3
node
10.15.1
npm
6.9.0
The text was updated successfully, but these errors were encountered: