Skip to content

Commit 2cf79df

Browse files
committed
allow max_levels to be infinity if set
1 parent 94b6f77 commit 2cf79df

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/clauseNums.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export default function iterator(spec: Spec): ClauseNumberIterator {
1111
let currentLevel = 0;
1212
let hasWarnedForExcessNesting = false;
1313
// Ecma house style calls for a maximum of 5 levels of clause division
14-
const MAX_LEVELS = spec.opts.maxClauseDepth ?? 6;
14+
const MAX_LEVELS = spec.opts.maxClauseDepth ? spec.opts.maxClauseDepth || Infinity : 6;
1515

1616
return {
1717
next(clauseStack: Clause[], node: HTMLElement) {
@@ -33,12 +33,12 @@ export default function iterator(spec: Spec): ClauseNumberIterator {
3333
message: 'clause is being numbered without numbering its parent clause',
3434
});
3535
}
36-
if (!hasWarnedForExcessNesting && level + 1 > (spec.opts.maxClauseDepth ?? 6)) {
36+
if (!hasWarnedForExcessNesting && level + 1 > MAX_LEVELS) {
3737
spec.warn({
3838
type: 'node',
3939
node,
4040
ruleId: 'max-clause-depth',
41-
message: `clause exceeds maximum nesting depth of ${spec.opts.maxClauseDepth ?? 'six'}`,
41+
message: `clause exceeds maximum nesting depth of ${MAX_LEVELS}`,
4242
});
4343
hasWarnedForExcessNesting = true;
4444
}

0 commit comments

Comments
 (0)