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 suggestion: symbol-description #6778
Comments
Thank you for this issue. I like this idea 👍. |
My only question is whether this is important enough to meet our new rule criteria. If not, I could see a use for a symbol-themed plugin. Not sure if I want to endorse just yet, but I'm not doing thumbs-down either. |
@jrencz please read over our guidelines for submitting rule proposals and update your description to match the format. In general I like the idea, but I'd like to see a proper proposal before evaluating. |
@nzakas I updated the description |
Now I understand what users need to do to conform to the rule (seems reasonable for symbols to have a description). I'll champion. @jrencz If this issue is accepted, we will look to you to implement. If you need/want any help, you can talk to the champion of the rule you are trying to add (which would be me in this case). Of course, you can always stop by the Gitter chat if you want real-time help from anyone who might be online. Thanks for the proposal! |
@platinumazure I made some quick and dirty attempt to implement the rule as described: https://github.com/jrencz/eslint/tree/symbol-description Should I file a PR as-is (with no documentation) or should I better prepare some docs first? |
@jrencz Definitely add docs before submitting a PR 😄 But if you would like, I am happy to take a look at your WIP branch. |
@platinumazure I'd appreciate. I'll add documentation tomorrow. I based my code on rules radix and no-new-symbol |
I am 👍 for this rule proposal. |
I'm not sure if we need the |
@mysticatea agreed, I don't think the |
Agreed, I don't think "never" is necessary. I'm 👍 |
(bug report template was previously here. It was removed)
I suggest new rule:
symbol-description
with optionsalways
andnever
: It should check if all (or neither of) symbols created in code have the description as described in the Spec: 19.4.1.1 Symbol ( [ description ] )Rationale: symbol description is optional but it facilitates debugging because Symbol#toString returns a descriptive string containing symbol description so it's worth enforcing.
When does this rule warn? Please describe and show example code:
The rule as briefly described above has 2 settings:
always
andnever
With
always
setting it should warn if the following code is detected:With
never
setting it should warn if the following code is detected:EDIT:
As @nzakas asked me to do I'm updating the request with the rule proposal template:
Is this rule preventing an error or is it stylistic?
The rule neither prevents an error nor is stylistic. I'd say it belongs either to "Best Practices" or to "ECMAScript 6" groups.
Why is this rule a candidate for inclusion instead of creating a custom rule?
It covers one of the new language features. If it's in the core people may adopt good practice of describing symbols used in their code by analysing the rules list and finding this one.
Are you willing to create the rule yourself?
Yes, but I never implemented eslint rule so I'm going to need some help.
The text was updated successfully, but these errors were encountered: