Skip to content

ban-types converter should respect the original TSLint configuration for each type descriptor #352

Closed
@moznion

Description

@moznion

🚀 Feature Request

Now, ban-types converter drops the original TSLint configuration for each type descriptor.
I mean, even if TSLint specified ban-types with the type argument, generated ESLint configuration doesn't contain the detailed type configuration.

In this situation, generated configuration only contains "@typescript-eslint/ban-types": "error", but according to the official documentation, probably this generated result
doesn't make sense because each rule requires the type name (and the message).

https://github.com/typescript-eslint/typescript-eslint/blob/f3160b471f8247e157555b6cf5b40a1f6ccdc233/packages/eslint-plugin/docs/rules/ban-types.md

Existing Behavior

For example, when the TSLint configuration is like the following:

{
  "rules": {
    "ban-types": [true,
      ["Object", "Use {} instead."],
    ]
  }
}

then, current logic generates the following ESLint configuration:

  "rules": {
      "@typescript-eslint/ban-types": "error"
  }

Change Proposal

I suppose this should generate the configuration that is like the following:

  "rules": {
      "@typescript-eslint/ban-types": [
          "error",
          {
              "types": {
                  "Object": {
                      "message": "Use {} instead."
                  }
              }
          }
      ]
  }

Note

I've already implemented a patch for this issue (but unit-tests are not yet).
https://github.com/typescript-eslint/tslint-to-eslint-config/compare/master...moznion:fix_ban_types?expand=1

Can I send a pull-request for this repository with unit-tests, if you don’t mind?

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: incorrect converterRule converter with incomplete, incorrect, or invalid rule names and/or argumentsstatus: accepting prsPlease, send in a PR to resolve this! ✨

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions