From 590ca50051b821aba6439125ee54c0c54c807ca9 Mon Sep 17 00:00:00 2001 From: Brad Zacher Date: Sun, 21 Jul 2019 15:51:36 -0700 Subject: [PATCH] feat(eslint-plugin): [promise-function-async] make allowAny default true (#733) BREAKING CHANGE: 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 e28de05742f..5ccddf45ed4 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 4d5c96d76b4..529f41ee72b 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 1b14ae5d131..829bb9a091c 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,