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

Convert modals to use JSX #7566

Merged
merged 1 commit into from
Nov 27, 2019
Merged

Conversation

whymarrh
Copy link
Contributor

Refs #6291

This PR replaces hyperscript in the modals file with JSX.

@whymarrh
Copy link
Contributor Author

Interesting lint failure here 🤔 looks like we're checking for single-quoted strings, specifically

@@ -161,7 +161,7 @@ async function verifyEnglishLocale (fix = false) {
const englishLocale = await getLocale('en')
const javascriptFiles = await findJavascriptFiles(path.resolve(__dirname, '..', 'ui'))

const regex = /'(\w+)'/g
const regex = /['"](\w+)["']/g
Copy link
Member

Choose a reason for hiding this comment

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

This will catch some false positives, like "example's" would match example despite the beginning quote being different from the end quote.

Something like this would work better:

Suggested change
const regex = /['"](\w+)["']/g
const regex = /'(\w+)'|"(\w+)"/g

However that'd create two capture groups. So the match[1] would need to be replaced with something like
match[1] || match[2]

h(DepositEtherModal, {}, []),
],
contents: [(
<DepositEtherModal key={0} />
Copy link
Member

Choose a reason for hiding this comment

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

Nit: All of these single-entry arrays could be assigned the component directly instead. This contents is just passed as the children prop to the FadeModal - it's never assumed to be an array.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point, I'll update these

Copy link
Member

@Gudahtt Gudahtt left a comment

Choose a reason for hiding this comment

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

LGTM

@whymarrh whymarrh merged commit cfd041b into MetaMask:develop Nov 27, 2019
@whymarrh whymarrh deleted the hyperscript-49 branch November 27, 2019 22:19
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.

2 participants