-
Notifications
You must be signed in to change notification settings - Fork 61
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
Quotation style enforcement? #47
Comments
Yeah, it looks like jshint is letting jscs handle issues of code style in the future. Personally, I see stylint as being a linter for both code correctness and code style, so a rule for enforcing quotation marks makes sense to me. |
if you pull the latest, this feature should be available now, could use some testing |
Leave it to me to find some edge cases. 😉 I found some inconsistency when checking quotes in selectors. Hopefully the example below makes the issue clear. quotes.styl // Passes but shouldn't
[class*="--button"] {
border: 1px solid $primary-color;
}
// Last line passes but shouldn't
// Other lines fail as expected
[class*="--button"],
[class*="--bigbutton"],
input[type="text"],
input[type="button"] {
border: 1px solid $primary-color;
} quotes.json {
"alphabetical": true,
"borderNone": true,
"brackets": false,
"colons": false,
"colors": false,
"commaSpace": true,
"commentSpace": false,
"cssLiteral": false,
"depthLimit": false,
"duplicates": true,
"efficient": true,
"enforceBlockStyle": false,
"enforceVarStyle": false,
"extendPref": false,
"globalDupe": false,
"indentSpaces": 4,
"leadingZero": true,
"maxWarnings": 10,
"maxWarningsKill": false,
"mixed": false,
"namingConvention": false,
"parenSpace": false,
"placeholders": true,
"quotePref": "single",
"semicolons": false,
"universal": true,
"valid": false,
"whitespace": true,
"zeroUnits": true,
"zIndexDuplicates": false,
"zIndexNormalize": false
} Output: Warning: preferred quote style is single quotes
File: quotes.styl
Line: 14: [class*="--button"],
Warning: preferred quote style is single quotes
File: quotes.styl
Line: 15: [class*="--bigbutton"],
Warning: preferred quote style is single quotes
File: quotes.styl
Line: 16: input[type="text"], |
There seems to be a problem checking for quote preference when setting argument defaults. If I specify show-content( $content = "Hello!" ) {
&::before {
content: $content;
}
} |
interesting that you're hitting these issues - i've tested all of the cases here with all the quotePref settings and they all appear to be behaving as expected, ie, i can't replicate the issue someone else want to test this? |
@rossPatton I'm testing with version |
Yeah, i always test by running stylint against real stylus files, and then again with unit tests. In both cases I didn't have this issue. I'll take another look, and make sure i'm testing with 0.9.2 instead of the latest on my local, and post an update here. |
I'm using I noticed if I add additional classes to the selectors, I can get all 5 to report warnings as expected.
Also, when using my preferred minimal syntax, all 5 warnings are reported as expected, without needing the additional classes:
Maybe something to do with attribute selectors next to curly braces? |
@jackbrewer i can take another look, thanks for providing more examples. could you try pulling develop and testing against that as well? |
Same output as master – 3 warning for the original stylus, full 5 warnings with the modifications from my above message. Tested on latest |
Thanks! |
Not sure if this is helpful, but I pulled the latest develop (3163885), and I still see issues. |
@awayken yeaaah, that's to be expected, i haven't really gotten to this one yet. soon though, i intend this fix to be in 0.9.5 |
@awayken aaand this should be fixed now (in develop). Lemme know! |
The only case that still doesn't error is in the function declaration. show-content( $content = "Hello!" ) {
&::before {
content: $content;
}
} I'm using fa1ee81. |
@awayken should be good now. it's now fixed in 0.9.5 |
👍 Looks good to me. Just tested with 26e58b7. |
A feature that I like from JSHint is the ability to enforce quotation types. I try to enforce double quotes in my CSS/Stylus and single quotes in my JavaScript. Is that something others would find valuable in Stylint?
That said, it looks like JSHint is moving away from enforcing this rule altogether: http://jshint.com/docs/options/#quotmark
The text was updated successfully, but these errors were encountered: