check-list-item-indent.js 554 B

12345678910111213141516171819202122
  1. /**
  2. * @typedef {import('../types.js').Options} Options
  3. * @typedef {import('../types.js').State} State
  4. */
  5. /**
  6. * @param {State} state
  7. * @returns {Exclude<Options['listItemIndent'], null | undefined>}
  8. */
  9. export function checkListItemIndent(state) {
  10. const style = state.options.listItemIndent || 'one'
  11. if (style !== 'tab' && style !== 'one' && style !== 'mixed') {
  12. throw new Error(
  13. 'Cannot serialize items with `' +
  14. style +
  15. '` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`'
  16. )
  17. }
  18. return style
  19. }