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

"cannot find formatter: rect" #317

Closed
dangreen opened this issue May 13, 2018 · 6 comments
Closed

"cannot find formatter: rect" #317

dangreen opened this issue May 13, 2018 · 6 comments
Labels
core Processing and transforming logic diagnostics Warnings and errors question User questions

Comments

@dangreen
Copy link

WARNING in Stylable: VisuallyHidden.st.css:10:8: cannot find formatter: rect

   8 |  height: 1px;
   9 |  overflow: hidden;
> 10 |  clip: rect(0 0 0 0);
     |        ^
  11 | }
  12 |
@idoros idoros added bug Unexpected behavior or exception and removed bug Unexpected behavior or exception labels May 14, 2018
@idoros
Copy link
Collaborator

idoros commented May 14, 2018

Native functions and formatters (custom functions) share the same context. And we test for formatters first, then fallback to a closed list of native functions, and this is just a bad message in case the name is not found in the list.

The reason rect() causes a warning, is probably because it's deprecated and not in our list (I think you should use clip-path: inset() instead).

Notice that this is just a warning, and Stylable still outputs the clip: rect() correctly.

That being said, I think we should modify the behavior of native/custom functions to to be like JSX with capital first letter for custom and remove the native white-list altogether...

@brucelawson
Copy link
Contributor

I agree it's a bad error message; should be clear that it's looking in custom formatters then native, not found anything, but output it anyway. (Not sure it should output it anyway - doesn't that break our promise of catching errors before production?)

@tomrav
Copy link
Collaborator

tomrav commented May 14, 2018

I agree the error message could benefit from being more verbose.

The idea to use capital letters to signify custom vs native feels slightly too magical to me.
Would this still be a concern when we introduce a registration mechanism for formatters/mixins?

@brucelawson
Copy link
Contributor

Perhaps in developer mode. we should run the end CSS through the official validator )https://github.com/w3c/css-validator) to alert developers of deprecated/ non-standard CSS?

@idoros
Copy link
Collaborator

idoros commented May 14, 2018

Not sure it should output it anyway - doesn't that break our promise of catching errors before production?

I think being tolerant here is the expected behavior. Stylable doesn't know what to do with the syntax, so it leaves it to CSS, which is tolerant as well and outputs a report with potential warnings (that might need an optional configuration).

capital letters to signify custom vs native

This should be taken out to a separate discussion

@brucelawson
Copy link
Contributor

I think being tolerant here is the expected behavior.

  • Good Point, Well Made. Agree. But nicer error message PLZ

@tomrav tomrav added the question User questions label May 21, 2018
@tomrav tomrav added diagnostics Warnings and errors core Processing and transforming logic labels May 29, 2018
@tomrav tomrav closed this as completed in 2c7c5dd Aug 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Processing and transforming logic diagnostics Warnings and errors question User questions
Projects
None yet
Development

No branches or pull requests

4 participants