machty / ember-concurrency

ember-concurrency is an Ember Addon that enables you to write concise, worry-free, cancelable, restartable, asynchronous tasks.
http://ember-concurrency.com
MIT License
691 stars 157 forks source link

chore: add Prettier to JS lint config #415

Closed alexlafroscia closed 3 years ago

alexlafroscia commented 3 years ago

Making good on my offer here

https://github.com/machty/ember-concurrency/pull/414#discussion_r596158086

This adds Prettier to run as part of ESLint, and then "fixes" all of the files.

This does not introduce Prettier for non-JS files (like Markdown or YAML) but that's something I could also add, if you're interested!

This also does not add a lint-on-commit hook, which I could set up as well if you're interested.

I went and added the default configuration here, which uses double-quotes rather than single-quotes. If anyone has a preference for single quotes instead, I can tweak that and update this PR. That would definitely change less files, since most (but not all) used single quotes 😅

alexlafroscia commented 3 years ago

Thanks for the review @maxfierke! I missed the notification earlier, but I'll fix those up and push again!

alexlafroscia commented 3 years ago

Hmmm... So, Prettier doesn't like the placement of those comments and pushes them onto other lines...

Maybe we have Prettier ignore the tutorial components?

maxfierke commented 3 years ago

Maybe we have Prettier ignore the tutorial components?

yeah, that'd be okay with me!

alexlafroscia commented 3 years ago

Sorry for the delay in getting back to this!

I started over again since the code has changed some. Those tutorial-* components have been ignored so their formatting shouldn't have changed this time!

I went and configured Prettier to use single-quotes rather than double. It seemed like more files did it that way than using double quotes, though there's a mix of both in here so that was pretty arbitrary. If you'd rather we use the default setting instead -- double quotes -- that would be easy to fix! For what it's worth, a new Ember app ships with Prettier's singleQuote setting turned on.

I also left the default trailingComma setting in tact, which does use them (and generated a lot of the diffs that are present). I prefer this style, as it means adding/removing keys from an object or elements from an array that spans multiple lines doesn't introduce a diff on an unrelated line, but I know that can be a controversial perspective. I can certainly turn that off and re-run the linting if that would be better!