From 0be054e2d19be6498e8945d753200d352b70a21d Mon Sep 17 00:00:00 2001 From: Brad Zacher Date: Sat, 20 Jul 2019 15:10:04 -0700 Subject: [PATCH] feat(eslint-plugin): [promise-function-async] make allowAny default true BREAKING: changing default rule config --- .../eslint-plugin/docs/rules/promise-function-async.md | 3 +-- .../eslint-plugin/src/rules/promise-function-async.ts | 2 +- .../tests/rules/promise-function-async.test.ts | 10 ++++++++++ 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/packages/eslint-plugin/docs/rules/promise-function-async.md b/packages/eslint-plugin/docs/rules/promise-function-async.md index e28de05742ff..5ccddf45ed47 100644 --- a/packages/eslint-plugin/docs/rules/promise-function-async.md +++ b/packages/eslint-plugin/docs/rules/promise-function-async.md @@ -36,7 +36,7 @@ async function functionDeturnsPromise() { Options may be provided as an object with: -- `allowAny` to indicate that `any` or `unknown` shouldn't be considered Promises (`false` by default). +- `allowAny` to indicate that `any` or `unknown` shouldn't be considered Promises (`true` by default). - `allowedPromiseNames` to indicate any extra names of classes or interfaces to be considered Promises when returned. In addition, each of the following properties may be provided, and default to `true`: @@ -51,7 +51,6 @@ In addition, each of the following properties may be provided, and default to `t "@typescript-eslint/promise-function-async": [ "error", { - "allowAny": true, "allowedPromiseNames": ["Thenable"], "checkArrowFunctions": true, "checkFunctionDeclarations": true, diff --git a/packages/eslint-plugin/src/rules/promise-function-async.ts b/packages/eslint-plugin/src/rules/promise-function-async.ts index 4d5c96d76b45..529f41ee72bb 100644 --- a/packages/eslint-plugin/src/rules/promise-function-async.ts +++ b/packages/eslint-plugin/src/rules/promise-function-async.ts @@ -58,7 +58,7 @@ export default util.createRule({ }, defaultOptions: [ { - allowAny: false, + allowAny: true, allowedPromiseNames: [], checkArrowFunctions: true, checkFunctionDeclarations: true, diff --git a/packages/eslint-plugin/tests/rules/promise-function-async.test.ts b/packages/eslint-plugin/tests/rules/promise-function-async.test.ts index 1b14ae5d131d..829bb9a091c6 100644 --- a/packages/eslint-plugin/tests/rules/promise-function-async.test.ts +++ b/packages/eslint-plugin/tests/rules/promise-function-async.test.ts @@ -102,6 +102,11 @@ function returnsAny(): any { return 0; } `, + options: [ + { + allowAny: false, + }, + ], errors: [ { messageId, @@ -114,6 +119,11 @@ function returnsUnknown(): unknown { return 0; } `, + options: [ + { + allowAny: false, + }, + ], errors: [ { messageId, pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy