diff --git a/src/rules/converters/jsdoc-format.ts b/src/rules/converters/jsdoc-format.ts new file mode 100644 index 000000000..06d4a61be --- /dev/null +++ b/src/rules/converters/jsdoc-format.ts @@ -0,0 +1,22 @@ +import { RuleConverter, ConvertedRuleChanges } from "../converter"; + +export const JSDocNoticeMsg = + "ESLint does not support enforcing the first line of multiline JSDoc comments be empty."; + +export const convertJSDocFormat: RuleConverter = () => { + const ruleNames = [ + "jsdoc/check-alignment", + "jsdoc/check-indentation", + "jsdoc/newline-after-description", + ]; + + const mappedRuleNames: ConvertedRuleChanges[] = ruleNames.map(ruleName => { + return { ruleName }; + }); + + return { + rules: [...mappedRuleNames], + notices: [JSDocNoticeMsg], + plugins: ["eslint-plugin-jsdoc"], + }; +}; diff --git a/src/rules/converters/tests/jsdoc-format.test.ts b/src/rules/converters/tests/jsdoc-format.test.ts new file mode 100644 index 000000000..fdbffa862 --- /dev/null +++ b/src/rules/converters/tests/jsdoc-format.test.ts @@ -0,0 +1,25 @@ +import { convertJSDocFormat, JSDocNoticeMsg } from "../jsdoc-format"; + +describe(convertJSDocFormat, () => { + test("conversion without arguments", () => { + const result = convertJSDocFormat({ + ruleArguments: [], + }); + + expect(result).toEqual({ + rules: [ + { + ruleName: "jsdoc/check-alignment", + }, + { + ruleName: "jsdoc/check-indentation", + }, + { + ruleName: "jsdoc/newline-after-description", + }, + ], + notices: [JSDocNoticeMsg], + plugins: ["eslint-plugin-jsdoc"], + }); + }); +}); diff --git a/src/rules/rulesConverters.ts b/src/rules/rulesConverters.ts index 4ac20ea89..20b484464 100644 --- a/src/rules/rulesConverters.ts +++ b/src/rules/rulesConverters.ts @@ -23,6 +23,7 @@ import { convertIncrementDecrement } from "./converters/increment-decrement"; import { convertIndent } from "./converters/indent"; import { convertInterfaceName } from "./converters/interface-name"; import { convertInterfaceOverTypeLiteral } from "./converters/interface-over-type-literal"; +import { convertJSDocFormat } from "./converters/jsdoc-format"; import { convertLabelPosition } from "./converters/label-position"; import { convertLinebreakStyle } from "./converters/linebreak-style"; import { convertMaxClassesPerFile } from "./converters/max-classes-per-file"; @@ -161,6 +162,7 @@ export const rulesConverters = new Map([ ["indent", convertIndent], ["interface-name", convertInterfaceName], ["interface-over-type-literal", convertInterfaceOverTypeLiteral], + ["jsdoc-format", convertJSDocFormat], ["label-position", convertLabelPosition], ["linebreak-style", convertLinebreakStyle], ["max-classes-per-file", convertMaxClassesPerFile],