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

fix(gatsby-plugin-google-analytics): Fix broken script #16223

Conversation

tinder-kyleboss
Copy link
Contributor

@tinder-kyleboss tinder-kyleboss commented Jul 30, 2019

Fixing a syntax error in gatsby-plugin-google-analytics
where an if-statement was not closed in transpiled code.

Description

#15280 introduced a post-transpilation syntax error. 😢

There was an if-statement which ends up not being closed.
This PR fixes that.

Related Issues

PS: I would love some advice on possible indentation improvements using our linter or tests. 😄 I gave some things a shot but nothing looked quite right.

…15280)

gatsbyjs@b3ed9be
had a syntax error where, after transpiling the javascript, users
are given a syntax error.

There was an if-statement which ends up not being closed.
This commit fixes that.
Copy link
Contributor

@karlsander karlsander 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 the missing } for if (typeof ga === "function") {, correct?

Looks good.

@karlsander
Copy link
Contributor

karlsander commented Jul 30, 2019

Oops my code review was kind of pointless since I'm not a code owner.

I don't know how much this code can be improved with formatting. Looks pretty good already for being a huge string interpolation.

I think it could be improved with some refactoring. Pulling out all the processing of options so that the string interpolation only contains boolean and string variables defined right before it might be a good first step?

Copy link
Contributor

@sidharthachatterjee sidharthachatterjee left a comment

Choose a reason for hiding this comment

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

Good catch, thank you @tinder-kyleboss 👍

@sidharthachatterjee sidharthachatterjee changed the title fix(gatsby-plugin-google-analytics): Post-transpilation syntax error fix (#15280) fix(gatsby-plugin-google-analytics): Fix broken script Jul 30, 2019
@sidharthachatterjee sidharthachatterjee merged commit 4ff5321 into gatsbyjs:master Jul 30, 2019
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.

gatsby-plugin-google-analytics has a syntax error
3 participants