novu
novu copied to clipboard
feat: added import-order for eslint
- What kind of change does this PR introduce? (Bug fix, feature, docs update, ...) This adds the import-order rule for eslint to have package imports above relational imports, etc...
@scopsy it is handled automatically using "eslint --fix" - I added the rule for it to the eslintrc
This rule rullez :D I do use it often, but with a small addition, I do divide those imports also with an additional empty line, because sometimes they like merge together and it's tough to catch at first look. Also I do move imports from the same repository to the bottom of the "dependencies" imports part, like: first external dependencies, then same repo dependencies, then empty line and then relative. Yes, it saves time, increases readability :)
I love the import order only for packages and local imports. But when it's ordered also by name, it's becoming very annoying.
I love the import order only for packages and local imports. But when it's ordered also by name, it's becoming very annoying.
Is that because it's annoying to read or having to always fix it when eslint is complaining about the order? Because the later will be automatically handled by lint-staged here when commiting any changes.
This PR is a bit stale. I am happy to fully review it but after agreeing with the rules for the imports, as it is too big to review it multiple times. My take on order import (and preference) is:
// Novu packages imports
// Runtime dependency imports
// Absolute path imports from current file
// Relative path imports from current file
Alphabetical order based on package/path name for me is helpful. But flexible in that.
Was just about to merge when the list of merge conflicts :P
@venarius should we maybe take a look at it again after hacktoberfest? Because of the amount of PR's right now it will be hard to get it up to sync with outside collaborators. WdyT?
Was just about to merge when the list of merge conflicts :P
@venarius should we maybe take a look at it again after hacktoberfest? Because of the amount of PR's right now it will be hard to get it up to sync with outside collaborators. WdyT?
Yeah, sure thing!
@venarius do you want to give it another go? :)