diff --git a/src/rules/converters/no-unused-variable.ts b/src/rules/converters/no-unused-variable.ts new file mode 100644 index 00000000..5486a4a8 --- /dev/null +++ b/src/rules/converters/no-unused-variable.ts @@ -0,0 +1,16 @@ +import { RuleConverter } from "../converter"; + +export const NO_UNUSED_VARIABLE_NOTICE = + "Please read the following article as the rule behaviour may change on the short term: " + + "https://github.com/typescript-eslint/typescript-eslint/issues/1856"; + +export const convertNoUnusedVariable: RuleConverter = () => { + return { + rules: [ + { + ruleName: "@typescript-eslint/no-unused-vars", + notices: [NO_UNUSED_VARIABLE_NOTICE], + }, + ], + }; +}; diff --git a/src/rules/converters/tests/no-unused-variable.test.ts b/src/rules/converters/tests/no-unused-variable.test.ts new file mode 100644 index 00000000..ddfd0322 --- /dev/null +++ b/src/rules/converters/tests/no-unused-variable.test.ts @@ -0,0 +1,18 @@ +import { convertNoUnusedVariable, NO_UNUSED_VARIABLE_NOTICE } from "../no-unused-variable"; + +describe(convertNoUnusedVariable, () => { + test("conversion without arguments", () => { + const result = convertNoUnusedVariable({ + ruleArguments: [], + }); + + expect(result).toEqual({ + rules: [ + { + ruleName: "@typescript-eslint/no-unused-vars", + notices: [NO_UNUSED_VARIABLE_NOTICE], + }, + ], + }); + }); +}); diff --git a/src/rules/rulesConverters.ts b/src/rules/rulesConverters.ts index 95671e19..8d0d8be4 100644 --- a/src/rules/rulesConverters.ts +++ b/src/rules/rulesConverters.ts @@ -99,6 +99,7 @@ import { convertNoUnnecessarySemicolons } from "./converters/no-unnecessary-semi import { convertNoUnnecessaryTypeAssertion } from "./converters/no-unnecessary-type-assertion"; import { convertNoUnsafeFinally } from "./converters/no-unsafe-finally"; import { convertNoUnusedExpression } from "./converters/no-unused-expression"; +import { convertNoUnusedVariable } from "./converters/no-unused-variable"; import { convertNoUseBeforeDeclare } from "./converters/no-use-before-declare"; import { convertNoVarKeyword } from "./converters/no-var-keyword"; import { convertNoVarRequires } from "./converters/no-var-requires"; @@ -240,6 +241,7 @@ export const rulesConverters = new Map([ ["no-unnecessary-type-assertion", convertNoUnnecessaryTypeAssertion], ["no-unsafe-finally", convertNoUnsafeFinally], ["no-unused-expression", convertNoUnusedExpression], + ["no-unused-variable", convertNoUnusedVariable], ["no-use-before-declare", convertNoUseBeforeDeclare], ["no-var-keyword", convertNoVarKeyword], ["no-var-requires", convertNoVarRequires],