Skip to content

Upgrade eslint-plugin-react - #51110

Merged
molly-moen merged 7 commits into
stagingfrom
molly/react-linting
Apr 6, 2023
Merged

Upgrade eslint-plugin-react#51110
molly-moen merged 7 commits into
stagingfrom
molly/react-linting

Conversation

@molly-moen

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

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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

molly-moen commented Apr 5, 2023

Copy link
Copy Markdown
Contributor Author

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
Copy Markdown
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.

3 participants