question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Rule suggestion: symbol-description

See original GitHub issue

(bug report template was previously here. It was removed)

I suggest new rule: symbol-description with options always and never: 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 and never

With always setting it should warn if the following code is detected:

Symbol();

With never setting it should warn if the following code is detected:

Symbol('any strng');
Symbol(anyVariable);

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.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:12 (12 by maintainers)

github_iconTop GitHub Comments

1reaction
nzakascommented, Aug 1, 2016

@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.

0reactions
nzakascommented, Aug 2, 2016

Agreed, I don’t think “never” is necessary.

I’m 👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

symbol-description - ESLint - Pluggable JavaScript Linter
It may facilitate identifying symbols when one is observed during debugging. Rule Details. This rules requires a description when creating symbols. Examples.
Read more >
Rules and suggestions for using system symbols - IBM
The general rules and suggestions for using system symbols (which are described in z/OS MVS Initialization and Tuning Reference) also apply to JES3...
Read more >
Trademark Symbols – “®” “TM” “SM” – What Do They Mean ...
Only One Rule: There is only one rule that you have to follow when it comes to the use of trademark symbols, and...
Read more >
Use @mentions to get someone's attention - Microsoft Support
Add the @ symbol and the first few characters of a person's name. When Outlook offers you one or more suggestions, choose the...
Read more >
Trademark Symbols - International Trademark Association
It functions similarly to the TM symbol, in that it is used to provide notice of a claim of common law rights in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found