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

Do not warn when a parameter is added when unnecessary #12

Open
kud opened this issue Aug 12, 2019 · 4 comments

Comments

@kud
Copy link
Contributor

commented Aug 12, 2019

I don't see the point to warn that there's an unknown parameter.

For instance I do that:

        url={reverse(
          `${
            current
              ? routes.bill.step.text
              : routes.bill.step.text.amendment
          }`,
          {
            billId,
            stepPosition,
            stepRelation,
            amendmentId: id,
          },
        )}

and depending if it's current or not, I change the route, but amendment here is needed only if current is false, so I've got a warning saying that :amendmentId is unknown, which I know and I don't mind, it works. :D

@kud

This comment has been minimized.

Copy link
Contributor Author

commented Aug 12, 2019

Oh and even if the warnings are ok, the usecase seems not to work well:

        url={reverse(
          `${
            current
              ? routes.bill.step.text
              : routes.bill.step.text.amendment
          }`,
          {
            billId,
            stepPosition,
            stepRelation,
            amendmentId: !current ? id : undefined,
          },
        )}
@kud

This comment has been minimized.

Copy link
Contributor Author

commented Aug 12, 2019

Giving a warning when an unknown parameter is a point of view. But when this param is undefined, it shouldn't warn at all.

@kud

This comment has been minimized.

Copy link
Contributor Author

commented Aug 12, 2019

It forced me to do this:

        url={current
          ? reverse(`${routes.bill.step.text}`,
          {
            billId,
            stepPosition,
            stepRelation,
          })
          : reverse(`${routes.bill.step.text.amendment}`,
          {
            billId,
            stepPosition,
            stepRelation,
            amendmentId,
          })
        }

which I find it ugly. :/

@kud

This comment has been minimized.

Copy link
Contributor Author

commented Aug 12, 2019

Well fine, thank you ES6

        url={reverse(
          `${
            current
              ? routes.bill.step.text
              : routes.bill.step.text.amendment
          }`,
          {
            billId,
            stepPosition,
            stepRelation,
            ...!current && { amendmentId },
          },
        )}

but I'm still interested by your PoV about the warning :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.