-
-
Notifications
You must be signed in to change notification settings - Fork 930
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
Add bundled support for styles in template literals #3405
Conversation
79de13a
to
4aac942
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why we remove postcss-markdown
? We are using this for linting css in markdown
9bf4a3f
to
51af626
Compare
@evilebottnawi Please read the discussion in #3264 that you yourself had given a 👍 to. If you have a question on a PR also please add that as a question in a comment or make your PR review a comment, but please don't make these types of questions/comments as "Request Changes" as this is not the intended purpose of the "Request Changes" feature. |
@ntwb i support |
@@ -12,7 +12,7 @@ module.exports = function(selector /*: string*/) /*: boolean*/ { | |||
} | |||
|
|||
// SCSS placeholder selectors | |||
if (selector.indexOf("%") === 0) { | |||
if (selector[0] === "%") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Regression, i can use .my-class%foo { }
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
".my-class%foo".indexOf("%") === 0
// false
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
selector.startsWith("%")
is much clearer in the intent... assuming that I'm reading the intent of that code correctly in the first place!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rollback of unrelated modifications in 48d4788
package.json
Outdated
"postcss-media-query-parser": "^0.2.3", | ||
"postcss-reporter": "^5.0.0", | ||
"postcss-resolve-nested-selector": "^0.1.1", | ||
"postcss-safe-parser": "^3.0.1", | ||
"postcss-sass": "^0.3.0", | ||
"postcss-scss": "^1.0.2", | ||
"postcss-selector-parser": "^3.1.0", | ||
"postcss-syntax": "^0.28.0", | ||
"postcss-styled": "github:gucong3000/postcss-styled#literal_part", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think better use stable release for this
Also PR title is misleading 😕 because in package.json we still have |
Sorry @evilebottnawi, thanks for that clarification, I missed that myself 😞 |
1097434
to
6d57272
Compare
postcss-markdown
with postcss-styled
bbcc249
to
48d4788
Compare
48d4788
to
c9ba730
Compare
@evilebottnawi |
@gucong3000 Am I right in thinking we also need to bundle import React from "react";
const Component = () => (
<div style={{top: 0}}></div>
); |
Yes, right. |
Thanks. Shall we add it in this PR? |
|
Any ideas when babel@7 is due out? We could always include |
If there is no objection, I'd like to add |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gucong3000 I've requested some minor changes... just setting syntax: ..
on objects or moving tests into their own testRule
blocks to bring them in line with our conventions.
Once these changes are in, I think we can merge this and add bundled support for styled components.
@@ -114,6 +114,10 @@ testRule(rule, { | |||
{ | |||
code: "a { -WEBKIT-border-radius: 12px; -webkit-BORDER-radius: 10px; }", | |||
message: messages.rejected("-webkit-BORDER-radius") | |||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we please pull this out into its own testRule
block with syntax: styled
, please?
We should place it at the end of the file, after the syntax: html
testRule
block.
@@ -79,6 +79,10 @@ testRule(rule, { | |||
code: | |||
"a { border-top-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-right-width: 1px; }", | |||
message: messages.expected("border-width") | |||
}, | |||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we please pull this out into its own testRule
block with syntax: styled
, please?
We should place it at the end of the file.
@@ -100,6 +100,10 @@ testRule(rule, { | |||
"-webKIT-transition", | |||
"-WEBKIT-transition-property" | |||
) | |||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we please pull this out into its own testRule
block with syntax: styled
, please?
We should place it at the end of the file.
@@ -69,6 +69,10 @@ testRule(rule, { | |||
{ | |||
code: "a { background: url(var(--image)); }", | |||
description: "ignore variable" | |||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we please pull this out into its own testRule
block with syntax: styled
, please?
We should place it at the end of the file.
@@ -185,6 +185,9 @@ testRule(rule, { | |||
}, | |||
{ | |||
code: 'a { background: url("") }' | |||
}, | |||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we please pull this out into its own testRule
block with syntax: styled
, please?
We should place it at the end of the file.
@@ -112,6 +112,50 @@ testRule(rule, { | |||
] | |||
}); | |||
|
|||
testRule(rule, { | |||
ruleName, | |||
config: [1], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add syntax: styled
here to be explicit, please?
|
||
testRule(rule, { | ||
ruleName, | ||
config: [20], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add syntax: styled
here please.
@@ -34,6 +34,12 @@ testRule(rule, { | |||
{ | |||
code: ".foo { *width: 100px; }", | |||
description: "ignore CSS hacks" | |||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we please pull this out into its own testRule
block with syntax: styled
, please?
We should place it at the end of the file.
@@ -132,6 +132,9 @@ testRule(rule, { | |||
{ | |||
code: ".foo /for/ .bar {}", | |||
description: "reference combinators" | |||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we please pull this out into its own testRule
block with syntax: styled
, please?
We should place it at the end of the file.
7961662
to
74bbab2
Compare
74bbab2
to
9faa4a7
Compare
Done. |
9faa4a7
to
7e2043e
Compare
@gucong3000 Thank you. Those tests are much easier to scan and consume now. LGTM. Has anyone got time to add a 2nd review to this? I'll endeavour to release tomorrow if we get this merged. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! This is an exciting new direction for stylelint.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
#3264
e.g. "No, it's self explanatory."