UNPKG

canonical

Version:

Canonical code style linter and formatter for JavaScript, SCSS, CSS and JSON.

37 lines (27 loc) 890 B
'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _js = require('./../syntaxes/js'); var _json = require('./../syntaxes/json'); var _scss = require('./../syntaxes/scss'); exports.default = function (text, options) { var result = undefined; if (options.syntax === 'css') { result = (0, _scss.lintText)(text); } else if (options.syntax === 'js') { result = (0, _js.lintText)(text); } else if (options.syntax === 'json') { result = (0, _json.lintText)(text); } else if (options.syntax === 'scss') { result = (0, _scss.lintText)(text); } else { throw new Error('Unknown syntax "' + options.syntax + '".'); } if (options.filePath) { result.filePath = options.filePath; } return result; }; module.exports = exports['default']; //# sourceMappingURL=lintText.js.map