Skip to content
This repository has been archived by the owner on Mar 25, 2021. It is now read-only.

object-literal-sort-keys does not handle spreads well #2554

Closed
giladgray opened this issue Apr 11, 2017 · 0 comments · Fixed by #2592
Closed

object-literal-sort-keys does not handle spreads well #2554

giladgray opened this issue Apr 11, 2017 · 0 comments · Fixed by #2592

Comments

@giladgray
Copy link

Bug Report

  • TSLint version: 4.5.1
  • TypeScript version: 2.2.1
  • Running TSLint via: VSCode & gulp-tslint

TypeScript code being linted

const options: Tether.ITetherOptions = {
        constraints: useSmartPositioning ? [DEFAULT_CONSTRAINTS] : undefined,
        ...tetherOptions,
        attachment: getPopoverAttachment(position),
        bodyElement: fakeHtmlElement,
        classPrefix: "pt-tether",
        element,
        target,
        targetAttachment: getTargetAttachment(position),
    };

Actual behavior

constraints is marked as being out of order, wants it to appear after classPrefix (classic aphabetization), but this is not equivalent code since constraints appears in its own object before tetherOptions.

Expected behavior

spreads should break up properties into separate groups (cuz they're compiled to separate objects in __assign helper)

// compiled tsc output, modified for readability (and only key names)
var options = tslib_1.__assign(
    { constraints }, 
    tetherOptions, 
    { attachment, bodyElement, classPrefix, element, target, targetAttachment },
);
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants