Repository: typescript-eslint/tslint-to-eslint-config (ts)

Issue:
Unnecessary capitalized-comments rule
### 🐛 Bug Report

-   `tslint-to-eslint-config` version: 0.4.0
-   ESLint version: 6.8.0
-   Node version: 12.14.0

#### Actual Behavior

The `capitalized-comments` is disabled in TSLint but enabled in ESLint.

`tslint.json`

```
{
  "rules": {
    "comment-format": [true, "check-space"]
  }
}
```

`.eslintrc.js`

```javascript
module.exports = {
// ...
    "rules": {
        "capitalized-comments": "error",
        "spaced-comment": "error"
    }
};
```

#### Expected Behavior

```javascript
module.exports = {
// ...
    "rules": {
        "spaced-comment": "error"
    }
};
```

#### Reproduction

```bash
#!/bin/bash -x
mkdir example
cd example/
node --version # v12.14.0
npm init -y
npm i -D \
  @typescript-eslint/parser@2.12.0 \
  @typescript-eslint/eslint-plugin@2.12.0 \
  eslint@6.8.0 \
  tslint@5.20.1 \
  typescript@3.7.4
cat <<EOS >tslint.json
{
  "rules": {
    "comment-format": [true, "check-space"]
  }
}
EOS
cat <<'EOS' >index.ts
// lowercase comment
function add(x: number, y: number) { return x + y; }
EOS
$(npm bin)/tsc --init

npx tslint-to-eslint-config@0.4.0

cat .eslintrc.js # generated
# module.exports = {
#     "env": {
#         "browser": true,
#         "es6": true
#     },
#     "parser": "@typescript-eslint/parser",
#     "parserOptions": {
#         "project": "tsconfig.json",
#         "sourceType": "module"
#     },
#     "plugins": [
#         "@typescript-eslint"
#     ],
#     "rules": {
#         "capitalized-comments": "error",
#         "spaced-comment": "error"
#     }
# };

$(npm bin)/tslint index.ts # ok
$(npm bin)/eslint index.ts # ng
#   1:1  error  Comments should not begin with a lowercase character  capitalized-comments
#
# ✖ 1 problem (1 error, 0 warnings)
#   1 error and 0 warnings potentially fixable with the `--fix` option.
```

Pull request:
Fix `comment-format` (`capitalized-comments`)
## PR Checklist

-   [x] Addresses an existing issue: fixes #296 
-   [ ] That issue was marked as [`status: accepting prs`](https://github.com/typescript-eslint/tslint-to-eslint-config/labels/status%3A%20accepting%20prs)

## Overview

See #296.


Patch:
diff --git a/src/rules/converters/comment-format.ts b/src/rules/converters/comment-format.ts
index 6567555..265a5fb 100644
--- a/src/rules/converters/comment-format.ts
+++ b/src/rules/converters/comment-format.ts
@@ -35,13 +35,15 @@ export const convertCommentFormat: RuleConverter = tslintRule => {
 
     return {
         rules: [
-            {
-                ruleName: "capitalized-comments",
-                ...(capitalizedRuleArguments.length !== 0 && {
-                    ruleArguments: capitalizedRuleArguments,
-                }),
-                ...(capitalizedNotices.length !== 0 && { notices: capitalizedNotices }),
-            },
+            ...(capitalizedRuleArguments.length === 0
+                ? []
+                : [
+                      {
+                          ruleName: "capitalized-comments",
+                          ruleArguments: capitalizedRuleArguments,
+                          ...(capitalizedNotices.length !== 0 && { notices: capitalizedNotices }),
+                      },
+                  ]),
             {
                 ruleName: "spaced-comment",
                 ...(spaceCommentRuleArguments.length !== 0 && {


Test patch:
diff --git a/src/rules/converters/tests/comment-format.test.ts b/src/rules/converters/tests/comment-format.test.ts
index 0ffed9f..45c4cb0 100644
--- a/src/rules/converters/tests/comment-format.test.ts
+++ b/src/rules/converters/tests/comment-format.test.ts
@@ -8,9 +8,6 @@ describe(convertCommentFormat, () => {
 
         expect(result).toEqual({
             rules: [
-                {
-                    ruleName: "capitalized-comments",
-                },
                 {
                     ruleArguments: ["never"],
                     ruleName: "spaced-comment",
@@ -26,9 +23,6 @@ describe(convertCommentFormat, () => {
 
         expect(result).toEqual({
             rules: [
-                {
-                    ruleName: "capitalized-comments",
-                },
                 {
                     ruleName: "spaced-comment",
                 },
@@ -57,13 +51,14 @@ describe(convertCommentFormat, () => {
 
     test("conversion with ignore-pattern argument", () => {
         const result = convertCommentFormat({
-            ruleArguments: [{ "ignore-pattern": "STD\\w{2,3}\\b" }],
+            ruleArguments: ["check-uppercase", { "ignore-pattern": "STD\\w{2,3}\\b" }],
         });
 
         expect(result).toEqual({
             rules: [
                 {
                     notices: [CapitalizedIgnoreMessage],
+                    ruleArguments: ["always"],
                     ruleName: "capitalized-comments",
                 },
                 {
@@ -74,14 +69,30 @@ describe(convertCommentFormat, () => {
         });
     });
 
+    test("conversion with ignore-pattern argument (no check-{lower,upper}case)", () => {
+        const result = convertCommentFormat({
+            ruleArguments: [{ "ignore-pattern": "STD\\w{2,3}\\b" }],
+        });
+
+        expect(result).toEqual({
+            rules: [
+                {
+                    ruleArguments: ["never"],
+                    ruleName: "spaced-comment",
+                },
+            ],
+        });
+    });
+
     test("conversion with empty ignore-words argument", () => {
         const result = convertCommentFormat({
-            ruleArguments: [{ "ignore-words": [] }],
+            ruleArguments: ["check-uppercase", { "ignore-words": [] }],
         });
 
         expect(result).toEqual({
             rules: [
                 {
+                    ruleArguments: ["always"],
                     ruleName: "capitalized-comments",
                 },
                 {
@@ -92,15 +103,31 @@ describe(convertCommentFormat, () => {
         });
     });
 
+    test("conversion with empty ignore-words argument (no check-{lower,upper}case)", () => {
+        const result = convertCommentFormat({
+            ruleArguments: [{ "ignore-words": [] }],
+        });
+
+        expect(result).toEqual({
+            rules: [
+                {
+                    ruleArguments: ["never"],
+                    ruleName: "spaced-comment",
+                },
+            ],
+        });
+    });
+
     test("conversion with ignore-words argument", () => {
         const result = convertCommentFormat({
-            ruleArguments: [{ "ignore-words": ["TODO", "HACK"] }],
+            ruleArguments: ["check-uppercase", { "ignore-words": ["TODO", "HACK"] }],
         });
 
         expect(result).toEqual({
             rules: [
                 {
                     notices: [CapitalizedIgnoreMessage],
+                    ruleArguments: ["always"],
                     ruleName: "capitalized-comments",
                 },
                 {
@@ -111,6 +138,21 @@ describe(convertCommentFormat, () => {
         });
     });
 
+    test("conversion with ignore-words argument (no check-{lower,upper}case)", () => {
+        const result = convertCommentFormat({
+            ruleArguments: [{ "ignore-words": ["TODO", "HACK"] }],
+        });
+
+        expect(result).toEqual({
+            rules: [
+                {
+                    ruleArguments: ["never"],
+                    ruleName: "spaced-comment",
+                },
+            ],
+        });
+    });
+
     test("conversion with all arguments", () => {
         const result = convertCommentFormat({
             ruleArguments: [