Closed Bug 1872688 Opened 5 months ago Closed 5 months ago

Fix unknown property issues in aboutwelcome/newtab code when upgrading eslint-plugin-react to 7.33.2

Categories

(Firefox :: Messaging System, task)

task

Tracking

()

RESOLVED FIXED
123 Branch
Tracking Status
firefox123 --- fixed

People

(Reporter: standard8, Assigned: aminomancer)

References

(Blocks 2 open bugs)

Details

Attachments

(1 file)

When upgrading eslint-plugin-react to 7.33.2, there are various errors generated: (Note: there are also errors for devtools, that I'll raise in a separate bug).

browser/components/aboutwelcome/content-src/components/MultiStageProtonScreen.jsx
  106:7   error  Unknown property 'flow' found                    react/no-unknown-property (eslint)
  188:11  error  Unknown property 'alignment' found               react/no-unknown-property (eslint)
  345:9   error  Unknown property 'button-size' found             react/no-unknown-property (eslint)
  496:9   error  Unknown property 'layout' found                  react/no-unknown-property (eslint)
  497:9   error  Unknown property 'pos' found                     react/no-unknown-property (eslint)
  509:11  error  Unknown property 'hide-secondary-section' found  react/no-unknown-property (eslint)

browser/components/newtab/content-src/components/CustomizeMenu/ContentSection/ContentSection.jsx
  129:19  error  Unknown property 'preference' found   react/no-unknown-property (eslint)
  165:23  error  Unknown property 'preference' found   react/no-unknown-property (eslint)
  166:23  error  Unknown property 'eventSource' found  react/no-unknown-property (eslint)
  207:27  error  Unknown property 'preference' found   react/no-unknown-property (eslint)
  208:27  error  Unknown property 'eventSource' found  react/no-unknown-property (eslint)
  226:27  error  Unknown property 'preference' found   react/no-unknown-property (eslint)
  227:27  error  Unknown property 'eventSource' found  react/no-unknown-property (eslint)

browser/components/newtab/content-src/components/DiscoveryStreamComponents/DSDismiss/DSDismiss.jsx
  47:11  error  Unknown property 'onHover' found  react/no-unknown-property (eslint)

Please can someone take a look at fixing this? I am starting to investigate upgrading to ESLint v9, and want to make sure we have all the plugins up to date as there may be plugin changes needed as well.

To test the upgrade locally:

  • Update package.json to set eslint-plugin-react to "7.33.2"
  • Run rm -r node_modules package-lock.json && ./mach npm install to regenerate the node modules installation.
  • Run ESLint as normal, e.g. ./mach eslint . or ./mach eslint browser/components/
See Also: → 1872689
Blocks: fxms-build

Thanks for filing, upgrading to 9 sounds great. I guess this rule was broken in old eslint versions. At first glance:

  • I do want the custom props for MultiStageProtonScreen. We could just flip the rule to off, but maybe it's better to just add exclusions. "react/no-unknown-property": ["error", { ignore: ["flow", "alignment", "button-size", "layout", "pos", "hide-secondary-section"] }]
  • But the one in DSDismiss looks like an accidental duplicate of onMouseEnter, and safe to remove.
  • The ContentSection props are read, but they could be changed to data-preference and data-event-source, which the eslint rule should accept without issue.

(In reply to Shane Hughes [:aminomancer] from comment #1)

Thanks for filing, upgrading to 9 sounds great. I guess this rule was broken in old eslint versions.

Just to clarify, it is upgrading the plugin that is raising the errors, we haven't updated ESLint yet (begin able to upgrade the plugin should make it easier to upgrade ESLint).

I'll leave you to decide on what's best for the code :)

Seems like at least the about welcome stuff is probably messaging system.

Shane, do you have cycles to take this?

Blocks: 1872689
Component: New Tab Page → Messaging System
Flags: needinfo?(shughes)
See Also: 1872689

Yes. I'll submit a patch today.

Flags: needinfo?(shughes)
Assignee: nobody → shughes
Status: NEW → ASSIGNED
Pushed by shughes@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/372a10fa73b5
Fix react/no-unknown-property violations in newtab. r=Standard8
Status: ASSIGNED → RESOLVED
Closed: 5 months ago
Resolution: --- → FIXED
Target Milestone: --- → 123 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: