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

ESLint + debug ElasticAPM RUM #504

Merged
merged 145 commits into from
Aug 30, 2023
Merged

ESLint + debug ElasticAPM RUM #504

merged 145 commits into from
Aug 30, 2023

Conversation

rtertiaer
Copy link
Contributor

This is a wombo-combo of two distinct things - the work @SteveMicroNova did to ESLint the entire repo, and the ElasticAPM integration for a quick debug mode config to get feedback on webapp_2. This is the branch that's currently playing things in the office 😎 I'm opting to PR this into webapp_2 so we can begin working on merging #494 🙃 It might make sense to review this PR commit by commit, and skipping the large linting commits; should some concerns arise about some of the super buried bits of this, we can re-constitute a branch with cherry-picked commits and work off that.

Things I'd appreciate feedback on:

  • is the eslint ruleset at .eslintrc.cjs what we want to run with? I'm a little concerned that the changes are so profound in some of these commits.
  • anybody opposed to targetting es2022 for top level await? I know that makes me a smidge lazy... but Slack is deprecating my Firefox 107 browser on Sept 1st so I think we're probably fine lol

linknum23 and others added 30 commits November 16, 2022 11:18
This bug was missed in testing.
This should simplify the look of the user interface. TODO: add virtual sources display?
This allows an AmpliPi to be shallowly rebranded in the web app.
This allows a different picture to be displayed while waiting for a connection
@SteveMicroNova
Copy link
Contributor

The main functional changes added in my commits would be just commenting out unused variables, so if there's something wrong I'd suggest searching for comment delineators, especially in the earlier commits

Copy link
Contributor

@jonahshader jonahshader left a comment

Choose a reason for hiding this comment

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

I think I prefer two spaces for indentation, and maybe even no semicolon. The rest of the formatting changes make sense. I like the react propTypes thing.

@jonahshader
Copy link
Contributor

Why do we want "top level await" in particular?

Comment on lines +20 to +29
try {
const r = await fetch("/debug");
const debugDocText = await r.text();
const debugDoc = JSON.parse(debugDocText);
const debug = (debugDoc && debugDoc["debug"]) ? true : false;

var apm = initApm({ // eslint-disable-line no-unused-vars
active: debug,
serviceName: "Amplipi",
serverUrl: debugDoc["apmHost"] ? debugDoc["apmHost"] : "",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jonahshader I use top level await here to instantiate a very early connection to an arbitrary APM server, specified from a debug endpoint. I could also resolve the promise myself, or use a fancy vite plugin to transform top level awaits into resolved ones. I just didn't see a reason not to track more modern browsers and it seemed least messy at the time.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, got it. I think @linknum23 should answer this since he advocated for more backwards compatibility in the past.

Copy link
Contributor Author

@rtertiaer rtertiaer Aug 30, 2023

Choose a reason for hiding this comment

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

for context, introducing top level await drops support from estimates of 95% to 90% of global web browsers; most anything released since 2021 has this support. All long term support (read: oldest supported) versions of Firefox and Chrome support es2022.

on a super opinionated note, I'm not opposed to using browser compatibility as a forcing function to get folks to upgrade. Browsers have the most pronounced attack surface of any commonly used software. The equitability/accessibility concerns are minimal here, outweighed by serious security considerations.

@jonahshader
Copy link
Contributor

Looking at the react static propType, react just recommends using TypeScript instead. How difficult would it be to turn this into a TypeScript project? Considering that TypeScript is a strict superset of JavaScript, making that change won't break anything, and we could slowly add type checking to our components as needed. We could also add type checks to our other non-component functions, which isn't supported by prop-types.

Copy link
Contributor

@klay2000 klay2000 left a comment

Choose a reason for hiding this comment

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

looks fine formatting wise to me other than the 4 space tabs

Copy link
Contributor

@linknum23 linknum23 left a comment

Choose a reason for hiding this comment

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

This is a good start. Lets integrate this so we can polish up the new interface.

@rtertiaer rtertiaer merged commit 5be6c7c into webapp_2 Aug 30, 2023
1 check passed
@rtertiaer rtertiaer deleted the Webapp2-RUM branch August 30, 2023 19:00
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

6 participants