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

[no-magic-numbers] - default parameter values #13201

Closed
avalanche1 opened this issue Apr 20, 2020 · 4 comments
Closed

[no-magic-numbers] - default parameter values #13201

avalanche1 opened this issue Apr 20, 2020 · 4 comments
Labels
archived due to age This issue has been archived; please open a new issue for any further discussion auto closed The bot closed this issue triage An ESLint team member will look at this issue soon

Comments

@avalanche1
Copy link

Tell us about your environment

  • ESLint Version:
    ^7.0.0-alpha.2

What did you do? Please include the actual source code causing the issue, as well as the command that you used to run ESLint.

function foo(param = 3000) {
  // code
}

What did you expect to happen?
eslint will not complain
What actually happened? Please include the actual, raw output from ESLint.
No magic number: 3000

I think magic numbers in default values for function params either:

  • should not be reported
  • provide an option to the rule to omit those

The whole point of default values is to specify the value, is it not?

@eslint-deprecated eslint-deprecated bot added the triage An ESLint team member will look at this issue soon label Apr 20, 2020
@anikethsaha
Copy link
Member

I think it does make sense to ignore default arguments of a function as a separate options.
+1 for this

@mdjermanovic
Copy link
Member

I think this is correct default behavior, but an option to omit those makes sense to me.

There is already proposal/PR #12611 that includes default values for function params, as clarified in the discussion.

@avalanche1 would you prefer a separate option for function params only?

@avalanche1
Copy link
Author

#12611 looks fine by me.
actually I wan't aware of default params with destructuring assignment

@eslint-deprecated eslint-deprecated bot added the auto closed The bot closed this issue label May 30, 2020
@eslint-deprecated
Copy link

Unfortunately, it looks like there wasn't enough interest from the team
or community to implement this change. While we wish we'd be able to
accommodate everyone's requests, we do need to prioritize. We've found
that issues failing to reach accepted status after 21 days tend to
never be accepted, and as such, we close those issues.
This doesn't mean the idea isn't interesting or useful, just that it's
not something the team can commit to.

Thanks for contributing to ESLint and we appreciate your understanding.

@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Nov 27, 2020
@eslint-deprecated eslint-deprecated bot added the archived due to age This issue has been archived; please open a new issue for any further discussion label Nov 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
archived due to age This issue has been archived; please open a new issue for any further discussion auto closed The bot closed this issue triage An ESLint team member will look at this issue soon
Projects
None yet
Development

No branches or pull requests

3 participants