hicommonwealth / commonwealth

A platform for decentralized communities
https://commonwealth.im
GNU General Public License v3.0
68 stars 44 forks source link

Get prettier to organize imports #4611

Open kurtisassad opened 1 year ago

kurtisassad commented 1 year ago

Description

It takes time away to go through imports of each file and make sure unused ones are removed. An easier way to do things would be to have it done automatically for us.

We already have prettier running in a pre-commit hook, so all we need to do is add this plugin: https://www.npmjs.com/package/prettier-plugin-organize-imports

and it should clean up the imports on every file after commit.

Engineering Requirements

CowMuon commented 1 year ago

It takes time away to go through imports of each file and make sure unused ones are removed.

Doesn't Github already tell us this in Code Quality Checks? TBH, if that's the case, I would defer to using that, rather than adding another plugin.

Having said that, we really want to both automate the tedious bits and not encourage an "out of sight out of mind" attitude.

But if CQC gives us this, let's try to use that rather than adding a new plugin @kurtisassad @jnaviask

kurtisassad commented 1 year ago

Eslint shows it as a warning (which doesn't fail CI). The problem is, I don't want to run eslint --fix because it will fix all warnings, and some of them are red herrings which will break the code.

We already run prettier which is why I think the prettier plugin is a better solution. This way the code change is minimal (just an yarn add and adding it to the config).