From fb4777de4c6c6e4db32e54e2ae3e9c6a38cd7964 Mon Sep 17 00:00:00 2001 From: KingDarBoja Date: Sun, 13 Oct 2019 17:57:07 -0500 Subject: [PATCH 1/4] Add jsdoc-format converter --- src/rules/converters.ts | 2 ++ src/rules/converters/jsdoc-format.ts | 18 ++++++++++++++ .../converters/tests/jsdoc-format.test.ts | 24 +++++++++++++++++++ 3 files changed, 44 insertions(+) create mode 100644 src/rules/converters/jsdoc-format.ts create mode 100644 src/rules/converters/tests/jsdoc-format.test.ts diff --git a/src/rules/converters.ts b/src/rules/converters.ts index d21e68bea..1552dba1e 100644 --- a/src/rules/converters.ts +++ b/src/rules/converters.ts @@ -19,6 +19,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"; @@ -149,6 +150,7 @@ export const converters = 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], diff --git a/src/rules/converters/jsdoc-format.ts b/src/rules/converters/jsdoc-format.ts new file mode 100644 index 000000000..898dc4af6 --- /dev/null +++ b/src/rules/converters/jsdoc-format.ts @@ -0,0 +1,18 @@ +import { RuleConverter, ConvertedRuleChanges } from "../converter"; + +export const convertJSDocFormat: RuleConverter = () => { + const ruleNames: string[] = [ + "jsdoc/check-alignment", + "jsdoc/require-jsdoc", + "jsdoc/newline-after-description", + ]; + + const mappedRuleNames: ConvertedRuleChanges[] = ruleNames.map(ruleName => { + return { ruleName }; + }); + + return { + rules: [...mappedRuleNames], + 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..fdc50930d --- /dev/null +++ b/src/rules/converters/tests/jsdoc-format.test.ts @@ -0,0 +1,24 @@ +import { convertJSDocFormat } from "../jsdoc-format"; + +describe(convertJSDocFormat, () => { + test("conversion without arguments", () => { + const result = convertJSDocFormat({ + ruleArguments: [], + }); + + expect(result).toEqual({ + rules: [ + { + ruleName: "jsdoc/check-alignment", + }, + { + ruleName: "jsdoc/require-jsdoc", + }, + { + ruleName: "jsdoc/newline-after-description", + }, + ], + plugins: ["eslint-plugin-jsdoc"], + }); + }); +}); From c58a4579ad500834e39d2a39aba6d5f821ddd9d5 Mon Sep 17 00:00:00 2001 From: KingDarBoja Date: Sun, 19 Jan 2020 12:37:07 -0500 Subject: [PATCH 2/4] Replace jsdoc format rule with check indentation --- src/rules/converters/jsdoc-format.ts | 4 ++-- src/rules/converters/tests/jsdoc-format.test.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/rules/converters/jsdoc-format.ts b/src/rules/converters/jsdoc-format.ts index 898dc4af6..09056f91f 100644 --- a/src/rules/converters/jsdoc-format.ts +++ b/src/rules/converters/jsdoc-format.ts @@ -1,9 +1,9 @@ import { RuleConverter, ConvertedRuleChanges } from "../converter"; export const convertJSDocFormat: RuleConverter = () => { - const ruleNames: string[] = [ + const ruleNames = [ "jsdoc/check-alignment", - "jsdoc/require-jsdoc", + "jsdoc/check-indentation", "jsdoc/newline-after-description", ]; diff --git a/src/rules/converters/tests/jsdoc-format.test.ts b/src/rules/converters/tests/jsdoc-format.test.ts index fdc50930d..ce4909caa 100644 --- a/src/rules/converters/tests/jsdoc-format.test.ts +++ b/src/rules/converters/tests/jsdoc-format.test.ts @@ -12,7 +12,7 @@ describe(convertJSDocFormat, () => { ruleName: "jsdoc/check-alignment", }, { - ruleName: "jsdoc/require-jsdoc", + ruleName: "jsdoc/check-indentation", }, { ruleName: "jsdoc/newline-after-description", From aecdd1dd2f31db8d6a3be0f6df7c40375b4f9489 Mon Sep 17 00:00:00 2001 From: KingDarBoja Date: Sun, 19 Jan 2020 12:43:55 -0500 Subject: [PATCH 3/4] Add notice for multiline comments in jsdoc rule --- src/rules/converters/jsdoc-format.ts | 4 ++++ src/rules/converters/tests/jsdoc-format.test.ts | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/rules/converters/jsdoc-format.ts b/src/rules/converters/jsdoc-format.ts index 09056f91f..8d71bc4c2 100644 --- a/src/rules/converters/jsdoc-format.ts +++ b/src/rules/converters/jsdoc-format.ts @@ -1,5 +1,8 @@ import { RuleConverter, ConvertedRuleChanges } from "../converter"; +export const JSDocNoticeMsg = + "ESLint does not support enabling check for multiline comments in the first line"; + export const convertJSDocFormat: RuleConverter = () => { const ruleNames = [ "jsdoc/check-alignment", @@ -13,6 +16,7 @@ export const convertJSDocFormat: RuleConverter = () => { 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 index ce4909caa..fdbffa862 100644 --- a/src/rules/converters/tests/jsdoc-format.test.ts +++ b/src/rules/converters/tests/jsdoc-format.test.ts @@ -1,4 +1,4 @@ -import { convertJSDocFormat } from "../jsdoc-format"; +import { convertJSDocFormat, JSDocNoticeMsg } from "../jsdoc-format"; describe(convertJSDocFormat, () => { test("conversion without arguments", () => { @@ -18,6 +18,7 @@ describe(convertJSDocFormat, () => { ruleName: "jsdoc/newline-after-description", }, ], + notices: [JSDocNoticeMsg], plugins: ["eslint-plugin-jsdoc"], }); }); From 98512af8883b138eb53debc794bc3ae72e6fa913 Mon Sep 17 00:00:00 2001 From: KingDarBoja Date: Sat, 15 Feb 2020 12:25:58 -0500 Subject: [PATCH 4/4] Provide jsdoc format notice closer to TSLint docs --- src/rules/converters/jsdoc-format.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rules/converters/jsdoc-format.ts b/src/rules/converters/jsdoc-format.ts index 8d71bc4c2..06d4a61be 100644 --- a/src/rules/converters/jsdoc-format.ts +++ b/src/rules/converters/jsdoc-format.ts @@ -1,7 +1,7 @@ import { RuleConverter, ConvertedRuleChanges } from "../converter"; export const JSDocNoticeMsg = - "ESLint does not support enabling check for multiline comments in the first line"; + "ESLint does not support enforcing the first line of multiline JSDoc comments be empty."; export const convertJSDocFormat: RuleConverter = () => { const ruleNames = [