Comments (17)
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.
from stylint.
if you pull the latest, this feature should be available now, could use some testing
from stylint.
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"],
from stylint.
There seems to be a problem checking for quote preference when setting argument defaults. If I specify quotePref: "single"
, the following still passes:
show-content( $content = "Hello!" ) {
&::before {
content: $content;
}
}
from stylint.
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?
from stylint.
@rossPatton I'm testing with version Stylint version: 0.9.2
. If you create files and use the settings as I have them above, do you see the issue like I do?
from stylint.
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.
from stylint.
I'm using master
and am seeing the same output as pasted above: only 3 warnings reported for the file, even though 5 exist.
I noticed if I add additional classes to the selectors, I can get all 5 to report warnings as expected.
[class*="--button"],
.additional-class {
border: 1px solid $primary-color;
}
[class*="--button"],
[class*="--bigbutton"],
input[type="text"],
input[type="button"],
.another-additional-class {
border: 1px solid $primary-color;
}
Also, when using my preferred minimal syntax, all 5 warnings are reported as expected, without needing the additional classes:
[class*="--button"]
border 1px solid $primary-color
[class*="--button"]
[class*="--bigbutton"]
input[type="text"]
input[type="button"]
border 1px solid $primary-color
Maybe something to do with attribute selectors next to curly braces?
from stylint.
@jackbrewer i can take another look, thanks for providing more examples.
could you try pulling develop and testing against that as well?
from stylint.
Same output as master – 3 warning for the original stylus, full 5 warnings with the modifications from my above message. Tested on latest develop
(d3a01bc)
from stylint.
Thanks!
from stylint.
Not sure if this is helpful, but I pulled the latest develop (3163885), and I still see issues.
from stylint.
@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
from stylint.
@awayken aaand this should be fixed now (in develop). Lemme know!
from stylint.
The only case that still doesn't error is in the function declaration.
show-content( $content = "Hello!" ) {
&::before {
content: $content;
}
}
I'm using fa1ee81.
from stylint.
@awayken should be good now. it's now fixed in 0.9.5
from stylint.
from stylint.
Related Issues (20)
- bug(outdated): -webkit-text-stroke and unicode-bidi properties
- docs(outdated): outdated documentation in official site HOT 1
- Project still maintained? HOT 1
- Checkstyle Reporter
- VS Code Stylint Extension HOT 1
- ^[-1]:hover ^[-1..-1] - property is not valid
- feature_request(config): support config via .stylintrc.js (CommonJS export)
- Asterisk sometimes considered universal selector when used for multiplication
- Add support for "font-variation-settings" (variable fonts) HOT 1
- The .stylintrc file is ignored while using with syntastic in vim.
- Unable to support the Stylint Sublime Text plugin
- CLI support for multiple files HOT 2
- Hexadecimal spelling HOT 1
- bug(duplicates): false positives, if exists comments for Stylus selectors HOT 1
- Would you consider changing license to MIT? HOT 2
- duplicate property or selector, consider merging {block}
- CSS Grid Property is not valid HOT 1
- "valid" and "brackets": false positives on Stylus hashes
- Shareble config support
- Duplicate Warning when use mixin {block}
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from stylint.