-
Notifications
You must be signed in to change notification settings - Fork 7
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
Base indentation detection #16
Conversation
Pull Request Test Coverage Report for Build 1542386357Warning: This coverage report may be inaccurate.This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Details
💛 - Coveralls |
We now store the before/after strings from both the JS and the CSS in the raws of each node. This means we can simply output the JS raws when stringifying the node.
turns out that implementation was nonsense. have updated to sort it out, should be fine now. also added a test which simply enables stylelint's |
@abdonrd @web-padawan could you possibly give |
Thanks, I will try it tomorrow 👍 |
i gave it a go, i think we still have one last problem: accounting for the first newline. css`
.foo {}
`; The first new line after |
@43081j Tried to use it with our web components monorepo and faced an error:
Here is the branch: https://github.com/vaadin/web-components/tree/stylelint-14 |
strange, that sounds like there's syntax in your code that the babel parser didn't understand. ill see if i can reproduce it locally tonight |
@web-padawan this is because i removed it locally and it then lints correctly, but has the same "rule-empty-line-before" problem i mentioned above, ill fix that tonight |
Thanks for looking into it. I will put together a new version of the Stylelint config tomorrow. |
We trim this so we don't trigger stylelint's rules which disallow empty first lines. In JS sources, an empty first line makes sense. We also have to set `beforeStart` explicitly on the root's raws until stylelint fixes stylelint/stylelint#5767.
@web-padawan i published a new I had to put a bit of a hack in my PR which has been written up here: stylelint/stylelint#5767 for anyone curious. |
i've tested this against our repos too and it seems to work fine, so im gonna go ahead and merge. if you run into any problems, can you please open another issue? |
@43081j Thanks! Could you please also publish 0.1.3 so we can use it in the project? |
i've just published 0.2.0 @web-padawan |
@43081j it doesn't work well for me 😕 With the same branch: https://github.com/IBM/pwa-lit-template/compare/stylelint-14 |
@abdonrd can you possibly raise a new issue and ill try look into it tomorrow will run it against your branch and see where i get to |
Done! #18 |
@43081j I got it working in our web components monorepo, many thanks for putting this together! ❤️ Some interpolations were causing const richTextEditorStyles = css`
${contentStyles}
${toolbarStyles}
:host([readonly]) [part='toolbar'] {
display: none;
}
`; The errors are caused by |
ah yes, this is because we replace expressions with comments. but i opened #6 for this, as we may need to be smarter about what we use as a placeholder (e.g. values in value positions, comments elsewhere). i'll add a test like that at some point and see what i can do to make it better |
This detects the base indentation (that of the last backtick of the template) and removes it from the CSS source before parsing it.
We need this so we don't trigger stylelint's indentation rules incorrectly.
Fixes #14