summaryrefslogtreecommitdiff
path: root/node_modules/yaml/dist/compose/util-flow-indent-check.js
blob: aa7c99821ec0941e98b4081db28005231f3c4f75 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
'use strict';

var utilContainsNewline = require('./util-contains-newline.js');

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

exports.flowIndentCheck = flowIndentCheck;