Skip to content

[no-floating-promises] assigning unresolved promises doesn't cause an error #3359

@ATheCoder

Description

@ATheCoder
  • 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

module.exports = {
  env: {
    browser: true,
    amd: true,
    node: true,
  },
  root: true,
  parser: '@typescript-eslint/parser',
  parserOptions: {
    project: ['tsconfig.json'],
  },
  plugins: ['@typescript-eslint'],
  extends: [
    'eslint:recommended',
    'plugin:@typescript-eslint/eslint-recommended',
    'plugin:@typescript-eslint/recommended',
  ],
  rules: {
    '@typescript-eslint/no-floating-promises': [2],
    '@typescript-eslint/strict-boolean-expressions': [2],
    "require-await": "off",
    "@typescript-eslint/no-misused-promises": [2]
  }
};
const foo = async () => console.log('a')
foo()
const bar = foo()

Expected Result
Both the second and third lines should be linted.

Actual Result

only the second line gets linted

Additional Info

I think assigning unresolved promises doesn't trigger no-floating-promises

Versions

package version
@typescript-eslint/eslint-plugin 4.22.1
@typescript-eslint/parser 4.22.1
TypeScript 3.9.7
ESLint 7.25.0
node 14.16.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    package: eslint-pluginIssues related to @typescript-eslint/eslint-pluginworking as intendedIssues that are closed as they are working as intended

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions