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

CON-1959: add default-value rule #2

Merged
merged 1 commit into from
Oct 20, 2021
Merged

CON-1959: add default-value rule #2

merged 1 commit into from
Oct 20, 2021

Conversation

swain
Copy link
Contributor

@swain swain commented Oct 19, 2021

Note: This PR depends on #1.

Motivation

Adding an initial rule for enforcing defaultValue behavior.

@swain swain force-pushed the bootstrap branch 2 times, most recently from c2edbc5 to e2ef35d Compare October 19, 2021 22:32
@swain swain force-pushed the CON-1959 branch 4 times, most recently from a171f70 to 6829251 Compare October 19, 2021 22:37
@swain swain marked this pull request as ready for review October 19, 2021 22:40
Copy link
Member

@aecorredor aecorredor left a comment

Choose a reason for hiding this comment

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

Super nice 🚀

twoArguments: 'Translate function should have two arguments',
optionsObject: 'Translate function options should be an object',
defaultValuePresence:
'Translate function defaultValue must a string property on the second argument',
Copy link
Member

Choose a reason for hiding this comment

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

typo nit: must a string


if (prop?.value.type === 'Literal' && typeof prop.value.value === 'string') {
const variableNames = prop.value.value
.match(/{{[ a-zA-Z0-9]+}}/g)
Copy link
Member

Choose a reason for hiding this comment

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

Did we need the white space after the first [?

Copy link
Contributor Author

@swain swain Oct 20, 2021

Choose a reason for hiding this comment

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

yes, to ensure we also match e.g. {{ long }}, not just {{long}}

Base automatically changed from bootstrap to master October 20, 2021 13:59
Copy link

@lars-mortenson lars-mortenson left a comment

Choose a reason for hiding this comment

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

Awesome!

@swain swain merged commit b99311d into master Oct 20, 2021
@swain swain deleted the CON-1959 branch October 20, 2021 14:40
@github-actions
Copy link

🎉 This PR is included in version 1.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants