Skip to content

Commit

Permalink
Fix max-nesting-depth error for at-rules in Sass syntax (#6909)
Browse files Browse the repository at this point in the history
  • Loading branch information
ybiquitous committed Jun 9, 2023
1 parent 7fc0f9d commit 7f51872
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/cyan-dingos-own.md
@@ -0,0 +1,5 @@
---
"stylelint": patch
---

Fixed: `max-nesting-depth` error for at-rules in Sass syntax
17 changes: 17 additions & 0 deletions lib/rules/max-nesting-depth/__tests__/index.js
@@ -1,5 +1,7 @@
'use strict';

const { stripIndent } = require('common-tags');

const { messages, ruleName } = require('..');

testRule({
Expand Down Expand Up @@ -281,3 +283,18 @@ testRule({
},
],
});

testRule({
ruleName,
config: [1],
customSyntax: 'postcss-sass',

accept: [
{
code: stripIndent`
@media print
color: white
`,
},
],
});
4 changes: 2 additions & 2 deletions lib/rules/max-nesting-depth/index.js
Expand Up @@ -90,8 +90,8 @@ const rule = (primary, secondaryOptions) => {
function nestingDepth(node, level) {
const parent = node.parent;

if (parent == null) {
throw new Error('The parent node must exist');
if (!parent) {
return 0;
}

if (isIgnoreAtRule(parent)) {
Expand Down

0 comments on commit 7f51872

Please sign in to comment.