Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(eslint-plugin)!: [promise-function-async] make allowAny default true #733

Merged
merged 2 commits into from
Jul 21, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 1 addition & 2 deletions packages/eslint-plugin/docs/rules/promise-function-async.md
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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