{"version":3,"sources":["../../src/rules/noMissingSyntax.js"],"names":["setDefaults","state","selectorMap","incrementSelector","selector","comment","info","contextSelected","exit","context","options","length","report","loc","start","column","line","message","contexts","some","cntxt","contextStr","contextKey","undefined","minimum","Object","values","every","cmmnt","data","end","meta","docs","description","url","fixable","schema","additionalProperties","properties","items","anyOf","type"],"mappings":";;;;;;;AAAA;;;;AAEA,MAAMA,WAAW,GAAIC,KAAD,IAAW;AAC7B,MAAI,CAACA,KAAK,CAACC,WAAX,EAAwB;AACtBD,IAAAA,KAAK,CAACC,WAAN,GAAoB,EAApB;AACD;AACF,CAJD;;AAMA,MAAMC,iBAAiB,GAAG,CAACF,KAAD,EAAQG,QAAR,EAAkBC,OAAlB,KAA8B;AACtD,MAAI,CAACJ,KAAK,CAACC,WAAN,CAAkBE,QAAlB,CAAL,EAAkC;AAChCH,IAAAA,KAAK,CAACC,WAAN,CAAkBE,QAAlB,IAA8B,EAA9B;AACD;;AACD,MAAI,CAACH,KAAK,CAACC,WAAN,CAAkBE,QAAlB,EAA4BC,OAA5B,CAAL,EAA2C;AACzCJ,IAAAA,KAAK,CAACC,WAAN,CAAkBE,QAAlB,EAA4BC,OAA5B,IAAuC,CAAvC;AACD;;AACDJ,EAAAA,KAAK,CAACC,WAAN,CAAkBE,QAAlB,EAA4BC,OAA5B;AACD,CARD;;eAUe,2BAAa,CAAC;AAC3BC,EAAAA,IAAI,EAAE;AAACF,IAAAA,QAAD;AAAWC,IAAAA;AAAX,GADqB;AAE3BJ,EAAAA;AAF2B,CAAD,KAGtB;AACJD,EAAAA,WAAW,CAACC,KAAD,CAAX;AAEAE,EAAAA,iBAAiB,CAACF,KAAD,EAAQG,QAAR,EAAkBC,OAAlB,CAAjB;AACD,CAPc,EAOZ;AACDE,EAAAA,eAAe,EAAE,IADhB;;AAEDC,EAAAA,IAAI,CAAE;AACJC,IAAAA,OADI;AACKR,IAAAA;AADL,GAAF,EAED;AACD,QAAI,CAACQ,OAAO,CAACC,OAAR,CAAg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O,EAAE;AACPiB,kBAAAA,IAAI,EAAE;AADC;AAVC,eAFd;AAgBEA,cAAAA,IAAI,EAAE;AAhBR,aAJK;AADF,WADC;AA0BRA,UAAAA,IAAI,EAAE;AA1BE;AADA,OAFd;AAgCEA,MAAAA,IAAI,EAAE;AAhCR,KADM,CANJ;AA0CJA,IAAAA,IAAI,EAAE;AA1CF;AA3DL,CAPY,C","sourcesContent":["import iterateJsdoc from '../iterateJsdoc';\n\nconst setDefaults = (state) => {\n if (!state.selectorMap) {\n state.selectorMap = {};\n }\n};\n\nconst incrementSelector = (state, selector, comment) => {\n if (!state.selectorMap[selector]) {\n state.selectorMap[selector] = {};\n }\n if (!state.selectorMap[selector][comment]) {\n state.selectorMap[selector][comment] = 0;\n }\n state.selectorMap[selector][comment]++;\n};\n\nexport default iterateJsdoc(({\n info: {selector, comment},\n state,\n}) => {\n setDefaults(state);\n\n incrementSelector(state, selector, comment);\n}, {\n contextSelected: true,\n exit ({\n context, state,\n }) {\n if (!context.options.length) {\n context.report({\n loc: {\n start: {\n column: 1,\n line: 1,\n },\n },\n message: 'Rule `no-missing-syntax` is missing a `context` option.',\n });\n\n return;\n }\n setDefaults(state);\n\n const {\n contexts,\n } = context.options[0];\n\n // Report when MISSING\n contexts.some((cntxt) => {\n const contextStr = typeof cntxt === 'object' ? cntxt.context ?? 'any' : cntxt;\n const comment = cntxt?.comment ?? '';\n\n const contextKey = contextStr === 'any' ? undefined : contextStr;\n\n if (\n (!state.selectorMap[contextKey] ||\n !state.selectorMap[contextKey][comment] ||\n state.selectorMap[contextKey][comment] < (cntxt?.minimum ?? 1)) &&\n (contextStr !== 'any' || Object.values(state.selectorMap).every((cmmnt) => {\n return !cmmnt[comment] || cmmnt[comment] < (cntxt?.minimum ?? 1);\n }))\n ) {\n const message = cntxt?.message ?? 'Syntax is required: {{context}}' +\n (comment ? ' with {{comment}}' : '');\n context.report({\n data: {\n comment,\n context: contextStr,\n },\n loc: {\n end: {line: 1},\n start: {line: 1},\n },\n message,\n });\n\n return true;\n }\n\n return false;\n });\n },\n meta: {\n docs: {\n description: 'Reports when certain comment structures are always expected.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-no-missing-syntax',\n },\n fixable: 'code',\n schema: [\n {\n additionalProperties: false,\n properties: {\n contexts: {\n items: {\n anyOf: [\n {\n type: 'string',\n },\n {\n additionalProperties: false,\n properties: {\n comment: {\n type: 'string',\n },\n context: {\n type: 'string',\n },\n message: {\n type: 'string',\n },\n minimum: {\n type: 'integer',\n },\n },\n type: 'object',\n },\n ],\n },\n type: 'array',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"file":"noMissingSyntax.js"}