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
Consistent rules naming #57846
Comments
Adding even more options (or renaming them) will only bring more confusion, and you still need to consult the documentation to understand what the options do. I've seen similar issues already, and they're always rejected. There gotta be a really good reason for such a change, and IMO you haven't presented any.
It's not code, it's a configuration file. |
I don't really see what the upside is here. There's already a completion list here; if you type "returns" you will see that it's Conversely, if two options that control the same thing exist:
|
Let's just remove all the options and have tsc behave the same for everyone and be completely nonconfigurable... "for consistency" π |
@fatcerberus let's just be more friendly eh? |
@RyanCavanaugh it's just I was studying ts config docs and it appeared to me counterintuitive to have such namings for rules in the first place. You made good point about this as well.
Those are small things and are easily looked up in docs, but throughout time they gather like snowball and in the end you just have to consult docs for every such details and it's not a good developer experience IMHO. Or maybe there is some specific reason why those rules were named like this? Or this is just a simple human error? |
@medreres That's the reason for the π emoji - trolleybus for friendly/playful trolling (and in this case I was trolling Ryan, not you). Don't take it too seriously
I would argue if you care about the options in a tsconfig at all you should be consulting the docs anyway, regardless of what they're named. The name alone can't convey all the effects a given option has, particularly in combination with other options, so what things are called is the least of your worries.
More like "organic growth over time"; individual options are named pragmatically as they're introduced, naming preferences change, etc. etc. There's no specific reason for the haphazard naming beyond "that's just the way it worked out". |
They're named such that their default values are all For example, if the default behavior is that If the default behavior is that This keeps you from having to look up in the docs what the default value is - by looking at the name, you can tell. Edit: The only flag that disobeys this rule is |
Note that this scheme is way better in terms of "saving you a trip to the docs" -- the completion list of options itself encodes their default values via the naming convention. I think it'd be a lot worse if you were looking at a list of |
Interesting thing, good to know, thanks :) Didn't get the second point about self encoding naming though |
The self-encoding naming point is just a restatement of the bit you quoted. |
π Search Terms
compilerOptions, allowUnreachableCode, allowUnusedLabels, noStrictGenericChecks
β Viability Checklist
β Suggestion
The naming convention is not consistent across rules in compiler options, therefore obstructing intuitive and straightforward code styling.
One bulk of compiler rules goes with "allow" prefix, another goes with "no" and there is third group using "suppress".
I suggest unifying those rules. It will reduce the need of consulting the documentation and will provide more clarity to the codebase.
Rules with old naming could be marked as deprecated.
π Motivating Example
This
versus this
π» Use Cases
For easier learning of details of ts config and easier setup of projects
No shortcomings, the need of consulting the docs will be reduced to minimum
Remembering the options and consulting the docs.
The text was updated successfully, but these errors were encountered: