summaryrefslogtreecommitdiff
path: root/MistyCore/node_modules/yaml/browser/dist/compose/util-flow-indent-check.js
blob: c20e67019294cf897fcb59fb2772639c446bd9e8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import { containsNewline } from './util-contains-newline.js';

function flowIndentCheck(indent, fc, onError) {
    if (fc?.type === 'flow-collection') {
        const end = fc.end[0];
        if (end.indent === indent &&
            (end.source === ']' || end.source === '}') &&
            containsNewline(fc)) {
            const msg = 'Flow end indicator should be more indented than parent';
            onError(end, 'BAD_INDENT', msg, true);
        }
    }
}

export { flowIndentCheck };