ExchangeUnion / xud

Exchange Union Daemon 🔁 ⚡️
https://exchangeunion.com
GNU Affero General Public License v3.0
115 stars 49 forks source link

style(lint): upgrade from tslint to eslint #2013

Closed erkarl closed 3 years ago

erkarl commented 3 years ago

This PR upgrades our deprecated tslint linter to eslint. In addition to default eslint configuration I had to disable some of the rules in order not to generate huge code differences in this PR.

If we choose to adjust some of the rules we can do so in the follow-up PRs.

EDIT by @kilrau : depends on #2016

erkarl commented 3 years ago

I ran npm install from this branch, but it seems that linting isn't catching some common errors. I tried putting excess whitespace at the end of lines, and I tried removing the commas from the end of lines, and neither were fixed or detected by running npm run lint. Is the same happening for you? If so I think we should try to make sure that at least most of the old rules are preserved.

Indeed, the recommended configuration for eslint does not enforce code style. I'd keep eslint for code intelligence and for enforcing style use prettier instead https://github.com/ExchangeUnion/xud/pull/1676

kilrau commented 3 years ago

Then let's get both in ?

sangaman commented 3 years ago

Then let's get both in ?

https://www.youtube.com/watch?v=OawrlVoQqSs

I agree if it's not too much work. I think it'd be nice to preserve the style enforcement so that there aren't PRs in the meantime that violate them that would then need to be cleaned up later.

kilrau commented 3 years ago

Since prettier has a separate PR now (cheers @erkarl ), this deserves another review @sangaman

erkarl commented 3 years ago

Since prettier has a separate PR now (cheers @erkarl ), this deserves another review @sangaman

The prettier PR is against this branch. Let's get the prettier one in first, then this one.

sangaman commented 3 years ago

Since prettier has a separate PR now (cheers @erkarl ), this deserves another review @sangaman

The prettier PR is against this branch. Let's get the prettier one in first, then this one.

You mean other way around? This first then prettier? Since prettier is based off this.

erkarl commented 3 years ago

You mean other way around? This first then prettier? Since prettier is based off this.

Oh, yes. Let me fix up the simulation tests in prettier branch so we can get them in at the same time we disable current tslint style enforcement.

sangaman commented 3 years ago

You mean other way around? This first then prettier? Since prettier is based off this.

Oh, yes. Let me fix up the simulation tests in prettier branch so we can get them in at the same time we disable current tslint style enforcement.

Great, I'm ready to merge these once that's done, so as to minimize any conflicts/switching back and forth going forward.