Skip to content

Make check-types configurable #215

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
golopot opened this issue May 12, 2019 · 3 comments · Fixed by #247
Closed

Make check-types configurable #215

golopot opened this issue May 12, 2019 · 3 comments · Fixed by #247

Comments

@golopot
Copy link
Collaborator

golopot commented May 12, 2019

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".

@brettz9
Copy link
Collaborator

brettz9 commented May 15, 2019

See my comment on a related issue, i.e., per issue #107 I think we might look at something like this if reimplementing valid-jsdoc's preferType.

@brettz9 brettz9 mentioned this issue May 21, 2019
@brettz9
Copy link
Collaborator

brettz9 commented May 21, 2019

Closed by #247. Thanks for the great idea! I tweaked it a little in the implementation, but it is similar as you can see in the docs. (also connects to options with check-types and no-undefined-types)

@brettz9 brettz9 closed this as completed May 21, 2019
@gajus
Copy link
Owner

gajus commented May 21, 2019

🎉 This issue has been resolved in version 6.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@gajus gajus added the released label May 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants