Skip to content

Latest commit

 

History

History
25 lines (17 loc) · 926 Bytes

File metadata and controls

25 lines (17 loc) · 926 Bytes

Example: redux-toolkit and Floating Promise Detection

An example of using redux-toolkit along with the @typescript-eslint/no-floating-promises rule enabled. It uses the allowForKnownSafePromises rule option to not report on RTK APIs that create a SafePromise, such as createAsyncThunk.

Setup

npm i

Usage

npm run lint

There should be no lint reports.

If you remove the allowForKnownSafePromises option from eslint.config.js, there will be:

.../index.test.ts
  4:1  error  Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the `void` operator  @typescript-eslint/no-floating-promises