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

number_separator: allow ignoring certain types of numbers #5932

Open
2 tasks done
rgoldberg opened this issue Jan 2, 2025 · 5 comments
Open
2 tasks done

number_separator: allow ignoring certain types of numbers #5932

rgoldberg opened this issue Jan 2, 2025 · 5 comments
Labels
discussion Topics that cannot be categorized as bugs or enhancements yet. They require further discussions.

Comments

@rgoldberg
Copy link

New Issue Checklist

Feature or Enhancement Proposal

number_separator should be able to be configured to ignore/exclude certain types / typealiases of numbers like:

number_separator:
  ignore: [pid_t]

So any literal used for a pid_t is ignored by this rule.

@SimplyDanny
Copy link
Collaborator

In which regard would this be helpful? Why would numbers used for pid_ts not benefit from separators?

@SimplyDanny SimplyDanny added the discussion Topics that cannot be categorized as bugs or enhancements yet. They require further discussions. label Jan 2, 2025
@rgoldberg
Copy link
Author

There are some typealiases that I'd prefer to see without underscores. Mainly if they're IDs instead of counts. It's just a personal preference. Not the most necessary option, but figured I'd document it here in case others would like it, too.

@SimplyDanny
Copy link
Collaborator

Note, that this only works well for declarations with initializations such as let id: ID = 1234 or let id = ID(123). Otherwise there's no way to know the type of a literal to be ignored.

@rgoldberg
Copy link
Author

A cast or the type of a function parameter can also indicate the type of the literal.

@SimplyDanny
Copy link
Collaborator

Cast yes, function parameters only for default values. At the call side, there is no way to know the type of the argument, at least not for fast lint rules like number_separator.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion Topics that cannot be categorized as bugs or enhancements yet. They require further discussions.
Projects
None yet
Development

No branches or pull requests

2 participants