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

no-mergeable-selectors not working properly with nth-child(even) nth-child(odd) #834

Closed
adrifmonte opened this issue Aug 18, 2016 · 4 comments
Labels

Comments

@adrifmonte
Copy link

What version of Sass Lint are you using?

Older (working) version:

gulp-sass-lint@1.2.0 node_modules/gulp-sass-lint
├── through2@2.0.1 (xtend@4.0.1, readable-stream@2.0.6)
└── gulp-util@3.0.7 (array-differ@1.0.0, lodash._reevaluate@3.0.0, beeper@1.1.0, lodash._reescape@3.0.0, lodash._reinterpolate@3.0.0, array-uniq@1.0.3, object-assign@3.0.0, replace-ext@0.0.1, has-gulplog@0.1.0, fancy-log@1.2.0, minimist@1.2.0, vinyl@0.5.3, chalk@1.1.3, lodash.template@3.6.2, gulplog@1.0.0, multipipe@0.1.2, dateformat@1.0.12)

sass-lint@1.8.2 node_modules/sass-lint
├── path-is-absolute@1.0.0
├── lodash.kebabcase@4.1.1
├── lodash.capitalize@4.2.1
├── merge@1.2.0
├── commander@2.9.0 (graceful-readlink@1.0.1)
├── util@0.10.3 (inherits@2.0.1)
├── gonzales-pe@3.3.4 (minimist@1.1.3)
├── glob@7.0.5 (fs.realpath@1.0.0, inherits@2.0.1, once@1.3.3, inflight@1.0.5, minimatch@3.0.3)
├── fs-extra@0.30.0 (rimraf@2.5.4, jsonfile@2.3.1, graceful-fs@4.1.5, klaw@1.3.0)
├── js-yaml@3.6.1 (esprima@2.7.2, argparse@1.0.7)
└── globule@1.0.0 (minimatch@3.0.3, lodash@4.9.0)

Newer (buggy) version:

gulp-sass-lint@1.2.0 node_modules/gulp-sass-lint
├── through2@2.0.1 (xtend@4.0.1, readable-stream@2.0.6)
└── gulp-util@3.0.7 (array-differ@1.0.0, array-uniq@1.0.3, beeper@1.1.0, lodash._reescape@3.0.0, lodash._reevaluate@3.0.0, object-assign@3.0.0, lodash._reinterpolate@3.0.0, replace-ext@0.0.1, has-gulplog@0.1.0, fancy-log@1.2.0, minimist@1.2.0, vinyl@0.5.3, chalk@1.1.3, lodash.template@3.6.2, gulplog@1.0.0, multipipe@0.1.2, dateformat@1.0.12)

sass-lint@1.9.0 node_modules/sass-lint
├── path-is-absolute@1.0.0
├── lodash.capitalize@4.2.1
├── lodash.kebabcase@4.1.1
├── merge@1.2.0
├── commander@2.9.0 (graceful-readlink@1.0.1)
├── util@0.10.3 (inherits@2.0.1)
├── glob@7.0.5 (fs.realpath@1.0.0, inherits@2.0.1, inflight@1.0.5, once@1.3.3, minimatch@3.0.3)
├── gonzales-pe@3.4.4 (minimist@1.1.3)
├── fs-extra@0.30.0 (rimraf@2.5.4, graceful-fs@4.1.5, klaw@1.3.0, jsonfile@2.3.1)
├── js-yaml@3.6.1 (esprima@2.7.2, argparse@1.0.7)
└── globule@1.0.0 (minimatch@3.0.3, lodash@4.9.0)

Please include any relevant parts of your configuration

  no-mergeable-selectors:
    - 2

What did you do? Please include the actual source code causing the issue.

.fake-field {
  tbody {
    tr:nth-child(even) {
      background: lighten($theme-color-primary, 50%);
    }
    tr:nth-child(odd) {
      background: #FFFFFF;
    }
  }
}

What did you expect to happen?

I expected no issues, since those two rules aren't mergeable!

What actually happened? Please include any error messages given to you by Sass Lint.

Rule .fake-page .fake-table tbody tr:nth-child(null) should be merged with the rule on line 66 (no-mergeable-selectors)

If you're using a IDE plugin have you tried the CLI too?

The former version (1.8.2) didn't have that bug. After an npm update, it was updated to version 1.9.0, and this bug was reproduced (see "What version of Sass Lint are you using?" section).
I have tested running the sass-lint with and without the gulp plugin, and the bug was reproduced on both situations.

@adrifmonte adrifmonte changed the title nth-child(even) nth-child(odd) no-mergeable-selectors no-mergeable-selectors giving error to nth-child(even) nth-child(odd) Aug 18, 2016
@adrifmonte adrifmonte changed the title no-mergeable-selectors giving error to nth-child(even) nth-child(odd) no-mergeable-selectors not working properly with nth-child(even) nth-child(odd) Aug 18, 2016
@DanPurdy DanPurdy added the bug label Aug 18, 2016
DanPurdy added a commit to DanPurdy/sass-lint that referenced this issue Aug 18, 2016
@Nickman87
Copy link

We also have this issue in 1.9.0 with the nth-child selectors, but it doesn't end there.
The following selector is also failing

&:not(:first-child) {
   border-left: none;
}

I don't see a specific test case being added for the not selector in the related pull request, will this also be fixed by your changes @DanPurdy ?

@DanPurdy
Copy link
Member

@Nickman87 I'll check, it should be as it was just a case of missing a node type check.

@DanPurdy
Copy link
Member

@Nickman87 I added your tests to the PR i can confirm the fix did fix this too and you should see it arrive in the next release which will hopefully be a patch release very soon

@Nickman87
Copy link

awesome! thanks

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