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

chore: Upgrade ESLint from v7 to v8 #3725

Merged
merged 14 commits into from Nov 19, 2021
Merged

chore: Upgrade ESLint from v7 to v8 #3725

merged 14 commits into from Nov 19, 2021

Conversation

nzdjb
Copy link
Contributor

@nzdjb nzdjb commented Nov 13, 2021

From #3623

Work remaining:

  • upgrade eslint-plugin-react (once released)
  • upgrade eslint-plugin-prettier (once released)
  • upgrade eslint-plugin-jest-dom (once released)
  • upgrade eslint-plugin-jsx-a11y (once released)
  • resolve any linting issues surfaced by new versions

Release Notes

@nzdjb
Copy link
Contributor Author

nzdjb commented Nov 13, 2021

I initially thought eslint-plugin-prettier and eslint-plugin-jest-dom needed updates, but after the updates to the others, the issues from these seem to have been resolved.

@nzdjb
Copy link
Contributor Author

nzdjb commented Nov 13, 2021

New issues that appear under ESLint 8 that weren't there with ESLint 7:

/workspaces/redwood/packages/forms/src/index.tsx
  479:7  warning  'name' is missing in props validation            react/prop-types
  480:7  warning  'id' is missing in props validation              react/prop-types
  482:7  warning  'errorClassName' is missing in props validation  react/prop-types
  483:7  warning  'errorStyle' is missing in props validation      react/prop-types
  487:7  warning  'validation' is missing in props validation      react/prop-types
  488:7  warning  'onBlur' is missing in props validation          react/prop-types
  489:7  warning  'onChange' is missing in props validation        react/prop-types
  528:7  warning  'name' is missing in props validation            react/prop-types
  529:7  warning  'id' is missing in props validation              react/prop-types
  531:7  warning  'errorClassName' is missing in props validation  react/prop-types
  532:7  warning  'errorStyle' is missing in props validation      react/prop-types
  536:7  warning  'validation' is missing in props validation      react/prop-types
  537:7  warning  'onBlur' is missing in props validation          react/prop-types
  538:7  warning  'onChange' is missing in props validation        react/prop-types
  577:7  warning  'name' is missing in props validation            react/prop-types
  578:7  warning  'id' is missing in props validation              react/prop-types
  580:7  warning  'errorClassName' is missing in props validation  react/prop-types
  581:7  warning  'errorStyle' is missing in props validation      react/prop-types
  585:7  warning  'validation' is missing in props validation      react/prop-types
  586:7  warning  'onBlur' is missing in props validation          react/prop-types
  587:7  warning  'onChange' is missing in props validation        react/prop-types
  696:7  warning  'name' is missing in props validation            react/prop-types
  697:7  warning  'id' is missing in props validation              react/prop-types
  699:7  warning  'errorClassName' is missing in props validation  react/prop-types
  700:7  warning  'errorStyle' is missing in props validation      react/prop-types
  704:7  warning  'validation' is missing in props validation      react/prop-types
  705:7  warning  'onBlur' is missing in props validation          react/prop-types
  706:7  warning  'onChange' is missing in props validation        react/prop-types

/workspaces/redwood/packages/internal/src/generate/graphqlSchema.ts
  48:25  error  Unsafe usage of optional chaining. If it short-circuits with 'undefined' the evaluation will throw TypeError  no-unsafe-optional-chaining

/workspaces/redwood/packages/router/src/links.tsx
   64:10  warning  'onClick' is missing in props validation  react/prop-types
  105:58  warning  'onClick' is missing in props validation  react/prop-types

✖ 31 problems (1 error, 30 warnings)

@nzdjb
Copy link
Contributor Author

nzdjb commented Nov 13, 2021

Have now resolved all the new linting issues.

The changes in packages/forms/src/index.tsx could do with a careful look from someone familiar with the intention of the typing. It wasn't entirely clear what the reason was for 'type' was being omitted and that 'id' not being defined. However, linting and tests both pass.

The other changes should be straightforward.

@nzdjb nzdjb marked this pull request as ready for review November 13, 2021 06:33
@dac09
Copy link
Collaborator

dac09 commented Nov 15, 2021

Requesting a HODL ✋ on this till we merge in the babel changes that are going in #3719 please!

@thedavidprice thedavidprice linked an issue Nov 16, 2021 that may be closed by this pull request
@thedavidprice
Copy link
Contributor

@nzdjb Fantastic work! I'll queue this up for review to include in the next release. Thank you.

Roger that @dac09 👍

@thedavidprice thedavidprice added dependencies release:breaking This PR is a breaking change and removed triage/processing labels Nov 16, 2021
@thedavidprice thedavidprice added this to the next-release-priority milestone Nov 16, 2021
@redwoodjs-bot redwoodjs-bot bot moved this from New issues to In progress (priority) in Current-Release-Sprint Nov 16, 2021
@thedavidprice thedavidprice moved this from In progress (priority) to v0.39 (locked) in Current-Release-Sprint Nov 16, 2021
@@ -89,6 +89,7 @@ interface FieldProps<
| HTMLInputElement = HTMLInputElement
> {
name: string
id?: string
Copy link
Contributor

Choose a reason for hiding this comment

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

@jtoar can you confirm this is correct?

@@ -45,7 +45,7 @@ export const generateGraphQLSchema = async () => {
// This tries to clean up the output of those errors.
console.error(e)
console.error(chalk.red('Error parsing SDLs or Schema'))
for (const error of e?.errors) {
for (const error of e.errors ?? []) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice!

Current-Release-Sprint automation moved this from v0.39 (locked) to Ready to merge Nov 19, 2021
Copy link
Contributor

@jtoar jtoar left a comment

Choose a reason for hiding this comment

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

Hey @nzdjb thanks for not only tracking the changes it'd take for us to upgrade to ESLint v8, but then also upgrading us as well! 🚀

I'm good with merging this as is, just had one question about TS in forms. The TS I did in the forms package is definitely not great but I'm seeing one type hint (for type) now that I feel like shouldn't be there:

Before:

image

After:

image

I'd just like to know if you thought it was correct show type as a prop when we do nothing with it in TextAreaField, etc?

@thedavidprice
Copy link
Contributor

Great work on this! I'm merging now. If there's need to make an adjustment based on @jtoar question above, we can handle in a follow-up PR.

Thanks, everyone. 🚀

@thedavidprice thedavidprice merged commit 2d2d90c into redwoodjs:main Nov 19, 2021
Current-Release-Sprint automation moved this from Ready to merge to Done Nov 19, 2021
@nzdjb
Copy link
Contributor Author

nzdjb commented Nov 20, 2021

I'd just like to know if you thought it was correct show type as a prop when we do nothing with it in TextAreaField, etc?

Probably not correct, no, but was the minimal change to resolve the issue. I'll take another bash at it and see what can be done about omitting it.

Copy link
Collaborator

@callingmedic911 callingmedic911 left a comment

Choose a reason for hiding this comment

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

@nzdjb Thanks for all the work here! 🔥 While I was working on router stuff I came across a TS error.
Screenshot 2021-11-22 at 12 45 42 AM

I've added my suggestion as a fix, have a look whenever you get the chance. Feel free to include it in your ongoing forms related PR.

packages/router/src/links.tsx Show resolved Hide resolved
packages/router/src/links.tsx Show resolved Hide resolved
@nzdjb
Copy link
Contributor Author

nzdjb commented Nov 21, 2021

@nzdjb Thanks for all the work here! 🔥 While I was working on router stuff I came across a TS error.
...

I've added my suggestion as a fix, have a look whenever you get the chance. Feel free to include it in your ongoing forms related PR.

Whoops! Sorry about that! 😞

Have added your suggested changes to #3762.

@thedavidprice
Copy link
Contributor

@nzdjb we have a monthly meetup for Redwood Contributors, and it would be a pleasure to add you to the group invite. (Read more about Redwood Contributors here.)

Could you send me a DM on the Redwood Forums? Or any other preferred way to connect?

https://community.redwoodjs.com/u/thedavid/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release:breaking This PR is a breaking change
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Upgrade ESLint from v7 to v8
5 participants