Skip to content
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

duplicateCheck looks buggy #27

Closed
PalleZingmark opened this issue Jan 26, 2015 · 11 comments
Closed

duplicateCheck looks buggy #27

PalleZingmark opened this issue Jan 26, 2015 · 11 comments
Labels

Comments

@PalleZingmark
Copy link
Contributor

Hi,
It seems like duplicateCheck is a bit buggy.

I get a warning for the following code:

.foo {
  .bar {
    color: red;
  }
}

Warning: duplicate property or selector, consider merging
File: ./app/assets/stylus/fubar.styl
Line: 5: }

Setting it to false has no effect either, same warning regardless of settings.

...
"duplicates": false,
"globalDupe": false,
...
@rossPatton
Copy link
Collaborator

Hey @PalleZingmark thanks for pointing this out.

So, really we got 2 issues here. Duplicates can't toggle and the actual check itself isn't working as intended.

Don't have a lot of time right now, so I just pushed up a quick fix for the toggle issue: if you update to the latest stylint you should be able to toggle duplicates off.

I'll take a longer look at false positives problem prolly tonight.

Thanks!

@rossPatton rossPatton added the bug label Jan 26, 2015
@PalleZingmark
Copy link
Contributor Author

Thank you, toggling duplicates is now working as intended. 👍

@rossPatton
Copy link
Collaborator

Hey, i wasn't able to replicate your issue, but I was able to make a few improvements to duplicates. I'd get the latest and see if they resolve your issue maybe?

I'm gonna close this issue out, i'll reopen if I can replicate it.

@PalleZingmark
Copy link
Contributor Author

No, unfortunately it does not solve my issue.

I did some further tests, and while this throws a warning:

.foo {
  .bar {
    color: red;
  }
}

This does not:

.foo {
  .bar {
    color: red;
  }}

It also throws warnings if you're using BEM naming methodology, so it looks like the match pattern is somewhat off in the duplicateCheck.

.foo {
  .foo-bar {
    color: red;
  }
}

@rossPatton rossPatton reopened this Jan 27, 2015
@rossPatton
Copy link
Collaborator

So, i still couldn't replicate this. Maybe post your config? Are you using tabs or spaces for indenting?

@PalleZingmark
Copy link
Contributor Author

stylint-test.styl

.foo {
  .foo-bar {
    color: red;
  }
}

.stylintrc

{
    "alphabetical": false,
    "borderNone": true,
    "brackets": false,
    "colons": false,
    "commaSpace": true,
    "commentSpace": false,
    "cssLiteral": false,
    "duplicates": true,
    "depthLimit": 4,
    "efficient": true,
    "enforceVarStyle": false,
    "enforceBlockStyle": false,
    "extendPref": false,
    "globalDupe": false,
    "indentSpaces": 2,
    "leadingZero": false,
    "maxWarnings": 10,
    "mixed": true,
    "namingConvention": "BEM",
    "parenSpace": false,
    "placeholders": false,
    "semicolons": false,
    "Whitespace": true,
    "universal": false,
    "valid": true,
    "zeroUnits": true,
    "zIndexDuplicates": false,
    "zIndexNormalize": false
}

hmm, I can see some strange behavior.

If I just lint stylint-test.styl by itself, using the config above - it passes.
But if I @import it into my project - it fails.

Warning: duplicate property or selector, consider merging
File: ./app/assets/stylus/stylint-test.styl
Line: 5: }

I have no other classes named .foo or .foo-bar in my project, so it shouldn't throw a warning.

To make it pass, I need to do like this:

.foo {
  .foo-bar {
    color: red;
  }}

@rossPatton
Copy link
Collaborator

@PalleZingmark hey so, i was eventually able to replicate the issue and hopefully 0.8.8 fixes it.

Let me know!

@lin-hun
Copy link

lin-hun commented Feb 4, 2015

.....in 0.8.8,i set duplicates as true.but didnt throw a warning
my test code:

.some-class
  margin 0
  margin 5px

@rossPatton
Copy link
Collaborator

@lin-hun thx for reporting: was able to duplicate, try upgrading to 0.8.9 and see if that fixes it.

@lin-hun
Copy link

lin-hun commented Feb 4, 2015

=w= duplicates works well

@rossPatton
Copy link
Collaborator

+1 cool, gonna close this now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants