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

Fix max-nesting-depth error for at-rules in Sass syntax #6909

Merged
merged 1 commit into from Jun 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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