SimenB / stylint

Improve your Stylus code with Stylint
https://simenb.github.io/stylint/
GNU General Public License v2.0
348 stars 62 forks source link

same property for different classes/elements triggers duplicate rule #333

Closed jszpila closed 8 years ago

jszpila commented 8 years ago

Getting the message:

/Users/jszpila/Work/MyProject/resources/src/stylus/app.styl 9 duplicates warning duplicate property or selector, consider merging

/Users/jszpila/Work/MyProject/resources/src/stylus/app.styl 12 duplicates warning duplicate property or selector, consider merging Stylint: 0 Errors. Stylint: 2 Warnings.

When I have the same property on different elements or classes. This seems like unintended behavior, unless I'm missing something.

Below is the entirety of my .stylus file; as you can see, the only duplicate property is margin. If I disable the duplicates rule it works fine, but obviously doesn't do what I'd like (find duplicated properties within the same class or element), setting globalDupes to false seems to have no effect (as I would suspect, but I figured I'd try just in case). Removing margin and plugging in different properties works fine as anticipated, but even with different properties, if two classes have the same property (even with different values) it still fails.

$gray = #CCC
$bgColor = #337ab7
$white = #FFF

body
  margin 0

.splash
  margin 10% 0

.test
  margin 0

This is my .stylintrc:

{
  "blocks": false,
  "brackets": "never",
  "colons": "always",
  "colors": "always",
  "commaSpace": "always",
  "commentSpace": "always",
  "cssLiteral": "never",
  "depthLimit": false,
  "duplicates": true,
  "efficient": "always",
  "exclude": [],
  "extendPref": false,
  "globalDupe": true,
  "indentPref": false,
  "leadingZero": "never",
  "maxErrors": false,
  "maxWarnings": false,
  "mixed": false,
  "namingConvention": false,
  "namingConventionStrict": false,
  "none": "never",
  "noImportant": true,
  "parenSpace": false,
  "placeholders": "always",
  "prefixVarsWithDollar": "always",
  "quotePref": false,
  "semicolons": "never",
  "sortOrder": "alphabetical",
  "stackedProperties": "never",
  "trailingWhitespace": "never",
  "universal": false,
  "valid": true,
  "zeroUnits": "never",
  "zIndexNormalize": false,
  "reporterOptions": {
      "columns": ["lineData", "severity", "description", "rule"],
      "columnSplitter": "  ",
      "showHeaders": false,
      "truncate": true
  }
}

Using stylint 1.5.5 and gulp-stylint 3.3.0. I googled around and found that this was previously an issue but that it looks as if it had been resolved in prior versions. Any ideas?

kevinmpowell commented 8 years ago

I can confirm I'm having this same issue, using stylint 1.5.5 cli.

Source:

.foo {
    font-size: 16px;
}

.bar {
    font-size: 24px;
}

And I get: 6 duplicates warning duplicate property or selector, consider merging

I get the same error with and without bracket syntax. Disabling this rule until there's a fix.

rossPatton commented 8 years ago

this should be fixed in 1.5.6