alisabzevari alisabzevari - 2 months ago 33
TypeScript Question

TSLint - Disable alphabetical ordering of members

How can I disable alphabetical ordering of members in object literal syntax?

Example:

function receiveLogin(user) {
return {
type: LOGIN_SUCCESS,
isFetching: false,
isAuthenticated: true,
id_token: user.id_token,
};
}


I want to have the type as the first item.

Answer

You should have "object-literal-sort-keys": false in your tslint.json rules.

Example:

{
  "extends": "tslint:latest",
  "rules": {
    "object-literal-sort-keys": false
  }
}