TSLint custom rule life cycle method ordering?


Has anyone written a custom TSLint rule for life cycle method order? I would like to have a rule which forces them to be placed as the first methods after the constructor and in a logical order, i.e. the order they’re called.

I’ve used “sort-comp” ESLint rule which does this for React projects: https://github.com/yannickcr/eslint-plugin-react/blob/master/lib/rules/sort-comp.js

Also grateful for other TSLint rules for Aurelia!


I was looking for something like this too, typically I’d like to put lifecycle methods right after my constructor. So all setup related logic can stay in the same place. But couldn’t find any rule for that, probably it would require contributing to TSlint :smile:

Find a solution or work around to solve this?

1 Like