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

Linting refactor and enable GitHub actions #3179

Merged
merged 23 commits into from
Oct 24, 2024
Merged

Linting refactor and enable GitHub actions #3179

merged 23 commits into from
Oct 24, 2024

Conversation

nellh
Copy link
Contributor

@nellh nellh commented Oct 22, 2024

The linter hasn't been run on CI in a while and some of the rules in use do not make sense for the current version of the project. This PR replaces the linting config and includes all the required fixes for the new ruleset.

This also adds the new react-compiler beta linter, which can do a better job of catching misuse of React and in the future may be useful for automatic memoization of component rendering.

TODO:

  • About 100 errors left
  • GitHub action

Copy link

codecov bot commented Oct 22, 2024

Codecov Report

Attention: Patch coverage is 56.55577% with 222 lines in your changes missing coverage. Please review.

Project coverage is 43.09%. Comparing base (0bf65b0) to head (dc70912).
Report is 39 commits behind head on master.

Files with missing lines Patch % Lines
packages/openneuro-cli/src/download.js 3.70% 26 Missing ⚠️
...euro-app/src/scripts/pages/admin/flagged-files.jsx 0.00% 18 Missing ⚠️
packages/openneuro-client/src/client.js 11.76% 15 Missing ⚠️
...ts/dataset/mutations/delete-anonymous-reviewer.tsx 0.00% 8 Missing and 1 partial ⚠️
packages/openneuro-server/src/handlers/comments.ts 0.00% 7 Missing ⚠️
...cripts/dataset/files/viewers/file-viewer-nifti.tsx 0.00% 5 Missing ⚠️
...src/scripts/dataset/fragments/copyable-tooltip.jsx 0.00% 4 Missing and 1 partial ⚠️
.../openneuro-server/src/graphql/resolvers/dataset.ts 16.66% 5 Missing ⚠️
packages/openneuro-app/src/scripts/app.tsx 0.00% 3 Missing and 1 partial ⚠️
...-components/src/activity-slider/ActivitySlider.tsx 0.00% 4 Missing ⚠️
... and 78 more
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3179      +/-   ##
==========================================
+ Coverage   42.84%   43.09%   +0.24%     
==========================================
  Files         549      547       -2     
  Lines       36187    36163      -24     
  Branches     1132     1128       -4     
==========================================
+ Hits        15506    15584      +78     
+ Misses      20479    20379     -100     
+ Partials      202      200       -2     

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

@nellh nellh marked this pull request as ready for review October 23, 2024 22:09
Copy link
Contributor

@effigies effigies left a comment

Choose a reason for hiding this comment

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

Partial review. Will finish tomorrow.

Comment on lines +15 to +16
"packages/openneuro-app/pluralize-esm.js",
"packages/openneuro-app/src/scripts/utils/schema-validator.js",
Copy link
Contributor

Choose a reason for hiding this comment

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

Might be helpful to future readers to know why we're ignoring these. I think this is the reason?

Suggested change
"packages/openneuro-app/pluralize-esm.js",
"packages/openneuro-app/src/scripts/utils/schema-validator.js",
// Generated from external sources
"packages/openneuro-app/pluralize-esm.js",
"packages/openneuro-app/src/scripts/utils/schema-validator.js",

"packages/**/*.ts",
"packages/**/*.tsx",
"packages/**/*.jsx",
"packages/**/*.js",
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it reasonable for this thing to lint itself?

Suggested change
"packages/**/*.js",
"packages/**/*.js",
"eslint.config.mjs",

@@ -80,7 +79,6 @@ const DatasetHistory = ({ datasetId }) => {
</div>
<div className="col-lg col col-2 grid actions">
<Revalidate datasetId={datasetId} revision={commit.id} />
<UpdateRef datasetId={datasetId} revision={commit.id} />
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are we removing this feature? I have occasionally used it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The mutation it uses hasn't worked since 2022. It would move the HEAD reference in MongoDB but we no longer do that, always following the git repo HEAD reference instead. The git version would be more destructive and I think it's better handled via the git interface itself.

Copy link
Contributor

Choose a reason for hiding this comment

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

Do we allow force-pushes to revert? If not, then it's just logging into the worker and manually doing the job.

Anyway, if it hasn't worked, then this is no loss, so no further objections.

@effigies
Copy link
Contributor

Finished review. Main concern is dropping the UpdateRef mutation, but it's not an indispensable feature.

@nellh nellh merged commit 1573f51 into master Oct 24, 2024
13 of 15 checks passed
@nellh nellh deleted the eslint-fixes branch October 24, 2024 16:26
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