.gitignore added
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / stylelint / lib / utils / getModulePath.js
1 /* @flow */
2 "use strict";
3
4 const configurationError = require("./configurationError");
5 const resolveFrom = require("resolve-from");
6
7 module.exports = function(
8   basedir /*: string*/,
9   lookup /*: string*/
10 ) /*: string*/ {
11   // First try to resolve from the provided directory,
12   // then try to resolve from process.cwd.
13   let path = resolveFrom.silent(basedir, lookup);
14   if (!path) {
15     path = resolveFrom.silent(process.cwd(), lookup);
16   }
17   if (!path) {
18     throw configurationError(
19       `Could not find "${lookup}". Do you need a \`configBasedir\`?`
20     );
21   }
22   return path;
23 };