commonmark / commonmark/commonmark.js
Don't use javascript reserved word as Object keys
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 1.6k
- Forks
- 231
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 3
Description
Hi,
I have observed the block.js file makes use of javascript keywords as objects keys. Ref: here.
Although this isn't prohibited, it isn't the correct thing to do.
- Editors highlight is wrongly
- Code minifiers have trouble with them.
Its best to not use them at all, in this scenarios it can be named as proceed. i.e the function returns. If that's not possible, at least you can quote them as below.
from
var object = {
continue: function(){}
}
object.continue();
to
var object = {
'continue': function(){}
}
object['continue']()
Please let me know how you wish to address this, I'll submit a PR with the changes.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at lib/blocks.js around line 223 and inspect the object keys that use JavaScript reserved words. Check whether the affected keys can use the suggested naming or quoted access without changing parser behavior. The work is done when reserved-word keys in this area are addressed and the existing project checks pass.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100