From 2c88ecd4607c48c8d62c1240c23cad3a3ebea5c7 Mon Sep 17 00:00:00 2001 From: asponda Date: Fri, 4 Oct 2019 15:26:41 -0300 Subject: [PATCH 1/2] feat: added no-async-without-await converter and unit tests --- src/rules/converters.ts | 2 ++ src/rules/converters/no-async-without-await.ts | 11 +++++++++++ .../tests/no-async-without-await.test.ts | 17 +++++++++++++++++ 3 files changed, 30 insertions(+) create mode 100644 src/rules/converters/no-async-without-await.ts create mode 100644 src/rules/converters/tests/no-async-without-await.test.ts diff --git a/src/rules/converters.ts b/src/rules/converters.ts index 96a036500..374dac514 100644 --- a/src/rules/converters.ts +++ b/src/rules/converters.ts @@ -29,6 +29,7 @@ import { convertNewlinePerChainedCall } from "./converters/newline-per-chained-c import { convertNewParens } from "./converters/new-parens"; import { convertNoAngleBracketTypeAssertion } from "./converters/no-angle-bracket-type-assertion"; import { convertNoArg } from "./converters/no-arg"; +import { convertNoAsyncWithoutAwait } from "./converters/no-async-without-await"; import { convertNoBannedTerms } from "./converters/no-banned-terms"; import { convertNoBitwise } from "./converters/no-bitwise"; import { convertNoConditionalAssignment } from "./converters/no-conditional-assignment"; @@ -136,6 +137,7 @@ export const converters = new Map([ ["no-angle-bracket-type-assertion", convertNoAngleBracketTypeAssertion], ["no-any", convertNoExplicitAny], ["no-arg", convertNoArg], + ["no-async-without-await", convertNoAsyncWithoutAwait], ["no-bitwise", convertNoBitwise], ["no-conditional-assignment", convertNoConditionalAssignment], ["no-construct", convertNoConstruct], diff --git a/src/rules/converters/no-async-without-await.ts b/src/rules/converters/no-async-without-await.ts new file mode 100644 index 000000000..e3bbc4fe5 --- /dev/null +++ b/src/rules/converters/no-async-without-await.ts @@ -0,0 +1,11 @@ +import { RuleConverter } from "../converter"; + +export const convertNoAsyncWithoutAwait: RuleConverter = () => { + return { + rules: [ + { + ruleName: "require-await", + }, + ], + }; +}; diff --git a/src/rules/converters/tests/no-async-without-await.test.ts b/src/rules/converters/tests/no-async-without-await.test.ts new file mode 100644 index 000000000..04a0f5ac8 --- /dev/null +++ b/src/rules/converters/tests/no-async-without-await.test.ts @@ -0,0 +1,17 @@ +import { convertNoAsyncWithoutAwait } from "../no-async-without-await"; + +describe(convertNoAsyncWithoutAwait, () => { + test("conversion without arguments", () => { + const result = convertNoAsyncWithoutAwait({ + ruleArguments: [], + }); + + expect(result).toEqual({ + rules: [ + { + ruleName: "require-await", + }, + ], + }); + }); +}); From 5678adf48ed9de64614d47be93bde1d5b63adb43 Mon Sep 17 00:00:00 2001 From: asponda Date: Sat, 5 Oct 2019 17:25:18 -0300 Subject: [PATCH 2/2] fix: no-async-without-await converter to @typescript-eslint/require-await --- src/rules/converters/no-async-without-await.ts | 2 +- src/rules/converters/tests/no-async-without-await.test.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/rules/converters/no-async-without-await.ts b/src/rules/converters/no-async-without-await.ts index e3bbc4fe5..7f8a5ff49 100644 --- a/src/rules/converters/no-async-without-await.ts +++ b/src/rules/converters/no-async-without-await.ts @@ -4,7 +4,7 @@ export const convertNoAsyncWithoutAwait: RuleConverter = () => { return { rules: [ { - ruleName: "require-await", + ruleName: "@typescript-eslint/require-await", }, ], }; diff --git a/src/rules/converters/tests/no-async-without-await.test.ts b/src/rules/converters/tests/no-async-without-await.test.ts index 04a0f5ac8..1a6084c6c 100644 --- a/src/rules/converters/tests/no-async-without-await.test.ts +++ b/src/rules/converters/tests/no-async-without-await.test.ts @@ -9,7 +9,7 @@ describe(convertNoAsyncWithoutAwait, () => { expect(result).toEqual({ rules: [ { - ruleName: "require-await", + ruleName: "@typescript-eslint/require-await", }, ], });