stylelint
Version:
A mighty CSS linter that helps you avoid errors and enforce conventions.
23 lines (18 loc) • 513 B
JavaScript
import { DEFAULT_FIX_MODE } from '../constants.mjs';
/** @import { FixMode } from 'stylelint' */
/**
* Normalize the fix mode based on options and configuration.
* If the input is unknown, this returns `undefined`.
*
* @param {unknown} fix
* @returns {FixMode | undefined}
*/
export default function normalizeFixMode(fix) {
if (fix === true || fix === 'true' || fix === '' || fix === DEFAULT_FIX_MODE) {
return DEFAULT_FIX_MODE;
}
if (fix === 'strict') {
return 'strict';
}
return undefined;
}