Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add prettier #695

Merged
merged 4 commits into from
Jan 10, 2024
Merged

Add prettier #695

merged 4 commits into from
Jan 10, 2024

Conversation

slifty
Copy link
Member

@slifty slifty commented Jan 2, 2024

This PR adds prettier and invokes it on the project.

It also moves us from spaces to tabs (tabs is what prettier has determined to be the Right Choice)

Resolves #601

Copy link

codecov bot commented Jan 2, 2024

Codecov Report

Attention: 84 lines in your changes are missing coverage. Please review.

Comparison is base (71970ed) 92.76% compared to head (88f0bcb) 93.05%.

Files Patch % Lines
src/tasks/processBulkUpload.ts 90.00% 18 Missing ⚠️
src/jobQueue.ts 34.61% 17 Missing ⚠️
src/handlers/bulkUploadsHandlers.ts 66.66% 9 Missing and 2 partials ⚠️
src/handlers/platformProviderResponsesHandlers.ts 66.66% 8 Missing and 2 partials ⚠️
src/handlers/proposalsHandlers.ts 93.20% 7 Missing ⚠️
src/scripts/migrate.ts 0.00% 6 Missing and 1 partial ⚠️
src/handlers/applicationFormsHandlers.ts 94.56% 5 Missing ⚠️
src/index.ts 0.00% 3 Missing ⚠️
src/handlers/baseFieldsHandlers.ts 95.34% 2 Missing ⚠️
src/test/harnessFunctions.ts 90.00% 2 Missing ⚠️
... and 2 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #695      +/-   ##
==========================================
+ Coverage   92.76%   93.05%   +0.28%     
==========================================
  Files          86       86              
  Lines        1382     1396      +14     
  Branches      209      216       +7     
==========================================
+ Hits         1282     1299      +17     
+ Misses         95       92       -3     
  Partials        5        5              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@slifty slifty requested a review from jasonaowen January 3, 2024 01:13
@slifty
Copy link
Member Author

slifty commented Jan 3, 2024

Note: I haven't invoked prettier yet since I'd like to merge the outstanding PRs first (it's gonna create infinite merge conflicts) -- that said we can still review based on the actual changes! I think the most important one is tabs vs spaces.

I admit: I prefer tabs, but the actual logic here is prettier defaults to tabs.

@jasonaowen
Copy link
Contributor

It'd be helpful to add this to a ignore file, per Ignoring mass reformatting commits with git blame!

@slifty
Copy link
Member Author

slifty commented Jan 6, 2024

@jasonaowen ready for real review!

ESLint is deprecating support for formatting-focused lint rules,
suggesting that projects rely on prettiers instead [1].

This commit adds prettier, though the invocation will be separated into
another commit to make it easier to resolve merge conflicts that might
come up between review and merge.

We decided that single quotes was something we collectively wanted to
keep, so that is the one setting we're overriding.

[1] https://eslint.org/blog/2023/10/deprecating-formatting-rules/
This commit applies prettier to the entire project, which results in
massive changes and touches almost every line.

Issue #601 Set up prettier
We recently rewrote almost every line by invoking prettier to format the
project. This messes with git blame history, but git provides a handy
tool for ignoring that type of commit if the hash is tracked.

This commit adds the hash to a tracking file and provides some
instructions on how to utilize it.
});
});
it('returns an empty Bundle when no data is present', async () => {
await agent.get('/bulkUploads').set(authHeader).expect(200, {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bah -- see this is an example of me not loving the wrapping defaults of prettier (womp womp)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, same. 😞

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Discussion here: prettier/prettier#7884

@slifty
Copy link
Member Author

slifty commented Jan 9, 2024

Note: the failing test is the issue addressed in #707 -- it's not a real failure

Now that we're using prettier we don't have the lint rules for
indentation enabled in the first place, so there is no need to disable
them in these strange edge cases.
@slifty
Copy link
Member Author

slifty commented Jan 9, 2024

I added one more commit to remove the now-obsolete eslint disable lines around tab formatting in the context of type helpers.

Copy link
Contributor

@jasonaowen jasonaowen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for taking care of this, @slifty!

});
});
it('returns an empty Bundle when no data is present', async () => {
await agent.get('/bulkUploads').set(authHeader).expect(200, {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, same. 😞

Comment on lines +8 to +9
): Promise<Bundle<BulkUpload>> =>
loadBundle(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, ew, here's another place where I disagree with Prettier. Should we start wrapping all multiline expressions in parens?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Blegh that decision feels so odd to me! I guess I can only hope I'll get used to it...

@jasonaowen
Copy link
Contributor

Oh, and pro tip, you can change the tab width GitHub uses in the appearance settings.

@slifty slifty merged commit b165f6d into main Jan 10, 2024
3 of 4 checks passed
@slifty slifty deleted the 601-set-up-prettier branch January 10, 2024 02:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Set up prettier
3 participants