-
-
Notifications
You must be signed in to change notification settings - Fork 131
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
Harmonize list item indent literals #281
Conversation
This comment has been minimized.
This comment has been minimized.
This comment was marked as resolved.
This comment was marked as resolved.
This is a breaking change, which I’d rather not do, especially if there’s no good reason for it. These options are also affected by the proposal (which is a breaking change) of syntax-tree/mdast-util-to-markdown#48, syntax-tree/mdast-util-to-markdown#50, and syntax-tree/mdast-util-to-markdown#51. |
@wooorm Is it a breaking change? |
You commit is removing the existing values ( |
option = | ||
{'tab-size': 'tab', space: 'one'}[/** @type {never} */ (option)] || option |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, should be backwards compatible. Maybe support for all but the preferred literals could be dropped at some future point ... Or not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I guess I missed this line?
Your object is nice but it’s a) a bit hard to read, and b) it’s vulnerable to things like toString
or constructor
being passed (which here doesn’t seem to result in actual problems, but it’s often good to steer clear of it anyway):
How about:
// To do in major: remove legacy fallbacks.
if (option === 'tab-size') {
option = 'tab'
} else if (option === 'space') {
option === 'one'
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- I didn't think of that (other properties of "empty" objects), thanks! I've replaced it with:
option =
option === 'tab-size' ? 'tab'
: option === 'space' ? 'one'
: option
For some reason one comment in the review didn’t come through (I think?): I think I prefer the existing (this rule’s) values instead of the |
I see your point about I'll close this and subscribe to syntax-tree/mdast-util-to-markdown#51 instead. Thanks! |
Hi! This was closed. Team: If this was merged, please describe when this is likely to be released. Otherwise, please add one of the |
Initial checklist
Description of changes
Whereas remark-stringify and mdast-util-to-markdown accept only
'one'
,'tab'
, or'mixed'
, remark-lint-list-item-indent accepts only'space'
,'tab-size'
, or'mixed'
.What do you think about allowing them to accept either the current or the preferred literals (whichever those are), and maybe dropping support for all but the preferred literals at some future point?