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

Migrate to new ESLint config format and fix some lint errors #2412

Merged
merged 3 commits into from
Sep 4, 2024

Conversation

jake-low
Copy link
Contributor

I noticed that I wasn't able to run eslint on the project, either from the CLI or from within my text editor. Attempting either would spew parse errors (it seemed babel wasn't configured to understand JSX when invoked this way). yarn build appeared to run eslint successfully, but only on files that had been modified (compared to the current git HEAD).

I think this had something to do with (1) using the old .eslint.json config syntax instead of the newer eslint.config.js, and (2) having a second (conflicting?) eslint configuration specified in package.json.

This PR ports the .eslint.json file in the repo to the new format, while maintaining (I think) functional equivalence, and removes the eslintConfig section in package.json. With these changes made, I'm now able to run eslint from the command line.

Once I made that change I noticed a ton of unused import errors, so I fixed those. Some were about React (as of React 17 there's a new JSX transform and it's no longer necessary for React to be in scope in order to use JSX). Others were about miscellaneous unused imports. I split them into two commits for clarity.

I think it'd be nice later on to enable some of the recommended eslint rules that are currently suppressed, but this diff is already pretty big so I'll save that for later.

@jake-low
Copy link
Contributor Author

Fixed to avoid noise from semicolon changes when rewriting import statements. It turned out to be difficult to omit the React changes entirely so I left them in (it's easy to only do the React import changes and none of the other import changes if you'd prefer that, but they're order-dependent).

@jake-low jake-low marked this pull request as ready for review August 15, 2024 17:51
Copy link

codecov bot commented Aug 15, 2024

Codecov Report

Attention: Patch coverage is 19.44444% with 29 lines in your changes missing coverage. Please review.

Project coverage is 23.95%. Comparing base (58b2708) to head (f118fbf).
Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
...ets/ProjectManagersWidget/ProjectManagersWidget.js 0.00% 3 Missing ⚠️
src/components/ActivityListing/ActivityListing.js 0.00% 2 Missing ⚠️
...ts/AdminPane/Manage/ChallengeCard/ChallengeCard.js 0.00% 2 Missing ⚠️
...lengeOwnerLeaderboard/ChallengeOwnerLeaderboard.js 0.00% 2 Missing ⚠️
.../components/ChallengeProgress/ChallengeProgress.js 50.00% 2 Missing ⚠️
...ustom/RJSFFormFieldAdapter/RJSFFormFieldAdapter.js 0.00% 2 Missing ⚠️
.../components/EnhancedMap/LayerToggle/LayerToggle.js 0.00% 2 Missing ⚠️
.../components/ActivityListing/ActivityDescription.js 0.00% 1 Missing ⚠️
...dminPane/Manage/ChallengeCard/ChallengeControls.js 0.00% 1 Missing ⚠️
.../AdminPane/Manage/ProgressStatus/ProgressStatus.js 0.00% 1 Missing ⚠️
... and 11 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2412      +/-   ##
==========================================
- Coverage   23.95%   23.95%   -0.01%     
==========================================
  Files         649      649              
  Lines       22482    22483       +1     
  Branches     6894     6908      +14     
==========================================
  Hits         5385     5385              
- Misses      14311    14312       +1     
  Partials     2786     2786              

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

@CollinBeczak CollinBeczak self-requested a review September 2, 2024 17:21
CollinBeczak
CollinBeczak previously approved these changes Sep 2, 2024
Copy link
Collaborator

@CollinBeczak CollinBeczak left a comment

Choose a reason for hiding this comment

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

tested yesterday, LGTM

@jake-low
Copy link
Contributor Author

jake-low commented Sep 3, 2024

Rebased over main, resolving two minor merge conflicts

@jake-low
Copy link
Contributor Author

jake-low commented Sep 4, 2024

Rebased again 🙂 and since I see that this has been approved (thanks!) I'm gonna go ahead and merge it.

@jake-low jake-low merged commit 8eaf220 into main Sep 4, 2024
5 of 6 checks passed
@jake-low jake-low deleted the jlow/eslint branch September 4, 2024 21:32
@CollinBeczak CollinBeczak mentioned this pull request Sep 9, 2024
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.

2 participants