Files
react-native-devtools-frontend/node_modules/stylelint/lib/printConfig.js
T
Tim van der Lippe 4cb097430f Update Stylelint and Postcss
R=jacktfranklin@chromium.org

Bug: none
Change-Id: I961be18530d3ccbc4efed0c2cda9bd603b14e27b
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/3372931
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
Commit-Queue: Tim Van der Lippe <tvanderlippe@chromium.org>
2022-01-07 14:36:30 +00:00

44 lines
947 B
JavaScript

'use strict';
const resolveConfig = require('./resolveConfig');
const globby = require('globby');
/** @typedef {import('stylelint').Config} StylelintConfig */
/**
* @param {import('stylelint').LinterOptions} options
* @returns {Promise<StylelintConfig | null>}
*/
module.exports = async function printConfig({
cwd = process.cwd(),
code,
config,
configBasedir,
configFile,
globbyOptions,
files,
}) {
const isCodeNotFile = code !== undefined;
if (!files || files.length !== 1 || isCodeNotFile) {
return Promise.reject(
new Error('The --print-config option must be used with exactly one file path.'),
);
}
const filePath = files[0];
if (globby.hasMagic(filePath)) {
return Promise.reject(new Error('The --print-config option does not support globs.'));
}
return (
(await resolveConfig(filePath, {
cwd: (globbyOptions && globbyOptions.cwd) || cwd,
config,
configBasedir,
configFile,
})) || null
);
};