diff --git a/src/rules/converters.ts b/src/rules/converters.ts index f98b21917..1154b04a4 100644 --- a/src/rules/converters.ts +++ b/src/rules/converters.ts @@ -80,6 +80,7 @@ import { convertNoUnsafeFinally } from "./converters/no-unsafe-finally"; import { convertNoUseBeforeDeclare } from "./converters/no-use-before-declare"; import { convertNoVarKeyword } from "./converters/no-var-keyword"; import { convertNoVarRequires } from "./converters/no-var-requires"; +import { convertNoVoidExpression } from "./converters/no-void-expression"; import { convertObjectLiteralKeyQuotes } from "./converters/object-literal-key-quotes"; import { convertObjectLiteralShorthand } from "./converters/object-literal-shorthand"; import { convertOneVariablePerDeclaration } from "./converters/one-variable-per-declaration"; @@ -168,6 +169,7 @@ export const converters = new Map([ ["no-use-before-declare", convertNoUseBeforeDeclare], ["no-var-keyword", convertNoVarKeyword], ["no-var-requires", convertNoVarRequires], + ["no-void-expression", convertNoVoidExpression], ["prefer-for-of", convertPreferForOf], ["prefer-object-spread", convertPreferObjectSpread], ["promise-function-async", convertPromiseFunctionAsync], diff --git a/src/rules/converters/no-void-expression.ts b/src/rules/converters/no-void-expression.ts new file mode 100644 index 000000000..55a14670c --- /dev/null +++ b/src/rules/converters/no-void-expression.ts @@ -0,0 +1,15 @@ +import { RuleConverter } from "../converter"; + +export const convertNoVoidExpression: RuleConverter = tslintRule => { + return { + rules: [ + { + ...(tslintRule.ruleArguments.length > 0 && + tslintRule.ruleArguments.includes("ignore-arrow-function-shorthand") && { + notices: ["ESLint does not support ignoring arrow function shorthand."], + }), + ruleName: "no-void", + }, + ], + }; +}; diff --git a/src/rules/converters/tests/no-void-expression.test.ts b/src/rules/converters/tests/no-void-expression.test.ts new file mode 100644 index 000000000..84a03ad49 --- /dev/null +++ b/src/rules/converters/tests/no-void-expression.test.ts @@ -0,0 +1,32 @@ +import { convertNoVoidExpression } from "../no-void-expression"; + +describe(convertNoVoidExpression, () => { + test("conversion without arguments", () => { + const result = convertNoVoidExpression({ + ruleArguments: [], + }); + + expect(result).toEqual({ + rules: [ + { + ruleName: "no-void", + }, + ], + }); + }); + + test("conversion with ignore-arrow-function-shorthand argument", () => { + const result = convertNoVoidExpression({ + ruleArguments: ["ignore-arrow-function-shorthand"], + }); + + expect(result).toEqual({ + rules: [ + { + notices: ["ESLint does not support ignoring arrow function shorthand."], + ruleName: "no-void", + }, + ], + }); + }); +});