mirror of
https://github.com/JamesIves/github-pages-deploy-action.git
synced 2023-12-15 20:03:39 +08:00
1 line
5.6 KiB
Plaintext
1 line
5.6 KiB
Plaintext
{"version":3,"sources":["../../src/rules/checkPropertyNames.js"],"names":["validatePropertyNames","targetTagName","jsdoc","jsdocNode","utils","propertyTags","Object","entries","tags","filter","tag","some","index","tagsIndex","dupeTagInfo","find","tgsIndex","tg","idx","name","reportJSDoc","splice","validatePropertyNamesDeep","jsdocPropertyNames","report","lastRealProperty","jsdocPropertyName","isPropertyPath","includes","pathRootNodeName","slice","indexOf","endsWith","jsdocPropertyNamesDeep","getJsdocTagsDeep","length","getPreferredTagName","tagName","isError","iterateAllJsdocs","meta","fixable","type"],"mappings":";;;;;;;AAAA;;;;AAEA,MAAMA,qBAAqB,GAAG,CAC5BC,aAD4B,EAE5BC,KAF4B,EAErBC,SAFqB,EAEVC,KAFU,KAGzB;AACH,QAAMC,YAAY,GAAGC,MAAM,CAACC,OAAP,CAAeL,KAAK,CAACM,IAArB,EAA2BC,MAA3B,CAAkC,CAAC,GAAGC,GAAH,CAAD,KAAa;AAClE,WAAOA,GAAG,CAACA,GAAJ,KAAYT,aAAnB;AACD,GAFoB,CAArB;AAIA,SAAOI,YAAY,CAACM,IAAb,CAAkB,CAAC,GAAGD,GAAH,CAAD,EAAUE,KAAV,KAAoB;AAC3C,QAAIC,SAAJ;AACA,UAAMC,WAAW,GAAGT,YAAY,CAACU,IAAb,CAAkB,CAAC,CAACC,QAAD,EAAWC,EAAX,CAAD,EAAiBC,GAAjB,KAAyB;AAC7DL,MAAAA,SAAS,GAAGG,QAAZ;AAEA,aAAOC,EAAE,CAACE,IAAH,KAAYT,GAAG,CAACS,IAAhB,IAAwBD,GAAG,KAAKN,KAAvC;AACD,KAJmB,CAApB;;AAKA,QAAIE,WAAJ,EAAiB;AACfV,MAAAA,KAAK,CAACgB,WAAN,CAAmB,cAAanB,aAAc,KAAIS,GAAG,CAACS,IAAK,GAA3D,EAA+DL,WAAW,CA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;AAOA,eAAO,IAAP;AACD;AACF,KAvBD,MAuBO;AACLO,MAAAA,gBAAgB,GAAGC,iBAAnB;AACD;;AAED,WAAO,KAAP;AACD,GA/BM,CAAP;AAgCD,CAtCD;;eAwCe,2BAAa,CAAC;AAC3BxB,EAAAA,KAD2B;AAE3BC,EAAAA,SAF2B;AAG3BqB,EAAAA,MAH2B;AAI3BpB,EAAAA;AAJ2B,CAAD,KAKtB;AACJ,QAAM6B,sBAAsB,GAAG7B,KAAK,CAAC8B,gBAAN,CAAuB,UAAvB,CAA/B;;AACA,MAAI,CAACD,sBAAsB,CAACE,MAA5B,EAAoC;AAClC;AACD;;AACD,QAAMlC,aAAa,GAAGG,KAAK,CAACgC,mBAAN,CAA0B;AAACC,IAAAA,OAAO,EAAE;AAAV,GAA1B,CAAtB;AACA,QAAMC,OAAO,GAAGtC,qBAAqB,CACnCC,aADmC,EAEnCC,KAFmC,EAE5BC,SAF4B,EAEjBC,KAFiB,CAArC;;AAKA,MAAIkC,OAAJ,EAAa;AACX;AACD;;AAEDhB,EAAAA,yBAAyB,CACvBrB,aADuB,EACRgC,sBADQ,EAEvB/B,KAFuB,EAEhBsB,MAFgB,CAAzB;AAID,CAxBc,EAwBZ;AACDe,EAAAA,gBAAgB,EAAE,IADjB;AAEDC,EAAAA,IAAI,EAAE;AACJC,IAAAA,OAAO,EAAE,MADL;AAEJC,IAAAA,IAAI,EAAE;AAFF;AAFL,CAxBY,C","sourcesContent":["import iterateJsdoc from '../iterateJsdoc';\n\nconst validatePropertyNames = (\n targetTagName : string,\n jsdoc, jsdocNode, utils,\n) => {\n const propertyTags = Object.entries(jsdoc.tags).filter(([, tag]) => {\n return tag.tag === targetTagName;\n });\n\n return propertyTags.some(([, tag], index) => {\n let tagsIndex;\n const dupeTagInfo = propertyTags.find(([tgsIndex, tg], idx) => {\n tagsIndex = tgsIndex;\n\n return tg.name === tag.name && idx !== index;\n });\n if (dupeTagInfo) {\n utils.reportJSDoc(`Duplicate @${targetTagName} \"${tag.name}\"`, dupeTagInfo[1], () => {\n jsdoc.tags.splice(tagsIndex, 1);\n });\n\n return true;\n }\n\n return false;\n });\n};\n\nconst validatePropertyNamesDeep = (\n targetTagName : string,\n jsdocPropertyNames : Array<string>, jsdoc, report : Function,\n) => {\n let lastRealProperty;\n\n return jsdocPropertyNames.some(({name: jsdocPropertyName, idx}) => {\n const isPropertyPath = jsdocPropertyName.includes('.');\n\n if (isPropertyPath) {\n if (!lastRealProperty) {\n report(`@${targetTagName} path declaration (\"${jsdocPropertyName}\") appears before any real property.`, null, jsdoc.tags[idx]);\n\n return true;\n }\n\n let pathRootNodeName = jsdocPropertyName.slice(0, jsdocPropertyName.indexOf('.'));\n\n if (pathRootNodeName.endsWith('[]')) {\n pathRootNodeName = pathRootNodeName.slice(0, -2);\n }\n\n if (pathRootNodeName !== lastRealProperty) {\n report(\n `@${targetTagName} path declaration (\"${jsdocPropertyName}\") root node name (\"${pathRootNodeName}\") ` +\n `does not match previous real property name (\"${lastRealProperty}\").`,\n null,\n jsdoc.tags[idx],\n );\n\n return true;\n }\n } else {\n lastRealProperty = jsdocPropertyName;\n }\n\n return false;\n });\n};\n\nexport default iterateJsdoc(({\n jsdoc,\n jsdocNode,\n report,\n utils,\n}) => {\n const jsdocPropertyNamesDeep = utils.getJsdocTagsDeep('property');\n if (!jsdocPropertyNamesDeep.length) {\n return;\n }\n const targetTagName = utils.getPreferredTagName({tagName: 'property'});\n const isError = validatePropertyNames(\n targetTagName,\n jsdoc, jsdocNode, utils,\n );\n\n if (isError) {\n return;\n }\n\n validatePropertyNamesDeep(\n targetTagName, jsdocPropertyNamesDeep,\n jsdoc, report,\n );\n}, {\n iterateAllJsdocs: true,\n meta: {\n fixable: 'code',\n type: 'suggestion',\n },\n});\n"],"file":"checkPropertyNames.js"} |