Skip to content

Make check-types configurable #215

@chiawendt

Description

@chiawendt

Users should be able to set the preference of types. The option could looks like this:

{
  '@typescript-eslint/ban-types': [
    'error',
    {
      types: {
        // ban type `Foo` using the default error message
        Foo: null,

        // ban type `Bar` with a custom message.
        Bar: "Don't use Bar!",

        // ban type `String` and tell the plugin how to fix it.
        String: {
          message: 'Use string instead',
          fixWith: 'string',
        },
      },
    },
  ],
};

See @typescript-eslint/ban-types.

As a side note, ban-types is a better name than check-types. The name check-types could mean "check type is valid", "check type is consistent to how it is used" or "check the style of types".

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions