UNPKG

@sasjs/lint

Version:

Linting and formatting for SAS code

34 lines 1.16 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.noTabs = void 0; const LintRuleType_1 = require("../../types/LintRuleType"); const Severity_1 = require("../../types/Severity"); const utils_1 = require("../../utils"); const name = 'noTabs'; const alias = 'noTabIndentation'; const description = 'Disallow indenting with tabs.'; const message = 'Line contains a tab character (09x)'; const test = (value, lineNumber, config) => { const severity = (config === null || config === void 0 ? void 0 : config.severityLevel[name]) || (config === null || config === void 0 ? void 0 : config.severityLevel[alias]) || Severity_1.Severity.Warning; const indices = (0, utils_1.getIndicesOf)('\t', value); return indices.map((index) => ({ message, lineNumber, startColumnNumber: index + 1, endColumnNumber: index + 2, severity })); }; /** * Lint rule that checks if a given line of text is indented with a tab. */ exports.noTabs = { type: LintRuleType_1.LintRuleType.Line, name, description, message, test }; //# sourceMappingURL=noTabs.js.map