pact-foundation / pact-js

JS version of Pact. Pact is a contract testing framework for HTTP APIs and non-HTTP asynchronous messaging systems.
https://pact.io
Other
1.59k stars 343 forks source link

Remove most lint directives #1027

Closed TimothyJones closed 1 year ago

TimothyJones commented 1 year ago

This PR removes almost all lint directives from the source. Each commit is reasonably self-contained, so you could cherry-pick if you don't want some of them.

Key points:

TimothyJones commented 1 year ago

Update: I fixed the duplicate rules problem by using the appropriate typescript lint settings. This brought in some new rules about dependency cycles and use-before-define, so I fixed those too. I don't think they're actually problems with the current versions of node, but it's still good to be standards compliant.

Also, I removed eslint-plugin-prettier since it wasn't used (pact uses the config instead). Using both is a common mistake - for those playing along at home:

Using the config (with prettier run separately on save) is a nicer developer experience because it means that you only get red squiggles in the editor if you're typing code that isn't right, rather than whenever the formatter hasn't been run.

mefellows commented 1 year ago

Update: I fixed the duplicate rules problem by using the appropriate typescript lint settings. This brought in some new rules about dependency cycles and use-before-define, so I fixed those too. I don't think they're actually problems with the current versions of node, but it's still good to be standards compliant.

Also, I removed eslint-plugin-prettier since it wasn't used (pact uses the config instead). Using both is a common mistake - for those playing along at home:

  • the plugin is to make the linter do prettier formatting (Pact did not do this)
  • the config is to stop the linter conflicting with prettier (Pact did do this)

Using the config (with prettier run separately on save) is a nicer developer experience because it means that you only get red squiggles in the editor if you're typing code that isn't right, rather than whenever the formatter hasn't been run.

Right, this explanation made sense. I think in the early days, we must have had some eslint rules that were constantly fighting with prettier. I'm pretty sure I introduced prettier, and this was the solution I ended up with.

But what I really want is this:

TimothyJones commented 1 year ago

But what I really want is this:

  • lint - find bugs, don't concern itself with styling
  • prettier - make the code look the same, no matter who writes it. Remove arguments about opinions (except semicolons of course 😆 )

I agree. This is the current state of pact linting (except for nestjs-pact, which has the conventions it was written with before it moved to pact-foundation)

The defaults for prettier include semicolons, of course ;)