Skip to content
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

Rule merger for @typescript-eslint/ban-types should deeply merge objects #1087

Open
JoshuaKGoldberg opened this issue May 23, 2021 · 1 comment
Labels
area: incorrect merger Rule merger with incomplete, incorrect, or invalid rule arguments good first issue Good for newcomers; welcome aboard! status: accepting prs Please, send in a PR to resolve this! ✨

Comments

@JoshuaKGoldberg
Copy link
Member

Overview

@typescript-eslint/ban-types has a fixWith option for types. https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/ban-types.md

Actual Behavior

That fixWith might go away if two rule arguments types lists are merged and the second doesn't have it.

First:

{
  types: [
    {
      fixWith: "number",
      typeName: "Number",
    },
  ];
}

Second:

{
  types: [
    {
      typeName: "Number",
    },
  ];
}

Output:

{
  types: [
    {
      typeName: "Number",
    },
  ];
}

Expected Behavior

The output should include fixWith if it exists.

@JoshuaKGoldberg JoshuaKGoldberg added status: accepting prs Please, send in a PR to resolve this! ✨ good first issue Good for newcomers; welcome aboard! area: incorrect merger Rule merger with incomplete, incorrect, or invalid rule arguments labels May 23, 2021
@Res42
Copy link
Contributor

Res42 commented May 23, 2021

Also another issue with this merger: when merging a configuration with no-args and a configuration which only contains types that are included in the default options (with no-args) it should merge these to no-args since that is "stronger".

The default types configuration is here: https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/ban-types.md

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: incorrect merger Rule merger with incomplete, incorrect, or invalid rule arguments good first issue Good for newcomers; welcome aboard! status: accepting prs Please, send in a PR to resolve this! ✨
Projects
None yet
Development

No branches or pull requests

2 participants