-
Notifications
You must be signed in to change notification settings - Fork 889
object-literal-sort-keys: Add match-declaration-order-only option #3748
object-literal-sort-keys: Add match-declaration-order-only option #3748
Conversation
Thanks for your interest in palantir/tslint, @jamescdavis! Before we can accept your pull request, you need to sign our contributor license agreement - just visit https://cla.palantir.com/ and follow the instructions. Once you sign, I'll automatically update this pull request. |
}, | ||
optionExamples: [ | ||
true, | ||
[true, OPTION_IGNORE_CASE, OPTION_MATCH_DECLARATION_ORDER, OPTION_SHORTHAND_FIRST], | ||
[true, OPTION_IGNORE_CASE, OPTION_MATCH_DECLARATION_ORDER, OPTION_MATCH_DECLARATION_ORDER_ONLY, OPTION_SHORTHAND_FIRST], |
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.
add a new option example with this new option and not OPTION_MATCH_DECLARATION_ORDER
. let's not encourage users to set both.
f85ecf9
to
246e48f
Compare
@jamescdavis please update this branch so we can review it, or close it if no longer relevant. we will close this if we do not hear from you in two weeks. |
246e48f
to
2b4306e
Compare
updated |
but don't fall back to alphabetical if a contextual type is not found. | ||
|
||
Note: If both ${OPTION_MATCH_DECLARATION_ORDER_ONLY} and ${OPTION_MATCH_DECLARATION_ORDER} options are present, | ||
${OPTION_MATCH_DECLARATION_ORDER_ONLY} will take precedence and alphabetical fallback will not occur. |
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.
How about console.warn
ing instead of explicitly mentioning it in the docs? Feels like this is an error case that we shouldn't allow.
…_object-literal-sort-keys
…_object-literal-sort-keys
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.
updated with @JoshuaKGoldberg's suggestion and fixed merge conflicts
Thanks for fixing this up, @adidahiya! |
PR checklist
object-literal-sort-keys
#2583 (as another possible option)Overview of change:
Add a
match-declaration-order-only
option toobject-literal-sort-keys
that behaves the same asmatch-declaration-order
but does not fall back to checking alphabetical sorting when no contextual type is is found.CHANGELOG.md entry:
[new-rule-option]:
object-literal-sort-keys
: Addmatch-declaration-order-only
option