Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: bjankord/stylelint-config-sass-guidelines
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v4.1.0
Choose a base ref
...
head repository: bjankord/stylelint-config-sass-guidelines
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v4.2.0
Choose a head ref
  • 3 commits
  • 6 files changed
  • 3 contributors

Commits on Feb 24, 2018

  1. Add "ignore" options to "max-nesting-depth" rule (fixes #25) (#26)

    * Add test for max-nesting ignore options
    
    * Add "ignore" options to "max-nesting-depth" rule
    
    * Add note about ignore option setting
    stormwarning authored and bjankord committed Feb 24, 2018
    Copy the full SHA
    606a8ad View commit details
  2. Update CHANGELOG.md

    bjankord authored Feb 24, 2018
    Copy the full SHA
    e395194 View commit details
  3. Released version 4.2.0

    Brett Jankord committed Feb 24, 2018
    Copy the full SHA
    d69dfdc View commit details
Showing with 64 additions and 12 deletions.
  1. +3 −0 CHANGELOG.md
  2. +1 −1 README.md
  3. +39 −8 __tests__/nesting-depth.js
  4. +10 −1 index.js
  5. +1 −1 package.json
  6. +10 −1 src/.stylelintrc.json
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# 4.2.0
- Add "ignore" options to "max-nesting-depth" rule (fixes [#25](https://github.com/bjankord/stylelint-config-sass-guidelines/issues/25)) [PR](https://github.com/bjankord/stylelint-config-sass-guidelines/pull/26)

# 4.1.0
- Update: Bumped up `stylelint-order` to v0.8.0
- Fix: Border zero rule. Issue [16](https://github.com/bjankord/stylelint-config-sass-guidelines/issues/16)
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -106,7 +106,7 @@ This is a list of the lints turned on in this configuration, and what they do.

* [`indentation`](http://stylelint.io/user-guide/rules/indentation/): Indentation should always be `2` spaces.
* [`length-zero-no-unit`](http://stylelint.io/user-guide/rules/length-zero-no-unit/): Disallow units for zero lengths.
* [`max-nesting-depth`](http://stylelint.io/user-guide/rules/max-nesting-depth/): Limit the allowed nesting depth to `1`.
* [`max-nesting-depth`](http://stylelint.io/user-guide/rules/max-nesting-depth/): Limit the allowed nesting depth to `1`. _Ignore_: Nested at-rules `@media`, `@supports`, and `@include`.
* [`no-missing-eof-newline`](http://stylelint.io/user-guide/rules/no-missing-eof-newline/): Disallow missing end-of-file newlines in non-empty files.

#### Media Feature
47 changes: 39 additions & 8 deletions __tests__/nesting-depth.js
Original file line number Diff line number Diff line change
@@ -4,32 +4,63 @@ import postcss from "postcss"
import scssSyntax from "postcss-scss"
import test from "tape"

const invalidScss = (
`.one {
const invalidScss = `
.one {
.two {
background-color: #c0ffee;
@media (min-width: 420px) {
background-color: #bada55;
}
@include mixin() {
background-color: #ba2;
}
.three {
.four {
color: #f00;
}
}
}
}
`)
`

test("Nesting depth scss", t => {
t.plan(4)
t.plan(5)

postcss()
.use(stylelint({ code: invalidScss, config: config,}))
.use(stylelint({ code: invalidScss, config: config }))
.process(invalidScss, { syntax: scssSyntax })
.then(checkResult)
.catch(logError)

function checkResult(result) {
t.equal(result.warnings().length, 3, "flags 3 warning")
t.is(result.warnings()[0].text, "Expected nesting depth to be no more than 1 (max-nesting-depth)", "correct warning text")
t.is(result.warnings()[1].text, "Expected nesting depth to be no more than 1 (max-nesting-depth)", "correct warning text")
t.is(result.warnings()[2].text, "Expected \".one .two .three .four\" to have no more than 3 compound selectors (selector-max-compound-selectors)", "correct warning text")

t.is(
result.warnings()[0].text,
"Expected nesting depth to be no more than 1 (max-nesting-depth)",
"correct warning text"
)

t.is(
result.warnings()[1].text,
"Expected nesting depth to be no more than 1 (max-nesting-depth)",
"correct warning text"
)

t.not(
result.warnings()[2].node.type,
"atrule",
"max-depth ignores at-rules"
)

t.is(
result.warnings()[2].text,
'Expected ".one .two .three .four" to have no more than 3 compound selectors (selector-max-compound-selectors)',
"correct warning text"
)
}
})

11 changes: 10 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -29,7 +29,16 @@ module.exports = {
"function-url-quotes": "always",
"indentation": 2,
"length-zero-no-unit": true,
"max-nesting-depth": 1,
"max-nesting-depth": [
1,
{
"ignoreAtRules": [
"media",
"supports",
"include"
]
}
],
"media-feature-name-no-vendor-prefix": true,
"media-feature-parentheses-space-inside": "never",
"no-missing-end-of-source-newline": true,
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "stylelint-config-sass-guidelines",
"version": "4.1.0",
"version": "4.2.0",
"description": "Sharable stylelint config based on https://sass-guidelin.es/",
"keywords": [
"stylelint",
11 changes: 10 additions & 1 deletion src/.stylelintrc.json
Original file line number Diff line number Diff line change
@@ -29,7 +29,16 @@
"function-url-quotes": "always",
"indentation": 2,
"length-zero-no-unit": true,
"max-nesting-depth": 1,
"max-nesting-depth": [
1,
{
"ignoreAtRules": [
"media",
"supports",
"include"
]
}
],
"media-feature-name-no-vendor-prefix": true,
"media-feature-parentheses-space-inside": "never",
"no-missing-end-of-source-newline": true,