UNPKG

eclint

Version:

Validate or fix code that doesn't adhere to EditorConfig settings or infer settings from existing code.

32 lines 1.01 kB
"use strict"; var EditorConfigError = require("../editor-config-error"); function resolve(settings) { return settings.max_line_length > 0 ? settings.max_line_length : void (0); } function check(settings, line) { var inferredSetting = infer(line); var configSetting = resolve(settings); if (inferredSetting > settings.max_line_length) { var error = new EditorConfigError('invalid line length: %s, exceeds: %s', inferredSetting, configSetting); error.lineNumber = line.number; error.columnNumber = settings.max_line_length; error.rule = 'max_line_length'; error.source = line.text; return error; } } function fix(_settings, line) { return line; // noop } function infer(line) { return line.text.length; } var MaxLineLengthRule = { check: check, fix: fix, infer: infer, resolve: resolve, type: 'LineRule', }; module.exports = MaxLineLengthRule; //# sourceMappingURL=max_line_length.js.map