import t from"../../../../_virtual/result.mjs";import e from"./getStylelintRule.mjs";import{isPlainObject as o}from"./validateTypes.mjs";import{lexer as r}from"../../../css-tree/lib/index.mjs";import i from"../normalizeRuleSettings.mjs";async function n(n,s){if(!o(n))throw new Error("Expected an options object");if(!s)throw new Error("Expected a callback function");const{ruleName:a,ruleSettings:l,root:c,result:f,context:m={lexer:r}}=n;if(!a)throw new Error('Expected a "ruleName" option');const u=await e(a,f?.stylelint?.config);if(!u)throw new Error(`Rule "${a}" does not exist`);if(!l)throw new Error('Expected a "ruleSettings" option');if(!c)throw new Error('Expected a "root" option');const d=i(l,u);if(!d)return;const p=new t(void 0,void 0,void 0),w=f?.stylelint??{ruleSeverities:{},customMessages:{},customUrls:{},ruleMetadata:{},fixersData:{},rangesOfComputedEditInfos:[],disabledRanges:{}};p.stylelint=w;const[E,x]=d,g=u(E,x||{},m);await g(c,p);for(const t of p.warnings())s(t)}export{n as default};