stylelint
Version:
A mighty, modern CSS linter.
36 lines (29 loc) • 1.17 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = function (stylelint, searchPath) {
searchPath = searchPath || process.cwd();
if (stylelint._options.config) {
var cached = stylelint._specifiedConfigCache.get(stylelint._options.config);
if (cached) return cached;
// stylelint._fullExplorer (cosmiconfig) is already configured to
// run augmentConfigFull; but since we're making up the result here,
// we need to manually run the transform
var augmentedResult = (0, _augmentConfig.augmentConfigFull)(stylelint, {
config: stylelint._options.config,
filepath: process.cwd()
});
stylelint._specifiedConfigCache.set(stylelint._options.config, augmentedResult);
return augmentedResult;
}
return stylelint._fullExplorer.load(searchPath, stylelint._options.configFile).then(function (config) {
if (!config) {
var ending = searchPath ? " for " + searchPath : "";
throw (0, _utils.configurationError)("No configuration provided" + ending);
}
return config;
});
};
var _augmentConfig = require("./augmentConfig");
var _utils = require("./utils");