Skip to content

Commit

Permalink
feat(eslint-plugin): [promise-function-async] make allowAny default t…
Browse files Browse the repository at this point in the history
…rue (#733)

BREAKING CHANGE: changing default rule config
  • Loading branch information
bradzacher authored and JamesHenry committed Jul 21, 2019
1 parent 4933ade commit 590ca50
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
3 changes: 1 addition & 2 deletions packages/eslint-plugin/docs/rules/promise-function-async.md
Expand Up @@ -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`:
Expand All @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-plugin/src/rules/promise-function-async.ts
Expand Up @@ -58,7 +58,7 @@ export default util.createRule<Options, MessageIds>({
},
defaultOptions: [
{
allowAny: false,
allowAny: true,
allowedPromiseNames: [],
checkArrowFunctions: true,
checkFunctionDeclarations: true,
Expand Down
10 changes: 10 additions & 0 deletions packages/eslint-plugin/tests/rules/promise-function-async.test.ts
Expand Up @@ -102,6 +102,11 @@ function returnsAny(): any {
return 0;
}
`,
options: [
{
allowAny: false,
},
],
errors: [
{
messageId,
Expand All @@ -114,6 +119,11 @@ function returnsUnknown(): unknown {
return 0;
}
`,
options: [
{
allowAny: false,
},
],
errors: [
{
messageId,
Expand Down

0 comments on commit 590ca50

Please sign in to comment.