productboardlabs / tslint-pb

📄 (DEPRECATED) Our own custom TSlint rules. What has been seen, cannot be unseen.
MIT License
5 stars 0 forks source link

Check for the order of named imports #25

Closed jukben closed 5 years ago

jukben commented 5 years ago

This PR introduce aditional check for named imports – they should be ordered alphabetically too. Has fixer.

In this PR is also fix, because asterisk imports were sorted wrongly. (The AST is really crazy for this case)

e.g:

import * as X, { x, y, z } from 'XY';
import { x, y, z } from 'XY';

@karelskopek gonna be happy I guess. 🚀

This also introduce very minor bug (https://github.com/productboardlabs/tslint-pb/issues/26) – in case where you have wrongly ordered named imports you won't get info about that you have wrongly ordered whole line. You get just one error per lime. Fixer works correctly tho. It's low prio, because everyone should use autofixer instead of manual fixing. (issue could be observed here, as you can see, it gets fixed correctly)