getLexer.mjs 300 B

123456789101112131415
  1. /**
  2. * @typedef {import('css-tree').Lexer} Lexer
  3. */
  4. /**
  5. * @param {import('stylelint').RuleContext} context
  6. * @returns {Lexer}
  7. */
  8. export default function getLexer(context) {
  9. if (!context?.lexer) {
  10. throw new Error('Expected a "lexer" object');
  11. }
  12. return /** @type Lexer */ (context.lexer);
  13. }