normalizeFixMode.cjs 706 B

12345678910111213141516171819202122232425262728
  1. // NOTICE: This file is generated by Rollup. To modify it,
  2. // please instead edit the ESM counterpart and rebuild with Rollup (npm run build).
  3. 'use strict';
  4. const constants = require('../constants.cjs');
  5. /** @import { FixMode } from 'stylelint' */
  6. /**
  7. * Normalize the fix mode based on options and configuration.
  8. * If the input is unknown, this returns `undefined`.
  9. *
  10. * @param {unknown} fix
  11. * @returns {FixMode | undefined}
  12. */
  13. function normalizeFixMode(fix) {
  14. if (fix === true || fix === 'true' || fix === '' || fix === constants.DEFAULT_FIX_MODE) {
  15. return constants.DEFAULT_FIX_MODE;
  16. }
  17. if (fix === 'strict') {
  18. return 'strict';
  19. }
  20. return undefined;
  21. }
  22. module.exports = normalizeFixMode;