linterjs / core

Lint all the things... with one command
MIT License
4 stars 0 forks source link

Make API async #9

Closed zimme closed 6 years ago

zimme commented 6 years ago

This makes format and lint async. This was needed to support the linters out there that does not have a sync API.

The LinterAdapter interface supports formatAsync, formatSync, lintAsync and lintSync. At least one format and lint function needs to be present on the linterAdapter that is being registered.

In the format and lint functions sync versions of the LinterAdapter's functions take presidence over the async versions. I don't know if this the best choice?

azz commented 6 years ago

Why have both {lint,format}{Sync,Async}? await syncFunction() works fine.

zimme commented 6 years ago

Why have both {lint,format}{Sync,Async}? await syncFunction() works fine.

I thought it was a bit unnecessary, but I didn't realize it was as simple as that. You learn something new every day :+1: