Skip to content
This repository was archived by the owner on Jan 22, 2026. It is now read-only.

Conversation

@clottman
Copy link
Contributor

@clottman clottman commented Mar 4, 2020

tl;dr: Things in this PR:

  • clean up the Popover component
  • new linting configuration that will catch more errors
  • fixes for things the new linting configuration complained about
  • fix for runtime console warning from Icon component due to recently updated search Icon
  • update eslint & its friends
  • turns on dogfood of server-side linting on Glitch

Why did this happen

The linting configuration we were previously using in shared components either excludes some important rules, or was failing silently. I learned this because I shipped a version of shared-components that has a bug that the linter should have caught.

bug from shared-components

I wasn't excited about playing whack-a-mole to figure out additional useful rules that weren't included in eslint-config-react-app, so instead I switched the config to extending eslint:recommended, plugin:jsx-a11y/recommended, and plugin:react/recommended. This is more in line with what the community site does for linting. (The community site also adds the airbnb eslint config, which is more opinionated.)

Popover bug

Linting fixes revealed a bug! This is the dream of linters everywhere.

edited to say:
I was largely wrong about there being a bug in the Popover component; we were passing one prop to something that was just a styled div that didn't take props, which I thought was a bug affecting behavior, but it was not affecting behavior at all. (see edit history of this description for more details on what I was thinking)
resume non-edited content

Also, since the Popover story example was using startOpen=true, when you load shared-components.glitch.me, the Delete Team element that is the popover example immediately receives focus. In addition to fixing the bug, the example now has startOpen={false} so you can load shared-components.glitch.me and see the top of the page.

Linting fixes for new rules

  • Many display names were added
  • a bunch of variables were defined but never used, so the variables got removed

Server side linting

Got instructions from Osmose on enabling server-side linting in the glitch editor. It appears to be working!

  • this requires using .eslintrc.json, not .eslintrc.js.
  • this means we can see errors from our plugins (React & jsx-a11y) in the glitch editor!
  • there will be a slight delay when you start editing your first javascript file before the errors start showing up
  • other weird things might happen; this is experimental

Server-side linting, wow!

@whimsicallyson
Copy link
Contributor

Popover from shared-components is already in use in a few places in community, but we don't use the startOpen prop in any of those instances.

we should be using it in user-options-pop (ln 166). does this change mean it works now, or is there a change we need to do on the community side to get it functioning properly?

@whimsicallyson whimsicallyson self-requested a review March 5, 2020 14:59
lib/popover.js Outdated
/* there's a good chance this isn't the right default, but it maintains backwards compatability with the community site,
from a time when Popover was not actually respecting startOpen and was passing true through to the underlying PopoverContainer
all the time */
startOpen: true,
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm a bit worried about this... since most popovers shouldn't startOpen. If this starts working as intended, will we suddenly have an open popover nightmare site?

Granted that's also something we can probably test locally before updating the package version in prod, right?

@clottman
Copy link
Contributor Author

clottman commented Mar 5, 2020

Updated to remove my introduction of a bug-fix-that-doesn't-fix-anything-but-maybe-breaks-stuff in the Popover component.

I thought we were using the community-specific Popover in user-options-pop in Community, but @whimsicallyson pointed out I was wrong on that. We were passing in startOpen as always true to PopoverContainer - but that's fine, because PopoverContainer is just a styled div, which doesn't read that prop at all. So, I removed startOpen from PopoverContainer inside Popover, but left everything else alone.

Still working on testing these changes- the instructions in contributing.md aren't working for me :(

@clottman clottman requested a review from whimsicallyson March 5, 2020 22:28
Copy link
Contributor

@whimsicallyson whimsicallyson left a comment

Choose a reason for hiding this comment

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

addressed all my concerns! let me know if you want any 🦆for trying to get it working locally, I haven't tried but am happy to bounce ideas off

@clottman
Copy link
Contributor Author

clottman commented Mar 6, 2020

@whimsicallyson and I both tested this as a pre-release on staging; it works! Deploying now

@clottman clottman merged commit 67d6f93 into master Mar 6, 2020
@clottman clottman deleted the general-legendary-salary branch March 6, 2020 17:07
@keithk
Copy link
Contributor

keithk commented Nov 10, 2020

🚀 PR was released in v0.19.0 🚀

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants