UNPKG

547 BJavaScriptView Raw
1'use strict';
2
3var utilContainsNewline = require('./util-contains-newline.js');
4
5function flowIndentCheck(indent, fc, onError) {
6 if (fc?.type === 'flow-collection') {
7 const end = fc.end[0];
8 if (end.indent === indent &&
9 (end.source === ']' || end.source === '}') &&
10 utilContainsNewline.containsNewline(fc)) {
11 const msg = 'Flow end indicator should be more indented than parent';
12 onError(end, 'BAD_INDENT', msg, true);
13 }
14 }
15}
16
17exports.flowIndentCheck = flowIndentCheck;