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

Upgrade eslint-plugin-react #51110

Merged
merged 7 commits into from
Apr 6, 2023
Merged

Upgrade eslint-plugin-react #51110

merged 7 commits into from
Apr 6, 2023

Conversation

molly-moen
Copy link
Contributor

@molly-moen molly-moen commented Apr 4, 2023

Upgrade to the latest version of eslint-plugin-react. We need to do this for our eslint upgrade, and it gives us additional linting benefits. Namely, prop types on functional components are now linted fully (it seems that nested objects were not being properly linted). This means we hit a few linter errors. I fixed a few that were in the student learning/vague ownership space. The rest seem to be teacher tools components, I've started a thread here on those.

The only other changes this enforced was adding rel="noreferrer" to links with target="_blank" (reasoning), and renaming a lifecycle method to the UNSAFE_ version.

Links

Testing story

Most of the changes here are adding ignores, and the other changes seem safe. I am relying on drone to validate this.

PR Checklist:

  • Tests provide adequate coverage
  • Privacy and Security impacts have been assessed
  • Code is well-commented
  • New features are translatable or updates will not break translations
  • Relevant documentation has been added or updated
  • User impact is well-understood and desirable
  • Pull Request is labeled appropriately
  • Follow-up work items (including potential tech debt) are tracked and linked

@molly-moen molly-moen marked this pull request as ready for review April 4, 2023 20:48
@molly-moen molly-moen requested a review from a team April 4, 2023 20:48
@bethanyaconnor
Copy link
Contributor

What lint errors are you seeing for the components that need to be skipped? I spot checked a couple and they do have prop types (example 1, example 2). I know I've also seen linter errors when props aren't listed, I think for functional components, so I think I'm missing what's changed?

@molly-moen
Copy link
Contributor Author

molly-moen commented Apr 5, 2023

What lint errors are you seeing for the components that need to be skipped? I spot checked a couple and they do have prop types (example 1, example 2). I know I've also seen linter errors when props aren't listed, I think for functional components, so I think I'm missing what's changed?

@bethanyaconnor it's a bit subtle, I should have clarified. A lot of the issues are because a prop in a nested object isn't defined (so maybe my statement about not checking props in functional components was overly broad). In (example 1, programmingExpression.blockName is not part of programmingExpressionShape. Example 2 has the same problem, and also hasn't defined programmingExpression.name. There was at least one case of non-nested props not being defined (InstructorsOnly), so linting was at least being applied inconsistently.

@bethanyaconnor
Copy link
Contributor

ahh makes sense thanks for clarifying!

@molly-moen molly-moen merged commit 9faf496 into staging Apr 6, 2023
@molly-moen molly-moen deleted the molly/react-linting branch April 6, 2023 15:47
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.

None yet

3 participants