Tslint: Feature Request: alphabetize interface members/fields

Created on 13 Nov 2017  Β·  11Comments  Β·  Source: palantir/tslint

Medium Accepting PRs Rule Suggestion 🌹 R.I.P. 🌹

Most helpful comment

I'd also ask for same alphabetize order of spreaded variables like here

        const {
            a,
            b,
            c
        } = this.props;

Although it's more related to object-literal-sort-keys or even sort-vars from es-lint.

All 11 comments

Have you already tried member-ordering?

The β€˜alphabetize’ option will enforce that members within the same category should be alphabetically sorted by name.

https://palantir.github.io/tslint/rules/member-ordering/

I believe @cjjojoba is interested in having the interfaces' fields sorted, not their implementation. This would be more like object-literal-sort-keys applied to types.

The benefits are similar β€” fewer merge conflicts, type-implementation consistency when using object-literal-sort-keys, and you could also compare your interfaces with network responses in Chrome DevTools.

This would be very helpful

I agree this would be very helpful.

It would also be very nice, but maybe a lot to ask: to have an auto-fixer for these :)

I'd also ask for same alphabetize order of spreaded variables like here

        const {
            a,
            b,
            c
        } = this.props;

Although it's more related to object-literal-sort-keys or even sort-vars from es-lint.

I would love to see this make it into tslint!

I would also like to see this! Right now I have to do it manually.

Note: per #4534, this issue will be closed in less than a month if no PR is sent to add the rule. If you _really_ need the rule, custom rules are always an option and can be maintained outside this repo!

πŸ’€ _It's time!_ πŸ’€

TSLint is being deprecated and no longer accepting pull requests for new rules. See #4534. 😱

If you'd like to see this rule implemented, you have two choices:

πŸ‘‹ It was a pleasure open sourcing with you!

_If you believe this message was posted here in error, please comment so we can re-open the issue!_

Hey guys, even though tslint is deprecated, I wrote this rule on a separate repo. You can install it using npm. Please check it out if interested.

πŸ€– Beep boop! πŸ‘‰ TSLint is deprecated πŸ‘ˆ _(#4534)_ and you should switch to typescript-eslint! πŸ€–

πŸ”’ This issue is being locked to prevent further unnecessary discussions. Thank you! πŸ‘‹

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rajinder-yadav picture rajinder-yadav  Β·  3Comments

zewa666 picture zewa666  Β·  3Comments

adidahiya picture adidahiya  Β·  3Comments

Ne-Ne picture Ne-Ne  Β·  3Comments

DanielKucal picture DanielKucal  Β·  3Comments