Skip to content

Conversation

@davydog187
Copy link
Collaborator

@davydog187 davydog187 commented May 6, 2021

Builds off of #314

Warns when a prop's default value is not in the :values! list

  • Documentation updates
  • Surface site PR
  • Support in the docs for :values!

"""

assert output =~ ~S"""
prop `invalid_acc2` default value 3 must be a list when accumulate: true
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

should i wrap the value in "``" like i do for the prop/data name?

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, I think we should start using ` ` whenever we have code-related stuff, just like we do in markdown. If in the future, we want to turn those boring monochromatic messages into beautiful colourful ones (like in Rust), it won't have to update any of the messages.

Maybe this is also valid for https://github.com/surface-ui/surface/pull/374/files#diff-fb7dcaf7105c49bd4b887f35e2c32958116d06d3ef6639370ed6cb3741f287cbR491 for accumulate: true.

Copy link
Member

@msaraiva msaraiva left a comment

Choose a reason for hiding this comment

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

@davydog187 looks great to me!

"""

assert output =~ ~S"""
prop `invalid_acc2` default value 3 must be a list when accumulate: true
Copy link
Member

Choose a reason for hiding this comment

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

Yeah, I think we should start using ` ` whenever we have code-related stuff, just like we do in markdown. If in the future, we want to turn those boring monochromatic messages into beautiful colourful ones (like in Rust), it won't have to update any of the messages.

Maybe this is also valid for https://github.com/surface-ui/surface/pull/374/files#diff-fb7dcaf7105c49bd4b887f35e2c32958116d06d3ef6639370ed6cb3741f287cbR491 for accumulate: true.

@davydog187
Copy link
Collaborator Author

@msaraiva updated the formatting. Are you suggesting to make a change for accumulate: true? That's unclear to me

Copy link
Member

@msaraiva msaraiva left a comment

Choose a reason for hiding this comment

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

@davydog187 looks great!

Do you think we should enhance the message a bit so we can instruct the user how to fix the issue? Something like:

prop `type` default value `"x-large"` does not exist in `:values!`

Hint: Either choose an existing value or replace `:values!` with `:values` to skip validation.

@davydog187
Copy link
Collaborator Author

yea, i like that idea

@davydog187
Copy link
Collaborator Author

@msaraiva I added the hint, should be good to go

@msaraiva msaraiva merged commit 5c05e66 into surface-ui:surface-next May 10, 2021
@msaraiva
Copy link
Member

@davydog187 thanks! ❤️

lnr0626 added a commit to lnr0626/surface that referenced this pull request May 11, 2021
* surface-next:
  Remove `phx_` prefix from props (surface-ui#384)
  Remove code for embedded interpolation inside strings
  Introduce <#unless> (surface-ui#376)
  Introduce the concept of root properties (surface-ui#382)
  Warn on invalid prop/data defaults (surface-ui#374)
  Deprecated unquoted strings (surface-ui#379)
  Convert embedded interpolation (surface-ui#380)
  Introduce <#raw> and deprecate <#Raw> (surface-ui#377)
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