|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700 |
- <a name="eslint-plugin-jsdoc"></a>
- # eslint-plugin-jsdoc
-
- [![GitSpo Mentions](https://gitspo.com/badges/mentions/gajus/eslint-plugin-jsdoc?style=flat-square)](https://gitspo.com/mentions/gajus/eslint-plugin-jsdoc)
- [![NPM version](https://img.shields.io/npm/v/eslint-plugin-jsdoc.svg?style=flat-square)](https://www.npmjs.org/package/eslint-plugin-jsdoc)
- [![Travis build status](https://img.shields.io/travis/gajus/eslint-plugin-jsdoc/master.svg?style=flat-square)](https://travis-ci.org/gajus/eslint-plugin-jsdoc)
- [![js-canonical-style](https://img.shields.io/badge/code%20style-canonical-blue.svg?style=flat-square)](https://github.com/gajus/canonical)
- [![Discord Chat](https://img.shields.io/badge/chat-on%20disord-green.svg?logo=discord)](https://discord.gg/kFFy3nc)
-
- JSDoc linting rules for ESLint.
-
- * [eslint-plugin-jsdoc](#eslint-plugin-jsdoc)
- * [Installation](#eslint-plugin-jsdoc-installation)
- * [Configuration](#eslint-plugin-jsdoc-configuration)
- * [Options](#eslint-plugin-jsdoc-options)
- * [Settings](#eslint-plugin-jsdoc-settings)
- * [Allow tags (`@private` or `@internal`) to disable rules for that comment block](#eslint-plugin-jsdoc-settings-allow-tags-private-or-internal-to-disable-rules-for-that-comment-block)
- * [`maxLines` and `minLines`](#eslint-plugin-jsdoc-settings-maxlines-and-minlines)
- * [Mode](#eslint-plugin-jsdoc-settings-mode)
- * [Alias Preference](#eslint-plugin-jsdoc-settings-alias-preference)
- * [`@override`/`@augments`/`@extends`/`@implements`/`@ignore` Without Accompanying `@param`/`@description`/`@example`/`@returns`/`@throws`/`@yields`](#eslint-plugin-jsdoc-settings-override-augments-extends-implements-ignore-without-accompanying-param-description-example-returns-throws-yields)
- * [Settings to Configure `check-types` and `no-undefined-types`](#eslint-plugin-jsdoc-settings-settings-to-configure-check-types-and-no-undefined-types)
- * [`structuredTags`](#eslint-plugin-jsdoc-settings-structuredtags)
- * [Advanced](#eslint-plugin-jsdoc-advanced)
- * [AST and Selectors](#eslint-plugin-jsdoc-advanced-ast-and-selectors)
- * [Rules](#eslint-plugin-jsdoc-rules)
- * [`check-access`](#eslint-plugin-jsdoc-rules-check-access)
- * [`check-alignment`](#eslint-plugin-jsdoc-rules-check-alignment)
- * [`check-examples`](#eslint-plugin-jsdoc-rules-check-examples)
- * [`check-indentation`](#eslint-plugin-jsdoc-rules-check-indentation)
- * [`check-line-alignment`](#eslint-plugin-jsdoc-rules-check-line-alignment)
- * [`check-param-names`](#eslint-plugin-jsdoc-rules-check-param-names)
- * [`check-property-names`](#eslint-plugin-jsdoc-rules-check-property-names)
- * [`check-syntax`](#eslint-plugin-jsdoc-rules-check-syntax)
- * [`check-tag-names`](#eslint-plugin-jsdoc-rules-check-tag-names)
- * [`check-types`](#eslint-plugin-jsdoc-rules-check-types)
- * [`check-values`](#eslint-plugin-jsdoc-rules-check-values)
- * [`empty-tags`](#eslint-plugin-jsdoc-rules-empty-tags)
- * [`implements-on-classes`](#eslint-plugin-jsdoc-rules-implements-on-classes)
- * [`match-description`](#eslint-plugin-jsdoc-rules-match-description)
- * [`match-name`](#eslint-plugin-jsdoc-rules-match-name)
- * [`multiline-blocks`](#eslint-plugin-jsdoc-rules-multiline-blocks)
- * [`newline-after-description`](#eslint-plugin-jsdoc-rules-newline-after-description)
- * [`no-bad-blocks`](#eslint-plugin-jsdoc-rules-no-bad-blocks)
- * [`no-defaults`](#eslint-plugin-jsdoc-rules-no-defaults)
- * [`no-missing-syntax`](#eslint-plugin-jsdoc-rules-no-missing-syntax)
- * [`no-multi-asterisks`](#eslint-plugin-jsdoc-rules-no-multi-asterisks)
- * [`no-restricted-syntax`](#eslint-plugin-jsdoc-rules-no-restricted-syntax)
- * [`no-types`](#eslint-plugin-jsdoc-rules-no-types)
- * [`no-undefined-types`](#eslint-plugin-jsdoc-rules-no-undefined-types)
- * [`require-asterisk-prefix`](#eslint-plugin-jsdoc-rules-require-asterisk-prefix)
- * [`require-description-complete-sentence`](#eslint-plugin-jsdoc-rules-require-description-complete-sentence)
- * [`require-description`](#eslint-plugin-jsdoc-rules-require-description)
- * [`require-example`](#eslint-plugin-jsdoc-rules-require-example)
- * [`require-file-overview`](#eslint-plugin-jsdoc-rules-require-file-overview)
- * [`require-hyphen-before-param-description`](#eslint-plugin-jsdoc-rules-require-hyphen-before-param-description)
- * [`require-jsdoc`](#eslint-plugin-jsdoc-rules-require-jsdoc)
- * [`require-param-description`](#eslint-plugin-jsdoc-rules-require-param-description)
- * [`require-param-name`](#eslint-plugin-jsdoc-rules-require-param-name)
- * [`require-param-type`](#eslint-plugin-jsdoc-rules-require-param-type)
- * [`require-param`](#eslint-plugin-jsdoc-rules-require-param)
- * [`require-property`](#eslint-plugin-jsdoc-rules-require-property)
- * [`require-property-description`](#eslint-plugin-jsdoc-rules-require-property-description)
- * [`require-property-name`](#eslint-plugin-jsdoc-rules-require-property-name)
- * [`require-property-type`](#eslint-plugin-jsdoc-rules-require-property-type)
- * [`require-returns-check`](#eslint-plugin-jsdoc-rules-require-returns-check)
- * [`require-returns-description`](#eslint-plugin-jsdoc-rules-require-returns-description)
- * [`require-returns-type`](#eslint-plugin-jsdoc-rules-require-returns-type)
- * [`require-returns`](#eslint-plugin-jsdoc-rules-require-returns)
- * [`require-throws`](#eslint-plugin-jsdoc-rules-require-throws)
- * [`require-yields`](#eslint-plugin-jsdoc-rules-require-yields)
- * [`require-yields-check`](#eslint-plugin-jsdoc-rules-require-yields-check)
- * [`tag-lines`](#eslint-plugin-jsdoc-rules-tag-lines)
- * [`valid-types`](#eslint-plugin-jsdoc-rules-valid-types)
-
-
- <a name="eslint-plugin-jsdoc-installation"></a>
- ## Installation
-
- Install [ESLint](https://www.github.com/eslint/eslint) either locally or
- globally.
-
- ```sh
- npm install --save-dev eslint
- ```
-
- If you have installed `ESLint` globally, you have to install JSDoc plugin
- globally too. Otherwise, install it locally.
-
- ```sh
- npm install --save-dev eslint-plugin-jsdoc
- ```
-
- <a name="eslint-plugin-jsdoc-configuration"></a>
- ## Configuration
-
- Add `plugins` section to [.eslintrc.*](https://eslint.org/docs/user-guide/configuring#configuration-file-formats)
- and specify `eslint-plugin-jsdoc` as a plugin.
-
- ```json
- {
- "plugins": [
- "jsdoc"
- ]
- }
- ```
-
- Finally, enable all of the rules that you would like to use.
-
- ```javascript
- {
- "rules": {
- "jsdoc/check-access": 1, // Recommended
- "jsdoc/check-alignment": 1, // Recommended
- "jsdoc/check-examples": 1,
- "jsdoc/check-indentation": 1,
- "jsdoc/check-line-alignment": 1,
- "jsdoc/check-param-names": 1, // Recommended
- "jsdoc/check-property-names": 1, // Recommended
- "jsdoc/check-syntax": 1,
- "jsdoc/check-tag-names": 1, // Recommended
- "jsdoc/check-types": 1, // Recommended
- "jsdoc/check-values": 1, // Recommended
- "jsdoc/empty-tags": 1, // Recommended
- "jsdoc/implements-on-classes": 1, // Recommended
- "jsdoc/match-description": 1,
- "jsdoc/multiline-blocks": 1, // Recommended
- "jsdoc/newline-after-description": 1, // Recommended
- "jsdoc/no-bad-blocks": 1,
- "jsdoc/no-defaults": 1,
- "jsdoc/no-missing-syntax": 1,
- "jsdoc/no-multi-asterisks": 1, // Recommended
- "jsdoc/no-restricted-syntax": 1,
- "jsdoc/no-types": 1,
- "jsdoc/no-undefined-types": 1, // Recommended
- "jsdoc/require-asterisk-prefix": 1,
- "jsdoc/require-description": 1,
- "jsdoc/require-description-complete-sentence": 1,
- "jsdoc/require-example": 1,
- "jsdoc/require-file-overview": 1,
- "jsdoc/require-hyphen-before-param-description": 1,
- "jsdoc/require-jsdoc": 1, // Recommended
- "jsdoc/require-param": 1, // Recommended
- "jsdoc/require-param-description": 1, // Recommended
- "jsdoc/require-param-name": 1, // Recommended
- "jsdoc/require-param-type": 1, // Recommended
- "jsdoc/require-property": 1, // Recommended
- "jsdoc/require-property-description": 1, // Recommended
- "jsdoc/require-property-name": 1, // Recommended
- "jsdoc/require-property-type": 1, // Recommended
- "jsdoc/require-returns": 1, // Recommended
- "jsdoc/require-returns-check": 1, // Recommended
- "jsdoc/require-returns-description": 1, // Recommended
- "jsdoc/require-returns-type": 1, // Recommended
- "jsdoc/require-throws": 1,
- "jsdoc/require-yields": 1, // Recommended
- "jsdoc/require-yields-check": 1, // Recommended
- "jsdoc/tag-lines": 1, // Recommended
- "jsdoc/valid-types": 1 // Recommended
- }
- }
- ```
-
- Or you can simply add the following to [.eslintrc.*](https://eslint.org/docs/user-guide/configuring#configuration-file-formats),
- which enables the rules commented above as "recommended":
-
-
- ```json
- {
- "extends": ["plugin:jsdoc/recommended"]
- }
- ```
-
- You can then selectively add to or override the recommended rules.
-
- <a name="eslint-plugin-jsdoc-options"></a>
- ## Options
-
- Rules may, as per the [ESLint user guide](https://eslint.org/docs/user-guide/configuring), have their own individual options. In `eslint-plugin-jsdoc`, a few options,
- such as, `exemptedBy` and `contexts`, may be used across different rules.
-
- `eslint-plugin-jsdoc` options, if present, are generally in the form of an
- object supplied as the second argument in an array after the error level
- (any exceptions to this format are explained within that rule's docs).
-
- ```js
- // `.eslintrc.js`
- {
- rules: {
- 'jsdoc/require-example': [
- // The Error level should be `error`, `warn`, or `off` (or 2, 1, or 0)
- 'error',
- // The options vary by rule, but are generally added to an options
- // object as follows:
- {
- avoidExampleOnConstructors: true,
- exemptedBy: ['type']
- }
- ]
- }
- }
- ```
-
- <a name="eslint-plugin-jsdoc-settings"></a>
- ## Settings
-
- <a name="eslint-plugin-jsdoc-settings-allow-tags-private-or-internal-to-disable-rules-for-that-comment-block"></a>
- ### Allow tags (<code>@private</code> or <code>@internal</code>) to disable rules for that comment block
-
- - `settings.jsdoc.ignorePrivate` - Disables all rules for the comment block
- on which a `@private` tag (or `@access private`) occurs. Defaults to
- `false`. Note: This has no effect with the rule `check-access` (whose
- purpose is to check access modifiers) or `empty-tags` (which checks
- `@private` itself).
- - `settings.jsdoc.ignoreInternal` - Disables all rules for the comment block
- on which a `@internal` tag occurs. Defaults to `false`. Note: This has no
- effect with the rule `empty-tags` (which checks `@internal` itself).
-
- <a name="eslint-plugin-jsdoc-settings-maxlines-and-minlines"></a>
- ### <code>maxLines</code> and <code>minLines</code>
-
- One can use `minLines` and `maxLines` to indicate how many line breaks
- (if any) will be checked to find a jsdoc comment block before the given
- code block. These settings default to `0` and `1` respectively.
-
- In conjunction with the `require-jsdoc` rule, these settings can
- be enforced so as to report problems if a jsdoc block is not found within
- the specified boundaries. The settings are also used in the fixer to determine
- how many line breaks to add when a block is missing.
-
- <a name="eslint-plugin-jsdoc-settings-mode"></a>
- ### Mode
-
- - `settings.jsdoc.mode` - Set to `typescript`, `closure`, or `jsdoc` (the
- default unless the `@typescript-eslint` parser is in use in which case
- `typescript` will be the default).
- Note that if you do not wish to use separate `.eslintrc.*` files for a
- project containing both JavaScript and TypeScript, you can also use
- [`overrides`](https://eslint.org/docs/user-guide/configuring). You may also
- set to `"permissive"` to try to be as accommodating to any of the styles,
- but this is not recommended. Currently is used for the following:
- - `check-tag-names`: Determine valid tags and aliases
- - `no-undefined-types`: Only check `@template` for types in "closure" and
- "typescript" modes
- - `check-syntax`: determines aspects that may be enforced
- - `valid-types`: in non-Closure mode, `@extends`, `@package` and access tags
- (e.g., `@private`) with a bracketed type are reported as are missing
- names with `@typedef`
- - For type/namepath-checking rules, determine which tags will be checked for
- types/namepaths (Closure allows types on some tags which the others do not,
- so these tags will additionally be checked in "closure" mode)
- - For type-checking rules, impacts parsing of types (through
- [jsdoctypeparser](https://github.com/jsdoctypeparser/jsdoctypeparser)
- dependency); note that some TypeScript features are
- [not yet](https://github.com/gajus/eslint-plugin-jsdoc/issues/145)
- [supported](https://github.com/jsdoctypeparser/jsdoctypeparser/issues/50)
- - Check preferred tag names
- - Disallows namepath on `@interface` for "closure" mode in `valid-types` (and
- avoids checking in other rules)
-
- <a name="eslint-plugin-jsdoc-settings-alias-preference"></a>
- ### Alias Preference
-
- Use `settings.jsdoc.tagNamePreference` to configure a preferred alias name for
- a JSDoc tag. The format of the configuration is:
- `<primary tag name>: <preferred alias name>`, e.g.
-
- ```json
- {
- "rules": {},
- "settings": {
- "jsdoc": {
- "tagNamePreference": {
- "param": "arg",
- "returns": "return"
- }
- }
- }
- }
- ```
-
- Note: ESLint does not allow settings to have keys which conflict with
- `Object.prototype` e.g. `'constructor'`. To work around this, you can use the
- key `'tag constructor'`.
-
- One may also use an object with a `message` and `replacement`.
-
- The following will report the message
- `@extends is to be used over @augments as it is more evocative of classes than @augments`
- upon encountering `@augments`.
-
- ```json
- {
- "rules": {},
- "settings": {
- "jsdoc": {
- "tagNamePreference": {
- "augments": {
- "message": "@extends is to be used over @augments as it is more evocative of classes than @augments",
- "replacement": "extends"
- }
- }
- }
- }
- }
- ```
-
- If one wishes to reject a normally valid tag, e.g., `@todo`, one may set the
- tag to `false`:
-
- ```json
- {
- "rules": {},
- "settings": {
- "jsdoc": {
- "tagNamePreference": {
- "todo": false
- }
- }
- }
- }
- ```
-
- A project wishing to ensure no blocks are left excluded from entering the
- documentation, might wish to prevent the `@ignore` tag in the above manner.
-
- Or one may set the targeted tag to an object with a custom `message`, but
- without a `replacement` property:
-
- ```json
- {
- "rules": {},
- "settings": {
- "jsdoc": {
- "tagNamePreference": {
- "todo": {
- "message": "We expect immediate perfection, so don't leave to-dos in your code."
- }
- }
- }
- }
- }
- ```
-
- Note that the preferred tags indicated in the
- `settings.jsdoc.tagNamePreference` map will be assumed to be defined by
- `check-tag-names`.
-
- See `check-tag-names` for how that fact can be used to set an alias to itself
- to allow both the alias and the default (since aliases are otherwise not
- permitted unless used in `tagNamePreference`).
-
- <a name="eslint-plugin-jsdoc-settings-alias-preference-default-preferred-aliases"></a>
- #### Default Preferred Aliases
-
- The defaults in `eslint-plugin-jsdoc` (for tags which offer
- aliases) are as follows:
-
- - `@abstract` (over `@virtual`)
- - `@augments` (over `@extends`)
- - `@class` (over `@constructor`)
- - `@constant` (over `@const`)
- - `@default` (over `@defaultvalue`)
- - `@description` (over `@desc`)
- - `@external` (over `@host`)
- - `@file` (over `@fileoverview`, `@overview`)
- - `@fires` (over `@emits`)
- - `@function` (over `@func`, `@method`)
- - `@member` (over `@var`)
- - `@param` (over `@arg`, `@argument`)
- - `@property` (over `@prop`)
- - `@returns` (over `@return`)
- - `@throws` (over `@exception`)
- - `@yields` (over `@yield`)
-
- This setting is utilized by the the rule for tag name checking
- (`check-tag-names`) as well as in the `@param` and `@require` rules:
-
- - `check-param-names`
- - `check-tag-names`
- - `require-hyphen-before-param-description`
- - `require-description`
- - `require-param`
- - `require-param-description`
- - `require-param-name`
- - `require-param-type`
- - `require-returns`
- - `require-returns-check`
- - `require-returns-description`
- - `require-returns-type`
-
- <a name="eslint-plugin-jsdoc-settings-override-augments-extends-implements-ignore-without-accompanying-param-description-example-returns-throws-yields"></a>
- ### <code>@override</code>/<code>@augments</code>/<code>@extends</code>/<code>@implements</code>/<code>@ignore</code> Without Accompanying <code>@param</code>/<code>@description</code>/<code>@example</code>/<code>@returns</code>/<code>@throws</code>/<code>@yields</code>
-
- The following settings allows the element(s) they reference to be omitted
- on the JSDoc comment block of the function or that of its parent class
- for any of the "require" rules (i.e., `require-param`, `require-description`,
- `require-example`, `require-returns`, `require-throws`, `require-yields`).
-
- * `settings.jsdoc.ignoreReplacesDocs` (`@ignore`) - Defaults to `true`
- * `settings.jsdoc.overrideReplacesDocs` (`@override`) - Defaults to `true`
- * `settings.jsdoc.augmentsExtendsReplacesDocs` (`@augments` or its alias
- `@extends`) - Defaults to `false`.
- * `settings.jsdoc.implementsReplacesDocs` (`@implements`) - Defaults to `false`
-
- The format of the configuration is as follows:
-
- ```json
- {
- "rules": {},
- "settings": {
- "jsdoc": {
- "ignoreReplacesDocs": true,
- "overrideReplacesDocs": true,
- "augmentsExtendsReplacesDocs": true,
- "implementsReplacesDocs": true
- }
- }
- }
- ```
-
- <a name="eslint-plugin-jsdoc-settings-settings-to-configure-check-types-and-no-undefined-types"></a>
- ### Settings to Configure <code>check-types</code> and <code>no-undefined-types</code>
-
- - `settings.jsdoc.preferredTypes` An option map to indicate preferred
- or forbidden types (if default types are indicated here, these will
- have precedence over the default recommendations for `check-types`).
- The keys of this map are the types to be replaced (or forbidden).
- These keys may include:
- 1. The "ANY" type, `*`
- 1. The pseudo-type `[]` which we use to denote the parent (array)
- types used in the syntax `string[]`, `number[]`, etc.
- 1. The pseudo-type `.<>` (or `.`) to represent the format `Array.<value>`
- or `Object.<key, value>`
- 1. The pseudo-type `<>` to represent the format `Array<value>` or
- `Object<key, value>`
- 1. A plain string type, e.g., `MyType`
- 1. A plain string type followed by one of the above pseudo-types (except
- for `[]` which is always assumed to be an `Array`), e.g., `Array.`, or
- `SpecialObject<>`.
-
- If a bare pseudo-type is used, it will match all parent types of that form.
- If a pseudo-type prefixed with a type name is used, it will only match
- parent types of that form and type name.
-
- The values can be:
- - `false` to forbid the type
- - a string to indicate the type that should be preferred in its place
- (and which `fix` mode can replace); this can be one of the formats
- of the keys described above.
- - Note that the format will not be changed unless you use a pseudo-type
- in the replacement. (For example, `'Array.<>': 'MyArray'` will change
- `Array.<string>` to `MyArray.<string>`, preserving the dot. To get rid
- of the dot, you must use the pseudo-type with `<>`, i.e.,
- `'Array.<>': 'MyArray<>'`, which will change `Array.<string>` to
- `MyArray<string>`).
- - If you use a _bare_ pseudo-type in the replacement (e.g.,
- `'MyArray.<>': '<>'`), the type will be converted to the format
- of the pseudo-type without changing the type name. For example,
- `MyArray.<string>` will become `MyArray<string>` but `Array.<string>`
- will not be modified.
- - an object with:
- - the key `message` to provide a specific error message
- when encountering the discouraged type.
- - The message string will have the substrings with special meaning,
- `{{tagName}}` and `{{tagValue}}`, replaced with their
- corresponding value.
- - an optional key `replacement` with either of the following values:
- - a string type to be preferred in its place (and which `fix` mode
- can replace)
- - `false` (for forbidding the type)
-
- Note that the preferred types indicated as targets in
- `settings.jsdoc.preferredTypes` map will be assumed to be defined by
- `no-undefined-types`.
-
- See the option of `check-types`, `unifyParentAndChildTypeChecks`, for
- how the keys of `preferredTypes` may have `<>` or `.<>` (or just `.`)
- appended and its bearing on whether types are checked as parents/children
- only (e.g., to match `Array` if the type is `Array` vs. `Array.<string>`).
-
- Note that if a value is present both as a key and as a value, neither the
- key nor the value will be reported. Thus in `check-types`, this fact can
- be used to allow both `object` and `Object` if one has a `preferredTypes`
- key `object: 'Object'` and `Object: 'object'`.
-
- <a name="eslint-plugin-jsdoc-settings-structuredtags"></a>
- ### <code>structuredTags</code>
-
- An object indicating tags whose types and names/namepaths (whether defining or
- referencing namepaths) will be checked, subject to configuration. If the tags
- have predefined behavior or `allowEmptyNamepaths` behavior, this option will
- override that behavior for any specified tags, though this option can also be
- used for tags without predefined behavior. Its keys are tag names and its
- values are objects with the following optional properties:
- - `name` - String set to one of the following:
- - `"text"` - When a name is present, plain text will be allowed in the
- name position (non-whitespace immediately after the tag and whitespace),
- e.g., in `@throws This is an error`, "This" would normally be the name,
- but "text" allows non-name text here also. This is the default.
- - `"namepath-defining"` - As with `namepath-referencing`, but also
- indicates the tag adds a namepath to definitions, e.g., to prevent
- `no-undefined-types` from reporting references to that namepath.
- - `"namepath-referencing"` - This will cause any name position to be
- checked to ensure it is a valid namepath. You might use this to ensure
- that tags which normally allow free text, e.g., `@see` will instead
- require a namepath.
- - `false` - This will disallow any text in the name position.
- - `type`:
- - `true` - Allows valid types within brackets. This is the default.
- - `false` - Explicitly disallows any brackets or bracketed type. You
- might use this with `@throws` to suggest that only free form text
- is being input or with `@augments` (for jsdoc mode) to disallow
- Closure-style bracketed usage along with a required namepath.
- - (An array of strings) - A list of permissible types.
- - `required` - Array of one of the following (defaults to an empty array,
- meaning none are required):
- - One or both of the following strings (if both are included, then both
- are required):
- - `"name"` - Indicates that a name position is required (not just that
- if present, it is a valid namepath). You might use this with `see`
- to insist that a value (or namepath, depending on the `name` value)
- is always present.
- - `"type"` - Indicates that the type position (within curly brackets)
- is required (not just that if present, it is a valid type). You
- might use this with `@throws` or `@typedef` which might otherwise
- normally have their types optional. See the type groups 3-5 above.
- - `"typeOrName"` - Must have either type (e.g., `@throws {aType}`) or
- name (`@throws Some text`); does not require that both exist but
- disallows just an empty tag.
-
- <a name="eslint-plugin-jsdoc-advanced"></a>
- ## Advanced
-
- <a name="eslint-plugin-jsdoc-advanced-ast-and-selectors"></a>
- ### AST and Selectors
-
- For various rules, one can add to the environments to which the rule applies
- by using the `contexts` option.
-
- This option works with [ESLint's selectors](https://eslint.org/docs/developer-guide/selectors) which are [esquery](https://github.com/estools/esquery/#readme)
- expressions one may use to target a specific node type or types, including
- subsets of the type(s) such as nodes with certain children or attributes.
-
- These expressions are used within ESLint plugins to find those parts of
- your files' code which are of interest to check. However, in
- `eslint-plugin-jsdoc`, we also allow you to use these selectors to define
- additional contexts where you wish our own rules to be applied.
-
- <a name="eslint-plugin-jsdoc-advanced-ast-and-selectors-contexts-format"></a>
- #### <code>contexts</code> format
-
- While at their simplest, these can be an array of string selectors, one can
- also supply an object with `context` (in place of the string) and one of two
- properties:
-
- 1. For `require-jsdoc`, there is also a `inlineCommentBlock` property. See
- that rule for details.
- 1. For `no-missing-syntax` and `no-restricted-syntax`, there is also a
- `message` property which allows customization of the message to be shown
- when the rule is triggered.
- 1. For `no-missing-syntax`, there is also a `minimum` property. See that rule.
- 1. For other rules, there is a `comment` property which adds to the `context`
- in requiring that the `comment` AST condition is also met, e.g., to
- require that certain tags are present and/or or types and type operators
- are in use. Note that this AST (either for `Jsdoc*` or `JsdocType*` AST)
- has not been standardized and should be considered experimental.
- Note that this property might also become obsolete if parsers begin to
- include JSDoc-structured AST. A
- [parser](https://github.com/brettz9/jsdoc-eslint-parser/) is available
- which aims to support comment AST as
- a first class citizen where comment/comment types can be used anywhere
- within a normal AST selector but this should only be considered
- experimental. When using such a parser, you need not use `comment` and
- can just use a plain string context. The determination of the node on
- which the comment is attached is also subject to change. It may be
- currently possible for different structures to map to the same comment
- block. This is because normally when querying to find either the
- declaration of the function expression for
- `const quux = function () {}`, the associated comment would,
- in both cases, generally be expected to be on the line above both, rather
- than to be immediately preceding the funciton (in the case of the
- function). See [@es-joy/jsdoccomment](https://github.com/es-joy/jsdoccomment)
- for the precise structure of the comment (and comment type) nodes.
-
- <a name="eslint-plugin-jsdoc-advanced-ast-and-selectors-discovering-available-ast-definitions"></a>
- #### Discovering available AST definitions
-
- To know all of the AST definitions one may target, it will depend on the
- [parser](https://eslint.org/docs/user-guide/configuring#specifying-parser)
- you are using with ESLint (e.g., `espree` is the default parser for ESLint,
- and this follows [EStree AST](https://github.com/estree/estree) but
- to support the the latest experimental features of JavaScript, one may use
- `@babel/eslint-parser` or to be able to have one's rules (including JSDoc rules)
- apply to TypeScript, one may use `@typescript-eslint/parser`, etc.
-
- So you can look up a particular parser to see its rules, e.g., browse through
- the [ESTree docs](https://github.com/estree/estree) as used by Espree or see
- ESLint's [overview of the structure of AST](https://eslint.org/docs/developer-guide/working-with-custom-parsers#the-ast-specification).
-
- However, it can sometimes be even more helpful to get an idea of AST by just
- providing some of your JavaScript to the wonderful
- [AST Explorer](https://astexplorer.net/) tool and see what AST is built out
- of your code. You can set the tool to the specific parser which you are using.
-
- <a name="eslint-plugin-jsdoc-advanced-ast-and-selectors-uses-tips-for-ast"></a>
- #### Uses/Tips for AST
-
- And if you wish to introspect on the AST of code within your projects, you can
- use [eslint-plugin-query](https://github.com/brettz9/eslint-plugin-query).
- Though it also works as a plugin, you can use it with its own CLI, e.g.,
- to search your files for matching esquery selectors, optionally showing
- it as AST JSON.
-
- Tip: If you want to more deeply understand not just the resulting AST tree
- structures for any given code but also the syntax for esquery selectors so
- that you can, for example, find only those nodes with a child of a certain
- type, you can set the "Transform" feature to ESLint and test out
- esquery selectors in place of the selector expression (e.g., replace
- `'VariableDeclaration > VariableDeclarator > Identifier[name="someVar"]'` as
- we have
- [here](https://astexplorer.net/#/gist/71a93130c19599d6f197bddb29c13a59/latest))
- to the selector you wish so as to get messages reported in the bottom right
- pane which match your [esquery](https://github.com/estools/esquery/#readme)
- selector).
-
- <a name="eslint-plugin-jsdoc-rules"></a>
- ## Rules
-
- <a name="eslint-plugin-jsdoc-rules-check-access"></a>
- ### <code>check-access</code>
-
- Checks that `@access` tags use one of the following values:
-
- - "package", "private", "protected", "public"
-
- Also reports:
-
- - Mixing of `@access` with `@public`, `@private`, `@protected`, or `@package`
- on the same doc block.
- - Use of multiple instances of `@access` (or the `@public`, etc. style tags)
- on the same doc block.
-
- |||
- |---|---|
- |Context|everywhere|
- |Tags|`@access`|
- |Recommended|false|
- |Settings||
- |Options||
-
- The following patterns are considered problems:
-
- ````js
- /**
- * @access foo
- */
- function quux (foo) {
-
- }
- // Message: Missing valid JSDoc @access level.
-
- /**
- * @access foo
- */
- function quux (foo) {
-
- }
- // Settings: {"jsdoc":{"ignorePrivate":true}}
- // Message: Missing valid JSDoc @access level.
-
- /**
- * @accessLevel foo
- */
- function quux (foo) {
-
- }
- // Settings: {"jsdoc":{"tagNamePreference":{"access":"accessLevel"}}}
- // Message: Missing valid JSDoc @accessLevel level.
-
- /**
- * @access
- */
- function quux (foo) {
-
- }
- // Settings: {"jsdoc":{"tagNamePreference":{"access":false}}}
- // Message: Unexpected tag `@access`
-
- class MyClass {
- /**
- * @access
- */
- myClassField = 1
- }
- // Message: Missing valid JSDoc @access level.
-
- /**
- * @access public
- * @public
- */
- function quux (foo) {
-
- }
- // Message: The @access tag may not be used with specific access-control tags (@package, @private, @protected, or @public).
-
- /**
- * @access public
- * @access private
- */
- function quux (foo) {
-
- }
- // Message: At most one access-control tag may be present on a jsdoc block.
-
- /**
- * @access public
- * @access private
- */
- function quux (foo) {
-
- }
- // Settings: {"jsdoc":{"ignorePrivate":true}}
- // Message: At most one access-control tag may be present on a jsdoc block.
-
- /**
- * @public
- * @private
- */
- function quux (foo) {
-
- }
- // Message: At most one access-control tag may be present on a jsdoc block.
-
- /**
- * @public
- * @private
- */
- function quux (foo) {
-
- }
- // Settings: {"jsdoc":{"ignorePrivate":true}}
- // Message: At most one access-control tag may be present on a jsdoc block.
-
- /**
- * @public
- * @public
- */
- function quux (foo) {
-
- }
- // Message: At most one access-control tag may be present on a jsdoc block.
- ````
-
- The following patterns are not considered problems:
-
- ````js
- /**
- *
- */
- function quux (foo) {
-
- }
-
- /**
- * @access public
- */
- function quux (foo) {
-
- }
-
- /**
- * @accessLevel package
- */
- function quux (foo) {
-
- }
- // Settings: {"jsdoc":{"tagNamePreference":{"access":"accessLevel"}}}
-
- class MyClass {
- /**
- * @access private
- */
- myClassField = 1
- }
-
- /**
- * @public
- */
- function quux (foo) {
-
- }
-
- /**
- * @private
- */
- function quux (foo) {
-
- }
- // Settings: {"jsdoc":{"ignorePrivate":true}}
- ````
-
-
- <a name="eslint-plugin-jsdoc-rules-check-alignment"></a>
- ### <code>check-alignment</code>
-
- Reports invalid alignment of JSDoc block asterisks.
-
- |||
- |---|---|
- |Context|everywhere|
- |Tags|N/A|
- |Recommended|true|
-
- The following patterns are considered problems:
-
- ````js
- /**
- * @param {Number} foo
- */
- function quux (foo) {
- // with spaces
- }
- // Message: Expected JSDoc block to be aligned.
-
- /**
- * @param {Number} foo
- */
- function quux (foo) {
- // with tabs
- }
- // Message: Expected JSDoc block to be aligned.
-
- /**
- * @param {Number} foo
- */
- function quux (foo) {
- // with spaces
- }
- // Message: Expected JSDoc block to be aligned.
-
- /**
- * @param {Number} foo
- */
- function quux (foo) {
- // with spaces
- }
- // Message: Expected JSDoc block to be aligned.
-
- /**
- * @param {Number} foo
- */
- function quux (foo) {
-
- }
- // Message: Expected JSDoc block to be aligned.
-
- /**
- * @param {Number} foo
- */
- function quux (foo) {
-
- }
- // Message: Expected JSDoc block to be aligned.
-
- /**
- * @param {Number} foo
- */
- function quux (foo) {
-
- }
- // Message: Expected JSDoc block to be aligned.
-
- /**
- * @param {Number} foo
- */
- function quux (foo) {
-
- }
- // Message: Expected JSDoc block to be aligned.
-
- /**
- * A jsdoc not attached to any node.
- */
- // Message: Expected JSDoc block to be aligned.
-
- class Foo {
- /**
- * Some method
- * @param a
- */
- quux(a) {}
- }
- // Message: Expected JSDoc block to be aligned.
- ````
-
- The following patterns are not considered problems:
-
- ````js
- /**
- * Desc
- *
- * @param {Number} foo
- */
- function quux (foo) {
-
- }
-
- /**
- * Desc
- *
- * @param {{
- foo: Bar,
- bar: Baz
- * }} foo
- *
- */
- function quux (foo) {
-
- }
-
- /* <- JSDoc must start with 2 stars.
- * So this is unchecked.
- */
- function quux (foo) {}
-
- /**
- * @param {Number} foo
- * @private
- */
- function quux (foo) {
- // with spaces
- }
- // Settings: {"jsdoc":{"ignorePrivate":true}}
-
- /**
- * @param {Number} foo
- * @access private
- */
- function quux (foo) {
- // with spaces
- }
- // Settings: {"jsdoc":{"ignorePrivate":true}}
- ````
-
-
- <a name="eslint-plugin-jsdoc-rules-check-examples"></a>
- ### <code>check-examples</code>
-
- Ensures that (JavaScript) examples within JSDoc adhere to ESLint rules. Also
- has options to lint the default values of optional `@param`/`@arg`/`@argument`
- and `@property`/`@prop` tags or the values of `@default`/`@defaultvalue` tags.
-
- <a name="eslint-plugin-jsdoc-rules-check-examples-options-1"></a>
- #### Options
-
- The options below all default to no-op/`false` except as noted.
-
- <a name="eslint-plugin-jsdoc-rules-check-examples-options-1-captionrequired"></a>
- ##### <code>captionRequired</code>
-
- JSDoc specs use of an optional `<caption>` element at the beginning of
- `@example`.
-
- The option `captionRequired` insists on a `<caption>` being present at
- the beginning of any `@example`.
-
- Used only for `@example`.
-
- <a name="eslint-plugin-jsdoc-rules-check-examples-options-1-examplecoderegex-and-rejectexamplecoderegex"></a>
- ##### <code>exampleCodeRegex</code> and <code>rejectExampleCodeRegex</code>
-
- JSDoc does not specify a formal means for delimiting code blocks within
- `@example` (it uses generic syntax highlighting techniques for its own
- syntax highlighting). The following options determine whether a given
- `@example` tag will have the `check-examples` checks applied to it:
-
- * `exampleCodeRegex` - Regex which whitelists lintable
- examples. If a parenthetical group is used, the first one will be used,
- so you may wish to use `(?:...)` groups where you do not wish the
- first such group treated as one to include. If no parenthetical group
- exists or matches, the whole matching expression will be used.
- An example might be ````"^```(?:js|javascript)([\\s\\S]*)```\s*$"````
- to only match explicitly fenced JavaScript blocks. Defaults to only
- using the `u` flag, so to add your own flags, encapsulate your
- expression as a string, but like a literal, e.g., ````/```js.*```/gi````.
- Note that specifying a global regular expression (i.e., with `g`) will
- allow independent linting of matched blocks within a single `@example`.
- * `rejectExampleCodeRegex` - Regex blacklist which rejects
- non-lintable examples (has priority over `exampleCodeRegex`). An example
- might be ```"^`"``` to avoid linting fenced blocks which may indicate
- a non-JavaScript language. See `exampleCodeRegex` on how to add flags
- if the default `u` is not sufficient.
-
- If neither is in use, all examples will be matched. Note also that even if
- `captionRequired` is not set, any initial `<caption>` will be stripped out
- before doing the regex matching.
-
- <a name="eslint-plugin-jsdoc-rules-check-examples-options-1-paddedindent"></a>
- ##### <code>paddedIndent</code>
-
- This integer property allows one to add a fixed amount of whitespace at the
- beginning of the second or later lines of the example to be stripped so as
- to avoid linting issues with the decorative whitespace. For example, if set
- to a value of `4`, the initial whitespace below will not trigger `indent`
- rule errors as the extra 4 spaces on each subsequent line will be stripped
- out before evaluation.
-
- ```js
- /**
- * @example
- * anArray.filter((a) => {
- * return a.b;
- * });
- */
- ```
-
- Only applied to `@example` linting.
-
- <a name="eslint-plugin-jsdoc-rules-check-examples-options-1-reportunuseddisabledirectives"></a>
- ##### <code>reportUnusedDisableDirectives</code>
-
- If not set to `false`, `reportUnusedDisableDirectives` will report disabled
- directives which are not used (and thus not needed). Defaults to `true`.
- Corresponds to ESLint's [`--report-unused-disable-directives`](https://eslint.org/docs/user-guide/command-line-interface#--report-unused-disable-directives).
-
- Inline ESLint config within `@example` JavaScript is allowed (or within
- `@default`, etc.), though the disabling of ESLint directives which are not
- needed by the resolved rules will be reported as with the ESLint
- `--report-unused-disable-directives` command.
-
- <a name="eslint-plugin-jsdoc-rules-check-examples-options-for-determining-eslint-rule-applicability-allowinlineconfig-nodefaultexamplerules-matchingfilename-configfile-checkeslintrc-and-baseconfig"></a>
- #### Options for Determining ESLint Rule Applicability (<code>allowInlineConfig</code>, <code>noDefaultExampleRules</code>, <code>matchingFileName</code>, <code>configFile</code>, <code>checkEslintrc</code>, and <code>baseConfig</code>)
-
- The following options determine which individual ESLint rules will be
- applied to the JavaScript found within the `@example` tags (as determined
- to be applicable by the above regex options) or for the other tags checked by
- `checkDefaults`, `checkParams`, or `checkProperties` options. They are ordered
- by decreasing precedence:
-
- * `allowInlineConfig` - If not set to `false`, will allow
- inline config within the `@example` to override other config. Defaults
- to `true`.
- * `noDefaultExampleRules` - Setting to `true` will disable the
- default rules which are expected to be troublesome for most documentation
- use. See the section below for the specific default rules.
- * `configFile` - A config file. Corresponds to ESLint's [`-c`](https://eslint.org/docs/user-guide/command-line-interface#-c---config).
- * `matchingFileName` - Option for a file name (even non-existent) to trigger
- specific rules defined in one's config; usable with ESLint `.eslintrc.*`
- `overrides` -> `files` globs, to apply a desired subset of rules with
- `@example` (besides allowing for rules specific to examples, this option
- can be useful for enabling reuse of the same rules within `@example` as
- with JavaScript Markdown lintable by
- [other plugins](https://github.com/eslint/eslint-plugin-markdown), e.g.,
- if one sets `matchingFileName` to `dummy.md/*.js` so that `@example`
- rules will follow rules for fenced JavaScript blocks within one's Markdown
- rules). (In ESLint 6's processor API and `eslint-plugin-markdown` < 2, one
- would instead use `dummy.md`.) For `@example` only.
- * `matchingFileNameDefaults` - As with `matchingFileName` but for use with
- `checkDefaults` and defaulting to `.jsdoc-defaults` as extension.
- * `matchingFileNameParams` - As with `matchingFileName` but for use with
- `checkParams` and defaulting to `.jsdoc-params` as extension.
- * `matchingFileNameProperties` As with `matchingFileName` but for use with
- `checkProperties` and defaulting to `.jsdoc-properties` as extension.
- * `checkEslintrc` - Defaults to `true` in adding rules
- based on an `.eslintrc.*` file. Setting to `false` corresponds to
- ESLint's [`--no-eslintrc`](https://eslint.org/docs/user-guide/command-line-interface#--no-eslintrc).
- If `matchingFileName` is set, this will automatically be `true` and
- will use the config corresponding to that file. If `matchingFileName` is
- not set and this value is set to `false`, the `.eslintrc.*` configs will
- not be checked. If `matchingFileName` is not set, and this is unset or
- set to `true`, the `.eslintrc.*` configs will be checked as though the file
- name were the same as the file containing the example, with any file
- extension changed to `".md/*.js"` (and if there is no file extension,
- `"dummy.md/*.js"` will be the result). This allows convenient sharing of
- similar rules with often also context-free Markdown as well as use of
- `overrides` as described under `matchingFileName`. Note that this option
- (whether set by `matchingFileName` or set manually to `true`) may come at
- somewhat of a performance penalty as the file's existence is checked by
- eslint.
- * `baseConfig` - Set to an object of rules with the same schema
- as `.eslintrc.*` for defaults.
-
- <a name="eslint-plugin-jsdoc-rules-check-examples-options-for-determining-eslint-rule-applicability-allowinlineconfig-nodefaultexamplerules-matchingfilename-configfile-checkeslintrc-and-baseconfig-rules-disabled-by-default-unless-nodefaultexamplerules-is-set-to-true"></a>
- ##### Rules Disabled by Default Unless <code>noDefaultExampleRules</code> is Set to <code>true</code>
-
- * `eol-last` - Insisting that a newline "always" be at the end is less likely
- to be desired in sample code as with the code file convention.
- * `no-console` - This rule is unlikely to have inadvertent temporary debugging
- within examples.
- * `no-multiple-empty-lines` - This rule may be problematic for projects which
- use an initial newline just to start an example. Also, projects may wish to
- use extra lines within examples just for easier illustration
- purposes.
- * `no-undef` - Many variables in examples will be `undefined`.
- * `no-unused-vars` - It is common to define variables for clarity without
- always using them within examples.
- * `padded-blocks` - It can generally look nicer to pad a little even if one's
- code follows more stringency as far as block padding.
- * `jsdoc/require-file-overview` - Shouldn't check example for jsdoc blocks.
- * `jsdoc/require-jsdoc` - Wouldn't expect jsdoc blocks within jsdoc blocks.
- * `import/no-unresolved` - One wouldn't generally expect example paths to
- resolve relative to the current JavaScript file as one would with real code.
- * `import/unambiguous` - Snippets in examples are likely too short to always
- include full import/export info.
- * `node/no-missing-import` - See `import/no-unresolved`.
- * `node/no-missing-require` - See `import/no-unresolved`.
-
- For `checkDefaults`, `checkParams`, and `checkProperties`, the following
- expression-oriented rules will be used by default as well:
-
- * `quotes` - Will insist on "double".
- * `semi` - Will insist on "never".
- * `strict` - Disabled.
- * `no-empty-function` - Disabled.
- * `no-new` - Disabled.
- * `no-unused-expressions` - Disabled.
- * `chai-friendly/no-unused-expressions` - Disabled.
-
- <a name="eslint-plugin-jsdoc-rules-check-examples-options-for-determining-eslint-rule-applicability-allowinlineconfig-nodefaultexamplerules-matchingfilename-configfile-checkeslintrc-and-baseconfig-options-for-checking-other-than-example-checkdefaults-checkparams-or-checkproperties"></a>
- ##### Options for checking other than <code>@example</code> (<code>checkDefaults</code>, <code>checkParams</code>, or <code>checkProperties</code>)
-
- * `checkDefaults` - Whether to check the values of `@default`/`@defaultvalue` tags
- * `checkParams` - Whether to check `@param`/`@arg`/`@argument` default values
- * `checkProperties` - Whether to check `@property`/`@prop` default values
-
- |||
- |---|---|
- |Context|everywhere|
- |Tags|`example`|
- |Recommended|false|
- |Options| *See above* |
-
- The following patterns are considered problems:
-
- ````js
- /**
- * @example alert('hello')
- */
- function quux () {
-
- }
- // "jsdoc/check-examples": ["error"|"warn", {"baseConfig":{"rules":{"no-alert":2,"semi":["error","always"]}},"checkEslintrc":false}]
- // Message: @example error (no-alert): Unexpected alert.
-
- /**
- * @example alert('hello')
- */
- class quux {
-
- }
- // "jsdoc/check-examples": ["error"|"warn", {"baseConfig":{"rules":{"no-alert":2,"semi":["error","always"]}},"checkEslintrc":false}]
- // Message: @example error (no-alert): Unexpected alert.
-
- /**
- * @example ```js
- alert('hello');
- ```
- */
- function quux () {
-
- }
- // "jsdoc/check-examples": ["error"|"warn", {"baseConfig":{"rules":{"semi":["error","never"]}},"checkEslintrc":false,"exampleCodeRegex":"```js([\\s\\S]*)```"}]
- // Message: @example error (semi): Extra semicolon.
-
- /**
- * @example
- *
- * ```js alert('hello'); ```
- */
- function quux () {
-
- }
- // "jsdoc/check-examples": ["error"|"warn", {"baseConfig":{"rules":{"semi":["error","never"]}},"checkEslintrc":false,"exampleCodeRegex":"```js ([\\s\\S]*)```"}]
- // Message: @example error (semi): Extra semicolon.
-
- /**
- * @example
- * ```js alert('hello'); ```
- */
- var quux = {
-
- };
- // "jsdoc/check-examples": ["error"|"warn", {"baseConfig":{"rules":{"semi":["error","never"]}},"checkEslintrc":false,"exampleCodeRegex":"```js ([\\s\\S]*)```"}]
- // Message: @example error (semi): Extra semicolon.
-
- /**
- * @example ```
- * js alert('hello'); ```
- */
- function quux () {
-
- }
- // "jsdoc/check-examples": ["error"|"warn", {"baseConfig":{"rules":{"semi":["error","never"]}},"checkEslintrc":false,"exampleCodeRegex":"```\njs ([\\s\\S]*)```"}]
- // Message: @example error (semi): Extra semicolon.
-
- /**
- * @example <b>Not JavaScript</b>
- */
- function quux () {
-
- }
- /**
- * @example quux2();
- */
- function quux2 () {
-
- }
- // "jsdoc/check-examples": ["error"|"warn", {"baseConfig":{"rules":{"semi":["error","never"]}},"checkEslintrc":false,"rejectExampleCodeRegex":"^\\s*<.*>\\s*$"}]
- // Message: @example error (semi): Extra semicolon.
-
- /**
- * @example
- * quux(); // does something useful
- */
- function quux () {
-
- }
- // "jsdoc/check-examples": ["error"|"warn", {"baseConfig":{"rules":{"no-undef":["error"]}},"checkEslintrc":false,"noDefaultExampleRules":true}]
- // Message: @example error (no-undef): 'quux' is not defined.
-
- /**
- * @example <caption>Valid usage</caption>
- * quux(); // does something useful
- *
- * @example
- * quux('random unwanted arg'); // results in an error
- */
- function quux () {
-
- }
- // "jsdoc/check-examples": ["error"|"warn", {"captionRequired":true,"checkEslintrc":false}]
- // Message: Caption is expected for examples.
-
- /**
- * @example quux();
- */
- function quux () {
-
- }
- // "jsdoc/check-examples": ["error"|"warn", {"baseConfig":{"rules":{"indent":["error"]}},"checkEslintrc":false,"noDefaultExampleRules":false}]
- // Message: @example error (indent): Expected indentation of 0 spaces but found 1.
-
- /**
- * @example test() // eslint-disable-line semi
- */
- function quux () {}
- // "jsdoc/check-examples": ["error"|"warn", {"checkEslintrc":false,"noDefaultExampleRules":true,"reportUnusedDisableDirectives":true}]
- // Message: @example error: Unused eslint-disable directive (no problems were reported from 'semi').
-
- /**
- * @example
- test() // eslint-disable-line semi
- */
- function quux () {}
- // "jsdoc/check-examples": ["error"|"warn", {"allowInlineConfig":false,"baseConfig":{"rules":{"semi":["error","always"]}},"checkEslintrc":false,"noDefaultExampleRules":true}]
- // Message: @example error (semi): Missing semicolon.
-
- /**
- * @example const i = 5;
- * quux2()
- */
- function quux2 () {
-
- }
- // "jsdoc/check-examples": ["error"|"warn", {"matchingFileName":"../../jsdocUtils.js"}]
- // Message: @example warning (id-length): Identifier name 'i' is too short (< 2).
-
- /**
- * @example const i = 5;
- * quux2()
- */
- function quux2 () {
-
- }
- // "jsdoc/check-examples": ["error"|"warn", {"configFile":".eslintrc.json","matchingFileName":"../../jsdocUtils.js"}]
- // Message: @example warning (id-length): Identifier name 'i' is too short (< 2).
-
- /**
- * @example const i = 5;
- * quux2()
- */
- function quux2 () {
-
- }
- // Message: @example warning (id-length): Identifier name 'i' is too short (< 2).
-
- /**
- * @example const i = 5;
- * quux2()
- */
- function quux2 () {
-
- }
- // "jsdoc/check-examples": ["error"|"warn", {"paddedIndent":2}]
- // Message: @example warning (id-length): Identifier name 'i' is too short (< 2).
-
- /**
- * @example
- * const i = 5;
- * quux2()
- */
- function quux2 () {
-
- }
- // Message: @example warning (id-length): Identifier name 'i' is too short (< 2).
-
- /**
- * @example const idx = 5;
- * quux2()
- */
- function quux2 () {
-
- }
- // "jsdoc/check-examples": ["error"|"warn", {"matchingFileName":"dummy.js"}]
- // Message: @example error (semi): Missing semicolon.
-
- /**
- * @example const idx = 5;
- *
- * quux2()
- */
- function quux2 () {
-
- }
- // "jsdoc/check-examples": ["error"|"warn", {"matchingFileName":"dummy.js"}]
- // Message: @example error (semi): Missing semicolon.
-
- /**
- * @example const idx = 5;
- *
- * quux2()
- */
- function quux2 () {
-
- }
- // "jsdoc/check-examples": ["error"|"warn", {"checkEslintrc":false,"matchingFileName":"dummy.js"}]
- // Message: @example error: Parsing error: The keyword 'const' is reserved
-
- /**
- * @example // begin
- alert('hello')
- // end
- */
- function quux () {
-
- }
- // "jsdoc/check-examples": ["error"|"warn", {"baseConfig":{"rules":{"semi":["warn","always"]}},"checkEslintrc":false,"exampleCodeRegex":"// begin[\\s\\S]*// end","noDefaultExampleRules":true}]
- // Message: @example warning (semi): Missing semicolon.
-
- /**
- * @typedef {string} Foo
- * @example <caption></caption>
- * 'foo'
- */
- // "jsdoc/check-examples": ["error"|"warn", {"captionRequired":true,"checkEslintrc":false}]
- // Message: Caption is expected for examples.
-
- /**
- * @example
- * const list: number[] = [1, 2, 3]
- * quux(list);
- */
- function quux () {
-
- }
- // "jsdoc/check-examples": ["error"|"warn", {"baseConfig":{"parser":"@typescript-eslint/parser","parserOptions":{"ecmaVersion":6},"rules":{"semi":["error","always"]}},"checkEslintrc":false}]
- // Message: @example error (semi): Missing semicolon.
-
- /**
- * @example
- * const test = something.find((_) => {
- * return _
- * });
- */
- function quux () {
-
- }
- // "jsdoc/check-examples": ["error"|"warn", {"baseConfig":{"parserOptions":{"ecmaVersion":6},"rules":{"semi":["error","always"]}}}]
- // Message: @example error (semi): Missing semicolon.
-
- /**
- * @example <caption>Say `Hello!` to the user.</caption>
- * First, import the function:
- *
- * ```js
- * import popup from './popup'
- * const aConstInSameScope = 5;
- * ```
- *
- * Then use it like this:
- *
- * ```js
- * const aConstInSameScope = 7;
- * popup('Hello!')
- * ```
- *
- * Here is the result on macOS:
- *
- * ![Screenshot](path/to/screenshot.jpg)
- */
- // "jsdoc/check-examples": ["error"|"warn", {"baseConfig":{"parserOptions":{"ecmaVersion":2015,"sourceType":"module"},"rules":{"semi":["error","always"]}},"checkEslintrc":false,"exampleCodeRegex":"/^```(?:js|javascript)\\n([\\s\\S]*?)```$/gm"}]
- // Message: @example error (semi): Missing semicolon.
-
- /**
- * @example // begin
- alert('hello')
- // end
- * And here is another example:
- // begin
- alert('there')
- // end
- */
- function quux () {
-
- }
- // "jsdoc/check-examples": ["error"|"warn", {"baseConfig":{"rules":{"semi":["warn","always"]}},"checkEslintrc":false,"exampleCodeRegex":"/\\/\\/ begin[\\s\\S]*?// end/g","noDefaultExampleRules":true}]
- // Message: @example warning (semi): Missing semicolon.
-
- /**
- * @example
- * quux();
- */
- function quux () {
-
- }
- // "jsdoc/check-examples": ["error"|"warn", {"baseConfig":{"rules":{"indent":["error"]}},"checkEslintrc":false,"noDefaultExampleRules":false}]
- // Message: @example error (indent): Expected indentation of 0 spaces but found 2.
-
- /**
- * @default 'abc'
- */
- const str = 'abc';
- // "jsdoc/check-examples": ["error"|"warn", {"checkDefaults":true}]
- // Message: @default error (quotes): Strings must use doublequote.
-
- /**
- * @param {myType} [name='abc']
- */
- function quux () {
- }
- // "jsdoc/check-examples": ["error"|"warn", {"checkParams":true}]
- // Message: @param error (quotes): Strings must use doublequote.
-
- /**
- * @property {myType} [name='abc']
- */
- const obj = {};
- // "jsdoc/check-examples": ["error"|"warn", {"checkProperties":true}]
- // Message: @property error (quotes): Strings must use doublequote.
-
- /**
- * Test function.
- *
- * @example <caption>functionName (paramOne: string, paramTwo?: any,
- * paramThree?: any): boolean</caption> test()
- *
- * @param {string} paramOne Parameter description.
- * @param {any} [paramTwo] Parameter description.
- * @param {any} [paramThree] Parameter description.
- * @returns {boolean} Return description.
- */
- const functionName = function (paramOne, paramTwo,
- paramThree) {
- return false;
- };
- // "jsdoc/check-examples": ["error"|"warn", {"baseConfig":{"parserOptions":{"ecmaVersion":2015,"sourceType":"module"},"rules":{"semi":["error","always"]}},"captionRequired":true,"checkEslintrc":false}]
- // Message: @example error (semi): Missing semicolon.
- ````
-
- The following patterns are not considered problems:
-
- ````js
- /**
- * @example ```js
- alert('hello');
- ```
- */
- function quux () {
-
- }
- // "jsdoc/check-examples": ["error"|"warn", {"baseConfig":{"rules":{"semi":["error","always"]}},"checkEslintrc":false,"exampleCodeRegex":"```js([\\s\\S]*)```"}]
-
- /**
- * @example ```js
- alert('hello');
- ```
- */
- function quux () {
-
- }
- // "jsdoc/check-examples": ["error"|"warn", {"baseConfig":{"rules":{"semi":["error","always"]}},"checkEslintrc":false,"exampleCodeRegex":"/```js([\\s\\S]*)```/"}]
-
- /**
- * @example
- * // arbitrary example content
- */
- function quux () {
-
- }
- // "jsdoc/check-examples": ["error"|"warn", {"checkEslintrc":false}]
-
- /**
- * @example
- * quux(); // does something useful
- */
- function quux () {
-
- }
- // "jsdoc/check-examples": ["error"|"warn", {"baseConfig":{"rules":{"no-undef":["error"]}},"checkEslintrc":false,"noDefaultExampleRules":false}]
-
- /**
- * @example quux();
- */
- function quux () {
-
- }
- // "jsdoc/check-examples": ["error"|"warn", {"baseConfig":{"rules":{"indent":["error"]}},"checkEslintrc":false,"noDefaultExampleRules":false}]
-
- /**
- * @example <caption>Valid usage</caption>
- * quux(); // does something useful
- *
- * @example <caption>Invalid usage</caption>
- * quux('random unwanted arg'); // results in an error
- */
- function quux () {
-
- }
- // "jsdoc/check-examples": ["error"|"warn", {"captionRequired":true,"checkEslintrc":false}]
-
- /**
- * @example test() // eslint-disable-line semi
- */
- function quux () {}
- // "jsdoc/check-examples": ["error"|"warn", {"checkEslintrc":false,"noDefaultExampleRules":true,"reportUnusedDisableDirectives":false}]
-
- /**
- * @example
- test() // eslint-disable-line semi
- */
- function quux () {}
- // "jsdoc/check-examples": ["error"|"warn", {"allowInlineConfig":true,"baseConfig":{"rules":{"semi":["error","always"]}},"checkEslintrc":false,"noDefaultExampleRules":true}]
-
- /**
- * @example ```js
- alert('hello')
- ```
- */
- var quux = {
-
- };
- // "jsdoc/check-examples": ["error"|"warn", {"baseConfig":{"rules":{"semi":["error","never"]}},"checkEslintrc":false,"exampleCodeRegex":"```js([\\s\\S]*)```"}]
-
- /**
- * @example
- * foo(function (err) {
- * throw err;
- * });
- */
- function quux () {}
- // "jsdoc/check-examples": ["error"|"warn", {"baseConfig":{"rules":{"indent":["error"]}},"checkEslintrc":false,"noDefaultExampleRules":false}]
-
- /**
- * @example
- * const list: number[] = [1, 2, 3];
- * quux(list);
- */
- function quux () {
-
- }
- // "jsdoc/check-examples": ["error"|"warn", {"baseConfig":{"parser":"@typescript-eslint/parser","parserOptions":{"ecmaVersion":6},"rules":{"semi":["error","always"]}},"checkEslintrc":false}]
-
- /**
- * @example const ident = 5;
- * quux2();
- * bar();
- */
- function quux2 () {
-
- }
- // "jsdoc/check-examples": ["error"|"warn", {"paddedIndent":2}]
-
- /**
- * @example
- * function quux() {
- * bar();
- * }
- */
- function quux () {
-
- }
- // "jsdoc/check-examples": ["error"|"warn", {"baseConfig":{"rules":{"indent":["error"]}},"checkEslintrc":false,"noDefaultExampleRules":false}]
-
- // Comment
- a();
-
- export default {};
-
- /**
- *
- */
- function f () {
-
- }
-
- /**
- * Does quux
- * @example
- * // Do it!
- * quux();
- */
- function quux () {
- }
- // "jsdoc/check-examples": ["error"|"warn", {"baseConfig":{"plugins":["jsdoc"],"rules":{"jsdoc/require-file-overview":["error"]}},"checkEslintrc":false,"noDefaultExampleRules":false}]
-
- /**
- * @default "abc"
- */
- const str = 'abc';
- // "jsdoc/check-examples": ["error"|"warn", {"checkDefaults":true}]
-
- /**
- * @default
- */
- const str = 'abc';
- // "jsdoc/check-examples": ["error"|"warn", {"checkDefaults":true}]
-
- /**
- * @param {myType} [name="abc"]
- */
- function quux () {
- }
- // "jsdoc/check-examples": ["error"|"warn", {"checkParams":true}]
-
- /**
- * @param {myType} name
- */
- function quux () {
- }
- // "jsdoc/check-examples": ["error"|"warn", {"checkParams":true}]
-
- /**
- * @property {myType} [name="abc"]
- */
- const obj = {};
- // "jsdoc/check-examples": ["error"|"warn", {"checkProperties":true}]
-
- /**
- * @property {myType} [name]
- */
- const obj = {};
- // "jsdoc/check-examples": ["error"|"warn", {"checkProperties":true}]
-
- /**
- * @default 'abc'
- */
- const str = 'abc';
- // "jsdoc/check-examples": ["error"|"warn", {"checkDefaults":false,"matchingFileNameDefaults":"dummy.js"}]
-
- /**
- * @param {myType} [name='abc']
- */
- function quux () {
- }
- // "jsdoc/check-examples": ["error"|"warn", {"checkParams":false,"matchingFileNameParams":"dummy.js"}]
-
- /**
- * @property {myType} [name='abc']
- */
- const obj = {};
- // "jsdoc/check-examples": ["error"|"warn", {"checkProperties":false,"matchingFileNameProperties":"dummy.js"}]
-
- /**
- * Test function.
- *
- * @example <caption>functionName (paramOne: string, paramTwo?: any,
- * paramThree?: any): boolean</caption> test();
- *
- * @param {string} paramOne Parameter description.
- * @param {any} [paramTwo] Parameter description.
- * @param {any} [paramThree] Parameter description.
- * @returns {boolean} Return description.
- */
- const functionName = function (paramOne, paramTwo,
- paramThree) {
- return false;
- };
- // "jsdoc/check-examples": ["error"|"warn", {"baseConfig":{"parserOptions":{"ecmaVersion":2015,"sourceType":"module"},"rules":{"semi":["error","always"]}},"captionRequired":true,"checkEslintrc":false}]
- ````
-
-
- <a name="eslint-plugin-jsdoc-rules-check-indentation"></a>
- ### <code>check-indentation</code>
-
- Reports invalid padding inside JSDoc blocks.
-
- Ignores parts enclosed in Markdown "code block"'s. For example,
- the following description is not reported:
-
- ```js
- /**
- * Some description:
- * ```html
- * <section>
- * <title>test</title>
- * </section>
- * ```
- */
- ```
-
- <a name="eslint-plugin-jsdoc-rules-check-indentation-options-2"></a>
- #### Options
-
- This rule has an object option.
-
- <a name="eslint-plugin-jsdoc-rules-check-indentation-options-2-excludetags"></a>
- ##### <code>excludeTags</code>
-
- Array of tags (e.g., `['example', 'description']`) whose content will be
- "hidden" from the `check-indentation` rule. Defaults to `['example']`.
-
- By default, the whole JSDoc block will be checked for invalid padding.
- That would include `@example` blocks too, which can get in the way
- of adding full, readable examples of code without ending up with multiple
- linting issues.
-
- When disabled (by passing `excludeTags: []` option), the following code *will*
- report a padding issue:
-
- ```js
- /**
- * @example
- * anArray.filter((a) => {
- * return a.b;
- * });
- */
- ```
-
- |||
- |---|---|
- |Context|everywhere|
- |Tags|N/A|
- |Recommended|false|
- |Options| `excludeTags` |
-
- The following patterns are considered problems:
-
- ````js
- /** foo */
- function quux () {
-
- }
- // Message: There must be no indentation.
-
- /**
- * foo
- *
- * @param bar
- * baz
- */
- function quux () {
-
- }
- // Message: There must be no indentation.
-
- /**
- * Foo
- * bar
- */
- class Moo {}
- // Message: There must be no indentation.
-
- /**
- * foo
- *
- * @example
- * anArray.filter((a) => {
- * return a.b;
- * });
- */
- function quux () {
-
- }
- // "jsdoc/check-indentation": ["error"|"warn", {"excludeTags":[]}]
- // Message: There must be no indentation.
-
- /**
- * foo
- *
- * @example
- * aaaa
- * @returns
- * eeee
- */
- function quux () {
-
- }
- // Message: There must be no indentation.
-
- /**
- * foo
- * ```html
- * <section>
- * <title>test</title>
- * </section>
- * ```
- * @returns
- * eeee
- */
- function quux () {
-
- }
- // Message: There must be no indentation.
-
- /**
- * foo
- * ``` aaaa```
- * @returns
- * eeee
- */
- function quux () {
-
- }
- // Message: There must be no indentation.
-
- /**
- * @example <caption>
- * Here is a long
- * indented summary of this
- * example
- * </caption>
- * ```js
- * function hi () {
- * alert('Hello');
- * }
- * ```
- */
- // "jsdoc/check-indentation": ["error"|"warn", {"excludeTags":[]}]
- // Message: There must be no indentation.
-
- /**
- * @example <caption>
- * Here is a long
- * summary of this
- * example
- * </caption>
- * // Code is not wrapped into fenced code block
- * function hi () {
- * alert('Hello');
- * }
- */
- // "jsdoc/check-indentation": ["error"|"warn", {"excludeTags":[]}]
- // Message: There must be no indentation.
- ````
-
- The following patterns are not considered problems:
-
- ````js
- /**
- * foo
- *
- * @param bar
- * baz
- */
- function quux () {
-
- }
-
- /*** foo */
- function quux () {
-
- }
-
- /**
- * foo
- *
- * @example
- * anArray.filter((a) => {
- * return a.b;
- * });
- */
- function quux () {
-
- }
-
- /**
- * foo
- *
- * @example
- * anArray.filter((a) => {
- * return a.b;
- * });
- * @returns
- * eeee
- */
- function quux () {
-
- }
- // "jsdoc/check-indentation": ["error"|"warn", {"excludeTags":["example","returns"]}]
-
- /**
- * foo
- * ```html
- * <section>
- * <title>test</title>
- * </section>
- * ```
- * @returns eeee
- */
- function quux () {
-
- }
-
- /**
- * foo
- * ``` aaaa```
- * @returns eeee
- */
- function quux () {
-
- }
-
- /**
- * @example <caption>
- * Here is a long
- * summary of this
- * example
- * </caption>
- * ```js
- * function hi () {
- * alert('Hello');
- * }
- * ```
- */
- // "jsdoc/check-indentation": ["error"|"warn", {"excludeTags":[]}]
- ````
-
-
- <a name="eslint-plugin-jsdoc-rules-check-line-alignment"></a>
- ### <code>check-line-alignment</code>
-
- Reports invalid alignment of JSDoc block lines. This is a
- [standard recommended to WordPress code](https://make.wordpress.org/core/handbook/best-practices/inline-documentation-standards/javascript/#aligning-comments),
- for example.
-
- <a name="eslint-plugin-jsdoc-rules-check-line-alignment-options-3"></a>
- #### Options
-
- This rule allows one optional string argument. If it is `"always"` then a
- problem is raised when the lines are not aligned. If it is `"never"` then
- a problem should be raised when there is more than one space between each
- line's parts. Defaults to `"never"`.
-
- Note that in addition to alignment, both options will ensure at least one
- space is present after the asterisk delimiter.
-
- After the string, an options object is allowed with the following properties.
-
- <a name="eslint-plugin-jsdoc-rules-check-line-alignment-options-3-tags"></a>
- ##### <code>tags</code>
-
- Use this to change the tags which are sought for alignment changes. *Currently*
- *only works with the "never" option.* Defaults to an array of
- `['param', 'arg', 'argument', 'property', 'prop', 'returns', 'return']`.
-
- <a name="eslint-plugin-jsdoc-rules-check-line-alignment-options-3-customspacings"></a>
- ##### <code>customSpacings</code>
-
- An object with any of the following keys set to an integer. Affects spacing:
-
- - `postDelimiter` - after the asterisk (e.g., `* @param`)
- - `postTag` - after the tag (e.g., `* @param `)
- - `postType` - after the type (e.g., `* @param {someType} `)
- - `postName` - after the name (e.g., `* @param {someType} name `)
-
- If a spacing is not defined, it defaults to one.
-
- |||
- |---|---|
- |Context|everywhere|
- |Options|(a string matching `"always" or "never"` and optional object with `tags` and `customSpacings`)|
- |Tags|`param`, `property`, `returns` and others added by `tags`|
- |Aliases|`arg`, `argument`, `prop`, `return`|
- |Recommended|false|
-
- The following patterns are considered problems:
-
- ````js
- /**
- * Function description.
- *
- * @param {string} lorem Description.
- * @param {int} sit Description multi words.
- */
- const fn = ( lorem, sit ) => {}
- // "jsdoc/check-line-alignment": ["error"|"warn", "always"]
- // Message: Expected JSDoc block lines to be aligned.
-
- /**
- * With tabs.
- *
- * @param {string} lorem Description.
- * @param {int} sit Description multi words.
- */
- const fn = ( lorem, sit ) => {}
- // "jsdoc/check-line-alignment": ["error"|"warn", "always"]
- // Message: Expected JSDoc block lines to be aligned.
-
- /**
- * Function description.
- *
- * @param {string} lorem - Description.
- * @param {int} sit - Description multi words.
- */
- const fn = ( lorem, sit ) => {}
- // "jsdoc/check-line-alignment": ["error"|"warn", "always"]
- // Message: Expected JSDoc block lines to be aligned.
-
- /**
- * Function description.
- *
- * @param {string} lorem Description.
- * @param {int} sit Description multi words.
- */
- const fn = ( lorem, sit ) => {}
- // "jsdoc/check-line-alignment": ["error"|"warn", "always"]
- // Message: Expected JSDoc block lines to be aligned.
-
- /**
- * Function description.
- *
- * @param {string} lorem Description.
- * @param {int} sit Description multi words.
- */
- const fn = ( lorem, sit ) => {}
- // "jsdoc/check-line-alignment": ["error"|"warn", "always"]
- // Message: Expected JSDoc block lines to be aligned.
-
- /**
- * Function description.
- *
- * @param {string} lorem Description.
- * @param {int} sit Description multi words.
- */
- const fn = ( lorem, sit ) => {}
- // "jsdoc/check-line-alignment": ["error"|"warn", "always"]
- // Message: Expected JSDoc block lines to be aligned.
-
- /**
- * Function description.
- *
- * @param {string} lorem Description.
- * @param {int} sit Description multi words.
- */
- const fn = ( lorem, sit ) => {}
- // "jsdoc/check-line-alignment": ["error"|"warn", "always"]
- // Message: Expected JSDoc block lines to be aligned.
-
- /**
- * Function description.
- *
- * @param {string} lorem Description.
- * @param {int} sit Description multi words.
- */
- function fn( lorem, sit ) {}
- // "jsdoc/check-line-alignment": ["error"|"warn", "always"]
- // Message: Expected JSDoc block lines to be aligned.
-
- const object = {
- /**
- * Function description.
- *
- * @param {string} lorem Description.
- * @param {int} sit Description multi words.
- */
- fn( lorem, sit ) {}
- }
- // "jsdoc/check-line-alignment": ["error"|"warn", "always"]
- // Message: Expected JSDoc block lines to be aligned.
-
- class ClassName {
- /**
- * Function description.
- *
- * @param {string} lorem Description.
- * @param {int} sit Description multi words.
- */
- fn( lorem, sit ) {}
- }
- // "jsdoc/check-line-alignment": ["error"|"warn", "always"]
- // Message: Expected JSDoc block lines to be aligned.
-
- /**
- * Function description.
- *
- * @arg {string} lorem Description.
- * @arg {int} sit Description multi words.
- */
- const fn = ( lorem, sit ) => {}
- // "jsdoc/check-line-alignment": ["error"|"warn", "always"]
- // Message: Expected JSDoc block lines to be aligned.
-
- /**
- * @namespace
- * @property {object} defaults Description.
- * @property {int} defaults.lorem Description multi words.
- */
- const config = {
- defaults: {
- lorem: 1
- }
- }
- // "jsdoc/check-line-alignment": ["error"|"warn", "always"]
- // Message: Expected JSDoc block lines to be aligned.
-
- /**
- * My object.
- *
- * @typedef {Object} MyObject
- *
- * @property {string} lorem Description.
- * @property {int} sit Description multi words.
- */
- // "jsdoc/check-line-alignment": ["error"|"warn", "always"]
- // Message: Expected JSDoc block lines to be aligned.
-
- /**
- * My object.
- *
- * @typedef {Object} MyObject
- *
- * @property {{a: number, b: string, c}} lorem Description.
- * @property {Object.<string, Class>} sit Description multi words.
- * @property {Object.<string, Class>} amet Description} weird {multi} {{words}}.
- * @property {Object.<string, Class>} dolor
- */
- // "jsdoc/check-line-alignment": ["error"|"warn", "always"]
- // Message: Expected JSDoc block lines to be aligned.
-
- /**
- * My object.
- *
- * @typedef {Object} MyObject
- *
- * @property {{a: number, b: string, c}} lorem Description.
- * @property {Object.<string, Class>} sit Description multi words.
- * @property {Object.<string, Class>} amet Description} weird {multi} {{words}}.
- * @property {Object.<string, Class>} dolor
- */
- // "jsdoc/check-line-alignment": ["error"|"warn", "always",{"tags":["typedef","property"]}]
- // Message: Expected JSDoc block lines to be aligned.
-
- /**
- * My function.
- *
- * @param {string} lorem Description.
- * @param {int} sit Description multi words.
- */
- const fn = ( lorem, sit ) => {}
- // "jsdoc/check-line-alignment": ["error"|"warn", "never"]
- // Message: Expected JSDoc block lines to not be aligned.
-
- /**
- * My function.
- *
- * @param {string} lorem Description.
- * @param {int} sit Description multi words.
- */
- const fn = ( lorem, sit ) => {}
- // "jsdoc/check-line-alignment": ["error"|"warn", "never"]
- // Message: Expected JSDoc block lines to not be aligned.
-
- /**
- * My function.
- *
- * @param {string} lorem Description.
- * @param {int} sit
- */
- const fn = ( lorem, sit ) => {}
- // "jsdoc/check-line-alignment": ["error"|"warn", "never"]
- // Message: Expected JSDoc block lines to not be aligned.
-
- /**
- * My function.
- *
- * @param {string} lorem Description.
- * @param {int} sit
- */
- const fn = ( lorem, sit ) => {}
- // Message: Expected JSDoc block lines to not be aligned.
-
- /**
- * Function description.
- *
- * @param {string} lorem Description.
- * @param {int} sit Description multi
- line without *.
- */
- const fn = ( lorem, sit ) => {}
- // "jsdoc/check-line-alignment": ["error"|"warn", "always"]
- // Message: Expected JSDoc block lines to be aligned.
-
- /**
- * My function.
- *
- * @param {string} lorem Description.
- * @param {int} sit
- *
- * @return {string} Return description
- * with multi line, but don't touch.
- */
- const fn = ( lorem, sit ) => {}
- // "jsdoc/check-line-alignment": ["error"|"warn", "always",{"tags":["param"]}]
- // Message: Expected JSDoc block lines to be aligned.
-
- /**
- * Only return doc.
- *
- * @return {boolean} Return description.
- */
- const fn = ( lorem, sit ) => {}
- // "jsdoc/check-line-alignment": ["error"|"warn", "always"]
- // Message: Expected JSDoc block lines to be aligned.
-
- /**
- * Creates OS based shortcuts for files, folders, and applications.
- *
- * @param {object} options Options object for each OS.
- * @return {boolean} True = success, false = failed to create the icon
- */
- function quux () {}
- // "jsdoc/check-line-alignment": ["error"|"warn", "never"]
- // Message: Expected JSDoc block lines to not be aligned.
-
- /**
- * Creates OS based shortcuts for files, folders, and applications.
- *
- * @param {object} options Options object for each OS.
- * @return {boolean} True = success, false = failed to create the icon
- */
- function quux () {}
- // "jsdoc/check-line-alignment": ["error"|"warn", "never"]
- // Message: Expected JSDoc block lines to not be aligned.
-
- /**
- * Creates OS based shortcuts for files, folders, and applications.
- *
- * @param {object} options Options object for each OS.
- * @return True = success, false = failed to create the icon
- */
- function quux () {}
- // "jsdoc/check-line-alignment": ["error"|"warn", "never"]
- // Message: Expected JSDoc block lines to not be aligned.
-
- /**
- * Creates OS based shortcuts for files, folders, and applications.
- *
- * @param options Options object for each OS.
- * @return True = success, false = failed to create the icon
- */
- function quux () {}
- // "jsdoc/check-line-alignment": ["error"|"warn", "never"]
- // Message: Expected JSDoc block lines to not be aligned.
-
- /**
- * Creates OS based shortcuts for files, folders, and applications.
- *
- * @param {object} options Options object for each OS.
- * @param {object} other Other.
- * @return True = success, false = failed to create the icon
- */
- function quux () {}
- // "jsdoc/check-line-alignment": ["error"|"warn", "never",{"tags":["param","return"]}]
- // Message: Expected JSDoc block lines to not be aligned.
-
- /**
- * Returns the value stored in the process.env for a given
- * environment variable.
- *
- * @param {string} withPercents '%USERNAME%'
- * @param {string} withoutPercents 'USERNAME'
- * @return {string} 'bob' || '%USERNAME%'
- */
- function quux () {}
- // "jsdoc/check-line-alignment": ["error"|"warn", "never"]
- // Message: Expected JSDoc block lines to not be aligned.
-
- /**
- * Function description
- * description with post delimiter.
- *
- * @param {string} lorem Description.
- * @param {int} sit Description multi words.
- */
- const fn = ( lorem, sit ) => {}
- // "jsdoc/check-line-alignment": ["error"|"warn", "always"]
- // Message: Expected JSDoc block lines to be aligned.
-
- /**
- * Function description.
- *
- * @param {string} lorem Description.
- * @param {int} sit Description multi words.
- *
- * @return {string} Return description.
- */
- const fn = ( lorem, sit ) => {}
- // "jsdoc/check-line-alignment": ["error"|"warn", "always",{"customSpacings":{"postDelimiter":2,"postTag":3,"postType":2}}]
- // Message: Expected JSDoc block lines to be aligned.
-
- /**
- * Function description.
- *
- * @param {string} lorem Description.
- * @param {int} sit Description multi words.
- *
- * @return {string} Return description.
- */
- const fn = ( lorem, sit ) => {}
- // "jsdoc/check-line-alignment": ["error"|"warn", "always",{"customSpacings":{"postName":3}}]
- // Message: Expected JSDoc block lines to be aligned.
-
- /**
- * Function description.
- *
- * @param {string} lorem Description.
- * @param {int} sit Description multi words.
- */
- const fn = ( lorem, sit ) => {}
- // "jsdoc/check-line-alignment": ["error"|"warn", "never",{"customSpacings":{"postDelimiter":2,"postTag":3,"postType":2}}]
- // Message: Expected JSDoc block lines to not be aligned.
-
- /**
- * Function description.
- *
- * @param {string} lorem Description.
- * @param {int} sit Description multi words.
- */
- const fn = ( lorem, sit ) => {}
- // "jsdoc/check-line-alignment": ["error"|"warn", "never",{"customSpacings":{"postName":3}}]
- // Message: Expected JSDoc block lines to not be aligned.
-
-
- /**
- * Function description.
- *
- * @param {string} lorem Description.
- * @param {int} sit Description multi words.
- * @param {string} sth Multi
- * line description.
- */
- const fn = ( lorem, sit ) => {}
- // "jsdoc/check-line-alignment": ["error"|"warn", "always"]
- // Message: Expected JSDoc block lines to be aligned.
- ````
-
- The following patterns are not considered problems:
-
- ````js
- /**
- * Function description.
- *
- * @param {string} lorem Description.
- * @param {int} sit Description multi words.
- */
- const fn = ( lorem, sit ) => {}
- // "jsdoc/check-line-alignment": ["error"|"warn", "always"]
-
- /**
- * With tabs.
- *
- * @param {string} lorem Description.
- * @param {int} sit Description multi words.
- */
- const fn = ( lorem, sit ) => {}
- // "jsdoc/check-line-alignment": ["error"|"warn", "always"]
-
- /**
- * Function description.
- *
- * @param {string} lorem - Description.
- * @param {int} sit - Description multi words.
- */
- const fn = ( lorem, sit ) => {}
- // "jsdoc/check-line-alignment": ["error"|"warn", "always"]
-
- /**
- * @param {string} lorem Description.
- * @param {int} sit
- */
- const fn = ( lorem, sit ) => {}
- // "jsdoc/check-line-alignment": ["error"|"warn", "always"]
-
- /**
- * @param {int} sit
- * @param {string} lorem Description.
- */
- const fn = ( lorem, sit ) => {}
- // "jsdoc/check-line-alignment": ["error"|"warn", "always"]
-
- /**
- * No params.
- */
- const fn = () => {}
- // "jsdoc/check-line-alignment": ["error"|"warn", "always"]
-
- const fn = ( lorem, sit ) => {}
- // "jsdoc/check-line-alignment": ["error"|"warn", "always"]
-
- /**
- * Function description.
- *
- * @param {string} lorem Description.
- * @param {int} sit Description multi words.
- */
- function fn( lorem, sit ) {}
- // "jsdoc/check-line-alignment": ["error"|"warn", "always"]
-
- const object = {
- /**
- * Function description.
- *
- * @param {string} lorem Description.
- * @param {int} sit Description multi words.
- */
- fn( lorem, sit ) {},
- }
- // "jsdoc/check-line-alignment": ["error"|"warn", "always"]
-
- class ClassName {
- /**
- * Function description.
- *
- * @param {string} lorem Description.
- * @param {int} sit Description multi words.
- */
- fn( lorem, sit ) {}
- }
- // "jsdoc/check-line-alignment": ["error"|"warn", "always"]
-
- /**
- * Function description.
- *
- * @arg {string} lorem Description.
- * @arg {int} sit Description multi words.
- */
- const fn = ( lorem, sit ) => {}
- // "jsdoc/check-line-alignment": ["error"|"warn", "always"]
-
- /**
- * @namespace
- * @property {object} defaults Description.
- * @property {int} defaults.lorem Description multi words.
- */
- const config = {
- defaults: {
- lorem: 1
- }
- }
- // "jsdoc/check-line-alignment": ["error"|"warn", "always"]
-
- /**
- * My object.
- *
- * @typedef {Object} MyObject
- *
- * @property {string} lorem Description.
- * @property {int} sit Description multi words.
- */
- // "jsdoc/check-line-alignment": ["error"|"warn", "always"]
-
- /**
- * My object.
- *
- * @typedef {Object} MyObject
- *
- * @property {{a: number, b: string, c}} lorem Description.
- * @property {Object.<string, Class>} sit Description multi words.
- * @property {Object.<string, Class>} amet Description} weird {multi} {{words}}.
- * @property {Object.<string, Class>} dolor
- */
- // "jsdoc/check-line-alignment": ["error"|"warn", "always"]
-
- /**
- * My object.
- *
- * @typedef {Object} MyObject
- *
- * @property {{a: number, b: string, c}} lorem Description.
- * @property {Object.<string, Class>} sit Description multi words.
- * @property {Object.<string, Class>} amet Description} weird {multi} {{words}}.
- * @property {Object.<string, Class>} dolor
- */
- // "jsdoc/check-line-alignment": ["error"|"warn", "always",{"tags":["typedef","property"]}]
-
- /**
- * My object.
- *
- * @template T
- * @template W,X,Y,Z
- * @template {string} K - K must be a string or string literal
- * @template {{ serious(): string }} Seriousalizable - must have a serious method
- *
- * @param {{a: number, b: string, c}} lorem Description.
- */
- // "jsdoc/check-line-alignment": ["error"|"warn", "always",{"tags":["template","param"]}]
-
- /** @param {number} lorem */
- const fn = ( lorem ) => {}
- // "jsdoc/check-line-alignment": ["error"|"warn", "always"]
-
- /**
- * Creates OS based shortcuts for files, folders, and applications.
- *
- * @param {object} options Options object for each OS.
- * @return {boolean} True = success, false = failed to create the icon
- */
- function quux () {}
- // "jsdoc/check-line-alignment": ["error"|"warn", "always"]
-
- /**
- * Creates OS based shortcuts for files, folders, and applications.
- *
- * @param {object} options Options object for each OS.
- * @return {boolean}
- */
- function quux () {}
- // "jsdoc/check-line-alignment": ["error"|"warn", "always"]
-
- /**
- * Only return doc.
- *
- * @return {boolean} Return description.
- */
- function quux () {}
- // "jsdoc/check-line-alignment": ["error"|"warn", "always"]
-
- /**
- * Not validating without option.
- *
- * @param {string} lorem Description.
- * @param {int} sit Description multi words.
- */
- const fn = ( lorem, sit ) => {}
-
- /**
- * Creates OS based shortcuts for files, folders, and applications.
- *
- * @param {object} options Options object for each OS.
- * @return {boolean} True = success, false = failed to create the icon
- */
- function quux (options) {}
-
- /**
- * Creates OS based shortcuts for files, folders, and applications.
- *
- * @param {object} options Options object for each OS.
- * @param {object} other Other.
- * @return True = success, false = failed to create the icon
- */
- function quux () {}
- // "jsdoc/check-line-alignment": ["error"|"warn", "never",{"tags":["param"]}]
-
- /**
- * @param parameter Description.
- */
- function func(parameter){
-
- }
-
- /**
- * Function description
- * description with post delimiter.
- *
- * @param {string} lorem Description.
- * @param {int} sit Description multi words.
- */
- const fn = ( lorem, sit ) => {}
- // "jsdoc/check-line-alignment": ["error"|"warn", "always",{"preserveMainDescriptionPostDelimiter":true}]
-
- /**
- * Function description.
- *
- * @param {string} lorem Description.
- * @param {int} sit Description multi words.
- *
- * @return {string} Return description.
- */
- const fn = ( lorem, sit ) => {}
- // "jsdoc/check-line-alignment": ["error"|"warn", "always",{"customSpacings":{"postDelimiter":2,"postTag":3,"postType":2}}]
-
- /**
- * Function description.
- *
- * @param {string} lorem Description.
- * @param {int} sit Description multi words.
- *
- * @return {string} Return description.
- */
- const fn = ( lorem, sit ) => {}
- // "jsdoc/check-line-alignment": ["error"|"warn", "never",{"customSpacings":{"postDelimiter":2,"postTag":3,"postType":2}}]
-
- /**
- * @param {{
- * ids: number[]
- * }} params
- */
- const fn = ({ids}) => {}
- // "jsdoc/check-line-alignment": ["error"|"warn", "always"]
-
-
- /**
- * Function description.
- *
- * @param {string} lorem Description.
- * @param {int} sit Description multi words.
- * @param {string} sth Multi
- * line description.
- */
- const fn = ( lorem, sit ) => {}
- // "jsdoc/check-line-alignment": ["error"|"warn", "always"]
- ````
-
-
- <a name="eslint-plugin-jsdoc-rules-check-param-names"></a>
- ### <code>check-param-names</code>
-
- Ensures that parameter names in JSDoc match those in the function declaration.
-
- <a name="eslint-plugin-jsdoc-rules-check-param-names-destructuring"></a>
- #### Destructuring
-
- Note that by default the rule will not report parameters present on the docs
- but non-existing on the function signature when an object rest property is part
- of that function signature since the seemingly non-existing properties might
- actually be a part of the object rest property.
-
- ```js
- /**
- * @param options
- * @param options.foo
- */
- function quux ({foo, ...extra}) {}
- ```
-
- To require that `extra` be documented--and that any extraneous properties
- get reported--e.g., if there had been a `@param options.bar` above--you
- can use the `checkRestProperty` option which insists that the rest
- property be documented (and that there be no other implicit properties).
- Note, however, that jsdoc [does not appear](https://github.com/jsdoc/jsdoc/issues/1773)
- to currently support syntax or output to distinguish rest properties from
- other properties, so in looking at the docs alone without looking at the
- function signature, the disadvantage of enabling this option is that it
- may appear that there is an actual property named `extra`.
-
- <a name="eslint-plugin-jsdoc-rules-check-param-names-options-4"></a>
- #### Options
-
- <a name="eslint-plugin-jsdoc-rules-check-param-names-options-4-checkrestproperty"></a>
- ##### <code>checkRestProperty</code>
-
- See the "Destructuring" section. Defaults to `false`.
-
- <a name="eslint-plugin-jsdoc-rules-check-param-names-options-4-checktypespattern"></a>
- ##### <code>checkTypesPattern</code>
-
- See `require-param` under the option of the same name.
-
- <a name="eslint-plugin-jsdoc-rules-check-param-names-options-4-enablefixer"></a>
- ##### <code>enableFixer</code>
-
- Set to `true` to auto-remove `@param` duplicates (based on identical
- names).
-
- Note that this option will remove duplicates of the same name even if
- the definitions do not match in other ways (e.g., the second param will
- be removed even if it has a different type or description).
-
- <a name="eslint-plugin-jsdoc-rules-check-param-names-options-4-allowextratrailingparamdocs"></a>
- ##### <code>allowExtraTrailingParamDocs</code>
-
- If set to `true`, this option will allow extra `@param` definitions (e.g.,
- representing future expected or virtual params) to be present without needing
- their presence within the function signature. Other inconsistencies between
- `@param`'s and present function parameters will still be reported.
-
- <a name="eslint-plugin-jsdoc-rules-check-param-names-options-4-checkdestructured"></a>
- ##### <code>checkDestructured</code>
-
- Whether to check destructured properties. Defaults to `true`.
-
- <a name="eslint-plugin-jsdoc-rules-check-param-names-options-4-usedefaultobjectproperties"></a>
- ##### <code>useDefaultObjectProperties</code>
-
- Set to `true` if you wish to avoid reporting of child property documentation
- where instead of destructuring, a whole plain object is supplied as default
- value but you wish its keys to be considered as signalling that the properties
- are present and can therefore be documented. Defaults to `false`.
-
- <a name="eslint-plugin-jsdoc-rules-check-param-names-options-4-disableextrapropertyreporting"></a>
- ##### <code>disableExtraPropertyReporting</code>
-
- Whether to check for extra destructured properties. Defaults to `false`. Change
- to `true` if you want to be able to document properties which are not actually
- destructured. Keep as `false` if you expect properties to be documented in
- their own types. Note that extra properties will always be reported if another
- item at the same level is destructured as destructuring will prevent other
- access and this option is only intended to permit documenting extra properties
- that are available and actually used in the function.
-
- |||
- |---|---|
- |Context|`ArrowFunctionExpression`, `FunctionDeclaration`, `FunctionExpression`|
- |Options|`allowExtraTrailingParamDocs`, `checkDestructured`, `checkRestProperty`, `checkTypesPattern`, `useDefaultObjectProperties`, `disableExtraPropertyReporting`|
- |Tags|`param`|
- |Aliases|`arg`, `argument`|
- |Recommended|true|
- The following patterns are considered problems:
-
- ````js
- /**
- * @param Foo
- */
- function quux (foo = 'FOO') {
-
- }
- // Message: Expected @param names to be "foo". Got "Foo".
-
- /**
- * @arg Foo
- */
- function quux (foo = 'FOO') {
-
- }
- // Settings: {"jsdoc":{"tagNamePreference":{"param":"arg"}}}
- // Message: Expected @arg names to be "foo". Got "Foo".
-
- /**
- * @param Foo
- */
- function quux (foo) {
-
- }
- // Message: Expected @param names to be "foo". Got "Foo".
-
- /**
- * @param Foo.Bar
- */
- function quux (foo) {
-
- }
- // Message: @param path declaration ("Foo.Bar") appears before any real parameter.
-
- /**
- * @param foo
- * @param Foo.Bar
- */
- function quux (foo) {
-
- }
- // Message: @param path declaration ("Foo.Bar") root node name ("Foo") does not match previous real parameter name ("foo").
-
- /**
- * Assign the project to a list of employees.
- * @param {string} employees[].name - The name of an employee.
- * @param {string} employees[].department - The employee's department.
- */
- function assign (employees) {
-
- };
- // Message: @param path declaration ("employees[].name") appears before any real parameter.
-
- /**
- * Assign the project to a list of employees.
- * @param {string} employees[].name - The name of an employee.
- * @param {string} employees[].name - The employee's department.
- */
- function assign (employees) {
-
- };
- // "jsdoc/check-param-names": ["error"|"warn", {"enableFixer":true}]
- // Message: Duplicate @param "employees[].name"
-
- /**
- * @param foo
- * @param foo.bar
- * @param bar
- */
- function quux (bar, foo) {
-
- }
- // Message: Expected @param names to be "bar, foo". Got "foo, bar".
-
- /**
- * @param foo
- * @param bar
- */
- function quux (foo) {
-
- }
- // Message: @param "bar" does not match an existing function parameter.
-
- /**
- * @param foo
- * @param foo
- */
- function quux (foo) {
-
- }
- // "jsdoc/check-param-names": ["error"|"warn", {"enableFixer":true}]
- // Message: Duplicate @param "foo"
-
- class bar {
- /**
- * @param foo
- * @param foo
- */
- quux (foo) {
-
- }
- }
- // "jsdoc/check-param-names": ["error"|"warn", {"enableFixer":true}]
- // Message: Duplicate @param "foo"
-
- /**
- * @param foo
- * @param foo
- */
- function quux (foo, bar) {
-
- }
- // "jsdoc/check-param-names": ["error"|"warn", {"enableFixer":true}]
- // Message: Duplicate @param "foo"
-
- /**
- * @param foo
- * @param foo
- */
- function quux (foo, foo) {
-
- }
- // "jsdoc/check-param-names": ["error"|"warn", {"enableFixer":true}]
- // Message: Duplicate @param "foo"
-
- /**
- * @param cfg
- * @param cfg.foo
- * @param cfg.foo
- */
- function quux ({foo}) {
-
- }
- // "jsdoc/check-param-names": ["error"|"warn", {"enableFixer":true}]
- // Message: Duplicate @param "cfg.foo"
-
- /**
- * @param cfg
- * @param cfg.foo
- * @param cfg.foo
- */
- function quux ({foo}) {
-
- }
- // Message: Duplicate @param "cfg.foo"
-
- /**
- * @param cfg
- * @param cfg.foo
- */
- function quux ({foo, bar}) {
-
- }
- // Message: Missing @param "cfg.bar"
-
- /**
- * @param cfg
- * @param cfg.foo
- * @param [cfg.foo]
- * @param baz
- */
- function quux ({foo}, baz) {
-
- }
- // "jsdoc/check-param-names": ["error"|"warn", {"enableFixer":true}]
- // Message: Duplicate @param "cfg.foo"
-
- /**
- * @param cfg
- * @param cfg.foo
- * @param [cfg.foo="with a default"]
- * @param baz
- */
- function quux ({foo, bar}, baz) {
-
- }
- // Message: Missing @param "cfg.bar"
-
- /**
- * @param cfg
- * @param cfg.foo
- * @param [cfg.foo="with a default"]
- * @param baz
- */
- function quux ({foo}, baz) {
-
- }
- // "jsdoc/check-param-names": ["error"|"warn", {"enableFixer":true}]
- // Message: Duplicate @param "cfg.foo"
-
- /**
- * @param cfg
- * @param [cfg.foo="with a default"]
- * @param baz
- */
- function quux ({foo, bar}, baz) {
-
- }
- // Message: Missing @param "cfg.bar"
-
- /**
- * @param args
- */
- function quux ({a, b}) {
-
- }
- // Message: Missing @param "args.a"
-
- /**
- * @param args
- */
- function quux ({a, b} = {}) {
-
- }
- // Message: Missing @param "args.a"
-
- export class SomeClass {
- /**
- * @param prop
- */
- constructor(private property: string) {}
- }
- // Message: Expected @param names to be "property". Got "prop".
-
- export class SomeClass {
- /**
- * @param prop
- * @param prop.foo
- */
- constructor(prop: { foo: string, bar: string }) {}
- }
- // Message: Missing @param "prop.bar"
-
- export class SomeClass {
- /**
- * @param prop
- * @param prop.foo
- * @param prop.bar
- */
- constructor(options: { foo: string, bar: string }) {}
- }
- // Message: @param "prop" does not match parameter name "options"
-
- export class SomeClass {
- /**
- * @param options
- * @param options.foo
- * @param options.bar
- */
- constructor(options: { foo: string }) {}
- }
- // Message: @param "options.bar" does not exist on options
-
- /**
- * @param foo
- */
- function quux (foo) {
-
- }
- // Settings: {"jsdoc":{"tagNamePreference":{"param":false}}}
- // Message: Unexpected tag `@param`
-
- /**
- * @param {Error} error Exit code
- * @param {number} [code = 1] Exit code
- */
- function quux (error, cde = 1) {
- };
- // Message: Expected @param names to be "error, cde". Got "error, code".
-
- /**
- * @param foo
- */
- function quux ([a, b] = []) {
-
- }
- // Message: Missing @param "foo."0""
-
- /**
- * @param options
- * @param options.foo
- */
- function quux ({foo, ...extra}) {
- }
- // "jsdoc/check-param-names": ["error"|"warn", {"checkRestProperty":true}]
- // Message: Missing @param "options.extra"
-
- /**
- * @param cfg
- * @param cfg.foo
- * @param cfg.bar
- * @param cfg.extra
- */
- function quux ({foo, ...extra}) {
-
- }
- // "jsdoc/check-param-names": ["error"|"warn", {"checkRestProperty":true}]
- // Message: @param "cfg.bar" does not exist on cfg
-
- /**
- * Converts an SVGRect into an object.
- * @param {SVGRect} bbox - a SVGRect
- */
- const bboxToObj = function ({x, y, width, height}) {
- return {x, y, width, height};
- };
- // "jsdoc/check-param-names": ["error"|"warn", {"checkTypesPattern":"SVGRect"}]
- // Message: Missing @param "bbox.x"
-
- /**
- * Converts an SVGRect into an object.
- * @param {object} bbox - a SVGRect
- */
- const bboxToObj = function ({x, y, width, height}) {
- return {x, y, width, height};
- };
- // Message: Missing @param "bbox.x"
-
- module.exports = class GraphQL {
- /**
- * @param fetchOptions
- * @param cacheKey
- */
- fetch = ({ url, ...options }, cacheKey) => {
- }
- };
- // "jsdoc/check-param-names": ["error"|"warn", {"checkRestProperty":true}]
- // Message: Missing @param "fetchOptions.url"
-
- /**
- * Testing
- *
- * @param options
- * @param options.one One
- * @param options.two Two
- * @param options.four Four
- */
- function testingEslint(options: {
- one: string;
- two: string;
- three: string;
- }): string {
- return one + two + three;
- }
- // Message: Missing @param "options.three"
-
- /**
- *
- */
- function quux() {
-
- }
- // Settings: {"jsdoc":{"structuredTags":{"see":{"name":false,"required":["name"]}}}}
- // Message: Cannot add "name" to `require` with the tag's `name` set to `false`
-
- /**
- * @param root
- * @param foo
- */
- function quux ({foo, bar}, baz) {
-
- }
- // "jsdoc/check-param-names": ["error"|"warn", {"checkDestructured":false}]
- // Message: Expected @param names to be "root, baz". Got "root, foo".
-
- /**
- * Description.
- * @param {Object} options
- * @param {FooBar} foo
- */
- function quux ({ foo: { bar } }) {}
- // Message: Missing @param "options.foo"
-
- /**
- * Description.
- * @param {Object} options
- * @param options.foo
- */
- function quux ({ foo: { bar } }) {}
- // Message: Missing @param "options.foo.bar"
-
- /**
- * Description.
- * @param {object} options Options.
- * @param {object} options.foo A description.
- * @param {object} options.foo.bar
- */
- function foo({ foo: { bar: { baz } }}) {}
- // Message: Missing @param "options.foo.bar.baz"
-
- /**
- * Returns a number.
- * @param {Object} props Props.
- * @param {Object} props.prop Prop.
- * @param {string} props.prop.a String.
- * @param {string} props.prop.b String.
- * @return {number} A number.
- */
- export function testFn1 ({ prop = { a: 1, b: 2 } }) {
- }
- // "jsdoc/check-param-names": ["error"|"warn", {"useDefaultObjectProperties":false}]
- // Message: @param "props.prop.a" does not exist on props
-
- /**
- * @param {object} cfg
- * @param {string} cfg.foo
- * @param {string} cfg.bar
- * @param {object} cfg.extra
- */
- function quux ({foo}) {
-
- }
- // Message: @param "cfg.bar" does not exist on cfg
-
- /**
- * @param {object} cfg
- * @param {string} cfg.foo
- * @param {string} cfg.bar
- * @param {object} cfg.extra
- */
- function quux ({foo}) {
-
- }
- // "jsdoc/check-param-names": ["error"|"warn", {"disableExtraPropertyReporting":true}]
- // Message: @param "cfg.bar" does not exist on cfg
-
- /**
- * @param {object} root
- * @param {object} root.cfg
- * @param {object} root.cfg.a
- * @param {string} root.cfg.a.foo
- * @param {string} root.cfg.a.bar
- * @param {object} root.cfg.a.extra
- */
- function quux ({cfg: {a: {foo}}}) {
-
- }
- // Message: @param "root.cfg.a.bar" does not exist on root
-
- /**
- * @param {object} root
- * @param {object} root.cfg
- * @param {object} root.cfg.a
- * @param {string} root.cfg.a.foo
- * @param {string} root.cfg.a.bar
- * @param {object} root.cfg.a.extra
- */
- function quux ({cfg: {a: {foo}}}) {
-
- }
- // "jsdoc/check-param-names": ["error"|"warn", {"disableExtraPropertyReporting":true}]
- // Message: @param "root.cfg.a.bar" does not exist on root
-
- /**
- * @param {object} root
- * @param {object} root.cfg
- * @param {string} root.cfg.foo
- * @param {string} root.cfg.bar
- * @param {object} root.cfg.extra
- */
- function quux ({cfg}) {
-
- }
- // Message: @param "root.cfg.foo" does not exist on root
-
- /**
- * @param foo
- * @param foo
- * on another line
- */
- function quux (foo) {
-
- }
- // "jsdoc/check-param-names": ["error"|"warn", {"enableFixer":true}]
- // Message: Duplicate @param "foo"
- ````
-
- The following patterns are not considered problems:
-
- ````js
- /**
- *
- */
- function quux (foo) {
-
- }
-
- /**
- * @param foo
- */
- function quux (foo) {
-
- }
-
- /**
- * @param foo
- * @param bar
- */
- function quux (foo, bar) {
-
- }
-
- /**
- * @param foo
- * @param bar
- */
- function quux (foo, bar, baz) {
-
- }
-
- /**
- * @param foo
- * @param foo.foo
- * @param bar
- */
- function quux (foo, bar) {
-
- }
-
- /**
- * @param args
- */
- function quux (...args) {
-
- }
-
- /**
- * @param foo
- * @param foo.a
- * @param foo.b
- */
- function quux ({a, b}) {
-
- }
-
- /**
- * @param foo
- * @param foo.a
- * @param foo.b
- */
- function quux ({"a": A, b}) {
-
- }
-
- /**
- * @param foo
- * @param foo."a"
- * @param foo.b
- */
- function quux ({a: A, b}) {
-
- }
-
- /**
- * @param foo
- * @param foo."a-b"
- * @param foo.b
- */
- function quux ({"a-b": A, b}) {
-
- }
-
- /**
- * @param foo
- * @param foo.bar
- * @param foo.baz
- * @param bar
- */
- function quux (foo, bar) {
-
- }
-
- /**
- * Assign the project to a list of employees.
- * @param {object[]} employees - The employees who are responsible for the project.
- * @param {string} employees[].name - The name of an employee.
- * @param {string} employees[].department - The employee's department.
- */
- function assign (employees) {
-
- };
-
- export class SomeClass {
- /**
- * @param property
- */
- constructor(private property: string) {}
- }
-
- export class SomeClass {
- /**
- * @param options
- * @param options.foo
- * @param options.bar
- */
- constructor(options: { foo: string, bar: string }) {}
- }
-
- export class SomeClass {
- /**
- * @param options
- * @param options.foo
- * @param options.bar
- */
- constructor({ foo, bar }: { foo: string, bar: string }) {}
- }
-
- export class SomeClass {
- /**
- * @param options
- * @param options.foo
- * @param options.bar
- */
- constructor({ foo, bar }: { foo: string, bar: string }) {}
- }
-
- /**
- * @param {Error} error Exit code
- * @param {number} [code = 1] Exit code
- */
- function quux (error, code = 1) {
- };
-
- /**
- * @param foo
- * @param bar
- */
- function quux (foo) {
-
- }
- // "jsdoc/check-param-names": ["error"|"warn", {"allowExtraTrailingParamDocs":true}]
-
- /**
- * @param cfg
- * @param cfg.foo
- * @param baz
- */
- function quux ({foo}, baz) {
-
- }
-
- /**
- * @param cfg
- * @param cfg.foo
- * @param cfg2
- */
- function quux ({foo}, cfg2) {
-
- }
-
- /**
- * @param cfg
- * @param cfg.foo
- * @param baz
- * @param baz.cfg
- */
- function quux ({foo}, {cfg}) {
-
- }
-
- /**
- * @param options
- * @param options.foo
- */
- function quux ({foo, ...extra}) {
- }
-
- /**
- * @param foo
- * @param bar
- */
- function quux (foo, bar, ...extra) {
-
- }
-
- /**
- * Converts an SVGRect into an object.
- * @param {SVGRect} bbox - a SVGRect
- */
- const bboxToObj = function ({x, y, width, height}) {
- return {x, y, width, height};
- };
-
- /**
- * Converts an SVGRect into an object.
- * @param {SVGRect} bbox - a SVGRect
- */
- const bboxToObj = function ({x, y, width, height}) {
- return {x, y, width, height};
- };
-
- /**
- * Converts an SVGRect into an object.
- * @param {object} bbox - a SVGRect
- */
- const bboxToObj = function ({x, y, width, height}) {
- return {x, y, width, height};
- };
- // "jsdoc/check-param-names": ["error"|"warn", {"checkTypesPattern":"SVGRect"}]
-
- class CSS {
- /**
- * Set one or more CSS properties for the set of matched elements.
- *
- * @param {Object} propertyObject - An object of property-value pairs to set.
- */
- setCssObject(propertyObject: {[key: string]: string | number}): void {
- }
- }
-
- /**
- * Logs a string.
- *
- * @param input - String to output.
- */
- export default function (input: {
- [foo: string]: { a: string; b: string };
- }): void {
- input;
- }
-
- export class Thing {
- foo: any;
-
- /**
- * @param {} C
- */
- constructor(C: { new (): any }) {
- this.foo = new C();
- }
- }
-
- /**
- * @param foo
- * @param root
- */
- function quux (foo, {bar}) {
-
- }
- // "jsdoc/check-param-names": ["error"|"warn", {"checkDestructured":false}]
-
- class A {
- /**
- * Show a prompt.
- * @param hideButton true if button should be hidden, false otherwise
- * @param onHidden delegate to call when the prompt is hidden
- */
- public async showPrompt(hideButton: boolean, onHidden: {(): void}): Promise<void>
- {
- }
- }
-
- /**
- * Description.
- * @param {Object} options Options.
- * @param {FooBar} options.foo foo description.
- */
- function quux ({ foo: { bar }}) {}
-
- /**
- * Description.
- * @param {FooBar} options
- * @param {Object} options.foo
- */
- function quux ({ foo: { bar } }) {}
- // "jsdoc/check-param-names": ["error"|"warn", {"checkTypesPattern":"FooBar"}]
-
- /**
- * Description.
- * @param {Object} options
- * @param {FooBar} options.foo
- * @param {FooBar} options.baz
- */
- function quux ({ foo: { bar }, baz: { cfg } }) {}
-
- /**
- * Item
- *
- * @param {object} props
- * @param {object} props.data - case data
- * @param {string} props.data.className - additional css class
- * @param props.val
- */
- export default function Item({
- data: {
- className,
- } = {},
- val = 4
- }) {
- }
-
- /**
- * @param obj
- * @param obj.data
- * @param obj.data."0"
- * @param obj.data."1"
- * @param obj.data."2"
- * @param obj.defaulting
- * @param obj.defaulting."0"
- * @param obj.defaulting."1"
- */
- function Item({
- data: [foo, bar, ...baz],
- defaulting: [quux, xyz] = []
- }) {
- }
-
- /**
- * Returns a number.
- * @param {Object} props Props.
- * @param {Object} props.prop Prop.
- * @param {string} props.prop.a String.
- * @param {string} props.prop.b String.
- * @return {number} A number.
- */
- export function testFn1 ({ prop = { a: 1, b: 2 } }) {
- }
- // "jsdoc/check-param-names": ["error"|"warn", {"useDefaultObjectProperties":true}]
-
- /**
- * @param {object} root
- * @param {object} root.cfg
- * @param {string} root.cfg.foo
- * @param {string} root.cfg.bar
- * @param {object} root.cfg.extra
- */
- function quux ({cfg}) {
-
- }
- // "jsdoc/check-param-names": ["error"|"warn", {"disableExtraPropertyReporting":true}]
-
- class A {
- /**
- * @param cfg
- * @param cfg.abc
- */
- constructor({
- [new.target.prop]: cX,
- abc
- }) {
- }
- }
-
- /**
- * @param root
- * @param root."0" Ignored
- * @param root."1" Our "b"
- */
- const foo = ([, b]) => b;
- ````
-
-
- <a name="eslint-plugin-jsdoc-rules-check-property-names"></a>
- ### <code>check-property-names</code>
-
- Ensures that property names in JSDoc are not duplicated on the same block
- and that nested properties have defined roots.
-
- <a name="eslint-plugin-jsdoc-rules-check-property-names-options-5"></a>
- #### Options
-
- <a name="eslint-plugin-jsdoc-rules-check-property-names-options-5-enablefixer-1"></a>
- ##### <code>enableFixer</code>
-
- Set to `true` to auto-remove `@property` duplicates (based on
- identical names).
-
- Note that this option will remove duplicates of the same name even if
- the definitions do not match in other ways (e.g., the second property will
- be removed even if it has a different type or description).
-
- |||
- |---|---|
- |Context|Everywhere|
- |Options|`enableFixer`|
- |Tags|`property`|
- |Aliases|`prop`|
- |Recommended|true|
-
- The following patterns are considered problems:
-
- ````js
- /**
- * @typedef (SomeType) SomeTypedef
- * @property Foo.Bar
- */
- // Message: @property path declaration ("Foo.Bar") appears before any real property.
-
- /**
- * @typedef (SomeType) SomeTypedef
- * @property foo
- * @property Foo.Bar
- */
- // Message: @property path declaration ("Foo.Bar") root node name ("Foo") does not match previous real property name ("foo").
-
- /**
- * Assign the project to a list of employees.
- * @typedef (SomeType) SomeTypedef
- * @property {string} employees[].name - The name of an employee.
- * @property {string} employees[].department - The employee's department.
- */
- // Message: @property path declaration ("employees[].name") appears before any real property.
-
- /**
- * Assign the project to a list of employees.
- * @typedef (SomeType) SomeTypedef
- * @property {string} employees[].name - The name of an employee.
- * @property {string} employees[].name - The employee's department.
- */
- // "jsdoc/check-property-names": ["error"|"warn", {"enableFixer":true}]
- // Message: Duplicate @property "employees[].name"
-
- /**
- * @typedef (SomeType) SomeTypedef
- * @property foo
- * @property foo
- */
- // "jsdoc/check-property-names": ["error"|"warn", {"enableFixer":true}]
- // Message: Duplicate @property "foo"
-
- /**
- * @typedef (SomeType) SomeTypedef
- * @property foo
- * @property foo
- */
- // Message: Duplicate @property "foo"
-
- /**
- * @typedef (SomeType) SomeTypedef
- * @property cfg
- * @property cfg.foo
- * @property cfg.foo
- */
- function quux ({foo, bar}) {
-
- }
- // "jsdoc/check-property-names": ["error"|"warn", {"enableFixer":true}]
- // Message: Duplicate @property "cfg.foo"
-
- class Test {
- /**
- * @typedef (SomeType) SomeTypedef
- * @property cfg
- * @property cfg.foo
- * @property cfg.foo
- */
- quux ({foo, bar}) {
-
- }
- }
- // "jsdoc/check-property-names": ["error"|"warn", {"enableFixer":true}]
- // Message: Duplicate @property "cfg.foo"
-
- /**
- * @typedef (SomeType) SomeTypedef
- * @property cfg
- * @property cfg.foo
- * @property [cfg.foo]
- * @property baz
- */
- function quux ({foo, bar}, baz) {
-
- }
- // "jsdoc/check-property-names": ["error"|"warn", {"enableFixer":true}]
- // Message: Duplicate @property "cfg.foo"
-
- /**
- * @typedef (SomeType) SomeTypedef
- * @property cfg
- * @property cfg.foo
- * @property [cfg.foo="with a default"]
- * @property baz
- */
- function quux ({foo, bar}, baz) {
-
- }
- // "jsdoc/check-property-names": ["error"|"warn", {"enableFixer":true}]
- // Message: Duplicate @property "cfg.foo"
-
- /**
- * @typedef (SomeType) SomeTypedef
- * @prop foo
- * @prop foo
- */
- // Settings: {"jsdoc":{"tagNamePreference":{"property":"prop"}}}
- // "jsdoc/check-property-names": ["error"|"warn", {"enableFixer":true}]
- // Message: Duplicate @prop "foo"
-
- /**
- * @typedef (SomeType) SomeTypedef
- * @property foo
- */
- // Settings: {"jsdoc":{"tagNamePreference":{"property":false}}}
- // Message: Unexpected tag `@property`
- ````
-
- The following patterns are not considered problems:
-
- ````js
- /**
- *
- */
-
- /**
- * @typedef (SomeType) SomeTypedef
- * @property foo
- */
-
- /**
- * @typedef (SomeType) SomeTypedef
- * @prop foo
- */
-
- /**
- * @typedef (SomeType) SomeTypedef
- * @property foo
- * @property bar
- */
-
- /**
- * @typedef (SomeType) SomeTypedef
- * @property foo
- * @property foo.foo
- * @property bar
- */
-
- /**
- * Assign the project to a list of employees.
- * @typedef (SomeType) SomeTypedef
- * @property {object[]} employees - The employees who are responsible for the project.
- * @property {string} employees[].name - The name of an employee.
- * @property {string} employees[].department - The employee's department.
- */
-
- /**
- * @typedef (SomeType) SomeTypedef
- * @property {Error} error Exit code
- * @property {number} [code = 1] Exit code
- */
-
- /**
- * @namespace (SomeType) SomeNamespace
- * @property {Error} error Exit code
- * @property {number} [code = 1] Exit code
- */
-
- /**
- * @class
- * @property {Error} error Exit code
- * @property {number} [code = 1] Exit code
- */
- function quux (code = 1) {
- this.error = new Error('oops');
- this.code = code;
- }
-
- /**
- * @typedef (SomeType) SomeTypedef
- * @property foo
- * @property foo.bar
- * @property foo.baz
- * @property bar
- */
- ````
-
-
- <a name="eslint-plugin-jsdoc-rules-check-syntax"></a>
- ### <code>check-syntax</code>
-
- Reports against syntax not encouraged for the mode (e.g., Google Closure
- Compiler in "jsdoc" or "typescript" mode). Note that this rule will not check
- for types that are wholly invalid for a given mode, as that is covered by
- `valid-types`.
-
- Currently checks against:
-
- - Use of `=` in "jsdoc" or "typescript" mode
-
- Note that "jsdoc" actually allows Closure syntax, but with another
- option available for optional parameters (enclosing the name in brackets), the
- rule is enforced (except under "permissive" and "closure" modes).
-
- |||
- |---|---|
- |Context|everywhere|
- |Tags|N/A|
- |Recommended|false|
-
- The following patterns are considered problems:
-
- ````js
- /**
- * @param {string=} foo
- */
- function quux (foo) {
-
- }
- // Message: Syntax should not be Google Closure Compiler style.
- ````
-
- The following patterns are not considered problems:
-
- ````js
- /**
- * @param {string=} foo
- */
- function quux (foo) {
-
- }
- // Settings: {"jsdoc":{"mode":"closure"}}
-
- /**
- * @param {string} [foo]
- */
- function quux (foo) {
-
- }
-
- /**
- *
- */
- function quux (foo) {
-
- }
- ````
-
-
- <a name="eslint-plugin-jsdoc-rules-check-tag-names"></a>
- ### <code>check-tag-names</code>
-
- Reports invalid block tag names.
-
- Valid [JSDoc 3 Block Tags](https://jsdoc.app/#block-tags) are:
-
- ```
- abstract
- access
- alias
- async
- augments
- author
- borrows
- callback
- class
- classdesc
- constant
- constructs
- copyright
- default
- deprecated
- description
- enum
- event
- example
- exports
- external
- file
- fires
- function
- generator
- global
- hideconstructor
- ignore
- implements
- inheritdoc
- inner
- instance
- interface
- kind
- lends
- license
- listens
- member
- memberof
- memberof!
- mixes
- mixin
- module
- name
- namespace
- override
- package
- param
- private
- property
- protected
- public
- readonly
- requires
- returns
- see
- since
- static
- summary
- this
- throws
- todo
- tutorial
- type
- typedef
- variation
- version
- yields
- ```
-
- `modifies` is also supported (see [source](https://github.com/jsdoc/jsdoc/blob/master/packages/jsdoc/lib/jsdoc/tag/dictionary/definitions.js#L594))
- but is undocumented.
-
- The following synonyms are also recognized if you set them in
- `tagNamePreference` as a key (or replacement):
-
- ```
- arg
- argument
- const
- constructor
- defaultvalue
- desc
- emits
- exception
- extends
- fileoverview
- func
- host
- method
- overview
- prop
- return
- var
- virtual
- yield
- ```
-
- If you wish to allow in certain cases both a primary tag name and its
- alias(es), you can set a normally non-preferred tag name to itself to indicate
- that you want to allow both the default tag (in this case `@returns`) and a
- non-default (in this case `return`):
-
- ```js
- "tagNamePreference": {
- "return": "return",
- }
- ```
-
- Because the tags indicated as replacements in
- `settings.jsdoc.tagNamePreference` will automatically be considered as valid,
- the above works.
-
- Likewise are the tag keys of `settings.jsdoc.structuredTags` automatically
- considered as valid (as their defining an expected structure for tags implies
- the tags may be used).
-
- For [TypeScript](https://www.typescriptlang.org/docs/handbook/type-checking-javascript-files.html#supported-jsdoc)
- (or Closure), when `settings.jsdoc.mode` is set to `typescript` or `closure`,
- one may also use the following:
-
- ```
- template
- ```
-
- And for [Closure](https://github.com/google/closure-compiler/wiki/Annotating-JavaScript-for-the-Closure-Compiler),
- when `settings.jsdoc.mode` is set to `closure`, one may use the following (in
- addition to the jsdoc and TypeScript tags–though replacing `returns` with
- `return`):
-
- ```
- define (synonym of `const` per jsdoc source)
- dict
- export
- externs
- final
- implicitCast (casing distinct from that recognized by jsdoc internally)
- inheritDoc (casing distinct from that recognized by jsdoc internally)
- noalias
- nocollapse
- nocompile
- noinline
- nosideeffects
- polymer
- polymerBehavior
- preserve
- record (synonym of `interface` per jsdoc source)
- struct
- suppress
- unrestricted
- ```
-
- ...and these undocumented tags which are only in [source](https://github.com/google/closure-compiler/blob/master/src/com/google/javascript/jscomp/parsing/Annotation.java):
-
- ```
- closurePrimitive
- customElement
- expose
- hidden
- idGenerator
- meaning
- mixinClass
- mixinFunction
- ngInject
- owner
- typeSummary
- wizaction
- ```
-
- <a name="eslint-plugin-jsdoc-rules-check-tag-names-options-6"></a>
- #### Options
-
- <a name="eslint-plugin-jsdoc-rules-check-tag-names-options-6-definedtags"></a>
- ##### <code>definedTags</code>
-
- Use an array of `definedTags` strings to configure additional, allowed tags.
- The format is as follows:
-
- ```json
- {
- "definedTags": ["note", "record"]
- }
- ```
-
- <a name="eslint-plugin-jsdoc-rules-check-tag-names-jsxtags"></a>
- #### <code>jsxTags</code>
-
- If this is set to `true`, all of the following tags used to control JSX output are allowed:
-
- ```
- jsx
- jsxFrag
- jsxImportSource
- jsxRuntime
- ```
-
- For more information, see the [babel documentation](https://babeljs.io/docs/en/babel-plugin-transform-react-jsx).
-
-
- |||
- |---|---|
- |Context|everywhere|
- |Tags|N/A|
- |Recommended|true|
- |Options|`definedTags`|
- |Settings|`tagNamePreference`, `mode`|
-
- The following patterns are considered problems:
-
- ````js
- /** @typoo {string} */
- let a;
- // Message: Invalid JSDoc tag name "typoo".
-
- /** @typoo {string} */
- let a;
- // Settings: {"jsdoc":{"structuredTags":{"parameter":{"name":"namepath-referencing","required":["type","name"],"type":true}}}}
- // Message: Invalid JSDoc tag name "typoo".
-
- /**
- * @Param
- */
- function quux () {
-
- }
- // Message: Invalid JSDoc tag name "Param".
-
- /**
- * @foo
- */
- function quux () {
-
- }
- // Message: Invalid JSDoc tag name "foo".
-
- /**
- * @arg foo
- */
- function quux (foo) {
-
- }
- // Message: Invalid JSDoc tag (preference). Replace "arg" JSDoc tag with "param".
-
- /**
- * @param foo
- */
- function quux (foo) {
-
- }
- // Settings: {"jsdoc":{"tagNamePreference":{"param":"arg"}}}
- // Message: Invalid JSDoc tag (preference). Replace "param" JSDoc tag with "arg".
-
- /**
- * @constructor foo
- */
- function quux (foo) {
-
- }
- // Settings: {"jsdoc":{"tagNamePreference":{"tag constructor":"cons"}}}
- // Message: Invalid JSDoc tag (preference). Replace "constructor" JSDoc tag with "cons".
-
- /**
- * @arg foo
- */
- function quux (foo) {
-
- }
- // Settings: {"jsdoc":{"tagNamePreference":{"arg":"somethingDifferent"}}}
- // Message: Invalid JSDoc tag (preference). Replace "arg" JSDoc tag with "somethingDifferent".
-
- /**
- * @param foo
- */
- function quux (foo) {
-
- }
- // Settings: {"jsdoc":{"tagNamePreference":{"param":"parameter"}}}
- // Message: Invalid JSDoc tag (preference). Replace "param" JSDoc tag with "parameter".
-
- /**
- * @bar foo
- */
- function quux (foo) {
-
- }
- // Message: Invalid JSDoc tag name "bar".
-
- /**
- * @baz @bar foo
- */
- function quux (foo) {
-
- }
- // "jsdoc/check-tag-names": ["error"|"warn", {"definedTags":["bar"]}]
- // Message: Invalid JSDoc tag name "baz".
-
- /**
- * @bar
- * @baz
- */
- function quux (foo) {
-
- }
- // "jsdoc/check-tag-names": ["error"|"warn", {"definedTags":["bar"]}]
- // Message: Invalid JSDoc tag name "baz".
-
- /**
- * @todo
- */
- function quux () {
-
- }
- // Settings: {"jsdoc":{"tagNamePreference":{"todo":false}}}
- // Message: Blacklisted tag found (`@todo`)
-
- /**
- * @todo
- */
- function quux () {
-
- }
- // Settings: {"jsdoc":{"tagNamePreference":{"todo":{"message":"Please resolve to-dos or add to the tracker"}}}}
- // Message: Please resolve to-dos or add to the tracker
-
- /**
- * @todo
- */
- function quux () {
-
- }
- // Settings: {"jsdoc":{"tagNamePreference":{"todo":{"message":"Please use x-todo instead of todo","replacement":"x-todo"}}}}
- // Message: Please use x-todo instead of todo
-
- /**
- * @todo
- */
- function quux () {
-
- }
- // Settings: {"jsdoc":{"tagNamePreference":{"todo":{"message":"Please use x-todo instead of todo","replacement":"x-todo"}}}}
- // Message: Please use x-todo instead of todo
-
- /**
- * @todo
- */
- function quux () {
-
- }
- // Settings: {"jsdoc":{"tagNamePreference":{"todo":55}}}
- // Message: Invalid `settings.jsdoc.tagNamePreference`. Values must be falsy, a string, or an object.
-
- /**
- * @property {object} a
- * @prop {boolean} b
- */
- function quux () {
-
- }
- // Message: Invalid JSDoc tag (preference). Replace "prop" JSDoc tag with "property".
-
- /**
- * @abc foo
- * @abcd bar
- */
- function quux () {
-
- }
- // Settings: {"jsdoc":{"tagNamePreference":{"abc":"abcd"}}}
- // "jsdoc/check-tag-names": ["error"|"warn", {"definedTags":["abcd"]}]
- // Message: Invalid JSDoc tag (preference). Replace "abc" JSDoc tag with "abcd".
-
- /**
- * @abc
- * @abcd
- */
- function quux () {
-
- }
- // Settings: {"jsdoc":{"tagNamePreference":{"abc":"abcd"}}}
- // Message: Invalid JSDoc tag (preference). Replace "abc" JSDoc tag with "abcd".
-
- /**
- * @returns
- */
- function quux (foo) {}
- // Settings: {"jsdoc":{"mode":"closure"}}
- // Message: Invalid JSDoc tag (preference). Replace "returns" JSDoc tag with "return".
-
- /**
- * @modifies
- * @abstract
- * @access
- * @alias
- * @async
- * @augments
- * @author
- * @borrows
- * @callback
- * @class
- * @classdesc
- * @constant
- * @constructs
- * @copyright
- * @default
- * @deprecated
- * @description
- * @enum
- * @event
- * @example
- * @exports
- * @external
- * @file
- * @fires
- * @function
- * @generator
- * @global
- * @hideconstructor
- * @ignore
- * @implements
- * @inheritdoc
- * @inheritDoc
- * @inner
- * @instance
- * @interface
- * @kind
- * @lends
- * @license
- * @listens
- * @member
- * @memberof
- * @memberof!
- * @mixes
- * @mixin
- * @module
- * @name
- * @namespace
- * @override
- * @package
- * @param
- * @private
- * @property
- * @protected
- * @public
- * @readonly
- * @requires
- * @returns
- * @see
- * @since
- * @static
- * @summary
- * @this
- * @throws
- * @todo
- * @tutorial
- * @type
- * @typedef
- * @variation
- * @version
- * @yields
- */
- function quux (foo) {}
- // Settings: {"jsdoc":{"mode":"badMode"}}
- // Message: Unrecognized value `badMode` for `settings.jsdoc.mode`.
-
- /**
- * @modifies
- * @abstract
- * @access
- * @alias
- * @async
- * @augments
- * @author
- * @borrows
- * @callback
- * @class
- * @classdesc
- * @constant
- * @constructs
- * @copyright
- * @default
- * @deprecated
- * @description
- * @enum
- * @event
- * @example
- * @exports
- * @external
- * @file
- * @fires
- * @function
- * @generator
- * @global
- * @hideconstructor
- * @ignore
- * @implements
- * @inheritdoc
- * @inheritDoc
- * @inner
- * @instance
- * @interface
- * @kind
- * @lends
- * @license
- * @listens
- * @member
- * @memberof
- * @memberof!
- * @mixes
- * @mixin
- * @module
- * @name
- * @namespace
- * @override
- * @package
- * @param
- * @private
- * @property
- * @protected
- * @public
- * @readonly
- * @requires
- * @returns
- * @see
- * @since
- * @static
- * @summary
- * @this
- * @throws
- * @todo
- * @tutorial
- * @type
- * @typedef
- * @variation
- * @version
- * @yields
- * @template
- */
- function quux (foo) {}
- // Message: Invalid JSDoc tag name "template".
-
- /**
- * @externs
- */
- function quux (foo) {}
- // Message: Invalid JSDoc tag name "externs".
-
- /** @jsx h */
- /** @jsxFrag Fragment */
- /** @jsxImportSource preact */
- /** @jsxRuntime automatic */
- // Message: Invalid JSDoc tag name "jsx".
- ````
-
- The following patterns are not considered problems:
-
- ````js
- /**
- * @param foo
- */
- function quux (foo) {
-
- }
-
- /**
- * @memberof! foo
- */
- function quux (foo) {
-
- }
-
- /**
- * @arg foo
- */
- function quux (foo) {
-
- }
- // Settings: {"jsdoc":{"tagNamePreference":{"param":"arg"}}}
-
- /**
- * @parameter foo
- */
- function quux (foo) {
-
- }
- // Settings: {"jsdoc":{"structuredTags":{"parameter":{"name":"namepath-referencing","required":["type","name"],"type":true}}}}
-
- /**
- * @bar foo
- */
- function quux (foo) {
-
- }
- // "jsdoc/check-tag-names": ["error"|"warn", {"definedTags":["bar"]}]
-
- /**
- * @baz @bar foo
- */
- function quux (foo) {
-
- }
- // "jsdoc/check-tag-names": ["error"|"warn", {"definedTags":["baz","bar"]}]
-
- /**
- * @baz @bar foo
- */
- function quux (foo) {
-
- }
- // Settings: {"jsdoc":{"tagNamePreference":{"param":"baz","returns":{"message":"Prefer `bar`","replacement":"bar"},"todo":false}}}
-
- /**
- * @returns
- */
- function quux (foo) {}
-
- /**
- * @return
- */
- function quux (foo) {}
- // Settings: {"jsdoc":{"mode":"closure"}}
-
- /**
- * @modifies
- * @abstract
- * @access
- * @alias
- * @async
- * @augments
- * @author
- * @borrows
- * @callback
- * @class
- * @classdesc
- * @constant
- * @constructs
- * @copyright
- * @default
- * @deprecated
- * @description
- * @enum
- * @event
- * @example
- * @exports
- * @external
- * @file
- * @fires
- * @function
- * @generator
- * @global
- * @hideconstructor
- * @ignore
- * @implements
- * @inheritdoc
- * @inheritDoc
- * @inner
- * @instance
- * @interface
- * @kind
- * @lends
- * @license
- * @listens
- * @member
- * @memberof
- * @memberof!
- * @mixes
- * @mixin
- * @module
- * @name
- * @namespace
- * @override
- * @package
- * @param
- * @private
- * @property
- * @protected
- * @public
- * @readonly
- * @requires
- * @returns
- * @see
- * @since
- * @static
- * @summary
- * @this
- * @throws
- * @todo
- * @tutorial
- * @type
- * @typedef
- * @variation
- * @version
- * @yields
- */
- function quux (foo) {}
-
- /**
- * @modifies
- * @abstract
- * @access
- * @alias
- * @async
- * @augments
- * @author
- * @borrows
- * @callback
- * @class
- * @classdesc
- * @constant
- * @constructs
- * @copyright
- * @default
- * @deprecated
- * @description
- * @enum
- * @event
- * @example
- * @exports
- * @external
- * @file
- * @fires
- * @function
- * @generator
- * @global
- * @hideconstructor
- * @ignore
- * @implements
- * @inheritdoc
- * @inheritDoc
- * @inner
- * @instance
- * @interface
- * @kind
- * @lends
- * @license
- * @listens
- * @member
- * @memberof
- * @memberof!
- * @mixes
- * @mixin
- * @module
- * @name
- * @namespace
- * @override
- * @package
- * @param
- * @private
- * @property
- * @protected
- * @public
- * @readonly
- * @requires
- * @returns
- * @see
- * @since
- * @static
- * @summary
- * @this
- * @throws
- * @todo
- * @tutorial
- * @type
- * @typedef
- * @variation
- * @version
- * @yields
- * @template
- */
- function quux (foo) {}
- // Settings: {"jsdoc":{"mode":"typescript"}}
-
- /**
- * @externs
- */
- function quux (foo) {}
- // Settings: {"jsdoc":{"mode":"closure"}}
-
- /**
- *
- */
- function quux (foo) {
-
- }
-
- /**
- * @todo
- */
- function quux () {
-
- }
-
- /**
- * @extends Foo
- */
- function quux () {
-
- }
- // Settings: {"jsdoc":{"tagNamePreference":{"augments":{"message":"@extends is to be used over @augments.","replacement":"extends"}}}}
-
- /**
- * (Set tag name preference to itself to get aliases to
- * work along with main tag name.)
- * @augments Bar
- * @extends Foo
- */
- function quux () {
- }
- // Settings: {"jsdoc":{"tagNamePreference":{"extends":"extends"}}}
-
- /**
- * Registers the `target` class as a transient dependency; each time the dependency is resolved a new instance will be created.
- *
- * @param target - The class / constructor function to register as transient.
- *
- * @example ```ts
- @transient()
- class Foo { }
- ```
- * @param Time for a new tag
- */
- export function transient<T>(target?: T): T {
- // ...
- }
-
- /** @jsx h */
- /** @jsxFrag Fragment */
- /** @jsxImportSource preact */
- /** @jsxRuntime automatic */
- // "jsdoc/check-tag-names": ["error"|"warn", {"jsxTags":true}]
- ````
-
-
- <a name="eslint-plugin-jsdoc-rules-check-types"></a>
- ### <code>check-types</code>
-
- Reports invalid types.
-
- By default, ensures that the casing of native types is the same as in this
- list:
-
- ```
- undefined
- null
- boolean
- number
- bigint
- string
- symbol
- object
- Array
- Function
- Date
- RegExp
- ```
-
- <a name="eslint-plugin-jsdoc-rules-check-types-options-7"></a>
- #### Options
-
- `check-types` allows one option:
-
- - An option object:
- - with the key `noDefaults` to insist that only the supplied option type
- map is to be used, and that the default preferences (such as "string"
- over "String") will not be enforced. The option's default is `false`.
- - with the key `exemptTagContexts` which will avoid reporting when a
- bad type is found on a specified tag. Set to an array of objects with
- a key `tag` set to the tag to exempt, and a `types` key which can
- either be `true` to indicate that any types on that tag will be allowed,
- or to an array of strings which will only allow specific bad types.
- If an array of strings is given, these must match the type exactly,
- e.g., if you only allow `"object"`, it will not allow
- `"object<string, string>"`. Note that this is different from the
- behavior of `settings.jsdoc.preferredTypes`. This option is useful
- for normally restricting generic types like `object` with
- `preferredTypes`, but allowing `typedef` to indicate that its base
- type is `object`.
- - with the key `unifyParentAndChildTypeChecks` which will treat
- `settings.jsdoc.preferredTypes` keys such as `SomeType` as matching
- not only child types such as an unadorned `SomeType` but also
- `SomeType<aChildType>`, `SomeType.<aChildType>`, or if `SomeType` is
- `Array` (or `[]`), it will match `aChildType[]`. If this is `false` or
- unset, the former format will only apply to types which are not parent
- types/unions whereas the latter formats will only apply for parent
- types/unions. The special types `[]`, `.<>` (or `.`), and `<>`
- act only as parent types (and will not match a bare child type such as
- `Array` even when unified, though, as mentioned, `Array` will match
- say `string[]` or `Array.<string>` when unified). The special type
- `*` is only a child type. Note that there is no detection of parent
- and child type together, e.g., you cannot specify preferences for
- `string[]` specifically as distinct from say `number[]`, but you can
- target both with `[]` or the child types `number` or `string`.
-
- If a value is present both as a key and as a value, neither the key nor the
- value will be reported. Thus one can use this fact to allow both `object`
- and `Object`, for example. Note that in "typescript" mode, this is the default
- behavior.
-
- See also the documentation on `settings.jsdoc.preferredTypes` which impacts
- the behavior of `check-types`.
-
- Note that if there is an error [parsing](https://github.com/jsdoctypeparser/jsdoctypeparser)
- types for a tag, the function will silently ignore that tag, leaving it to
- the `valid-types` rule to report parsing errors.
-
- <a name="eslint-plugin-jsdoc-rules-check-types-why-not-capital-case-everything"></a>
- #### Why not capital case everything?
-
- Why are `boolean`, `number` and `string` exempt from starting with a capital
- letter? Let's take `string` as an example. In Javascript, everything is an
- object. The string Object has prototypes for string functions such as
- `.toUpperCase()`.
-
- Fortunately we don't have to write `new String()` everywhere in our code.
- Javascript will automatically wrap string primitives into string Objects when
- we're applying a string function to a string primitive. This way the memory
- footprint is a tiny little bit smaller, and the
- [GC](https://en.wikipedia.org/wiki/Garbage_collection_(computer_science)) has
- less work to do.
-
- So in a sense, there are two types of strings in Javascript:
- 1. `{string}` literals, also called primitives
- 2. `{String}` Objects.
-
- We use the primitives because it's easier to write and uses less memory.
- `{String}` and `{string}` are technically both valid, but they are not the same.
-
- ```js
- new String('lard') // String {0: "l", 1: "a", 2: "r", 3: "d", length: 4}
- 'lard' // "lard"
- new String('lard') === 'lard' // false
- ```
-
- To make things more confusing, there are also object literals and object
- Objects. But object literals are still static Objects and object Objects are
- instantiated Objects. So an object primitive is still an object Object.
-
- However, `Object.create(null)` objects are not `instanceof Object`, however, so
- in the case of this Object we lower-case to indicate possible support for
- these objects.
-
- Basically, for primitives, we want to define the type as a primitive, because
- that's what we use in 99.9% of cases. For everything else, we use the type
- rather than the primitive. Otherwise it would all just be `{object}`.
-
- In short: It's not about consistency, rather about the 99.9% use case. (And
- some functions might not even support the objects if they are checking for
- identity.)
-
- type name | `typeof` | check-types | testcase
- --|--|--|--
- **Array** | object | **Array** | `([]) instanceof Array` -> `true`
- **Function** | function | **Function** | `(function f () {}) instanceof Function` -> `true`
- **Date** | object | **Date** | `(new Date()) instanceof Date` -> `true`
- **RegExp** | object | **RegExp** | `(new RegExp(/.+/)) instanceof RegExp` -> `true`
- Object | **object** | **object** | `({}) instanceof Object` -> `true` but `Object.create(null) instanceof Object` -> `false`
- Boolean | **boolean** | **boolean** | `(true) instanceof Boolean` -> **`false`**
- Number | **number** | **number** | `(41) instanceof Number` -> **`false`**
- String | **string** | **string** | `("test") instanceof String` -> **`false`**
-
- If you define your own tags and don't wish their bracketed portions checked
- for types, you can use `settings.jsdoc.structuredTags` with a tag `type` of
- `false`. If you set their `type` to an array, only those values will be
- permitted.
-
- |||
- |---|---|
- |Context|everywhere|
- |Tags|`augments`, `class`, `constant`, `enum`, `implements`, `member`, `module`, `namespace`, `param`, `property`, `returns`, `throws`, `type`, `typedef`, `yields`|
- |Aliases|`constructor`, `const`, `extends`, `var`, `arg`, `argument`, `prop`, `return`, `exception`, `yield`|
- |Closure-only|`package`, `private`, `protected`, `public`, `static`|
- |Recommended|true|
- |Options|`noDefaults`, `exemptTagContexts`, `unifyParentAndChildTypeChecks`|
- |Settings|`preferredTypes`, `mode`, `structuredTags`|
-
- The following patterns are considered problems:
-
- ````js
- /**
- * @param {abc} foo
- */
- function quux (foo) {
-
- }
- // Settings: {"jsdoc":{"preferredTypes":{"abc":100}}}
- // Message: Invalid `settings.jsdoc.preferredTypes`. Values must be falsy, a string, or an object.
-
- /**
- * @param {Number} foo
- */
- function quux (foo) {
-
- }
- // Message: Invalid JSDoc @param "foo" type "Number"; prefer: "number".
-
- /**
- * @arg {Number} foo
- */
- function quux (foo) {
-
- }
- // Message: Invalid JSDoc @arg "foo" type "Number"; prefer: "number".
-
- /**
- * @returns {Number} foo
- * @throws {Number} foo
- */
- function quux () {
-
- }
- // Message: Invalid JSDoc @returns type "Number"; prefer: "number".
-
- /**
- * @param {(Number | string | Boolean)=} foo
- */
- function quux (foo, bar, baz) {
-
- }
- // Message: Invalid JSDoc @param "foo" type "Number"; prefer: "number".
-
- /**
- * @param {Array.<Number | String>} foo
- */
- function quux (foo, bar, baz) {
-
- }
- // Message: Invalid JSDoc @param "foo" type "Number"; prefer: "number".
-
- /**
- * @param {(Number | String)[]} foo
- */
- function quux (foo, bar, baz) {
-
- }
- // Message: Invalid JSDoc @param "foo" type "Number"; prefer: "number".
-
- /**
- * @param {abc} foo
- */
- function qux(foo) {
- }
- // Settings: {"jsdoc":{"preferredTypes":{"abc":"Abc","string":"Str"}}}
- // Message: Invalid JSDoc @param "foo" type "abc"; prefer: "Abc".
-
- /**
- * @param {abc} foo
- */
- function qux(foo) {
- }
- // Settings: {"jsdoc":{"preferredTypes":{"abc":{"replacement":"Abc"},"string":"Str"}}}
- // Message: Invalid JSDoc @param "foo" type "abc"; prefer: "Abc".
-
- /**
- * @param {abc} foo
- */
- function qux(foo) {
- }
- // Settings: {"jsdoc":{"preferredTypes":{"abc":{"message":"Messed up JSDoc @{{tagName}}{{tagValue}} type \"abc\"; prefer: \"Abc\".","replacement":"Abc"},"string":"Str"}}}
- // Message: Messed up JSDoc @param "foo" type "abc"; prefer: "Abc".
-
- /**
- * @param {abc} foo
- * @param {cde} bar
- * @param {object} baz
- */
- function qux(foo, bar, baz) {
- }
- // Settings: {"jsdoc":{"preferredTypes":{"abc":{"message":"Messed up JSDoc @{{tagName}}{{tagValue}} type \"abc\"; prefer: \"Abc\".","replacement":"Abc"},"cde":{"message":"More messed up JSDoc @{{tagName}}{{tagValue}} type \"cde\"; prefer: \"Cde\".","replacement":"Cde"},"object":"Object"}}}
- // Message: Messed up JSDoc @param "foo" type "abc"; prefer: "Abc".
-
- /**
- * @param {abc} foo
- */
- function qux(foo) {
- }
- // Settings: {"jsdoc":{"preferredTypes":{"abc":{"message":"Messed up JSDoc @{{tagName}}{{tagValue}} type \"abc\".","replacement":false},"string":"Str"}}}
- // Message: Messed up JSDoc @param "foo" type "abc".
-
- /**
- * @param {abc} foo
- */
- function qux(foo) {
- }
- // Settings: {"jsdoc":{"preferredTypes":{"abc":{"message":"Messed up JSDoc @{{tagName}}{{tagValue}} type \"abc\"."},"string":"Str"}}}
- // Message: Messed up JSDoc @param "foo" type "abc".
-
- /**
- * @param {abc} foo
- * @param {Number} bar
- */
- function qux(foo, bar) {
- }
- // Settings: {"jsdoc":{"preferredTypes":{"abc":"Abc","string":"Str"}}}
- // "jsdoc/check-types": ["error"|"warn", {"noDefaults":true}]
- // Message: Invalid JSDoc @param "foo" type "abc"; prefer: "Abc".
-
- /**
- * @param {abc} foo
- * @param {Number} bar
- */
- function qux(foo, bar) {
- }
- // Settings: {"jsdoc":{"preferredTypes":{"abc":"Abc","string":"Str"}}}
- // Message: Invalid JSDoc @param "foo" type "abc"; prefer: "Abc".
-
- /**
- * @param {abc} foo
- */
- function qux(foo) {
- }
- // Settings: {"jsdoc":{"preferredTypes":{"abc":false,"string":"Str"}}}
- // Message: Invalid JSDoc @param "foo" type "abc".
-
- /**
- * @param {abc} foo
- */
- function qux(foo) {
- }
- // Settings: {"jsdoc":{"preferredTypes":{"abc":false}}}
- // Message: Invalid JSDoc @param "foo" type "abc".
-
- /**
- * @param {*} baz
- */
- function qux(baz) {
- }
- // Settings: {"jsdoc":{"preferredTypes":{"*":false,"abc":"Abc","string":"Str"}}}
- // Message: Invalid JSDoc @param "baz" type "*".
-
- /**
- * @param {*} baz
- */
- function qux(baz) {
- }
- // Settings: {"jsdoc":{"preferredTypes":{"*":"aaa","abc":"Abc","string":"Str"}}}
- // Message: Invalid JSDoc @param "baz" type "*"; prefer: "aaa".
-
- /**
- * @param {abc} foo
- * @param {Number} bar
- */
- function qux(foo, bar) {
- }
- // Settings: {"jsdoc":{"preferredTypes":{"abc":"Abc","string":"Str"}}}
- // Message: Invalid JSDoc @param "foo" type "abc"; prefer: "Abc".
-
- /**
- * @param {Array} foo
- */
- function quux (foo) {
-
- }
- // Settings: {"jsdoc":{"preferredTypes":{"Array":"GenericArray"}}}
- // Message: Invalid JSDoc @param "foo" type "Array"; prefer: "GenericArray".
-
- /**
- * @param {Array} foo
- */
- function quux (foo) {
-
- }
- // Settings: {"jsdoc":{"preferredTypes":{"Array":"GenericArray","Array.<>":"GenericArray"}}}
- // Message: Invalid JSDoc @param "foo" type "Array"; prefer: "GenericArray".
-
- /**
- * @param {Array.<string>} foo
- */
- function quux (foo) {
-
- }
- // Settings: {"jsdoc":{"preferredTypes":{"Array.<>":"GenericArray"}}}
- // Message: Invalid JSDoc @param "foo" type "Array"; prefer: "GenericArray".
-
- /**
- * @param {Array<string>} foo
- */
- function quux (foo) {
-
- }
- // Settings: {"jsdoc":{"preferredTypes":{"Array<>":"GenericArray"}}}
- // Message: Invalid JSDoc @param "foo" type "Array"; prefer: "GenericArray".
-
- /**
- * @param {string[]} foo
- */
- function quux (foo) {
-
- }
- // Settings: {"jsdoc":{"preferredTypes":{"[]":"SpecialTypeArray"}}}
- // Message: Invalid JSDoc @param "foo" type "[]"; prefer: "SpecialTypeArray".
-
- /**
- * @param {string[]} foo
- */
- function quux (foo) {
-
- }
- // Settings: {"jsdoc":{"preferredTypes":{"[]":"SpecialTypeArray"}}}
- // "jsdoc/check-types": ["error"|"warn", {"unifyParentAndChildTypeChecks":true}]
- // Message: Invalid JSDoc @param "foo" type "[]"; prefer: "SpecialTypeArray".
-
- /**
- * @param {string[]} foo
- */
- function quux (foo) {
-
- }
- // Settings: {"jsdoc":{"preferredTypes":{"Array":"SpecialTypeArray"}}}
- // "jsdoc/check-types": ["error"|"warn", {"unifyParentAndChildTypeChecks":true}]
- // Message: Invalid JSDoc @param "foo" type "Array"; prefer: "SpecialTypeArray".
-
- /**
- * @param {object} foo
- */
- function quux (foo) {
-
- }
- // Settings: {"jsdoc":{"preferredTypes":{"object":"GenericObject"}}}
- // Message: Invalid JSDoc @param "foo" type "object"; prefer: "GenericObject".
-
- /**
- * @param {object} foo
- */
- function quux (foo) {
-
- }
- // Settings: {"jsdoc":{"preferredTypes":{"object":"GenericObject","object.<>":"GenericObject"}}}
- // Message: Invalid JSDoc @param "foo" type "object"; prefer: "GenericObject".
-
- /**
- * @param {object} foo
- */
- function quux (foo) {
-
- }
- // Settings: {"jsdoc":{"preferredTypes":{"object":"GenericObject","object<>":"GenericObject"}}}
- // Message: Invalid JSDoc @param "foo" type "object"; prefer: "GenericObject".
-
- /**
- * @param {object.<string>} foo
- */
- function quux (foo) {
-
- }
- // Settings: {"jsdoc":{"preferredTypes":{"object.<>":"GenericObject"}}}
- // Message: Invalid JSDoc @param "foo" type "object"; prefer: "GenericObject".
-
- /**
- * @param {object<string>} foo
- */
- function quux (foo) {
-
- }
- // Settings: {"jsdoc":{"preferredTypes":{"object<>":"GenericObject"}}}
- // Message: Invalid JSDoc @param "foo" type "object"; prefer: "GenericObject".
-
- /**
- * @param {object.<string, number>} foo
- */
- function quux (foo) {
-
- }
- // Settings: {"jsdoc":{"preferredTypes":{"object.<>":"GenericObject"}}}
- // Message: Invalid JSDoc @param "foo" type "object"; prefer: "GenericObject".
-
- /**
- * @param {object<string, number>} foo
- */
- function quux (foo) {
-
- }
- // Settings: {"jsdoc":{"preferredTypes":{"object<>":"GenericObject"}}}
- // Message: Invalid JSDoc @param "foo" type "object"; prefer: "GenericObject".
-
- /**
- * @param {object.<string>} foo
- */
- function quux (foo) {
-
- }
- // Settings: {"jsdoc":{"preferredTypes":{"object":"GenericObject"}}}
- // "jsdoc/check-types": ["error"|"warn", {"unifyParentAndChildTypeChecks":true}]
- // Message: Invalid JSDoc @param "foo" type "object"; prefer: "GenericObject".
-
- /**
- * @param {object<string>} foo
- */
- function quux (foo) {
-
- }
- // Settings: {"jsdoc":{"preferredTypes":{"object":"GenericObject"}}}
- // "jsdoc/check-types": ["error"|"warn", {"unifyParentAndChildTypeChecks":true}]
- // Message: Invalid JSDoc @param "foo" type "object"; prefer: "GenericObject".
-
- /**
- * @param {object} foo
- */
- function quux (foo) {
-
- }
- // Settings: {"jsdoc":{"preferredTypes":{"object":"GenericObject"}}}
- // "jsdoc/check-types": ["error"|"warn", {"unifyParentAndChildTypeChecks":true}]
- // Message: Invalid JSDoc @param "foo" type "object"; prefer: "GenericObject".
-
- /**
- * @param {object} foo
- */
- function quux (foo) {
-
- }
- // Settings: {"jsdoc":{"preferredTypes":{"object":false}}}
- // "jsdoc/check-types": ["error"|"warn", {"unifyParentAndChildTypeChecks":true}]
- // Message: Invalid JSDoc @param "foo" type "object".
-
- /**
- * @param {object} foo
- */
- function quux (foo) {
-
- }
- // Settings: {"jsdoc":{"preferredTypes":{"object":false}}}
- // Message: Invalid JSDoc @param "foo" type "object".
-
- /**
- * @param {object.<string, number>} foo
- */
- function quux (foo) {
-
- }
- // Settings: {"jsdoc":{"preferredTypes":{"object":"GenericObject"}}}
- // "jsdoc/check-types": ["error"|"warn", {"unifyParentAndChildTypeChecks":true}]
- // Message: Invalid JSDoc @param "foo" type "object"; prefer: "GenericObject".
-
- /**
- * @param {object<string, number>} foo
- */
- function quux (foo) {
-
- }
- // Settings: {"jsdoc":{"preferredTypes":{"object":"GenericObject"}}}
- // "jsdoc/check-types": ["error"|"warn", {"unifyParentAndChildTypeChecks":true}]
- // Message: Invalid JSDoc @param "foo" type "object"; prefer: "GenericObject".
-
- /**
- *
- * @param {string[][]} foo
- */
- function quux (foo) {
-
- }
- // Settings: {"jsdoc":{"preferredTypes":{"[]":"Array."}}}
- // Message: Invalid JSDoc @param "foo" type "[]"; prefer: "Array.".
-
- /**
- *
- * @param {string[][]} foo
- */
- function quux (foo) {
-
- }
- // Settings: {"jsdoc":{"preferredTypes":{"[]":"Array.<>"}}}
- // Message: Invalid JSDoc @param "foo" type "[]"; prefer: "Array.<>".
-
- /**
- *
- * @param {string[][]} foo
- */
- function quux (foo) {
-
- }
- // Settings: {"jsdoc":{"preferredTypes":{"[]":"Array<>"}}}
- // Message: Invalid JSDoc @param "foo" type "[]"; prefer: "Array<>".
-
- /**
- *
- * @param {object.<string, object.<string, string>>} foo
- */
- function quux (foo) {
-
- }
- // Settings: {"jsdoc":{"preferredTypes":{"object.":"Object"}}}
- // Message: Invalid JSDoc @param "foo" type "object"; prefer: "Object".
-
- /**
- *
- * @param {object.<string, object.<string, string>>} foo
- */
- function quux (foo) {
-
- }
- // Settings: {"jsdoc":{"preferredTypes":{"object.":"Object<>"}}}
- // Message: Invalid JSDoc @param "foo" type "object"; prefer: "Object<>".
-
- /**
- *
- * @param {object<string, object<string, string>>} foo
- */
- function quux (foo) {
-
- }
- // Settings: {"jsdoc":{"preferredTypes":{"object<>":"Object."}}}
- // Message: Invalid JSDoc @param "foo" type "object"; prefer: "Object.".
-
- /**
- *
- * @param {Array.<Array.<string>>} foo
- */
- function quux (foo) {
-
- }
- // Settings: {"jsdoc":{"preferredTypes":{"Array.":"[]"}}}
- // Message: Invalid JSDoc @param "foo" type "Array"; prefer: "[]".
-
- /**
- *
- * @param {Array.<Array.<string>>} foo
- */
- function quux (foo) {
-
- }
- // Settings: {"jsdoc":{"preferredTypes":{"Array.":"Array<>"}}}
- // Message: Invalid JSDoc @param "foo" type "Array"; prefer: "Array<>".
-
- /**
- *
- * @param {Array.<Array.<string>>} foo
- */
- function quux (foo) {
-
- }
- // Settings: {"jsdoc":{"preferredTypes":{"Array.":"<>"}}}
- // Message: Invalid JSDoc @param "foo" type "Array"; prefer: "<>".
-
- /**
- *
- * @param {Array.<MyArray.<string>>} foo
- */
- function quux (foo) {
-
- }
- // Settings: {"jsdoc":{"preferredTypes":{"Array.":"<>"}}}
- // Message: Invalid JSDoc @param "foo" type "Array"; prefer: "<>".
-
- /**
- *
- * @param {Array.<MyArray.<string>>} foo
- */
- function quux (foo) {
-
- }
- // Settings: {"jsdoc":{"preferredTypes":{"MyArray.":"<>"}}}
- // Message: Invalid JSDoc @param "foo" type "MyArray"; prefer: "<>".
-
- /**
- *
- * @param {Array<Array<string>>} foo
- */
- function quux (foo) {
-
- }
- // Settings: {"jsdoc":{"preferredTypes":{"<>":"Array."}}}
- // Message: Invalid JSDoc @param "foo" type "Array"; prefer: "Array.".
-
- /**
- *
- * @param {Array<Array<string>>} foo
- */
- function quux (foo) {
-
- }
- // Settings: {"jsdoc":{"preferredTypes":{"Array":"Array."}}}
- // "jsdoc/check-types": ["error"|"warn", {"unifyParentAndChildTypeChecks":true}]
- // Message: Invalid JSDoc @param "foo" type "Array"; prefer: "Array.".
-
- /**
- *
- * @param {Array<Array<string>>} foo
- */
- function quux (foo) {
-
- }
- // Settings: {"jsdoc":{"preferredTypes":{"<>":"[]"}}}
- // Message: Invalid JSDoc @param "foo" type "Array"; prefer: "[]".
-
- /** @typedef {String} foo */
- // Message: Invalid JSDoc @typedef "foo" type "String"; prefer: "string".
-
- /**
- * @this {array}
- */
- function quux () {}
- // Settings: {"jsdoc":{"mode":"closure"}}
- // Message: Invalid JSDoc @this type "array"; prefer: "Array".
-
- /**
- * @export {array}
- */
- function quux () {}
- // Settings: {"jsdoc":{"mode":"closure"}}
- // Message: Invalid JSDoc @export type "array"; prefer: "Array".
-
- /**
- * @typedef {object} foo
- * @property {object} bar
- */
- // Settings: {"jsdoc":{"preferredTypes":{"object":"Object"}}}
- // "jsdoc/check-types": ["error"|"warn", {"exemptTagContexts":[{"tag":"typedef","types":true}]}]
- // Message: Invalid JSDoc @property "bar" type "object"; prefer: "Object".
-
- /** @typedef {object} foo */
- // Settings: {"jsdoc":{"preferredTypes":{"object":"Object"}}}
- // "jsdoc/check-types": ["error"|"warn", {"exemptTagContexts":[{"tag":"typedef","types":["array"]}]}]
- // Message: Invalid JSDoc @typedef "foo" type "object"; prefer: "Object".
-
- /**
- * @typedef {object} foo
- * @property {object} bar
- */
- // Settings: {"jsdoc":{"preferredTypes":{"object":"Object"}}}
- // "jsdoc/check-types": ["error"|"warn", {"exemptTagContexts":[{"tag":"typedef","types":["object"]}]}]
- // Message: Invalid JSDoc @property "bar" type "object"; prefer: "Object".
-
- /** @typedef {object<string, string>} foo */
- // Settings: {"jsdoc":{"preferredTypes":{"object<>":"Object<>"}}}
- // "jsdoc/check-types": ["error"|"warn", {"exemptTagContexts":[{"tag":"typedef","types":["object"]}]}]
- // Message: Invalid JSDoc @typedef "foo" type "object"; prefer: "Object<>".
-
- /**
- * @param {Array<number | undefined>} foo
- */
- function quux (foo) {
-
- }
- // Settings: {"jsdoc":{"preferredTypes":{"Array.<>":"[]","Array<>":"[]"}}}
- // Message: Invalid JSDoc @param "foo" type "Array"; prefer: "[]".
-
- /**
- * @typedef {object} foo
- */
- function a () {}
-
- /**
- * @typedef {Object} foo
- */
- function b () {}
- // Settings: {"jsdoc":{"mode":"typescript","preferredTypes":{"object":"Object"}}}
- // Message: Invalid JSDoc @typedef "foo" type "object"; prefer: "Object".
-
- /**
- * @aCustomTag {Number} foo
- */
- // Settings: {"jsdoc":{"structuredTags":{"aCustomTag":{"type":true}}}}
- // Message: Invalid JSDoc @aCustomTag "foo" type "Number"; prefer: "number".
-
- /**
- * @aCustomTag {Number} foo
- */
- // Settings: {"jsdoc":{"structuredTags":{"aCustomTag":{"type":["otherType","anotherType"]}}}}
- // Message: Invalid JSDoc @aCustomTag "foo" type "Number"; prefer: ["otherType","anotherType"].
- ````
-
- The following patterns are not considered problems:
-
- ````js
- /**
- * @param {number} foo
- * @param {Bar} bar
- * @param {*} baz
- */
- function quux (foo, bar, baz) {
-
- }
-
- /**
- * @arg {number} foo
- * @arg {Bar} bar
- * @arg {*} baz
- */
- function quux (foo, bar, baz) {
-
- }
-
- /**
- * @param {(number | string | boolean)=} foo
- */
- function quux (foo, bar, baz) {
-
- }
-
- /**
- * @param {typeof bar} foo
- */
- function qux(foo) {
- }
-
- /**
- * @param {import('./foo').bar.baz} foo
- */
- function qux(foo) {
- }
-
- /**
- * @param {(x: number, y: string) => string} foo
- */
- function qux(foo) {
- }
-
- /**
- * @param {() => string} foo
- */
- function qux(foo) {
- }
-
- /**
- * @returns {Number} foo
- * @throws {Number} foo
- */
- function quux () {
-
- }
- // "jsdoc/check-types": ["error"|"warn", {"noDefaults":true}]
-
- /**
- * @param {Object} foo
- */
- function quux (foo) {
-
- }
- // Settings: {"jsdoc":{"preferredTypes":{"object":"Object"}}}
-
- /**
- * @param {Array} foo
- */
- function quux (foo) {
-
- }
-
- /**
- * @param {Array.<string>} foo
- */
- function quux (foo) {
-
- }
- // Settings: {"jsdoc":{"preferredTypes":{"Array":"GenericArray"}}}
-
- /**
- * @param {Array<string>} foo
- */
- function quux (foo) {
-
- }
- // Settings: {"jsdoc":{"preferredTypes":{"Array":"GenericArray"}}}
-
- /**
- * @param {string[]} foo
- */
- function quux (foo) {
-
- }
- // Settings: {"jsdoc":{"preferredTypes":{"Array":"SpecialTypeArray","Array.<>":"SpecialTypeArray","Array<>":"SpecialTypeArray"}}}
-
- /**
- * @param {string[]} foo
- */
- function quux (foo) {
-
- }
- // Settings: {"jsdoc":{"preferredTypes":{"Array.<>":"SpecialTypeArray","Array<>":"SpecialTypeArray"}}}
- // "jsdoc/check-types": ["error"|"warn", {"unifyParentAndChildTypeChecks":true}]
-
- /**
- * @param {Array} foo
- */
- function quux (foo) {
-
- }
- // Settings: {"jsdoc":{"preferredTypes":{"[]":"SpecialTypeArray"}}}
-
- /**
- * @param {Array} foo
- */
- function quux (foo) {
-
- }
- // Settings: {"jsdoc":{"preferredTypes":{"[]":"SpecialTypeArray"}}}
- // "jsdoc/check-types": ["error"|"warn", {"unifyParentAndChildTypeChecks":true}]
-
- /**
- * @param {Array} foo
- */
- function quux (foo) {
-
- }
- // Settings: {"jsdoc":{"preferredTypes":{"Array.<>":"GenericArray"}}}
-
- /**
- * @param {Array} foo
- */
- function quux (foo) {
-
- }
- // Settings: {"jsdoc":{"preferredTypes":{"Array<>":"GenericArray"}}}
-
- /**
- * @param {object} foo
- */
- function quux (foo) {
-
- }
-
- /**
- * @param {object.<string>} foo
- */
- function quux (foo) {
-
- }
- // Settings: {"jsdoc":{"preferredTypes":{"object":"GenericObject"}}}
-
- /**
- * @param {object<string>} foo
- */
- function quux (foo) {
-
- }
- // Settings: {"jsdoc":{"preferredTypes":{"object":"GenericObject"}}}
-
- /**
- * @param {object.<string, number>} foo
- */
- function quux (foo) {
-
- }
- // Settings: {"jsdoc":{"preferredTypes":{"object":"GenericObject"}}}
-
- /**
- * @param {object<string, number>} foo
- */
- function quux (foo) {
-
- }
- // Settings: {"jsdoc":{"preferredTypes":{"object":"GenericObject"}}}
-
- /**
- * @param {object} foo
- */
- function quux (foo) {
-
- }
- // Settings: {"jsdoc":{"preferredTypes":{"object.<>":"GenericObject"}}}
-
- /**
- * @param {object} foo
- */
- function quux (foo) {
-
- }
- // Settings: {"jsdoc":{"preferredTypes":{"object<>":"GenericObject"}}}
-
- /**
- * @param {Number<} Ignore the error as not a validating rule
- */
- function quux (foo) {
-
- }
-
- /** @param {function(...)} callback The function to invoke. */
- var subscribe = function(callback) {};
-
- /**
- * @this {Array}
- */
- function quux () {}
- // Settings: {"jsdoc":{"mode":"closure"}}
-
- /**
- * @export {Array}
- */
- function quux () {}
- // Settings: {"jsdoc":{"mode":"closure"}}
-
- /** @type {new() => EntityBase} */
-
- /** @typedef {object} foo */
- // Settings: {"jsdoc":{"preferredTypes":{"object":"Object"}}}
- // "jsdoc/check-types": ["error"|"warn", {"exemptTagContexts":[{"tag":"typedef","types":true}]}]
-
- /** @typedef {object<string, string>} foo */
- // Settings: {"jsdoc":{"preferredTypes":{"object":"Object"}}}
-
- /** @typedef {object<string, string>} foo */
- // Settings: {"jsdoc":{"preferredTypes":{"object<>":"Object<>"}}}
- // "jsdoc/check-types": ["error"|"warn", {"exemptTagContexts":[{"tag":"typedef","types":["object<string, string>"]}]}]
-
- /**
- * @typedef {object} foo
- */
-
- /**
- * @typedef {Object} foo
- */
- // Settings: {"jsdoc":{"preferredTypes":{"object":"Object","Object":"object"}}}
-
- /**
- * @typedef {object} foo
- */
- function a () {}
-
- /**
- * @typedef {Object} foo
- */
- function b () {}
- // Settings: {"jsdoc":{"preferredTypes":{"object":"Object","Object":"object"}}}
-
- /**
- * @typedef {object} foo
- */
- function a () {}
-
- /**
- * @typedef {Object} foo
- */
- function b () {}
- // Settings: {"jsdoc":{"mode":"typescript"}}
-
- /**
- * @aCustomTag {Number} foo
- */
- // Settings: {"jsdoc":{"structuredTags":{"aCustomTag":{"type":false}}}}
-
- /**
- * @aCustomTag {otherType} foo
- */
- // Settings: {"jsdoc":{"structuredTags":{"aCustomTag":{"type":["otherType","anotherType"]}}}}
-
- /**
- * @aCustomTag {anotherType|otherType} foo
- */
- // Settings: {"jsdoc":{"structuredTags":{"aCustomTag":{"type":["otherType","anotherType"]}}}}
-
- /**
- * Bad types handled by `valid-types` instead.
- * @param {str(} foo
- */
- function quux (foo) {
-
- }
- ````
-
-
- <a name="eslint-plugin-jsdoc-rules-check-values"></a>
- ### <code>check-values</code>
-
- This rule checks the values for a handful of tags:
-
- 1. `@version` - Checks that there is a present and valid
- [semver](https://semver.org/) version value.
- 2. `@since` - As with `@version`
- 3. `@license` - Checks that there is a present and valid SPDX identifier
- or is present within an `allowedLicenses` option.
- 4. `@author` - Checks that there is a value present, and if the option
- `allowedAuthors` is present, ensure that the author value is one
- of these array items.
- 5. `@variation` - If `numericOnlyVariation` is set, will checks that there
- is a value present, and that it is an integer (otherwise, jsdoc allows any
- value).
-
- <a name="eslint-plugin-jsdoc-rules-check-values-options-8"></a>
- #### Options
-
- <a name="eslint-plugin-jsdoc-rules-check-values-options-8-allowedauthors"></a>
- ##### <code>allowedAuthors</code>
-
- An array of allowable author values. If absent, only non-whitespace will
- be checked for.
-
- <a name="eslint-plugin-jsdoc-rules-check-values-options-8-allowedlicenses"></a>
- ##### <code>allowedLicenses</code>
-
- An array of allowable license values or `true` to allow any license text.
- If present as an array, will be used in place of SPDX identifiers.
-
- <a name="eslint-plugin-jsdoc-rules-check-values-options-8-licensepattern"></a>
- ##### <code>licensePattern</code>
-
- A string to be converted into a `RegExp` (with `u` flag) and whose first
- parenthetical grouping, if present, will match the portion of the license
- description to check (if no grouping is present, then the whole portion
- matched will be used). Defaults to `/([^\n\r]*)/gu`, i.e., the SPDX expression
- is expected before any line breaks.
-
- Note that the `/` delimiters are optional, but necessary to add flags.
-
- Defaults to using the `u` flag, so to add your own flags, encapsulate
- your expression as a string, but like a literal, e.g., `/^mit$/ui`.
-
- <a name="eslint-plugin-jsdoc-rules-check-values-options-8-numericonlyvariation"></a>
- ##### <code>numericOnlyVariation</code>
-
- Whether to enable validation that `@variation` must be a number. Defaults to
- `false`.
-
- |||
- |---|---|
- |Context|everywhere|
- |Tags|`@version`, `@since`, `@license`, `@author`, `@variation`|
- |Recommended|true|
- |Options|`allowedAuthors`, `allowedLicenses`, `licensePattern`|
- |Settings|`tagNamePreference`|
-
- The following patterns are considered problems:
-
- ````js
- /**
- * @version
- */
- function quux (foo) {
-
- }
- // Message: Missing JSDoc @version value.
-
- /**
- * @version 3.1
- */
- function quux (foo) {
-
- }
- // Message: Invalid JSDoc @version: "3.1".
-
- /**
- * @variation -3
- */
- function quux (foo) {
-
- }
- // "jsdoc/check-values": ["error"|"warn", {"numericOnlyVariation":true}]
- // Message: Invalid JSDoc @variation: "-3".
-
- /**
- * @since
- */
- function quux (foo) {
-
- }
- // Message: Missing JSDoc @since value.
-
- /**
- * @since 3.1
- */
- function quux (foo) {
-
- }
- // Message: Invalid JSDoc @since: "3.1".
-
- /**
- * @license
- */
- function quux (foo) {
-
- }
- // Message: Missing JSDoc @license value.
-
- /**
- * @license FOO
- */
- function quux (foo) {
-
- }
- // Message: Invalid JSDoc @license: "FOO"; expected SPDX expression: https://spdx.org/licenses/.
-
- /**
- * @license FOO
- */
- function quux (foo) {
-
- }
- // "jsdoc/check-values": ["error"|"warn", {"allowedLicenses":["BAR","BAX"]}]
- // Message: Invalid JSDoc @license: "FOO"; expected one of BAR, BAX.
-
- /**
- * @license MIT-7
- * Some extra text...
- */
- function quux (foo) {
-
- }
- // Message: Invalid JSDoc @license: "MIT-7"; expected SPDX expression: https://spdx.org/licenses/.
-
- /**
- * @license (MIT OR GPL-2.5)
- */
- function quux (foo) {
-
- }
- // Message: Invalid JSDoc @license: "(MIT OR GPL-2.5)"; expected SPDX expression: https://spdx.org/licenses/.
-
- /**
- * @license MIT
- * Some extra text
- */
- function quux (foo) {
-
- }
- // "jsdoc/check-values": ["error"|"warn", {"licensePattern":"[\\s\\S]*"}]
- // Message: Invalid JSDoc @license: "MIT
- Some extra text"; expected SPDX expression: https://spdx.org/licenses/.
-
- /**
- * @author
- */
- function quux (foo) {
-
- }
- // Message: Missing JSDoc @author value.
-
- /**
- * @author Brett Zamir
- */
- function quux (foo) {
-
- }
- // "jsdoc/check-values": ["error"|"warn", {"allowedAuthors":["Gajus Kuizinas","golopot"]}]
- // Message: Invalid JSDoc @author: "Brett Zamir"; expected one of Gajus Kuizinas, golopot.
-
- /**
- * @variation
- */
- function quux (foo) {
-
- }
- // "jsdoc/check-values": ["error"|"warn", {"numericOnlyVariation":true}]
- // Message: Missing JSDoc @variation value.
-
- /**
- * @variation 5.2
- */
- function quux (foo) {
-
- }
- // "jsdoc/check-values": ["error"|"warn", {"numericOnlyVariation":true}]
- // Message: Invalid JSDoc @variation: "5.2".
- ````
-
- The following patterns are not considered problems:
-
- ````js
- /**
- * @version 3.4.1
- */
- function quux (foo) {
-
- }
-
- /**
- * @version 3.4.1
- */
- function quux (foo) {
-
- }
-
- /**
- * @since 3.4.1
- */
- function quux (foo) {
-
- }
-
- /**
- * @since 3.4.1
- */
- function quux (foo) {
-
- }
-
- /**
- * @license MIT
- */
- function quux (foo) {
-
- }
-
- /**
- * @license MIT
- * Some extra text...
- */
- function quux (foo) {
-
- }
-
- /**
- * @license (MIT OR GPL-2.0)
- */
- function quux (foo) {
-
- }
-
- /**
- * @license FOO
- */
- function quux (foo) {
-
- }
- // "jsdoc/check-values": ["error"|"warn", {"allowedLicenses":["FOO","BAR","BAX"]}]
-
- /**
- * @license FOO
- */
- function quux (foo) {
-
- }
- // "jsdoc/check-values": ["error"|"warn", {"allowedLicenses":true}]
-
- /**
- * @license MIT
- * Some extra text
- */
- function quux (foo) {
-
- }
- // "jsdoc/check-values": ["error"|"warn", {"licensePattern":"[^\n]*"}]
-
- /**
- * @author Gajus Kuizinas
- */
- function quux (foo) {
-
- }
-
- /**
- * @author Brett Zamir
- */
- function quux (foo) {
-
- }
- // "jsdoc/check-values": ["error"|"warn", {"allowedAuthors":["Gajus Kuizinas","golopot","Brett Zamir"]}]
-
- /**
- * @variation 3
- */
- function quux (foo) {
-
- }
- // "jsdoc/check-values": ["error"|"warn", {"numericOnlyVariation":true}]
-
- /**
- * @variation abc
- */
- function quux (foo) {
-
- }
-
- /**
- * @module test
- * @license MIT
- */
- 'use strict';
- ````
-
-
- <a name="eslint-plugin-jsdoc-rules-empty-tags"></a>
- ### <code>empty-tags</code>
-
- Expects the following tags to be empty of any content:
-
- - `@abstract`
- - `@async`
- - `@generator`
- - `@global`
- - `@hideconstructor`
- - `@ignore`
- - `@inheritdoc`
- - `@inner`
- - `@instance`
- - `@internal` (used by TypeScript)
- - `@override`
- - `@readonly`
-
- The following will also be expected to be empty unless `settings.jsdoc.mode`
- is set to "closure" (which allows types).
-
- - `@package`
- - `@private`
- - `@protected`
- - `@public`
- - `@static`
-
- Note that `@private` will still be checked for content by this rule even with
- `settings.jsdoc.ignorePrivate` set to `true` (a setting which normally
- causes rules not to take effect).
-
- Similarly, `@internal` will still be checked for content by this rule even with
- `settings.jsdoc.ignoreInternal` set to `true`.
-
- <a name="eslint-plugin-jsdoc-rules-empty-tags-options-9"></a>
- #### Options
-
- <a name="eslint-plugin-jsdoc-rules-empty-tags-options-9-tags-1"></a>
- ##### <code>tags</code>
-
- If you want additional tags to be checked for their descriptions, you may
- add them within this option.
-
- ```js
- {
- 'jsdoc/empty-tags': ['error', {tags: ['event']}]
- }
- ```
-
- |||
- |---|---|
- |Context|everywhere|
- |Tags| `abstract`, `async`, `generator`, `global`, `hideconstructor`, `ignore`, `inheritdoc`, `inner`, `instance`, `internal`, `override`, `readonly`, `package`, `private`, `protected`, `public`, `static` and others added by `tags`|
- |Recommended|true|
- |Options|`tags`|
- The following patterns are considered problems:
-
- ````js
- /**
- * @abstract extra text
- */
- function quux () {
-
- }
- // Message: @abstract should be empty.
-
- class Test {
- /**
- * @abstract extra text
- */
- quux () {
-
- }
- }
- // Message: @abstract should be empty.
-
- /**
- * @abstract extra text
- * @inheritdoc
- * @async out of place
- */
- function quux () {
-
- }
- // Message: @abstract should be empty.
-
- /**
- * @event anEvent
- */
- function quux () {
-
- }
- // "jsdoc/empty-tags": ["error"|"warn", {"tags":["event"]}]
- // Message: @event should be empty.
-
- /**
- * @private {someType}
- */
- function quux () {
-
- }
- // Message: @private should be empty.
-
- /**
- * @internal {someType}
- */
- function quux () {
-
- }
- // Message: @internal should be empty.
-
- /**
- * @private {someType}
- */
- function quux () {
-
- }
- // Settings: {"jsdoc":{"ignorePrivate":true}}
- // Message: @private should be empty.
- ````
-
- The following patterns are not considered problems:
-
- ````js
- /**
- * @abstract
- */
- function quux () {
-
- }
-
- /**
- *
- */
- function quux () {
-
- }
-
- /**
- * @param aName
- */
- function quux () {
-
- }
-
- /**
- * @abstract
- * @inheritdoc
- * @async
- */
- function quux () {
-
- }
-
- /**
- * @private {someType}
- */
- function quux () {
-
- }
- // Settings: {"jsdoc":{"mode":"closure"}}
-
- /**
- * @private
- */
- function quux () {
-
- }
-
- /**
- * @internal
- */
- function quux () {
-
- }
-
- /**
- * Create an array.
- *
- * @private
- *
- * @param {string[]} [elem] - Elements to make an array of.
- * @param {boolean} [clone] - Optionally clone nodes.
- * @returns {string[]} The array of nodes.
- */
- function quux () {}
- ````
-
-
- <a name="eslint-plugin-jsdoc-rules-implements-on-classes"></a>
- ### <code>implements-on-classes</code>
-
- Reports an issue with any non-constructor function using `@implements`.
-
- Constructor functions, whether marked with `@class`, `@constructs`, or being
- an ES6 class constructor, will not be flagged.
-
- To indicate that a function follows another function's signature, one might
- instead use `@type` to indicate the `@function` or `@callback` to which the
- function is adhering.
-
- <a name="eslint-plugin-jsdoc-rules-implements-on-classes-options-10"></a>
- #### Options
-
- <a name="eslint-plugin-jsdoc-rules-implements-on-classes-options-10-contexts"></a>
- ##### <code>contexts</code>
-
- Set this to an array of strings representing the AST context (or an object with
- `context` and `comment` properties) where you wish the rule to be applied.
-
- Overrides the default contexts (see below). Set to `"any"` if you want
- the rule to apply to any jsdoc block throughout your files (as is necessary
- for finding function blocks not attached to a function declaration or
- expression, i.e., `@callback` or `@function` (or its aliases `@func` or
- `@method`) (including those associated with an `@interface`).
-
- See the ["AST and Selectors"](#eslint-plugin-jsdoc-advanced-ast-and-selectors)
- section of our README for more on the expected format.
-
- |||
- |---|---|
- |Context|`ArrowFunctionExpression`, `FunctionDeclaration`, `FunctionExpression`; others when `contexts` option enabled|
- |Tags|`implements` (prevented)|
- |Recommended|true|
- |Options|`contexts`|
-
- The following patterns are considered problems:
-
- ````js
- /**
- * @implements {SomeClass}
- */
- function quux () {
-
- }
- // Message: @implements used on a non-constructor function
-
- /**
- * @implements {SomeClass}
- */
- function quux () {
-
- }
- // "jsdoc/implements-on-classes": ["error"|"warn", {"contexts":["any"]}]
- // Message: @implements used on a non-constructor function
-
- /**
- * @function
- * @implements {SomeClass}
- */
- function quux () {
-
- }
- // "jsdoc/implements-on-classes": ["error"|"warn", {"contexts":["any"]}]
- // Message: @implements used on a non-constructor function
-
- /**
- * @callback
- * @implements {SomeClass}
- */
- // "jsdoc/implements-on-classes": ["error"|"warn", {"contexts":["any"]}]
- // Message: @implements used on a non-constructor function
-
- /**
- * @implements {SomeClass}
- */
- function quux () {
-
- }
- // Settings: {"jsdoc":{"tagNamePreference":{"implements":false}}}
- // Message: Unexpected tag `@implements`
-
- class Foo {
- /**
- * @implements {SomeClass}
- */
- constructor() {}
-
- /**
- * @implements {SomeClass}
- */
- bar() {}
- }
- // "jsdoc/implements-on-classes": ["error"|"warn", {"contexts":["MethodDefinition"]}]
- // Message: @implements used on a non-constructor function
-
- class Foo {
- /**
- * @implements {SomeClass}
- */
- constructor() {}
-
- /**
- * @implements {SomeClass}
- */
- bar() {}
- }
- // "jsdoc/implements-on-classes": ["error"|"warn", {"contexts":["any"]}]
- // Message: @implements used on a non-constructor function
- ````
-
- The following patterns are not considered problems:
-
- ````js
- /**
- * @implements {SomeClass}
- * @class
- */
- function quux () {
-
- }
-
- /**
- * @implements {SomeClass}
- * @class
- */
- function quux () {
-
- }
- // "jsdoc/implements-on-classes": ["error"|"warn", {"contexts":["any"]}]
-
- /**
- * @implements {SomeClass}
- */
- // "jsdoc/implements-on-classes": ["error"|"warn", {"contexts":["any"]}]
-
- /**
- * @implements {SomeClass}
- * @constructor
- */
- function quux () {
-
- }
-
- /**
- *
- */
- class quux {
- /**
- * @implements {SomeClass}
- */
- constructor () {
-
- }
- }
-
- /**
- *
- */
- const quux = class {
- /**
- * @implements {SomeClass}
- */
- constructor () {
-
- }
- }
-
- /**
- *
- */
- function quux () {
-
- }
-
- /**
- *
- */
- function quux () {
-
- }
- // Settings: {"jsdoc":{"tagNamePreference":{"implements":false}}}
-
- /**
- * @function
- * @implements {SomeClass}
- */
-
- /**
- * @callback
- * @implements {SomeClass}
- */
- ````
-
-
- <a name="eslint-plugin-jsdoc-rules-match-description"></a>
- ### <code>match-description</code>
-
- Enforces a regular expression pattern on descriptions.
-
- The default is this basic expression to match English sentences (Support
- for Unicode upper case may be added in a future version when it can be handled
- by our supported Node versions):
-
- ``^([A-Z]|[`\\d_])[\\s\\S]*[.?!`]$``
-
- Applies to the jsdoc block description and `@description` (or `@desc`)
- by default but the `tags` option (see below) may be used to match other tags.
-
- The default (and all regex options) defaults to using (only) the `u` flag, so
- to add your own flags, encapsulate your expression as a string, but like a
- literal, e.g., `/[A-Z].*\\./ui`.
-
- Note that `/` delimiters are optional, but necessary to add flags (besides
- `u`).
-
- Also note that the default or optional regular expressions is *not*
- case-insensitive unless one opts in to add the `i` flag.
-
- You can add the `s` flag if you want `.` to match newlines. Note, however,
- that the trailing newlines of a description will not be matched.
-
- <a name="eslint-plugin-jsdoc-rules-match-description-options-11"></a>
- #### Options
-
- <a name="eslint-plugin-jsdoc-rules-match-description-options-11-matchdescription"></a>
- ##### <code>matchDescription</code>
-
- You can supply your own expression to override the default, passing a
- `matchDescription` string on the options object.
-
- ```js
- {
- 'jsdoc/match-description': ['error', {matchDescription: '[A-Z].*\\.'}]
- }
- ```
-
- <a name="eslint-plugin-jsdoc-rules-match-description-options-11-message"></a>
- ##### <code>message</code>
-
- You may provide a custom default message by using the following format:
-
- ```js
- {
- 'jsdoc/match-description': ['error', {
- message: 'The default dscription should begin with a capital letter.'
- }]
- }
- ```
-
- This can be overridden per tag or for the main block description by setting
- `message` within `tags` or `mainDescription`, respectively.
-
- <a name="eslint-plugin-jsdoc-rules-match-description-options-11-tags-2"></a>
- ##### <code>tags</code>
-
- If you want different regular expressions to apply to tags, you may use
- the `tags` option object:
-
- ```js
- {
- 'jsdoc/match-description': ['error', {tags: {
- param: '\\- [A-Z].*\\.',
- returns: '[A-Z].*\\.'
- }}]
- }
- ```
-
- In place of a string, you can also add `true` to indicate that a particular
- tag should be linted with the `matchDescription` value (or the default).
-
- ```js
- {
- 'jsdoc/match-description': ['error', {tags: {
- param: true,
- returns: true
- }}]
- }
- ```
-
- Alternatively, you may supply an object with a `message` property to indicate
- the error message for that tag.
-
- ```js
- {
- 'jsdoc/match-description': ['error', {tags: {
- param: {message: 'Begin with a hyphen', match: '\\- [A-Z].*\\.'},
- returns: {message: 'Capitalize for returns (the default)', match: true}
- }}]
- }
- ```
-
- The tags `@param`/`@arg`/`@argument` and `@property`/`@prop` will be properly
- parsed to ensure that the matched "description" text includes only the text
- after the name.
-
- All other tags will treat the text following the tag name, a space, and
- an optional curly-bracketed type expression (and another space) as part of
- its "description" (e.g., for `@returns {someType} some description`, the
- description is `some description` while for `@some-tag xyz`, the description
- is `xyz`).
-
- <a name="eslint-plugin-jsdoc-rules-match-description-options-11-maindescription"></a>
- ##### <code>mainDescription</code>
-
- If you wish to override the main block description without changing the
- default `match-description` (which can cascade to the `tags` with `true`),
- you may use `mainDescription`:
-
- ```js
- {
- 'jsdoc/match-description': ['error', {
- mainDescription: '[A-Z].*\\.',
- tags: {
- param: true,
- returns: true
- }
- }]
- }
- ```
-
- There is no need to add `mainDescription: true`, as by default, the main
- block description (and only the main block description) is linted, though you
- may disable checking it by setting it to `false`.
-
- You may also provide an object with `message`:
-
- ```js
- {
- 'jsdoc/match-description': ['error', {
- mainDescription: {
- message: 'Capitalize first word of JSDoc block descriptions',
- match: '[A-Z].*\\.'
- },
- tags: {
- param: true,
- returns: true
- }
- }]
- }
- ```
-
- <a name="eslint-plugin-jsdoc-rules-match-description-options-11-contexts-1"></a>
- ##### <code>contexts</code>
-
- Set this to an array of strings representing the AST context (or an object with
- `context` and `comment` properties) where you wish the rule to be applied.
- (e.g., `ClassDeclaration` for ES6
- classes). Overrides the default contexts (see below). Set to `"any"` if you
- want the rule to apply to any jsdoc block throughout your files.
-
- See the ["AST and Selectors"](#eslint-plugin-jsdoc-advanced-ast-and-selectors)
- section of our README for more on the expected format.
-
- |||
- |---|---|
- |Context|`ArrowFunctionExpression`, `FunctionDeclaration`, `FunctionExpression`; others when `contexts` option enabled|
- |Tags|docblock and `@description` by default but more with `tags`|
- |Aliases|`@desc`|
- |Recommended|false|
- |Settings||
- |Options|`contexts`, `tags` (accepts tags with names and optional type such as 'param', 'arg', 'argument', 'property', and 'prop', and accepts arbitrary list of other tags with an optional type (but without names), e.g., 'returns', 'return'), `mainDescription`, `matchDescription`|
-
- The following patterns are considered problems:
-
- ````js
- /**
- * foo.
- */
- const q = class {
-
- }
- // "jsdoc/match-description": ["error"|"warn", {"contexts":["ClassExpression"]}]
- // Message: JSDoc description does not satisfy the regex pattern.
-
- /**
- * foo.
- */
- const q = class {
-
- }
- // "jsdoc/match-description": ["error"|"warn", {"contexts":["ClassExpression"],"message":"Needs to begin with a capital letter and end with an end mark."}]
- // Message: Needs to begin with a capital letter and end with an end mark.
-
- /**
- * foo.
- */
- // "jsdoc/match-description": ["error"|"warn", {"contexts":["any"]}]
- // Message: JSDoc description does not satisfy the regex pattern.
-
- /**
- * foo.
- */
- // "jsdoc/match-description": ["error"|"warn", {"contexts":["any"]}]
- // Message: JSDoc description does not satisfy the regex pattern.
-
- /**
- * foo.
- */
- const q = {
-
- };
- // "jsdoc/match-description": ["error"|"warn", {"contexts":["ObjectExpression"]}]
- // Message: JSDoc description does not satisfy the regex pattern.
-
- /**
- * foo.
- */
- function quux () {
-
- }
- // Message: JSDoc description does not satisfy the regex pattern.
-
- /**
- * Foo)
- */
- function quux () {
-
- }
- // Message: JSDoc description does not satisfy the regex pattern.
-
- /**
- * тест.
- */
- function quux () {
-
- }
- // "jsdoc/match-description": ["error"|"warn", {"matchDescription":"[А-Я][А-я]+\\."}]
- // Message: JSDoc description does not satisfy the regex pattern.
-
- /**
- * тест.
- */
- function quux () {
-
- }
- // "jsdoc/match-description": ["error"|"warn", {"matchDescription":"[А-Я][А-я]+\\.","message":"Needs to begin with a capital letter and end with an end mark."}]
- // Message: Needs to begin with a capital letter and end with an end mark.
-
- /**
- * Abc.
- */
- function quux () {
-
- }
- // "jsdoc/match-description": ["error"|"warn", {"mainDescription":"[А-Я][А-я]+\\.","tags":{"param":true}}]
- // Message: JSDoc description does not satisfy the regex pattern.
-
- /**
- * Abc.
- */
- function quux () {
-
- }
- // "jsdoc/match-description": ["error"|"warn", {"mainDescription":{"match":"[А-Я][А-я]+\\.","message":"Needs to begin with a Cyrillic capital letter and end with a period."},"tags":{"param":true}}]
- // Message: Needs to begin with a Cyrillic capital letter and end with a period.
-
- /**
- * Foo
- */
- function quux () {
-
- }
- // Message: JSDoc description does not satisfy the regex pattern.
-
- /**
- * Foo.
- *
- * @param foo foo.
- */
- function quux (foo) {
-
- }
- // "jsdoc/match-description": ["error"|"warn", {"tags":{"param":true}}]
- // Message: JSDoc description does not satisfy the regex pattern.
-
- /**
- * Foo.
- *
- * @template Abc, Def foo.
- */
- function quux (foo) {
-
- }
- // "jsdoc/match-description": ["error"|"warn", {"tags":{"template":true}}]
- // Message: JSDoc description does not satisfy the regex pattern.
-
- /**
- * Foo.
- *
- * @prop foo foo.
- */
- function quux (foo) {
-
- }
- // "jsdoc/match-description": ["error"|"warn", {"tags":{"prop":true}}]
- // Message: JSDoc description does not satisfy the regex pattern.
-
- /**
- * Foo.
- *
- * @summary foo.
- */
- function quux () {
-
- }
- // "jsdoc/match-description": ["error"|"warn", {"tags":{"summary":true}}]
- // Message: JSDoc description does not satisfy the regex pattern.
-
- /**
- * Foo.
- *
- * @author
- */
- function quux () {
-
- }
- // "jsdoc/match-description": ["error"|"warn", {"tags":{"author":".+"}}]
- // Message: JSDoc description does not satisfy the regex pattern.
-
- /**
- * Foo.
- *
- * @x-tag
- */
- function quux () {
-
- }
- // "jsdoc/match-description": ["error"|"warn", {"tags":{"x-tag":".+"}}]
- // Message: JSDoc description does not satisfy the regex pattern.
-
- /**
- * Foo.
- *
- * @description foo foo.
- */
- function quux (foo) {
-
- }
- // "jsdoc/match-description": ["error"|"warn", {"tags":{"description":true}}]
- // Message: JSDoc description does not satisfy the regex pattern.
-
- /**
- * Foo
- *
- * @param foo foo.
- */
- function quux (foo) {
-
- }
- // "jsdoc/match-description": ["error"|"warn", {"mainDescription":"^[a-zA-Z]*$","tags":{"param":true}}]
- // Message: JSDoc description does not satisfy the regex pattern.
-
- /**
- * Foo
- *
- * @param foo foo.
- */
- function quux (foo) {
-
- }
- // "jsdoc/match-description": ["error"|"warn", {"mainDescription":{"match":"^[a-zA-Z]*$","message":"Letters only"},"tags":{"param":{"match":true,"message":"Needs to begin with a capital letter and end with a period."}}}]
- // Message: Needs to begin with a capital letter and end with a period.
-
- /**
- * Foo
- *
- * @param foo foo.
- */
- function quux (foo) {
-
- }
- // "jsdoc/match-description": ["error"|"warn", {"mainDescription":false,"tags":{"param":true}}]
- // Message: JSDoc description does not satisfy the regex pattern.
-
- /**
- * Foo.
- *
- * @param foo bar
- */
- function quux (foo) {
-
- }
- // "jsdoc/match-description": ["error"|"warn", {"tags":{"param":true}}]
- // Message: JSDoc description does not satisfy the regex pattern.
-
- /**
- * {@see Foo.bar} buz
- */
- function quux (foo) {
-
- }
- // Message: JSDoc description does not satisfy the regex pattern.
-
- /**
- * Foo.
- *
- * @returns {number} foo
- */
- function quux (foo) {
-
- }
- // "jsdoc/match-description": ["error"|"warn", {"tags":{"returns":true}}]
- // Message: JSDoc description does not satisfy the regex pattern.
-
- /**
- * Foo.
- *
- * @returns foo.
- */
- function quux (foo) {
-
- }
- // "jsdoc/match-description": ["error"|"warn", {"tags":{"returns":true}}]
- // Message: JSDoc description does not satisfy the regex pattern.
-
- /**
- * lorem ipsum dolor sit amet, consectetur adipiscing elit. pellentesque elit diam,
- * iaculis eu dignissim sed, ultrices sed nisi. nulla at ligula auctor, consectetur neque sed,
- * tincidunt nibh. vivamus sit amet vulputate ligula. vivamus interdum elementum nisl,
- * vitae rutrum tortor semper ut. morbi porta ante vitae dictum fermentum.
- * proin ut nulla at quam convallis gravida in id elit. sed dolor mauris, blandit quis ante at,
- * consequat auctor magna. duis pharetra purus in porttitor mollis.
- */
- function longDescription (foo) {
-
- }
- // Message: JSDoc description does not satisfy the regex pattern.
-
- /**
- * @arg {number} foo - Foo
- */
- function quux (foo) {
-
- }
- // "jsdoc/match-description": ["error"|"warn", {"tags":{"arg":true}}]
- // Message: JSDoc description does not satisfy the regex pattern.
-
- /**
- * @argument {number} foo - Foo
- */
- function quux (foo) {
-
- }
- // "jsdoc/match-description": ["error"|"warn", {"tags":{"argument":true}}]
- // Message: JSDoc description does not satisfy the regex pattern.
-
- /**
- * @return {number} foo
- */
- function quux (foo) {
-
- }
- // "jsdoc/match-description": ["error"|"warn", {"tags":{"return":true}}]
- // Message: JSDoc description does not satisfy the regex pattern.
-
- /**
- * Returns bar.
- *
- * @return {number} bar
- */
- function quux (foo) {
-
- }
- // "jsdoc/match-description": ["error"|"warn", {"tags":{"return":true}}]
- // Message: JSDoc description does not satisfy the regex pattern.
-
- /**
- * @param notRet
- * @returns Тест.
- */
- function quux () {
-
- }
- // "jsdoc/match-description": ["error"|"warn", {"tags":{"param":"[А-Я][А-я]+\\."}}]
- // Message: JSDoc description does not satisfy the regex pattern.
-
- /**
- * @description notRet
- * @returns Тест.
- */
- function quux () {
-
- }
- // "jsdoc/match-description": ["error"|"warn", {"tags":{"description":"[А-Я][А-я]+\\."}}]
- // Message: JSDoc description does not satisfy the regex pattern.
-
- /**
- * foo.
- */
- class quux {
-
- }
- // "jsdoc/match-description": ["error"|"warn", {"contexts":["ClassDeclaration"]}]
- // Message: JSDoc description does not satisfy the regex pattern.
-
- class MyClass {
- /**
- * Abc
- */
- myClassField = 1
- }
- // "jsdoc/match-description": ["error"|"warn", {"contexts":["ClassProperty"]}]
- // Message: JSDoc description does not satisfy the regex pattern.
-
- /**
- * foo.
- */
- interface quux {
-
- }
- // "jsdoc/match-description": ["error"|"warn", {"contexts":["TSInterfaceDeclaration"]}]
- // Message: JSDoc description does not satisfy the regex pattern.
-
- const myObject = {
- /**
- * Bad description
- */
- myProp: true
- };
- // "jsdoc/match-description": ["error"|"warn", {"contexts":["Property"]}]
- // Message: JSDoc description does not satisfy the regex pattern.
-
- /**
- * @param foo Foo bar
- */
- function quux (foo) {
-
- }
- // Settings: {"jsdoc":{"tagNamePreference":{"description":false}}}
- // "jsdoc/match-description": ["error"|"warn", {"tags":{"param":true}}]
- // Message: JSDoc description does not satisfy the regex pattern.
-
- /**
- * Foo bar
- */
- function quux (foo) {
-
- }
- // Settings: {"jsdoc":{"tagNamePreference":{"description":false}}}
- // Message: JSDoc description does not satisfy the regex pattern.
- ````
-
- The following patterns are not considered problems:
-
- ````js
- /**
- *
- */
-
- /**
- *
- */
- function quux () {
-
- }
-
- /**
- * @param foo - Foo.
- */
- function quux () {
-
- }
- // "jsdoc/match-description": ["error"|"warn", {"tags":{"param":true}}]
-
- /**
- * Foo.
- */
- function quux () {
-
- }
-
- /**
- * Foo.
- * Bar.
- */
- function quux () {
-
- }
-
- /**
- * Foo.
- *
- * Bar.
- */
- function quux () {
-
- }
-
- /**
- * Foo.
- *
- * Bar.
- */
- function quux () {
-
- }
- // "jsdoc/match-description": ["error"|"warn", {"message":"This won't be shown"}]
-
- /**
- * Тест.
- */
- function quux () {
-
- }
- // "jsdoc/match-description": ["error"|"warn", {"matchDescription":"[А-Я][А-я]+\\."}]
-
- /**
- * @param notRet
- * @returns Тест.
- */
- function quux () {
-
- }
- // "jsdoc/match-description": ["error"|"warn", {"tags":{"returns":"[А-Я][А-я]+\\."}}]
-
- /**
- * @param notRet
- * @description Тест.
- */
- function quux () {
-
- }
- // "jsdoc/match-description": ["error"|"warn", {"tags":{"description":"[А-Я][А-я]+\\."}}]
-
- /**
- * Foo
- * bar.
- */
- function quux () {
-
- }
-
- /**
- * @returns Foo bar.
- */
- function quux () {
-
- }
- // "jsdoc/match-description": ["error"|"warn", {"tags":{"returns":true}}]
-
- /**
- * @returns {type1} Foo bar.
- */
- function quux () {
-
- }
- // "jsdoc/match-description": ["error"|"warn", {"tags":{"returns":true}}]
-
- /**
- * @description Foo bar.
- */
- function quux () {
-
- }
- // "jsdoc/match-description": ["error"|"warn", {"tags":{"description":true}}]
-
- /**
- * @description Foo
- * bar.
- * @param
- */
- function quux () {
-
- }
- // "jsdoc/match-description": ["error"|"warn", {"tags":{"description":true}}]
-
- /** @description Foo bar. */
- function quux () {
-
- }
- // "jsdoc/match-description": ["error"|"warn", {"tags":{"description":true}}]
-
- /**
- * @description Foo
- * bar.
- */
- function quux () {
-
- }
- // "jsdoc/match-description": ["error"|"warn", {"tags":{"description":true}}]
-
- /**
- * Foo. {@see Math.sin}.
- */
- function quux () {
-
- }
-
- /**
- * Foo {@see Math.sin} bar.
- */
- function quux () {
-
- }
-
- /**
- * Foo?
- *
- * Bar!
- *
- * Baz:
- * 1. Foo.
- * 2. Bar.
- */
- function quux () {
-
- }
-
- /**
- * Hello:
- * World.
- */
- function quux () {
-
- }
-
- /**
- * Hello: world.
- */
- function quux () {
-
- }
-
- /**
- * Foo
- * Bar.
- */
- function quux () {
-
- }
-
- /**
- * Foo.
- *
- * foo.
- */
- function quux () {
-
- }
-
- /**
- * foo.
- */
- function quux () {
-
- }
- // "jsdoc/match-description": ["error"|"warn", {"mainDescription":false}]
-
- /**
- * foo.
- */
- class quux {
-
- }
-
- /**
- * foo.
- */
- class quux {
-
- }
- // "jsdoc/match-description": ["error"|"warn", {"mainDescription":true}]
-
- class MyClass {
- /**
- * Abc.
- */
- myClassField = 1
- }
- // "jsdoc/match-description": ["error"|"warn", {"contexts":["ClassProperty"]}]
-
- /**
- * Foo.
- */
- interface quux {
-
- }
- // "jsdoc/match-description": ["error"|"warn", {"contexts":["TSInterfaceDeclaration"]}]
-
- const myObject = {
- /**
- * Bad description
- */
- myProp: true
- };
- // "jsdoc/match-description": ["error"|"warn", {"contexts":[]}]
-
- /**
- * foo.
- */
- const q = class {
-
- }
- // "jsdoc/match-description": ["error"|"warn", {"contexts":[]}]
-
- /**
- * foo.
- */
- const q = {
-
- };
- // "jsdoc/match-description": ["error"|"warn", {"contexts":[]}]
-
- /**
- * @description foo.
- */
- function quux () {
-
- }
- // "jsdoc/match-description": ["error"|"warn", {"tags":{"param":true}}]
-
- /**
- * Foo.
- *
- * @summary Foo.
- */
- function quux () {
-
- }
- // "jsdoc/match-description": ["error"|"warn", {"tags":{"summary":true}}]
-
- /**
- * Foo.
- *
- * @author Somebody
- */
- function quux () {
-
- }
- // "jsdoc/match-description": ["error"|"warn", {"tags":{"author":".+"}}]
-
- /**
- * Foo.
- *
- * @x-tag something
- */
- function quux () {
-
- }
- // "jsdoc/match-description": ["error"|"warn", {"tags":{"x-tag":".+"}}]
-
- /**
- * Foo.
- *
- * @prop foo Foo.
- */
- function quux (foo) {
-
- }
- // "jsdoc/match-description": ["error"|"warn", {"tags":{"prop":true}}]
-
- /**
- * @param foo Foo bar.
- */
- function quux (foo) {
-
- }
- // Settings: {"jsdoc":{"tagNamePreference":{"description":false}}}
-
- /**
- *
- */
- function quux () {
-
- }
- // Settings: {"jsdoc":{"tagNamePreference":{"description":false}}}
-
- /**
- * Foo.
- *
- * @template Abc, Def Foo.
- */
- function quux (foo) {
-
- }
- // "jsdoc/match-description": ["error"|"warn", {"tags":{"template":true}}]
-
- /**
- * Enable or disable plugin.
- *
- * When enabling with this function, the script will be attached to the `document` if:.
- * - the script runs in browser context.
- * - the `document` doesn't have the script already attached.
- * - the `loadScript` option is set to `true`.
- * @param enabled `true` to enable, `false` to disable. Default: `true`.
- */
- // "jsdoc/match-description": ["error"|"warn", {"contexts":["any"],"mainDescription":"/^[A-Z`-].*\\.$/us","matchDescription":"^([A-Z`-].*(\\.|:)|-\\s.*)$","tags":{"param":true,"returns":true}}]
- ````
-
-
- <a name="eslint-plugin-jsdoc-rules-match-name"></a>
- ### <code>match-name</code>
-
- Reports the name portion of a JSDoc tag if matching or not matching
- a given regular expression.
-
- Note that some tags do not possess names and anything appearing to be a
- name will actually be part of the description (e.g., for
- `@returns {type} notAName`). If you are defining your own tags, see the
- `structuredTags` setting (if `name: false`, this rule will not apply to
- that tag).
-
- <a name="eslint-plugin-jsdoc-rules-match-name-options-12"></a>
- #### Options
-
- A single options object with the following properties:
-
- <a name="eslint-plugin-jsdoc-rules-match-name-options-12-match"></a>
- ##### <code>match</code>
-
- `match` is a required option containing an array of objects which determine
- the conditions whereby a name is reported as being problematic.
-
- These objects can have any combination of the following groups of optional
- properties, all of which act to confine one another:
-
- - `tags` - This array should include tag names or `*` to indicate the
- match will apply for all tags (except as confined by any context
- properties). If `*` is not used, then these rules will only apply to
- the specified tags. If `tags` is omitted, then `*` is assumed.
-
- - `allowName` - Indicates which names are allowed for the given tag (or `*`).
- Accepts a string regular expression (optionally wrapped between two
- `/` delimiters followed by optional flags) used to match the name.
- - `disallowName` - As with `allowName` but indicates names that are not
- allowed.
- - `replacement` - If `disallowName` is supplied and this value is present, it
- will replace the matched `disallowName` text.
-
- - `context` - AST to confine the allowing or disallowing to jsdoc blocks
- associated with a particular context. See the
- ["AST and Selectors"](#eslint-plugin-jsdoc-advanced-ast-and-selectors)
- section of our README for more on the expected format.
- - `comment` - As with `context` but AST for the JSDoc block comment and types
-
- - `message` - An optional custom message to use when there is a match.
-
- Note that `comment`, even if targeting a specific tag, is used to match the
- whole block. So if a `comment` finds its specific tag, it may still apply
- fixes found by the likes of `disallowName` even when a different tag has the
- disallowed name. An alternative is to ensure that `comment` finds the specific
- tag of the desired tag and/or name and no `disallowName` (or `allowName`) is
- supplied. In such a case, only one error will be reported, but no fixer will
- be applied, however.
-
- |||
- |---|---|
- |Context|everywhere|
- |Tags|(The tags specifie by `tags`, including any tag if `*` is set)|
- |Recommended|false|
- |Settings|`structuredTags`|
- |Options|`match`|
-
- The following patterns are considered problems:
-
- ````js
- /**
- * @param opt_a
- * @param opt_b
- */
- // "jsdoc/match-name": ["error"|"warn", {"match":[{"disallowName":"/^opt_/i"}]}]
- // Message: Only allowing names not matching `/^opt_/i` but found "opt_a".
-
- /**
- * @param opt_a
- * @param opt_b
- */
- // "jsdoc/match-name": ["error"|"warn", {"match":[{"disallowName":"/^opt_/i","replacement":""}]}]
- // Message: Only allowing names not matching `/^opt_/i` but found "opt_a".
-
- /**
- * @param a
- * @param opt_b
- */
- // "jsdoc/match-name": ["error"|"warn", {"match":[{"allowName":"/^[a-z]+$/i"}]}]
- // Message: Only allowing names matching `/^[a-z]+$/i` but found "opt_b".
-
- /**
- * @param arg
- * @param opt_b
- */
- // "jsdoc/match-name": ["error"|"warn", {"match":[{"allowName":"/^[a-z]+$/i","disallowName":"/^arg/i"}]}]
- // Message: Only allowing names not matching `/^arg/i` but found "arg".
-
- /**
- * @param opt_a
- * @param arg
- */
- // "jsdoc/match-name": ["error"|"warn", {"match":[{"disallowName":"/^arg$/i"},{"disallowName":"/^opt_/i"}]}]
- // Message: Only allowing names not matching `/^opt_/i` but found "opt_a".
-
- /**
- * @property opt_a
- * @param opt_b
- */
- // "jsdoc/match-name": ["error"|"warn", {"match":[{"disallowName":"/^opt_/i","tags":["param"]}]}]
- // Message: Only allowing names not matching `/^opt_/i` but found "opt_b".
-
- /**
- * @someTag opt_a
- * @param opt_b
- */
- // Settings: {"jsdoc":{"structuredTags":{"someTag":{"name":"namepath-defining"}}}}
- // "jsdoc/match-name": ["error"|"warn", {"match":[{"disallowName":"/^opt_/i","tags":["param"]}]}]
- // Message: Only allowing names not matching `/^opt_/i` but found "opt_b".
-
- /**
- * @property opt_a
- * @param opt_b
- */
- // "jsdoc/match-name": ["error"|"warn", {"match":[{"disallowName":"/^opt_/i","tags":["*"]}]}]
- // Message: Only allowing names not matching `/^opt_/i` but found "opt_a".
-
- /**
- * @param opt_a
- * @param opt_b
- */
- function quux () {
- }
- // "jsdoc/match-name": ["error"|"warn", {"match":[{"context":"FunctionDeclaration","disallowName":"/^opt_/i"}]}]
- // Message: Only allowing names not matching `/^opt_/i` but found "opt_a".
-
- /**
- * @property opt_a
- * @param {Bar|Foo} opt_b
- */
- // "jsdoc/match-name": ["error"|"warn", {"match":[{"comment":"JSDocBlock:has(JSDocTag[tag=\"param\"][name=/opt_/] > JSDocTypeUnion:has(JsdocTypeName[value=\"Bar\"]:nth-child(1)))"}]}]
- // Message: Prohibited context for "opt_a".
-
- /**
- * @property opt_a
- * @param {Bar|Foo} opt_b
- */
- // "jsdoc/match-name": ["error"|"warn", {"match":[{"comment":"JSDocBlock:has(JSDocTag[tag=\"param\"][name=/opt_/] > JSDocTypeUnion:has(JsdocTypeName[value=\"Bar\"]:nth-child(1)))","message":"Don't use `opt_` prefixes with Bar|..."}]}]
- // Message: Don't use `opt_` prefixes with Bar|...
-
- /**
- * @param opt_a
- * @param opt_b
- */
- function quux () {}
- // "jsdoc/match-name": ["error"|"warn", ]
- // Message: Rule `no-restricted-syntax` is missing a `match` option.
- ````
-
- The following patterns are not considered problems:
-
- ````js
- /**
- * @param opt_a
- * @param opt_b
- */
- // "jsdoc/match-name": ["error"|"warn", {"match":[{"disallowName":"/^arg/i"}]}]
-
- /**
- * @param a
- * @param opt_b
- */
- // "jsdoc/match-name": ["error"|"warn", {"match":[{"allowName":"/^[a-z_]+$/i"}]}]
-
- /**
- * @param someArg
- * @param anotherArg
- */
- // "jsdoc/match-name": ["error"|"warn", {"match":[{"allowName":"/^[a-z]+$/i","disallowName":"/^arg/i"}]}]
-
- /**
- * @param elem1
- * @param elem2
- */
- // "jsdoc/match-name": ["error"|"warn", {"match":[{"disallowName":"/^arg$/i"},{"disallowName":"/^opt_/i"}]}]
-
- /**
- * @someTag opt_a
- * @param opt_b
- */
- // Settings: {"jsdoc":{"structuredTags":{"someTag":{"name":"namepath-defining"}}}}
- // "jsdoc/match-name": ["error"|"warn", {"match":[{"disallowName":"/^opt_/i","tags":["property"]}]}]
-
- /**
- * @property opt_a
- * @param opt_b
- */
- // "jsdoc/match-name": ["error"|"warn", {"match":[{"disallowName":"/^arg/i","tags":["*"]}]}]
-
- /**
- * @param opt_a
- * @param opt_b
- */
- class A {
- }
- // "jsdoc/match-name": ["error"|"warn", {"match":[{"context":"FunctionDeclaration","disallowName":"/^opt_/i"}]}]
-
- /**
- * @property opt_a
- * @param {Foo|Bar} opt_b
- */
- // "jsdoc/match-name": ["error"|"warn", {"match":[{"comment":"JSDocBlock > JSDocTag[tag=\"param\"] > JSDocTypeUnion[left.name=\"Bar\"]","disallowName":"/^opt_/i"}]}]
- ````
-
-
- <a name="eslint-plugin-jsdoc-rules-multiline-blocks"></a>
- ### <code>multiline-blocks</code>
-
- Controls how and whether jsdoc blocks can be expressed as single or multiple
- line blocks.
-
- Note that if you set `noSingleLineBlocks` and `noMultilineBlocks` to `true`
- and configure them in a certain manner, you might effectively be prohibiting
- all jsdoc blocks!
-
- Also allows for preventing text at the very beginning or very end of blocks.
-
- <a name="eslint-plugin-jsdoc-rules-multiline-blocks-options-13"></a>
- #### Options
-
- A single options object with the following properties.
-
- <a name="eslint-plugin-jsdoc-rules-multiline-blocks-options-13-nozerolinetext-defaults-to-true"></a>
- ##### <code>noZeroLineText</code> (defaults to <code>true</code>)
-
- For multiline blocks, any non-whitespace text immediately after the `/**` and
- space will be reported. (Text after a newline is not reported.)
-
- `noMultilineBlocks` will have priority over this rule if it applies.
-
- <a name="eslint-plugin-jsdoc-rules-multiline-blocks-options-13-nofinallinetext-defaults-to-true"></a>
- ##### <code>noFinalLineText</code> (defaults to <code>true</code>)
-
- For multiline blocks, any non-whitespace text preceding the `*/` on the final
- line will be reported. (Text preceding a newline is not reported.)
-
- `noMultilineBlocks` will have priority over this rule if it applies.
-
- <a name="eslint-plugin-jsdoc-rules-multiline-blocks-options-13-nosinglelineblocks-defaults-to-false"></a>
- ##### <code>noSingleLineBlocks</code> (defaults to <code>false</code>)
-
- If this is `true`, any single line blocks will be reported, except those which
- are whitelisted in `singleLineTags`.
-
- <a name="eslint-plugin-jsdoc-rules-multiline-blocks-options-13-singlelinetags-defaults-to-lends-type"></a>
- ##### <code>singleLineTags</code> (defaults to <code>['lends', 'type']</code>)
-
- An array of tags which can nevertheless be allowed as single line blocks when
- `noSingleLineBlocks` is set. You may set this to a empty array to
- cause all single line blocks to be reported. If `'*'` is present, then
- the presence of a tag will allow single line blocks (but not if a tag is
- missing).
-
- <a name="eslint-plugin-jsdoc-rules-multiline-blocks-options-13-nomultilineblocks-defaults-to-false"></a>
- ##### <code>noMultilineBlocks</code> (defaults to <code>false</code>)
-
- Requires that jsdoc blocks are restricted to single lines only unless impacted
- by the options `minimumLengthForMultiline`, `multilineTags`, or
- `allowMultipleTags`.
-
- <a name="eslint-plugin-jsdoc-rules-multiline-blocks-options-13-minimumlengthformultiline-defaults-to-not-being-in-effect"></a>
- ##### <code>minimumLengthForMultiline</code> (defaults to not being in effect)
-
- If `noMultilineBlocks` is set with this numeric option, multiline blocks will
- be permitted if containing at least the given amount of text.
-
- If not set, multiline blocks will not be permitted regardless of length unless
- a relevant tag is present and `multilineTags` is set.
-
- <a name="eslint-plugin-jsdoc-rules-multiline-blocks-options-13-multilinetags-defaults-to"></a>
- ##### <code>multilineTags</code> (defaults to <code>['*']</code>)
-
- If `noMultilineBlocks` is set with this option, multiline blocks may be allowed
- regardless of length as long as a tag or a tag of a certain type is present.
-
- If `*` is included in the array, the presence of a tags will allow for
- multiline blocks (but not when without any tags unless the amount of text is
- over an amount specified by `minimumLengthForMultiline`).
-
- If the array does not include `*` but lists certain tags, the presence of
- such a tag will cause multiline blocks to be allowed.
-
- You may set this to an empty array to prevent any tag from permitting multiple
- lines.
-
- <a name="eslint-plugin-jsdoc-rules-multiline-blocks-options-13-allowmultipletags-defaults-to-true"></a>
- ##### <code>allowMultipleTags</code> (defaults to <code>true</code>)
-
- If `noMultilineBlocks` is set to `true` with this option and multiple tags are
- found in a block, an error will not be reported.
-
- Since multiple-tagged lines cannot be collapsed into a single line, this option
- prevents them from being reported. Set to `false` if you really want to report
- any blocks.
-
- This option will also be applied when there is a block description and a single
- tag (since a description cannot precede a tag on a single line, and also
- cannot be reliably added after the tag either).
-
- |||
- |---|---|
- |Context|everywhere|
- |Tags|Any (though `singleLineTags` and `multilineTags` control the application)|
- |Recommended|true|
- |Settings||
- |Options|`noZeroLineText`, `noSingleLineBlocks`, `singleLineTags`, `noMultilineBlocks`, `minimumLengthForMultiline`, `multilineTags`, `allowMultipleTags`, `noFinalLineText`|
-
- The following patterns are considered problems:
-
- ````js
- /** Reported up here
- * because the rest is multiline
- */
- // Message: Should have no text on the "0th" line (after the `/**`).
-
- /** Reported up here
- * because the rest is multiline
- */
- // "jsdoc/multiline-blocks": ["error"|"warn", {"noZeroLineText":true}]
- // Message: Should have no text on the "0th" line (after the `/**`).
-
- /** @abc {aType} aName Reported up here
- * because the rest is multiline
- */
- // "jsdoc/multiline-blocks": ["error"|"warn", {"noZeroLineText":true}]
- // Message: Should have no text on the "0th" line (after the `/**`).
-
- /** @tag */
- // "jsdoc/multiline-blocks": ["error"|"warn", {"noSingleLineBlocks":true}]
- // Message: Single line blocks are not permitted by your configuration.
-
- /** @tag {someType} */
- // "jsdoc/multiline-blocks": ["error"|"warn", {"noSingleLineBlocks":true}]
- // Message: Single line blocks are not permitted by your configuration.
-
- /** @tag {someType} aName */
- // "jsdoc/multiline-blocks": ["error"|"warn", {"noSingleLineBlocks":true}]
- // Message: Single line blocks are not permitted by your configuration.
-
- /** @tag */
- // "jsdoc/multiline-blocks": ["error"|"warn", {"noSingleLineBlocks":true,"singleLineTags":["someOtherTag"]}]
- // Message: Single line blocks are not permitted by your configuration.
-
- /** desc */
- // "jsdoc/multiline-blocks": ["error"|"warn", {"noSingleLineBlocks":true,"singleLineTags":["*"]}]
- // Message: Single line blocks are not permitted by your configuration.
-
- /**
- * Desc.
- */
- // "jsdoc/multiline-blocks": ["error"|"warn", {"noMultilineBlocks":true}]
- // Message: Multiline jsdoc blocks are prohibited by your configuration.
-
- /** desc
- *
- */
- // "jsdoc/multiline-blocks": ["error"|"warn", {"noMultilineBlocks":true}]
- // Message: Multiline jsdoc blocks are prohibited by your configuration.
-
- /** desc
- *
- */
- // "jsdoc/multiline-blocks": ["error"|"warn", {"noMultilineBlocks":true,"noSingleLineBlocks":true}]
- // Message: Multiline jsdoc blocks are prohibited by your configuration but fixing would result in a single line block which you have prohibited with `noSingleLineBlocks`.
-
- /**
- *
- */
- // "jsdoc/multiline-blocks": ["error"|"warn", {"noMultilineBlocks":true}]
- // Message: Multiline jsdoc blocks are prohibited by your configuration.
-
- /**
- * This is not long enough to be permitted.
- */
- // "jsdoc/multiline-blocks": ["error"|"warn", {"minimumLengthForMultiline":100,"noMultilineBlocks":true}]
- // Message: Multiline jsdoc blocks are prohibited by your configuration.
-
- /**
- * This is not long enough to be permitted.
- */
- // "jsdoc/multiline-blocks": ["error"|"warn", {"allowMultipleTags":true,"minimumLengthForMultiline":100,"noMultilineBlocks":true}]
- // Message: Multiline jsdoc blocks are prohibited by your configuration.
-
- /**
- * This has the wrong tags so is not permitted.
- * @notTheRightTag
- */
- // "jsdoc/multiline-blocks": ["error"|"warn", {"allowMultipleTags":false,"multilineTags":["onlyThisIsExempted"],"noMultilineBlocks":true}]
- // Message: Multiline jsdoc blocks are prohibited by your configuration but the block has a description with a tag.
-
- /**
- * This has too many tags so cannot be fixed ot a single line.
- * @oneTag
- * @anotherTag
- */
- // "jsdoc/multiline-blocks": ["error"|"warn", {"allowMultipleTags":false,"multilineTags":[],"noMultilineBlocks":true}]
- // Message: Multiline jsdoc blocks are prohibited by your configuration but the block has multiple tags.
-
- /**
- * This has a tag and description so cannot be fixed ot a single line.
- * @oneTag
- */
- // "jsdoc/multiline-blocks": ["error"|"warn", {"allowMultipleTags":false,"multilineTags":[],"noMultilineBlocks":true}]
- // Message: Multiline jsdoc blocks are prohibited by your configuration but the block has a description with a tag.
-
- /**
- * This has no tags so is not permitted.
- */
- // "jsdoc/multiline-blocks": ["error"|"warn", {"multilineTags":["*"],"noMultilineBlocks":true}]
- // Message: Multiline jsdoc blocks are prohibited by your configuration.
-
- /**
- * This has the wrong tags so is not permitted.
- * @notTheRightTag
- */
- // "jsdoc/multiline-blocks": ["error"|"warn", {"allowMultipleTags":false,"minimumLengthForMultiline":500,"multilineTags":["onlyThisIsExempted"],"noMultilineBlocks":true}]
- // Message: Multiline jsdoc blocks are prohibited by your configuration but the block has a description with a tag.
-
- /**
- * @lends This can be safely fixed to a single line.
- */
- // "jsdoc/multiline-blocks": ["error"|"warn", {"multilineTags":[],"noMultilineBlocks":true,"noSingleLineBlocks":true}]
- // Message: Multiline jsdoc blocks are prohibited by your configuration.
-
- /**
- * @type {aType} This can be safely fixed to a single line.
- */
- // "jsdoc/multiline-blocks": ["error"|"warn", {"multilineTags":[],"noMultilineBlocks":true,"noSingleLineBlocks":true}]
- // Message: Multiline jsdoc blocks are prohibited by your configuration.
-
- /**
- * @aTag
- */
- // "jsdoc/multiline-blocks": ["error"|"warn", {"multilineTags":[],"noMultilineBlocks":true}]
- // Message: Multiline jsdoc blocks are prohibited by your configuration.
-
- /**
- * This is a problem when single and multiline are blocked.
- */
- // "jsdoc/multiline-blocks": ["error"|"warn", {"noMultilineBlocks":true,"noSingleLineBlocks":true}]
- // Message: Multiline jsdoc blocks are prohibited by your configuration but fixing would result in a single line block which you have prohibited with `noSingleLineBlocks`.
-
- /** This comment is bad
- * It should not have text on line zero
- */
- // "jsdoc/multiline-blocks": ["error"|"warn", {"minimumLengthForMultiline":50,"noMultilineBlocks":true,"noZeroLineText":true}]
- // Message: Should have no text on the "0th" line (after the `/**`).
-
- /**
- * @lends This can be safely fixed
- * to a single
- * line. */
- // "jsdoc/multiline-blocks": ["error"|"warn", {"multilineTags":[],"noMultilineBlocks":true}]
- // Message: Multiline jsdoc blocks are prohibited by your configuration.
-
- /**
- * @someTag {aType} with Description */
- // "jsdoc/multiline-blocks": ["error"|"warn", {"noFinalLineBlocks":true}]
- // Message: Should have no text on the final line (before the `*/`).
-
- /**
- * Description */
- // "jsdoc/multiline-blocks": ["error"|"warn", {"noFinalLineBlocks":true}]
- // Message: Should have no text on the final line (before the `*/`).
- ````
-
- The following patterns are not considered problems:
-
- ````js
- /** Not reported */
-
- /**
- * Not reported
- */
-
- /** Reported up here
- * because the rest is multiline
- */
- // "jsdoc/multiline-blocks": ["error"|"warn", {"noZeroLineText":false}]
-
- /** @tag */
-
- /** @lends */
- // "jsdoc/multiline-blocks": ["error"|"warn", {"noSingleLineBlocks":true}]
-
- /** @tag */
- // "jsdoc/multiline-blocks": ["error"|"warn", {"noSingleLineBlocks":true,"singleLineTags":["tag"]}]
-
- /** @tag */
- // "jsdoc/multiline-blocks": ["error"|"warn", {"noSingleLineBlocks":true,"singleLineTags":["*"]}]
-
- /**
- *
- */
-
- /**
- *
- */
- // "jsdoc/multiline-blocks": ["error"|"warn", {"noMultilineBlocks":false}]
-
- /** Test */
- // "jsdoc/multiline-blocks": ["error"|"warn", {"noMultilineBlocks":true}]
-
- /**
- * This is long enough to be permitted by our config.
- */
- // "jsdoc/multiline-blocks": ["error"|"warn", {"minimumLengthForMultiline":25,"noMultilineBlocks":true}]
-
- /**
- * This is long enough to be permitted by our config.
- */
- // "jsdoc/multiline-blocks": ["error"|"warn", {"minimumLengthForMultiline":50,"noMultilineBlocks":true}]
-
- /**
- * This has the right tag so is permitted.
- * @theRightTag
- */
- // "jsdoc/multiline-blocks": ["error"|"warn", {"multilineTags":["theRightTag"],"noMultilineBlocks":true}]
-
- /** This has no tags but is single line so is not permitted. */
- // "jsdoc/multiline-blocks": ["error"|"warn", {"multilineTags":["*"],"noMultilineBlocks":true}]
-
- /**
- * This has the wrong tags so is not permitted.
- * @notTheRightTag
- */
- // "jsdoc/multiline-blocks": ["error"|"warn", {"minimumLengthForMultiline":10,"multilineTags":["onlyThisIsExempted"],"noMultilineBlocks":true}]
-
- /**
- * This has the wrong tags so is not permitted.
- * @theRightTag
- */
- // "jsdoc/multiline-blocks": ["error"|"warn", {"minimumLengthForMultiline":500,"multilineTags":["theRightTag"],"noMultilineBlocks":true}]
-
- /** tag */
-
- /**
- * @lends This is ok per multiline
- */
- // "jsdoc/multiline-blocks": ["error"|"warn", {"noMultilineBlocks":true,"noSingleLineBlocks":true}]
-
- /**
- * This has too many tags so cannot be fixed ot a single line.
- * @oneTag
- * @anotherTag
- */
- // "jsdoc/multiline-blocks": ["error"|"warn", {"multilineTags":[],"noMultilineBlocks":true}]
-
- /**
- * This has too many tags so cannot be fixed ot a single line.
- * @oneTag
- * @anotherTag
- */
- // "jsdoc/multiline-blocks": ["error"|"warn", {"allowMultipleTags":true,"multilineTags":[],"noMultilineBlocks":true}]
-
- /**
- * This has a tag and description so cannot be fixed ot a single line.
- * @oneTag
- */
- // "jsdoc/multiline-blocks": ["error"|"warn", {"allowMultipleTags":true,"multilineTags":[],"noMultilineBlocks":true}]
-
- /**
- * This has a tag and description so cannot be fixed ot a single line.
- * @oneTag
- */
- // "jsdoc/multiline-blocks": ["error"|"warn", {"allowMultipleTags":false,"multilineTags":["oneTag"],"noMultilineBlocks":true}]
-
- /** @someTag with Description */
- // "jsdoc/multiline-blocks": ["error"|"warn", {"noFinalLineBlocks":true}]
- ````
-
-
- <a name="eslint-plugin-jsdoc-rules-newline-after-description"></a>
- ### <code>newline-after-description</code>
-
- Enforces a consistent padding of the block description.
-
- <a name="eslint-plugin-jsdoc-rules-newline-after-description-options-14"></a>
- #### Options
-
- This rule allows one optional string argument. If it is `"always"` then a
- problem is raised when there is no newline after the description. If it is
- `"never"` then a problem is raised when there is a newline after the
- description. The default value is `"always"`.
-
- |||
- |---|---|
- |Context|everywhere|
- |Tags|N/A (doc block)|
- |Options|(a string matching `"always" or "never"`)|
- |Recommended|true|
-
- The following patterns are considered problems:
-
- ````js
- /**
- * Foo.
- *
- * Foo.
- * @foo
- */
- function quux () {
-
- }
- // "jsdoc/newline-after-description": ["error"|"warn", "always"]
- // Message: There must be a newline after the description of the JSDoc block.
-
- /**
- * Foo.
- * @foo
- *
- * Foo.
- */
- function quux () {
-
- }
- // "jsdoc/newline-after-description": ["error"|"warn", "always"]
- // Message: There must be a newline after the description of the JSDoc block.
-
- /**
- * Foo.
- *
- * Foo.
- * @foo
- */
- function quux () {
-
- }
- // Message: There must be a newline after the description of the JSDoc block.
-
- /**
- * Bar.
- *
- * Bar.
- *
- * @bar
- */
- function quux () {
-
- }
- // "jsdoc/newline-after-description": ["error"|"warn", "never"]
- // Message: There must be no newline after the description of the JSDoc block.
-
- /**
- * Bar.
- *
- * @bar
- *
- * Bar.
- */
- function quux () {
-
- }
- // "jsdoc/newline-after-description": ["error"|"warn", "never"]
- // Message: There must be no newline after the description of the JSDoc block.
-
-
- /**
- * Bar.
- *
- * Bar.
- *
- * @bar
- */
- function quux () {
-
- }
- // "jsdoc/newline-after-description": ["error"|"warn", "never"]
- // Message: There must be no newline after the description of the JSDoc block.
-
- /**
- * A.
- *
- * @typedef {object} A
- * @prop {boolean} a A.
- */
- // "jsdoc/newline-after-description": ["error"|"warn", "never"]
- // Message: There must be no newline after the description of the JSDoc block.
-
- /**
- * A.
- * @typedef {object} A
- * @prop {boolean} a A.
- */
- // "jsdoc/newline-after-description": ["error"|"warn", "always"]
- // Message: There must be a newline after the description of the JSDoc block.
-
-
- /**
- * Service for fetching symbols.
- * @param {object} $http - Injected http helper.
- * @param {object} $q - Injected Promise api helper.
- * @param {object} $location - Injected window location object.
- * @param {object} REPORT_DIALOG_CONSTANTS - Injected handle.
- */
- // Message: There must be a newline after the description of the JSDoc block.
-
- /** An example function.
- *
- * @returns {number} An example number.
- */
- function example() {
- return 42;
- }
- // "jsdoc/newline-after-description": ["error"|"warn", "never"]
- // Message: There must be no newline after the description of the JSDoc block.
-
- /** An example function.
- * @returns {number} An example number.
- */
- function example() {
- return 42;
- }
- // "jsdoc/newline-after-description": ["error"|"warn", "always"]
- // Message: There must be a newline after the description of the JSDoc block.
- ````
-
- The following patterns are not considered problems:
-
- ````js
- /**
- * Foo.
- */
- function quux () {
-
- }
- // "jsdoc/newline-after-description": ["error"|"warn", "always"]
-
- /**
- * Bar.
- */
- function quux () {
-
- }
- // "jsdoc/newline-after-description": ["error"|"warn", "never"]
-
- /**
- * Foo.
- *
- * @foo
- */
- function quux () {
-
- }
- // "jsdoc/newline-after-description": ["error"|"warn", "always"]
-
- /**
- * Bar.
- * @bar
- */
- function quux () {
-
- }
- // "jsdoc/newline-after-description": ["error"|"warn", "never"]
-
-
- /**
- * @foo
- * Test
- * abc
- * @bar
- */
-
-
- /**
- *
- * @foo
- * Test
- * abc
- * @bar
- */
-
- /***
- *
- */
- function quux () {
-
- }
- // "jsdoc/newline-after-description": ["error"|"warn", "always"]
-
- /**
- * Parses query string to object containing URL parameters
- *
- * @param queryString
- * Input string
- *
- * @returns
- * Object containing URL parameters
- */
- export function parseQueryString(queryString: string): { [key: string]: string } { // <-- Line 10 that fails
-
- }
-
- /** An example function.
- *
- * @returns {number} An example number.
- */
- function example() {
- return 42;
- }
-
- /** An example function.
- * @returns {number} An example number.
- */
- function example() {
- return 42;
- }
- // "jsdoc/newline-after-description": ["error"|"warn", "never"]
- ````
-
-
- <a name="eslint-plugin-jsdoc-rules-no-bad-blocks"></a>
- ### <code>no-bad-blocks</code>
-
- This rule checks for multi-line-style comments which fail to meet the
- criteria of a jsdoc block, namely that it should begin with two and only two
- asterisks, but which appear to be intended as jsdoc blocks due to the presence
- of whitespace followed by whitespace or asterisks, and
- an at-sign (`@`) and some non-whitespace (as with a jsdoc block tag).
-
- <a name="eslint-plugin-jsdoc-rules-no-bad-blocks-options-15"></a>
- #### Options
-
- Takes an optional options object with the following.
-
- <a name="eslint-plugin-jsdoc-rules-no-bad-blocks-options-15-ignore"></a>
- ##### <code>ignore</code>
-
- An array of directives that will not be reported if present at the beginning of
- a multi-comment block and at-sign `/* @`.
-
- Defaults to `['ts-check', 'ts-expect-error', 'ts-ignore', 'ts-nocheck']`
- (some directives [used by TypeScript](https://www.typescriptlang.org/docs/handbook/intro-to-js-ts.html#ts-check)).
-
- <a name="eslint-plugin-jsdoc-rules-no-bad-blocks-options-15-preventallmultiasteriskblocks"></a>
- ##### <code>preventAllMultiAsteriskBlocks</code>
-
- A boolean (defaulting to `false`) which if `true` will prevent all
- multi-asterisked blocks even those without apparent tag content.
-
- |||
- |---|---|
- |Context|Everywhere|
- |Tags|N/A|
- |Recommended|false|
- |Options|`ignore`, `preventAllMultiAsteriskBlocks`|
-
- The following patterns are considered problems:
-
- ````js
- /*
- * @param foo
- */
- function quux (foo) {
-
- }
- // Message: Expected JSDoc-like comment to begin with two asterisks.
-
- /*
- * @property foo
- */
- // Message: Expected JSDoc-like comment to begin with two asterisks.
-
- function quux() {
-
- }
- // Settings: {"jsdoc":{"structuredTags":{"see":{"name":false,"required":["name"]}}}}
- // Message: Cannot add "name" to `require` with the tag's `name` set to `false`
-
- /* @ts-ignore */
- // "jsdoc/no-bad-blocks": ["error"|"warn", {"ignore":[]}]
- // Message: Expected JSDoc-like comment to begin with two asterisks.
-
- /*
- * Some description.
- *
- * @returns {string} Some string
- */
- function echo() {
- return 'Something';
- }
- // Message: Expected JSDoc-like comment to begin with two asterisks.
-
- /***
- * @param foo
- */
- function quux (foo) {
-
- }
- // Message: Expected JSDoc-like comment to begin with two asterisks.
-
- /***
- *
- */
- function quux (foo) {
-
- }
- // "jsdoc/no-bad-blocks": ["error"|"warn", {"preventAllMultiAsteriskBlocks":true}]
- // Message: Expected JSDoc-like comment to begin with two asterisks.
- ````
-
- The following patterns are not considered problems:
-
- ````js
- /**
- * @property foo
- */
-
- /**
- * @param foo
- */
- function quux () {
-
- }
-
- function quux () {
-
- }
-
- /* This could just be intended as a regular multiline comment,
- so don't report this */
- function quux () {
-
- }
-
- /* Just a regular multiline comment with an `@` but not appearing
- like a tag in a jsdoc-block, so don't report */
- function quux () {
-
- }
-
- /* @ts-check */
-
- /* @ts-expect-error */
-
- /* @ts-ignore */
-
- /* @ts-nocheck */
-
- /* */
-
- /* @custom */
- // "jsdoc/no-bad-blocks": ["error"|"warn", {"ignore":["custom"]}]
-
- /***
- * This is not JSDoc because of the 3 asterisks, but
- * is allowed without `preventAllMultiAsteriskBlocks`, as
- * some might wish normal multiline comments.
- */
- function quux (foo) {
-
- }
- ````
-
-
- <a name="eslint-plugin-jsdoc-rules-no-defaults"></a>
- ### <code>no-defaults</code>
-
- This rule reports defaults being used on the relevant portion of `@param`
- or `@default`. It also optionally reports the presence of the
- square-bracketed optional arguments at all.
-
- The rule is intended to prevent the indication of defaults on tags where
- this would be redundant with ES6 default parameters (or for `@default`,
- where it would be redundant with the context to which the `@default`
- tag is attached).
-
- Unless your `@default` is on a function, you will need to set `contexts`
- to an appropriate context, including, if you wish, "any".
-
- <a name="eslint-plugin-jsdoc-rules-no-defaults-options-16"></a>
- #### Options
-
- <a name="eslint-plugin-jsdoc-rules-no-defaults-options-16-nooptionalparamnames"></a>
- ##### <code>noOptionalParamNames</code>
-
- Set this to `true` to report the presence of optional parameters. May be
- used if the project is insisting on optionality being indicated by
- the presence of ES6 default parameters (bearing in mind that such
- "defaults" are only applied when the supplied value is missing or
- `undefined` but not for `null` or other "falsey" values).
-
- <a name="eslint-plugin-jsdoc-rules-no-defaults-options-16-contexts-2"></a>
- ##### <code>contexts</code>
-
- Set this to an array of strings representing the AST context (or an object with
- `context` and `comment` properties) where you wish the rule to be applied.
- Overrides the default contexts (see below). Set to `"any"` if you want
- the rule to apply to any jsdoc block throughout your files (as is necessary
- for finding function blocks not attached to a function declaration or
- expression, i.e., `@callback` or `@function` (or its aliases `@func` or
- `@method`) (including those associated with an `@interface`).
-
- See the ["AST and Selectors"](#eslint-plugin-jsdoc-advanced-ast-and-selectors)
- section of our README for more on the expected format.
-
- |||
- |---|---|
- |Context|`ArrowFunctionExpression`, `FunctionDeclaration`, `FunctionExpression`; others when `contexts` option enabled|
- |Tags|`param`, `default`|
- |Aliases|`arg`, `argument`, `defaultvalue`|
- |Recommended|false|
- |Options|`contexts`, `noOptionalParamNames`|
-
- The following patterns are considered problems:
-
- ````js
- /**
- * @param {number} [foo="7"]
- */
- function quux (foo) {
-
- }
- // Message: Defaults are not permitted on @param.
-
- class Test {
- /**
- * @param {number} [foo="7"]
- */
- quux (foo) {
-
- }
- }
- // Message: Defaults are not permitted on @param.
-
- /**
- * @param {number} [foo="7"]
- */
- function quux (foo) {
-
- }
- // "jsdoc/no-defaults": ["error"|"warn", {"noOptionalParamNames":true}]
- // Message: Optional param names are not permitted on @param.
-
- /**
- * @arg {number} [foo="7"]
- */
- function quux (foo) {
-
- }
- // Settings: {"jsdoc":{"tagNamePreference":{"param":"arg"}}}
- // Message: Defaults are not permitted on @arg.
-
- /**
- * @param {number} [foo="7"]
- */
- function quux (foo) {
-
- }
- // "jsdoc/no-defaults": ["error"|"warn", {"contexts":["any"]}]
- // Message: Defaults are not permitted on @param.
-
- /**
- * @function
- * @param {number} [foo="7"]
- */
- // "jsdoc/no-defaults": ["error"|"warn", {"contexts":["any"]}]
- // Message: Defaults are not permitted on @param.
-
- /**
- * @callback
- * @param {number} [foo="7"]
- */
- // "jsdoc/no-defaults": ["error"|"warn", {"contexts":["any"]}]
- // Message: Defaults are not permitted on @param.
-
- /**
- * @default {}
- */
- const a = {};
- // "jsdoc/no-defaults": ["error"|"warn", {"contexts":["any"]}]
- // Message: Default values are not permitted on @default.
-
- /**
- * @defaultvalue {}
- */
- const a = {};
- // Settings: {"jsdoc":{"tagNamePreference":{"default":"defaultvalue"}}}
- // "jsdoc/no-defaults": ["error"|"warn", {"contexts":["any"]}]
- // Message: Default values are not permitted on @defaultvalue.
- ````
-
- The following patterns are not considered problems:
-
- ````js
- /**
- * @param foo
- */
- function quux (foo) {
-
- }
-
- /**
- * @param {number} foo
- */
- function quux (foo) {
-
- }
-
- /**
- * @param foo
- */
- // "jsdoc/no-defaults": ["error"|"warn", {"contexts":["any"]}]
-
- /**
- * @function
- * @param {number} foo
- */
-
- /**
- * @callback
- * @param {number} foo
- */
-
- /**
- * @param {number} foo
- */
- function quux (foo) {
-
- }
- // "jsdoc/no-defaults": ["error"|"warn", {"noOptionalParamNames":true}]
-
- /**
- * @default
- */
- const a = {};
- // "jsdoc/no-defaults": ["error"|"warn", {"contexts":["any"]}]
- ````
-
-
- <a name="eslint-plugin-jsdoc-rules-no-missing-syntax"></a>
- ### <code>no-missing-syntax</code>
-
- This rule lets you report if certain always expected comment structures are
- missing.
-
- This (along with `no-restricted-syntax`) is a bit similar to Schematron for
- XML or jsontron for JSON--you can validate expectations of there being
- arbitrary structures.
-
- This differs from the rule of the same name in
- [`eslint-plugin-query`](https://github.com/brettz9/eslint-plugin-query)
- in that this rule always looks for a comment above a structure (whether or not
- you have a `comment` condition).
-
- This rule might be especially useful with [`overrides`](https://eslint.org/docs/user-guide/configuring/configuration-files#how-do-overrides-work)
- where you need only require tags and/or types within specific directories
- (e.g., to enforce that a plugins or locale directory always has a certain form
- of export and comment therefor).
-
- In addition to being generally useful for precision in requiring contexts,
- it is hoped that the ability to specify required tags on structures can
- be used for requiring `@type` or other types for a minimalist yet adequate
- specification of types which can be used to compile JavaScript+JSDoc (JJ)
- to WebAssembly (e.g., by converting it to TypeSscript and then using
- AssemblyScript to convert to WebAssembly). (It may be possible that one
- will need to require types with certain structures beyond function
- declarations and the like, as well as optionally requiring specification
- of number types.)
-
- Note that you can use selectors which make use of negators like `:not()`
- including with asterisk, e.g., `*:not(FunctionDeclaration)` to indicate types
- which are not adequate to satisfy a condition, e.g.,
- `FunctionDeclaration:not(FunctionDeclaration[id.name="ignoreMe"])` would
- not report if there were only a function declaration of the name "ignoreMe"
- (though it would report by function declarations of other names).
-
- <a name="eslint-plugin-jsdoc-rules-no-missing-syntax-options-17"></a>
- #### Options
-
- <a name="eslint-plugin-jsdoc-rules-no-missing-syntax-options-17-contexts-3"></a>
- ##### <code>contexts</code>
-
- Set this to an array of strings representing the AST context (or an object with
- `context` and `comment` properties) where you wish the rule to be applied.
-
- Use the `minimum` property (defaults to 1) to indicate how many are required
- for the rule to be reported.
-
- Use the `message` property to indicate the specific error to be shown when an
- error is reported for that context being found missing. You may use
- `{{context}}` and `{{comment}}` with such messages.
-
- Set to `"any"` if you want the rule to apply to any jsdoc block throughout
- your files (as is necessary for finding function blocks not attached to a
- function declaration or expression, i.e., `@callback` or `@function` (or its
- aliases `@func` or `@method`) (including those associated with an `@interface`).
-
- See the ["AST and Selectors"](#eslint-plugin-jsdoc-advanced-ast-and-selectors)
- section of our README for more on the expected format.
-
- |||
- |---|---|
- |Context|None except those indicated by `contexts`|
- |Tags|Any if indicated by AST|
- |Recommended|false|
- |Options|`contexts`|
-
- The following patterns are considered problems:
-
- ````js
- /**
- * @implements {Bar|Foo}
- */
- function quux () {
-
- }
- // "jsdoc/no-missing-syntax": ["error"|"warn", {"contexts":[{"comment":"JsdocBlock[postDelimiter=\"\"]:has(JsdocTypeUnion > JsdocTypeName[value=\"Foo\"]:nth-child(1))","context":"FunctionDeclaration"}]}]
- // Message: Syntax is required: FunctionDeclaration with JsdocBlock[postDelimiter=""]:has(JsdocTypeUnion > JsdocTypeName[value="Foo"]:nth-child(1))
-
- /**
- * @implements {Bar|Foo}
- */
- function quux () {
-
- }
- // "jsdoc/no-missing-syntax": ["error"|"warn", {"contexts":[{"comment":"JsdocBlock[postDelimiter=\"\"]:has(JsdocTypeUnion > JsdocTypeName[value=\"Foo\"]:nth-child(1))","context":"FunctionDeclaration","message":"Problematically missing function syntax: `{{context}}` with `{{comment}}`."}]}]
- // Message: Problematically missing function syntax: `FunctionDeclaration` with `JsdocBlock[postDelimiter=""]:has(JsdocTypeUnion > JsdocTypeName[value="Foo"]:nth-child(1))`.
-
- /**
- * @implements {Bar|Foo}
- */
- function quux () {
-
- }
- // "jsdoc/no-missing-syntax": ["error"|"warn", {"contexts":["FunctionDeclaration"]}]
- // Message: Syntax is required: FunctionDeclaration
-
- /**
- * @implements {Bar|Foo}
- */
- function quux () {
-
- }
- // Message: Rule `no-missing-syntax` is missing a `context` option.
-
- /**
- * @implements {Bar|Foo}
- */
- function quux () {
-
- }
- // "jsdoc/no-missing-syntax": ["error"|"warn", {"contexts":[{"comment":"JsdocBlock[postDelimiter=\"\"]:has(JsdocTypeUnion > JsdocTypeName[value=\"Bar\"]:nth-child(1))","context":"FunctionDeclaration","minimum":2}]}]
- // Message: Syntax is required: FunctionDeclaration with JsdocBlock[postDelimiter=""]:has(JsdocTypeUnion > JsdocTypeName[value="Bar"]:nth-child(1))
-
- /**
- * @param ab
- * @param cd
- */
- // "jsdoc/no-missing-syntax": ["error"|"warn", {"contexts":[{"comment":"JsdocBlock:has(JsdocTag[name=/opt_/])","context":"any","message":"Require names matching `/^opt_/i`."}]}]
- // Message: Require names matching `/^opt_/i`.
-
- /**
- * @param ab
- * @param cd
- */
- // "jsdoc/no-missing-syntax": ["error"|"warn", {"contexts":[{"comment":"JsdocBlock:has(JsdocTag[name=/opt_/])","message":"Require names matching `/^opt_/i`."}]}]
- // Message: Require names matching `/^opt_/i`.
-
- /**
- * @param ab
- * @param cd
- */
- function quux () {}
- // "jsdoc/no-missing-syntax": ["error"|"warn", {"contexts":[{"comment":"JsdocBlock:has(JsdocTag[name=/opt_/])","context":"any","message":"Require names matching `/^opt_/i`."}]}]
- // Message: Require names matching `/^opt_/i`.
- ````
-
- The following patterns are not considered problems:
-
- ````js
- /**
- * @implements {Bar|Foo}
- */
- function quux () {
-
- }
- // "jsdoc/no-missing-syntax": ["error"|"warn", {"contexts":[{"comment":"JsdocBlock[postDelimiter=\"\"]:has(JsdocTypeUnion > JsdocTypeName[value=\"Bar\"]:nth-child(1))","context":"FunctionDeclaration"}]}]
-
- /**
- * @implements {Bar|Foo}
- */
- function quux () {
-
- }
-
- /**
- * @implements {Bar|Foo}
- */
- function bar () {
-
- }
-
- /**
- * @implements {Bar|Foo}
- */
- function baz () {
-
- }
- // "jsdoc/no-missing-syntax": ["error"|"warn", {"contexts":[{"comment":"JsdocBlock[postDelimiter=\"\"]:has(JsdocTypeUnion > JsdocTypeName[value=\"Bar\"]:nth-child(1))","context":"FunctionDeclaration","minimum":2}]}]
-
- /**
- * @param opt_a
- * @param opt_b
- */
- // "jsdoc/no-missing-syntax": ["error"|"warn", {"contexts":[{"comment":"JsdocBlock:has(JsdocTag[name=/opt_/])","context":"any","message":"Require names matching `/^opt_/i`."}]}]
-
- /**
- * @param opt_a
- * @param opt_b
- */
- function quux () {}
- // "jsdoc/no-missing-syntax": ["error"|"warn", {"contexts":[{"comment":"JsdocBlock:has(JsdocTag[name=/opt_/])","context":"any","message":"Require names matching `/^opt_/i`."}]}]
-
- /**
- * @param opt_a
- * @param opt_b
- */
- function quux () {}
- // "jsdoc/no-missing-syntax": ["error"|"warn", {"contexts":[{"comment":"JsdocBlock:has(JsdocTag[name=/opt_/])","message":"Require names matching `/^opt_/i`."}]}]
- ````
-
-
- <a name="eslint-plugin-jsdoc-rules-no-multi-asterisks"></a>
- ### <code>no-multi-asterisks</code>
-
- Prevents use of multiple asterisks at the beginning of lines.
-
- Note that if you wish to prevent multiple asterisks at the very beginning of
- the jsdoc block, you should use `no-bad-blocks` (as that is not proper jsdoc
- and that rule is for catching blocks which only seem like jsdoc).
-
- <a name="eslint-plugin-jsdoc-rules-no-multi-asterisks-options-18"></a>
- #### Options
-
- <a name="eslint-plugin-jsdoc-rules-no-multi-asterisks-options-18-preventatmiddlelines-defaults-to-true"></a>
- ##### <code>preventAtMiddleLines</code> (defaults to <code>true</code>)
-
- Prevent the likes of this:
-
- ```js
- /**
- *
- **
- */
- ```
-
- <a name="eslint-plugin-jsdoc-rules-no-multi-asterisks-options-18-preventatend-defaults-to-true"></a>
- ##### <code>preventAtEnd</code> (defaults to <code>true</code>)
-
- Prevent the likes of this:
-
- ```js
- /**
- *
- *
- **/
- ```
-
- |||
- |---|---|
- |Context|everywhere|
- |Tags|(any)|
- |Recommended|true|
- |Settings||
- |Options|`preventAtEnd`, `preventAtMiddleLines`|
-
- The following patterns are considered problems:
-
- ````js
- /**
- *
- **
- */
- // Message: Should be no multiple asterisks on middle lines.
-
- /**
- *
- **
- */
- // "jsdoc/no-multi-asterisks": ["error"|"warn", {"preventAtMiddleLines":true}]
- // Message: Should be no multiple asterisks on middle lines.
-
- /**
- *
- **
- */
- // "jsdoc/no-multi-asterisks": ["error"|"warn", {"preventAtEnd":false}]
- // Message: Should be no multiple asterisks on middle lines.
-
- /**
- * With a description
- * @tag {SomeType} and a tag with details
- **
- */
- // Message: Should be no multiple asterisks on middle lines.
-
- /**
- **
- *
- */
- // Message: Should be no multiple asterisks on middle lines.
-
- /**
- * Desc.
- *
- **/
- // Message: Should be no multiple asterisks on end lines.
-
- /**
- * Desc.
- *
- **/
- // "jsdoc/no-multi-asterisks": ["error"|"warn", {"preventAtEnd":true}]
- // Message: Should be no multiple asterisks on end lines.
-
- /**
- * Desc.
- *
- abc * **/
- // "jsdoc/no-multi-asterisks": ["error"|"warn", {"preventAtEnd":true}]
- // Message: Should be no multiple asterisks on end lines.
-
- /**
- * Desc.
- *
- **/
- // "jsdoc/no-multi-asterisks": ["error"|"warn", {"preventAtMiddleLines":false}]
- // Message: Should be no multiple asterisks on end lines.
-
- /** Desc. **/
- // Message: Should be no multiple asterisks on end lines.
-
- /** @someTag name desc. **/
- // Message: Should be no multiple asterisks on end lines.
-
- /** abc * */
- // Message: Should be no multiple asterisks on end lines.
-
- /**
- * Preserve user's whitespace when fixing (though one may also
- * use an align rule)
- *
- * */
- // "jsdoc/no-multi-asterisks": ["error"|"warn", {"preventAtEnd":true}]
- // Message: Should be no multiple asterisks on end lines.
- ````
-
- The following patterns are not considered problems:
-
- ````js
- /**
- *
- * Desc. ***
- */
-
- /**
- * Desc. ***
- *
- */
-
- /**
- * Desc.
- *
- * sth */
-
- /**
- **
- *
- */
- // "jsdoc/no-multi-asterisks": ["error"|"warn", {"preventAtMiddleLines":false}]
-
- /**
- *
- *
- **/
- // "jsdoc/no-multi-asterisks": ["error"|"warn", {"preventAtEnd":false}]
-
- /**
- * With a desc.
- * and ***
- */
-
- /**
- * and ***
- * With a desc.
- */
-
- /**
- * With a desc.
- * With a desc.
- * Desc. */
-
- /**
- * With a description
- * @tag {SomeType} and a tag with details
- *
- */
-
- /** abc */
- function foo() {
- //
- }
-
- /** foo */
- function foo(): void {
- //
- }
-
- /** @aTag abc */
- function foo() {
- //
- }
- ````
-
-
- <a name="eslint-plugin-jsdoc-rules-no-restricted-syntax"></a>
- ### <code>no-restricted-syntax</code>
-
- Reports when certain comment structures are present.
-
- Note that this rule differs from ESLint's [no-restricted-syntax](https://eslint.org/docs/rules/no-restricted-syntax)
- rule in expecting values within a single options object's
- `contexts` property, and with the property `context` being used in place of
- `selector` (as well as allowing for `comment`). The format also differs from
- the format expected by [`eslint-plugin-query`](https://github.com/brettz9/eslint-plugin-query).
-
- Unlike those rules, this is specific to finding comments attached to
- structures, (whether or not you add a specific `comment` condition).
-
- Note that if your parser supports comment AST (as [jsdoc-eslint-parser/](https://github.com/brettz9/jsdoc-eslint-parser/) is designed to do), you can just use ESLint's
- rule.
-
- <a name="eslint-plugin-jsdoc-rules-no-restricted-syntax-options-19"></a>
- #### Options
-
- <a name="eslint-plugin-jsdoc-rules-no-restricted-syntax-options-19-contexts-4"></a>
- ##### <code>contexts</code>
-
- Set this to an array of strings representing the AST context (or an object with
- `context` and `comment` properties) where you wish the rule to be applied.
-
- Use the `message` property to indicate the specific error to be shown when an
- error is reported for that context being found.
-
- Set to `"any"` if you want the rule to apply to any jsdoc block throughout
- your files (as is necessary for finding function blocks not attached to a
- function declaration or expression, i.e., `@callback` or `@function` (or its
- aliases `@func` or `@method`) (including those associated with an `@interface`).
-
- See the ["AST and Selectors"](#eslint-plugin-jsdoc-advanced-ast-and-selectors)
- section of our README for more on the expected format.
-
- |||
- |---|---|
- |Context|None except those indicated by `contexts`|
- |Tags|Any if indicated by AST|
- |Recommended|false|
- |Options|`contexts`|
-
- The following patterns are considered problems:
-
- ````js
- /**
- *
- */
- function quux () {
-
- }
- // "jsdoc/no-restricted-syntax": ["error"|"warn", {"contexts":["FunctionDeclaration"]}]
- // Message: Syntax is restricted: FunctionDeclaration.
-
- /**
- *
- */
- function quux () {
-
- }
- // "jsdoc/no-restricted-syntax": ["error"|"warn", {"contexts":[{"context":"FunctionDeclaration","message":"Oops: `{{context}}`."}]}]
- // Message: Oops: `FunctionDeclaration`.
-
- /**
- * @implements {Bar|Foo}
- */
- function quux () {
-
- }
- // "jsdoc/no-restricted-syntax": ["error"|"warn", {"contexts":[{"comment":"JsdocBlock[postDelimiter=\"\"]:has(JsdocTypeUnion > JsdocTypeName[value=\"Bar\"]:nth-child(1))","context":"FunctionDeclaration"}]}]
- // Message: Syntax is restricted: FunctionDeclaration.
-
- /**
- * @implements {Bar|Foo}
- */
- function quux () {
-
- }
- // "jsdoc/no-restricted-syntax": ["error"|"warn", {"contexts":[{"comment":"JsdocBlock[postDelimiter=\"\"]:has(JsdocTypeUnion > JsdocTypeName[value=\"Foo\"]:nth-child(1))","context":"FunctionDeclaration","message":"The foo one: {{context}}."},{"comment":"JsdocBlock[postDelimiter=\"\"]:has(JsdocTypeUnion > JsdocTypeName[value=\"Bar\"]:nth-child(1))","context":"FunctionDeclaration","message":"The bar one: {{context}}."}]}]
- // Message: The bar one: FunctionDeclaration.
-
- /**
- * @implements {Bar|Foo}
- */
- function quux () {
-
- }
- // Message: Rule `no-restricted-syntax` is missing a `context` option.
-
- /**
- * @param opt_a
- * @param opt_b
- */
- function a () {}
- // "jsdoc/no-restricted-syntax": ["error"|"warn", {"contexts":[{"comment":"JsdocBlock:has(JsdocTag[name=/opt_/])","context":"FunctionDeclaration","message":"Only allowing names not matching `/^opt_/i`."}]}]
- // Message: Only allowing names not matching `/^opt_/i`.
-
- /**
- * @param opt_a
- * @param opt_b
- */
- function a () {}
- // "jsdoc/no-restricted-syntax": ["error"|"warn", {"contexts":[{"comment":"JsdocBlock:has(JsdocTag[name=/opt_/])","context":"any","message":"Only allowing names not matching `/^opt_/i`."}]}]
- // Message: Only allowing names not matching `/^opt_/i`.
-
- /**
- * @param opt_a
- * @param opt_b
- */
- function a () {}
- // "jsdoc/no-restricted-syntax": ["error"|"warn", {"contexts":[{"comment":"JsdocBlock:has(JsdocTag[name=/opt_/])","message":"Only allowing names not matching `/^opt_/i`."}]}]
- // Message: Only allowing names not matching `/^opt_/i`.
-
- /**
- * @param opt_a
- * @param opt_b
- */
- function a () {}
- // "jsdoc/no-restricted-syntax": ["error"|"warn", {"contexts":[{"comment":"JsdocBlock:has(JsdocTag[name=/not-this/])","context":"any","message":"Only allowing names not matching `/^not-this/i`."},{"comment":"JsdocBlock:has(JsdocTag[name=/opt_/])","context":"any","message":"Only allowing names not matching `/^opt_/i`."}]}]
- // Message: Only allowing names not matching `/^opt_/i`.
-
- /**
- * @param opt_a
- * @param opt_b
- */
- // "jsdoc/no-restricted-syntax": ["error"|"warn", {"contexts":[{"comment":"JsdocBlock:has(JsdocTag[name=/opt_/])","context":"any","message":"Only allowing names not matching `/^opt_/i`."}]}]
- // Message: Only allowing names not matching `/^opt_/i`.
- ````
-
- The following patterns are not considered problems:
-
- ````js
- /**
- *
- */
- function quux () {
-
- }
- // "jsdoc/no-restricted-syntax": ["error"|"warn", {"contexts":["FunctionExpression"]}]
-
- /**
- * @implements {Bar|Foo}
- */
- function quux () {
-
- }
- // "jsdoc/no-restricted-syntax": ["error"|"warn", {"contexts":[{"comment":"JsdocBlock[postDelimiter=\"\"]:has(JsdocTypeUnion > JsdocTypeName[value=\"Foo\"]:nth-child(1))","context":"FunctionDeclaration"}]}]
-
- /**
- * @param ab
- * @param cd
- */
- function a () {}
- // "jsdoc/no-restricted-syntax": ["error"|"warn", {"contexts":[{"comment":"JsdocBlock:has(JsdocTag[name=/opt_/])","context":"any","message":"Only allowing names not matching `/^opt_/i`."}]}]
-
- /**
- * @param ab
- * @param cd
- */
- // "jsdoc/no-restricted-syntax": ["error"|"warn", {"contexts":[{"comment":"JsdocBlock:has(JsdocTag[name=/opt_/])","context":"any","message":"Only allowing names not matching `/^opt_/i`."}]}]
-
- /**
- * @param ab
- * @param cd
- */
- // "jsdoc/no-restricted-syntax": ["error"|"warn", {"contexts":[{"comment":"JsdocBlock:has(JsdocTag[name=/opt_/])","message":"Only allowing names not matching `/^opt_/i`."}]}]
- ````
-
-
- <a name="eslint-plugin-jsdoc-rules-no-types"></a>
- ### <code>no-types</code>
-
- This rule reports types being used on `@param` or `@returns`.
-
- The rule is intended to prevent the indication of types on tags where
- the type information would be redundant with TypeScript.
-
- <a name="eslint-plugin-jsdoc-rules-no-types-options-20"></a>
- #### Options
-
- <a name="eslint-plugin-jsdoc-rules-no-types-options-20-contexts-5"></a>
- ##### <code>contexts</code>
-
- Set this to an array of strings representing the AST context (or an object with
- `context` and `comment` properties) where you wish the rule to be applied.
- Overrides the default contexts (see below). Set to `"any"` if you want
- the rule to apply to any jsdoc block throughout your files (as is necessary
- for finding function blocks not attached to a function declaration or
- expression, i.e., `@callback` or `@function` (or its aliases `@func` or
- `@method`) (including those associated with an `@interface`).
-
- See the ["AST and Selectors"](#eslint-plugin-jsdoc-advanced-ast-and-selectors)
- section of our README for more on the expected format.
-
- |||
- |---|---|
- |Context|`ArrowFunctionExpression`, `FunctionDeclaration`, `FunctionExpression`; others when `contexts` option enabled|
- |Tags|`param`, `returns`|
- |Aliases|`arg`, `argument`, `return`|
- |Recommended|false|
- |Options|`contexts`|
-
- The following patterns are considered problems:
-
- ````js
- /**
- * @param {number} foo
- */
- function quux (foo) {
-
- }
- // Message: Types are not permitted on @param.
-
- class quux {
- /**
- * @param {number} foo
- */
- bar (foo) {
-
- }
- }
- // Message: Types are not permitted on @param.
-
- /**
- * @param {number} foo
- */
- function quux (foo) {
-
- }
- // "jsdoc/no-types": ["error"|"warn", {"contexts":["any"]}]
- // Message: Types are not permitted on @param.
-
- class quux {
- /**
- * @param {number} foo
- */
- quux (foo) {
-
- }
- }
- // "jsdoc/no-types": ["error"|"warn", {"contexts":["any"]}]
- // Message: Types are not permitted on @param.
-
- /**
- * @function
- * @param {number} foo
- */
- // "jsdoc/no-types": ["error"|"warn", {"contexts":["any"]}]
- // Message: Types are not permitted on @param.
-
- /**
- * @callback
- * @param {number} foo
- */
- // "jsdoc/no-types": ["error"|"warn", {"contexts":["any"]}]
- // Message: Types are not permitted on @param.
-
- /**
- * @returns {number}
- */
- function quux () {
-
- }
- // Message: Types are not permitted on @returns.
-
- /**
- * Beep
- * Boop
- *
- * @returns {number}
- */
- function quux () {
-
- }
- // Message: Types are not permitted on @returns.
- ````
-
- The following patterns are not considered problems:
-
- ````js
- /**
- * @param foo
- */
- function quux (foo) {
-
- }
-
- /**
- * @param foo
- */
- // "jsdoc/no-types": ["error"|"warn", {"contexts":["any"]}]
-
- /**
- * @function
- * @param {number} foo
- */
-
- /**
- * @callback
- * @param {number} foo
- */
- ````
-
-
- <a name="eslint-plugin-jsdoc-rules-no-undefined-types"></a>
- ### <code>no-undefined-types</code>
-
- Checks that types in jsdoc comments are defined. This can be used to check
- unimported types.
-
- When enabling this rule, types in jsdoc comments will resolve as used
- variables, i.e. will not be marked as unused by `no-unused-vars`.
-
- In addition to considering globals found in code (or in ESLint-indicated
- `globals`) as defined, the following tags will also be checked for
- name(path) definitions to also serve as a potential "type" for checking
- the tag types in the table below:
-
- `@callback`, `@class` (or `@constructor`), `@constant` (or `@const`),
- `@event`, `@external` (or `@host`), `@function` (or `@func` or `@method`),
- `@interface`, `@member` (or `@var`), `@mixin`, `@name`, `@namespace`,
- `@template` (for "closure" or "typescript" `settings.jsdoc.mode` only),
- `@typedef`.
-
- The following tags will also be checked but only when the mode is `closure`:
-
- `@package`, `@private`, `@protected`, `@public`, `@static`
-
- The following types are always considered defined.
-
- - `null`, `undefined`, `void`, `string`, `boolean`, `object`,
- `function`, `symbol`
- - `number`, `bigint`, `NaN`, `Infinity`
- - `any`, `*`
- - `this`, `true`, `false`
- - `Array`, `Object`, `RegExp`, `Date`, `Function`
-
- Note that preferred types indicated within `settings.jsdoc.preferredTypes` will
- also be assumed to be defined.
-
- Also note that if there is an error [parsing](https://github.com/jsdoctypeparser/jsdoctypeparser)
- types for a tag, the function will silently ignore that tag, leaving it to
- the `valid-types` rule to report parsing errors.
-
- If you define your own tags, you can use `settings.jsdoc.structuredTags`
- to indicate that a tag's `name` is "namepath-defining" (and should prevent
- reporting on use of that namepath elsewhere) and/or that a tag's `type` is
- `false` (and should not be checked for types). If the `type` is an array, that
- array's items will be considered as defined for the purposes of that tag.
-
- <a name="eslint-plugin-jsdoc-rules-no-undefined-types-options-21"></a>
- #### Options
-
- An option object may have the following key:
-
- - `definedTypes` - This array can be populated to indicate other types which
- are automatically considered as defined (in addition to globals, etc.).
- Defaults to an empty array.
-
- |||
- |---|---|
- |Context|everywhere|
- |Tags|`augments`, `class`, `constant`, `enum`, `implements`, `member`, `module`, `namespace`, `param`, `property`, `returns`, `throws`, `type`, `typedef`, `yields`|
- |Aliases|`constructor`, `const`, `extends`, `var`, `arg`, `argument`, `prop`, `return`, `exception`, `yield`|
- |Closure-only|`package`, `private`, `protected`, `public`, `static`|
- |Recommended|true|
- |Options|`definedTypes`|
- |Settings|`preferredTypes`, `mode`, `structuredTags`|
-
- The following patterns are considered problems:
-
- ````js
- /**
- * @param {HerType} baz - Foo.
- */
- function quux(foo, bar, baz) {
-
- }
- // Settings: {"jsdoc":{"preferredTypes":{"HerType":1000}}}
- // Message: Invalid `settings.jsdoc.preferredTypes`. Values must be falsy, a string, or an object.
-
- /**
- * @param {HerType} baz - Foo.
- */
- function quux(foo, bar, baz) {
-
- }
- // Settings: {"jsdoc":{"preferredTypes":{"HerType":false}}}
- // Message: The type 'HerType' is undefined.
-
- /**
- * @param {strnig} foo - Bar.
- */
- function quux(foo) {
-
- }
- // Message: The type 'strnig' is undefined.
-
- /**
- * @param {MyType} foo - Bar.
- * @param {HisType} bar - Foo.
- */
- function quux(foo, bar) {
-
- }
- // "jsdoc/no-undefined-types": ["error"|"warn", {"definedTypes":["MyType"]}]
- // Message: The type 'HisType' is undefined.
-
- /**
- * @param {MyType} foo - Bar.
- * @param {HisType} bar - Foo.
- * @param {HerType} baz - Foo.
- */
- function quux(foo, bar, baz) {
-
- }
- // Settings: {"jsdoc":{"preferredTypes":{"hertype":{"replacement":"HerType"}}}}
- // "jsdoc/no-undefined-types": ["error"|"warn", {"definedTypes":["MyType"]}]
- // Message: The type 'HisType' is undefined.
-
- /**
- * @param {MyType} foo - Bar.
- * @param {HisType} bar - Foo.
- * @param {HerType} baz - Foo.
- */
- function quux(foo, bar, baz) {
-
- }
- // Settings: {"jsdoc":{"preferredTypes":{"hertype":{"replacement":false},"histype":"HisType"}}}
- // "jsdoc/no-undefined-types": ["error"|"warn", {"definedTypes":["MyType"]}]
- // Message: The type 'HerType' is undefined.
-
- /**
- * @template TEMPLATE_TYPE
- * @param {WRONG_TEMPLATE_TYPE} bar
- */
- function foo (bar) {
- };
- // Settings: {"jsdoc":{"mode":"closure"}}
- // Message: The type 'WRONG_TEMPLATE_TYPE' is undefined.
-
- class Foo {
- /**
- * @return {TEMPLATE_TYPE}
- */
- bar () {
- }
- }
- // Message: The type 'TEMPLATE_TYPE' is undefined.
-
- class Foo {
- /**
- * @return {TEMPLATE_TYPE}
- */
- invalidTemplateReference () {
- }
- }
-
- /**
- * @template TEMPLATE_TYPE
- */
- class Bar {
- /**
- * @return {TEMPLATE_TYPE}
- */
- validTemplateReference () {
- }
- }
- // Settings: {"jsdoc":{"mode":"typescript"}}
- // Message: The type 'TEMPLATE_TYPE' is undefined.
-
- /**
- * @type {strnig}
- */
- var quux = {
-
- };
- // Message: The type 'strnig' is undefined.
-
- /**
- * @template TEMPLATE_TYPE_A, TEMPLATE_TYPE_B
- */
- class Foo {
- /**
- * @param {TEMPLATE_TYPE_A} baz
- * @return {TEMPLATE_TYPE_B}
- */
- bar (baz) {
- }
- }
- // Message: The type 'TEMPLATE_TYPE_A' is undefined.
-
- /**
- * @param {...VAR_TYPE} varargs
- */
- function quux (varargs) {
- }
- // Message: The type 'VAR_TYPE' is undefined.
-
- /**
- * @this {Navigator}
- */
- function quux () {}
- // Settings: {"jsdoc":{"mode":"closure"}}
- // Message: The type 'Navigator' is undefined.
-
- /**
- * @export {SomeType}
- */
- function quux () {}
- // Settings: {"jsdoc":{"mode":"closure"}}
- // Message: The type 'SomeType' is undefined.
-
- /**
- * @aCustomTag {SomeType}
- */
- function quux () {}
- // Settings: {"jsdoc":{"structuredTags":{"aCustomTag":{"type":true}}}}
- // Message: The type 'SomeType' is undefined.
-
- /**
- * @aCustomTag {SomeType}
- */
- function quux () {}
- // Settings: {"jsdoc":{"structuredTags":{"aCustomTag":{"type":["aType","anotherType"]}}}}
- // Message: The type 'SomeType' is undefined.
-
- /**
- * @namepathDefiner SomeType
- */
- /**
- * @type {SomeType}
- */
- // Settings: {"jsdoc":{"structuredTags":{"namepathDefiner":{"name":"namepath-referencing"}}}}
- // Message: The type 'SomeType' is undefined.
-
- /**
- * @namepathDefiner SomeType
- */
- /**
- * @type {SomeType}
- */
- // Message: The type 'SomeType' is undefined.
-
- /**
- * @template abc TEMPLATE_TYPE
- * @param {TEMPLATE_TYPE} bar
- */
- function foo (bar) {
- };
- // Settings: {"jsdoc":{"mode":"closure"}}
- // Message: The type 'TEMPLATE_TYPE' is undefined.
- ````
-
- The following patterns are not considered problems:
-
- ````js
- /**
- * @param {string} foo - Bar.
- */
- function quux(foo) {
-
- }
-
- /**
- * @param {Promise} foo - Bar.
- */
- function quux(foo) {
-
- }
-
- class MyClass {}
-
- /**
- * @param {MyClass} foo - Bar.
- */
- function quux(foo) {
- console.log(foo);
- }
-
- quux(0);
-
- const MyType = require('my-library').MyType;
-
- /**
- * @param {MyType} foo - Bar.
- */
- function quux(foo) {
-
- }
-
- const MyType = require('my-library').MyType;
-
- /**
- * @param {MyType} foo - Bar.
- */
- function quux(foo) {
-
- }
-
- const MyType = require('my-library').MyType;
-
- /**
- * @param {MyType} foo - Bar.
- */
- function quux(foo) {
-
- }
-
- import {MyType} from 'my-library';
-
- /**
- * @param {MyType} foo - Bar.
- * @param {object<string, number>} foo
- * @param {Array<string>} baz
- */
- function quux(foo, bar, baz) {
-
- }
-
- /*globals MyType*/
-
- /**
- * @param {MyType} foo - Bar.
- * @param {HisType} bar - Foo.
- */
- function quux(foo, bar) {
-
- }
-
- /**
- * @typedef {object} hello
- * @property {string} a - a.
- */
-
- /**
- * @param {hello} foo
- */
- function quux(foo) {
-
- }
-
- /**
- * @param {Array<syntaxError} foo
- */
- function quux(foo) {
-
- }
-
- /**
- * Callback test.
- *
- * @callback addStuffCallback
- * @param {String} sum - An test integer.
- */
- /**
- * Test Eslint.
- *
- * @param {addStuffCallback} callback - A callback to run.
- */
- function testFunction(callback) {
- callback();
- }
-
- /**
- *
- *
- */
- function foo () {
-
- }
-
- /**
- *
- *
- */
- function foo () {
-
- }
-
- /**
- * @param {MyType} foo - Bar.
- * @param {HisType} bar - Foo.
- */
- function quux(foo, bar) {
-
- }
- // "jsdoc/no-undefined-types": ["error"|"warn", {"definedTypes":["MyType","HisType"]}]
-
- /**
- * @param {MyType} foo - Bar.
- * @param {HisType} bar - Foo.
- * @param {HerType} baz - Foo.
- */
- function quux(foo, bar, baz) {
-
- }
- // Settings: {"jsdoc":{"preferredTypes":{"hertype":{"replacement":"HerType"},"histype":"HisType"}}}
- // "jsdoc/no-undefined-types": ["error"|"warn", {"definedTypes":["MyType"]}]
-
- /**
- * @param {MyType} foo - Bar.
- * @param {HisType} bar - Foo.
- * @param {HerType} baz - Foo.
- */
- function quux(foo, bar, baz) {
-
- }
- // Settings: {"jsdoc":{"preferredTypes":{"hertype":{"replacement":"HerType<>"},"histype":"HisType.<>"}}}
- // "jsdoc/no-undefined-types": ["error"|"warn", {"definedTypes":["MyType"]}]
-
- /**
- * @template TEMPLATE_TYPE
- * @param {TEMPLATE_TYPE} bar
- * @return {TEMPLATE_TYPE}
- */
- function foo (bar) {
- };
- // Settings: {"jsdoc":{"mode":"closure"}}
-
- /**
- * @template TEMPLATE_TYPE
- */
- class Foo {
- /**
- * @return {TEMPLATE_TYPE}
- */
- bar () {
- }
- }
- // Settings: {"jsdoc":{"mode":"closure"}}
-
- /**
- * @template TEMPLATE_TYPE
- */
- class Foo {
- /**
- * @return {TEMPLATE_TYPE}
- */
- bar () {}
-
- /**
- * @return {TEMPLATE_TYPE}
- */
- baz () {}
- }
- // Settings: {"jsdoc":{"mode":"closure"}}
-
- /**
- * @template TEMPLATE_TYPE_A, TEMPLATE_TYPE_B
- */
- class Foo {
- /**
- * @param {TEMPLATE_TYPE_A} baz
- * @return {TEMPLATE_TYPE_B}
- */
- bar (baz) {
- }
- }
- // Settings: {"jsdoc":{"mode":"closure"}}
-
- /**
- * @template TEMPLATE_TYPE_A, TEMPLATE_TYPE_B - Some description
- */
- class Foo {
- /**
- * @param {TEMPLATE_TYPE_A} baz
- * @return {TEMPLATE_TYPE_B}
- */
- bar (baz) {
- }
- }
- // Settings: {"jsdoc":{"mode":"closure"}}
-
- /****/
-
- /**
- *
- */
- function quux () {
-
- }
-
- /**
- * @typedef {object} BaseObject
- */
- /**
- * Run callback when hooked method is called.
- *
- * @template {BaseObject} T
- * @param {T} obj - object whose method should be hooked.
- * @param {string} method - method which should be hooked.
- * @param {(sender: T) => void} callback - callback which should
- * be called when the hooked method was invoked.
- */
- function registerEvent(obj, method, callback) {
-
- }
- // Settings: {"jsdoc":{"mode":"typescript"}}
-
- /**
- * @param {...} varargs
- */
- function quux (varargs) {
- }
-
- /**
- * @param {...number} varargs
- */
- function quux (varargs) {
- }
-
- class Navigator {}
- /**
- * @this {Navigator}
- */
- function quux () {}
- // Settings: {"jsdoc":{"mode":"closure"}}
-
- class SomeType {}
- /**
- * @export {SomeType}
- */
- function quux () {}
- // Settings: {"jsdoc":{"mode":"closure"}}
-
- /**
- * @template T
- * @param {T} arg
- */
- function example(arg) {
-
- /** @param {T} */
- function inner(x) {
- }
- }
- // Settings: {"jsdoc":{"mode":"closure"}}
-
- const init = () => {
- /**
- * Makes request
- * @returns {Promise}
- */
- function request() {
- return Promise.resolve('success');
- }
- };
-
- /** Gets a Promise resolved with a given value.
- *
- * @template ValueType
- * @param {ValueType} value Value to resolve.
- * @returns {Promise<ValueType>} Promise resolved with value.
- */
- exports.resolve1 = function resolve1(value) {
- return Promise.resolve(value);
- };
- // Settings: {"jsdoc":{"mode":"typescript"}}
-
- /**
- * A function returning the same type as its argument.
- *
- * @template ValueType
- * @typedef {ValueType} ValueFunc
- */
- // Settings: {"jsdoc":{"mode":"typescript"}}
-
- /**
- * @aCustomTag {SomeType}
- */
- function quux () {}
- // Settings: {"jsdoc":{"structuredTags":{"aCustomTag":{"type":false}}}}
-
- /**
- * @aCustomTag {SomeType}
- */
- function quux () {}
- // Settings: {"jsdoc":{"structuredTags":{"aCustomTag":{"type":["aType","SomeType"]}}}}
-
- /**
- * @namepathDefiner SomeType
- */
- /**
- * @type {SomeType}
- */
- // Settings: {"jsdoc":{"structuredTags":{"namepathDefiner":{"name":"namepath-defining"}}}}
-
- class Test {
- /**
- * Method.
- *
- * @returns {this} Return description.
- */
- method (): this {
- return this;
- }
- }
-
- /**
- * Bad types ignored here and handled instead by `valid-types`.
- * @param {string(} foo - Bar.
- */
- function quux(foo) {
-
- }
- ````
-
-
- <a name="eslint-plugin-jsdoc-rules-require-asterisk-prefix"></a>
- ### <code>require-asterisk-prefix</code>
-
- Requires that each JSDoc line starts with an `*`.
-
- <a name="eslint-plugin-jsdoc-rules-require-asterisk-prefix-options-22"></a>
- #### Options
-
- This rule allows an optional string argument. If it is `"always"` then a
- problem is raised when there is no asterisk prefix on a given jsdoc line. If
- it is `"never"` then a problem is raised when there is an asterisk present.
- The default value is `"always"`. You may also set the default to `"any"`
- and use the `tags` option to apply to specific tags only.
-
- After the string option, one may add an object with the following.
-
- <a name="eslint-plugin-jsdoc-rules-require-asterisk-prefix-options-22-tags-3"></a>
- ##### <code>tags</code>
-
- If you want different values to apply to specific tags, you may use
- the `tags` option object. The keys are `always`, `never`, or `any` and
- the values are arrays of tag names or the special value `*description`
- which applies to the main jsdoc block description.
-
- ```js
- {
- 'jsdoc/require-asterisk-prefix': ['error', 'always', {
- tags: {
- always: ['*description'],
- any: ['example', 'license'],
- never: ['copyright']
- }
- }]
- }
- ```
-
- |||
- |---|---|
- |Context|everywhere|
- |Tags|All or as limited by the `tags` option|
- |Options|(a string matching `"always"|"never"` and optional object with `tags`)|
-
- The following patterns are considered problems:
-
- ````js
-
- /**
- @param {Number} foo
- */
- function quux (foo) {
- // with spaces
- }
- // Message: Expected JSDoc line to have the prefix.
-
-
- /**
- @param {Number} foo
- */
- function quux (foo) {
- // with spaces
- }
- // "jsdoc/require-asterisk-prefix": ["error"|"warn", "any",{"tags":{"always":["param"]}}]
- // Message: Expected JSDoc line to have the prefix.
-
-
- /**
- * Desc
-
- */
- function quux (foo) {
- // with spaces
- }
- // Message: Expected JSDoc line to have the prefix.
-
-
- /**
- *
- Desc
- */
- function quux (foo) {
- // with spaces
- }
- // Message: Expected JSDoc line to have the prefix.
-
-
- /**
- * Desc
- *
- */
- function quux (foo) {
- // with spaces
- }
- // "jsdoc/require-asterisk-prefix": ["error"|"warn", "never"]
- // Message: Expected JSDoc line to have no prefix.
-
-
- /**
- @param {Number} foo
- */
- function quux (foo) {
- // with spaces
- }
- // "jsdoc/require-asterisk-prefix": ["error"|"warn", "always",{"tags":{"any":["someOtherTag"]}}]
- // Message: Expected JSDoc line to have the prefix.
-
-
- /**
- * @param {Number} foo
- */
- function quux (foo) {
- // with spaces
- }
- // "jsdoc/require-asterisk-prefix": ["error"|"warn", "never",{"tags":{"always":["someOtherTag"]}}]
- // Message: Expected JSDoc line to have no prefix.
-
-
- /**
- * @param {Number} foo
- */
- function quux (foo) {
- // with spaces
- }
- // "jsdoc/require-asterisk-prefix": ["error"|"warn", "always",{"tags":{"never":["param"]}}]
- // Message: Expected JSDoc line to have no prefix.
-
-
- /**
- @param {Number} foo
- */
- function quux (foo) {
- // with spaces
- }
- // "jsdoc/require-asterisk-prefix": ["error"|"warn", "never",{"tags":{"always":["param"]}}]
- // Message: Expected JSDoc line to have the prefix.
-
- /**
- @param {Number} foo
- */function quux (foo) {
- // with spaces
- }
- // Message: Expected JSDoc line to have the prefix.
-
-
- /**
- * @param {Number} foo
- */
- function quux (foo) {
- // with spaces
- }
- // "jsdoc/require-asterisk-prefix": ["error"|"warn", "never"]
- // Message: Expected JSDoc line to have no prefix.
-
- /**
- *@param {Number} foo
- */function quux (foo) {
- // with spaces
- }
- // "jsdoc/require-asterisk-prefix": ["error"|"warn", "never"]
- // Message: Expected JSDoc line to have no prefix.
- ````
-
- The following patterns are not considered problems:
-
- ````js
- /**
- * Desc
- *
- * @param {Number} foo
- * This is more comment.
- */
- function quux (foo) {
-
- }
-
- /**
- * Desc
- *
- * @param {{
- * foo: Bar,
- * bar: Baz
- * }} foo
- *
- */
- function quux (foo) {
-
- }
-
- /* <- JSDoc must start with 2 stars.
- So this is unchecked.
- */
- function quux (foo) {}
-
- /** @param {Number} foo */
- function quux (foo) {
- // with spaces
- }
-
-
- /**
- @param {Number} foo
- */
- function quux (foo) {
- // with spaces
- }
- // "jsdoc/require-asterisk-prefix": ["error"|"warn", "always",{"tags":{"any":["param"]}}]
-
-
- /**
- * @param {Number} foo
- */
- function quux (foo) {
- // with spaces
- }
- // "jsdoc/require-asterisk-prefix": ["error"|"warn", "never",{"tags":{"always":["param"]}}]
-
-
- /**
- * @param {Number} foo
- */
- function quux (foo) {
- // with spaces
- }
- // "jsdoc/require-asterisk-prefix": ["error"|"warn", "always",{"tags":{"never":["someOtherTag"]}}]
-
-
- /**
- @param {Number} foo
- */
- function quux (foo) {
- // with spaces
- }
- // "jsdoc/require-asterisk-prefix": ["error"|"warn", "always",{"tags":{"never":["param"]}}]
-
-
- /**
- @param {Number} foo
- */
- function quux (foo) {
- // with spaces
- }
- // "jsdoc/require-asterisk-prefix": ["error"|"warn", "never",{"tags":{"always":["someOtherTag"]}}]
-
-
- /**
- * Desc
- *
- */
- function quux (foo) {
- // with spaces
- }
- // "jsdoc/require-asterisk-prefix": ["error"|"warn", "never",{"tags":{"any":["*description"]}}]
-
-
- /**
- * Desc
-
- */
- function quux (foo) {
- // with spaces
- }
- // "jsdoc/require-asterisk-prefix": ["error"|"warn", "always",{"tags":{"any":["*description"]}}]
-
-
- /**
- @param {Number} foo
- */
- function quux (foo) {
- // with spaces
- }
- // "jsdoc/require-asterisk-prefix": ["error"|"warn", "any",{"tags":{"always":["someOtherTag"]}}]
- ````
-
-
- <a name="eslint-plugin-jsdoc-rules-require-description-complete-sentence"></a>
- ### <code>require-description-complete-sentence</code>
-
- Requires that block description, explicit `@description`, and
- `@param`/`@returns` tag descriptions are written in complete sentences, i.e.,
-
- * Description must start with an uppercase alphabetical character.
- * Paragraphs must start with an uppercase alphabetical character.
- * Sentences must end with a period.
- * Every line in a paragraph (except the first) which starts with an uppercase
- character must be preceded by a line ending with a period.
- * A colon or semi-colon followed by two line breaks is still part of the
- containing paragraph (unlike normal dual line breaks).
- * Text within inline tags `{...}` are not checked for sentence divisions.
- * Periods after items within the `abbreviations` option array are not treated
- as sentence endings.
-
- <a name="eslint-plugin-jsdoc-rules-require-description-complete-sentence-options-23"></a>
- #### Options
-
- <a name="eslint-plugin-jsdoc-rules-require-description-complete-sentence-options-23-tags-4"></a>
- ##### <code>tags</code>
-
- If you want additional tags to be checked for their descriptions, you may
- add them within this option.
-
- ```js
- {
- 'jsdoc/require-description-complete-sentence': ['error', {
- tags: ['see', 'copyright']
- }]
- }
- ```
-
- The tags `@param`/`@arg`/`@argument` and `@property`/`@prop` will be properly
- parsed to ensure that the checked "description" text includes only the text
- after the name.
-
- All other tags will treat the text following the tag name, a space, and
- an optional curly-bracketed type expression (and another space) as part of
- its "description" (e.g., for `@returns {someType} some description`, the
- description is `some description` while for `@some-tag xyz`, the description
- is `xyz`).
-
- <a name="eslint-plugin-jsdoc-rules-require-description-complete-sentence-options-23-abbreviations"></a>
- ##### <code>abbreviations</code>
-
- You can provide an `abbreviations` options array to avoid such strings of text
- being treated as sentence endings when followed by dots. The `.` is not
- necessary at the end of the array items.
-
- <a name="eslint-plugin-jsdoc-rules-require-description-complete-sentence-options-23-newlinebeforecapsassumesbadsentenceend"></a>
- ##### <code>newlineBeforeCapsAssumesBadSentenceEnd</code>
-
- When `false` (the new default), we will not assume capital letters after
- newlines are an incorrect way to end the sentence (they may be proper
- nouns, for example).
-
- |||
- |---|---|
- |Context|everywhere|
- |Tags|doc block, `param`, `returns`, `description`, `property`, `summary`, `file`, `classdesc`, `todo`, `deprecated`, `throws`, 'yields' and others added by `tags`|
- |Aliases|`arg`, `argument`, `return`, `desc`, `prop`, `fileoverview`, `overview`, `exception`, `yield`|
- |Recommended|false|
- |Options|`tags`, `abbreviations`, `newlineBeforeCapsAssumesBadSentenceEnd`|
- The following patterns are considered problems:
-
- ````js
- /**
- * foo.
- */
- function quux () {
-
- }
- // Message: Sentence should start with an uppercase character.
-
- /**
- * foo?
- */
- function quux () {
-
- }
- // Message: Sentence should start with an uppercase character.
-
- /**
- * @description foo.
- */
- function quux () {
-
- }
- // Message: Sentence should start with an uppercase character.
-
- /**
- * Foo)
- */
- function quux () {
-
- }
- // Message: Sentence must end with a period.
-
- /**
- * `foo` is a variable
- */
- function quux () {
-
- }
- // Message: Sentence must end with a period.
-
- /**
- * Foo.
- *
- * foo.
- */
- function quux () {
-
- }
- // Message: Sentence should start with an uppercase character.
-
- /**
- * тест.
- */
- function quux () {
-
- }
- // Message: Sentence should start with an uppercase character.
-
- /**
- * Foo
- */
- function quux () {
-
- }
- // Message: Sentence must end with a period.
-
- /**
- * Foo
- * Bar.
- */
- function quux () {
-
- }
- // "jsdoc/require-description-complete-sentence": ["error"|"warn", {"newlineBeforeCapsAssumesBadSentenceEnd":true}]
- // Message: A line of text is started with an uppercase character, but preceding line does not end the sentence.
-
- /**
- * Foo.
- *
- * @param foo foo.
- */
- function quux (foo) {
-
- }
- // Message: Sentence should start with an uppercase character.
-
- /**
- * Foo.
- *
- * @param foo bar
- */
- function quux (foo) {
-
- }
- // Message: Sentence should start with an uppercase character.
-
- /**
- * {@see Foo.bar} buz
- */
- function quux (foo) {
-
- }
- // Message: Sentence should start with an uppercase character.
-
- /**
- * Foo.
- *
- * @returns {number} foo
- */
- function quux (foo) {
-
- }
- // Message: Sentence should start with an uppercase character.
-
- /**
- * Foo.
- *
- * @returns foo.
- */
- function quux (foo) {
-
- }
- // Message: Sentence should start with an uppercase character.
-
- /**
- * lorem ipsum dolor sit amet, consectetur adipiscing elit. pellentesque elit diam,
- * iaculis eu dignissim sed, ultrices sed nisi. nulla at ligula auctor, consectetur neque sed,
- * tincidunt nibh. vivamus sit amet vulputate ligula. vivamus interdum elementum nisl,
- * vitae rutrum tortor semper ut. morbi porta ante vitae dictum fermentum.
- * proin ut nulla at quam convallis gravida in id elit. sed dolor mauris, blandit quis ante at,
- * consequat auctor magna. duis pharetra purus in porttitor mollis.
- */
- function longDescription (foo) {
-
- }
- // Message: Sentence should start with an uppercase character.
-
- /**
- * @arg {number} foo - Foo
- */
- function quux (foo) {
-
- }
- // Message: Sentence must end with a period.
-
- /**
- * @argument {number} foo - Foo
- */
- function quux (foo) {
-
- }
- // Message: Sentence must end with a period.
-
- /**
- * @return {number} foo
- */
- function quux (foo) {
-
- }
- // Message: Sentence should start with an uppercase character.
-
- /**
- * Returns bar.
- *
- * @return {number} bar
- */
- function quux (foo) {
-
- }
- // Message: Sentence should start with an uppercase character.
-
- /**
- * @throws {object} Hello World
- * hello world
- */
- // Message: Sentence must end with a period.
-
- /**
- * @summary Foo
- */
- function quux () {
-
- }
- // Message: Sentence must end with a period.
-
- /**
- * @throws {SomeType} Foo
- */
- function quux () {
-
- }
- // Message: Sentence must end with a period.
-
- /**
- * @see Foo
- */
- function quux () {
-
- }
- // "jsdoc/require-description-complete-sentence": ["error"|"warn", {"tags":["see"]}]
- // Message: Sentence must end with a period.
-
- /**
- * @param foo Foo bar
- */
- function quux (foo) {
-
- }
- // Settings: {"jsdoc":{"tagNamePreference":{"description":false}}}
- // "jsdoc/require-description-complete-sentence": ["error"|"warn", {"tags":["param"]}]
- // Message: Sentence must end with a period.
-
- /**
- * Sorry, but this isn't a complete sentence, Mr.
- */
- function quux () {
-
- }
- // "jsdoc/require-description-complete-sentence": ["error"|"warn", {"abbreviations":["Mr"]}]
- // Message: Sentence must end with a period.
-
- /**
- * Sorry, but this isn't a complete sentence Mr.
- */
- function quux () {
-
- }
- // "jsdoc/require-description-complete-sentence": ["error"|"warn", {"abbreviations":["Mr."]}]
- // Message: Sentence must end with a period.
-
- /**
- * Sorry, but this isn't a complete sentence Mr.
- */
- function quux () {
-
- }
- // "jsdoc/require-description-complete-sentence": ["error"|"warn", {"abbreviations":["Mr"]}]
- // Message: Sentence must end with a period.
-
- /**
- * Sorry, but this isn't a complete sentence Mr. and Mrs.
- */
- function quux () {
-
- }
- // "jsdoc/require-description-complete-sentence": ["error"|"warn", {"abbreviations":["Mr","Mrs"]}]
- // Message: Sentence must end with a period.
-
- /**
- * This is a complete sentence. But this isn't, Mr.
- */
- function quux () {
-
- }
- // "jsdoc/require-description-complete-sentence": ["error"|"warn", {"abbreviations":["Mr"]}]
- // Message: Sentence must end with a period.
-
- /**
- * This is a complete Mr. sentence. But this isn't, Mr.
- */
- function quux () {
-
- }
- // "jsdoc/require-description-complete-sentence": ["error"|"warn", {"abbreviations":["Mr"]}]
- // Message: Sentence must end with a period.
-
- /**
- * This is a complete Mr. sentence.
- */
- function quux () {
-
- }
- // Message: Sentence should start with an uppercase character.
-
- /**
- * This is fun, i.e. enjoyable, but not superlatively so, e.g. not
- * super, wonderful, etc..
- */
- function quux () {
-
- }
- // Message: Sentence should start with an uppercase character.
-
- /**
- * Do not have dynamic content; e.g. homepage. Here a simple unique id
- * suffices.
- */
- function quux () {
-
- }
- // Message: Sentence should start with an uppercase character.
-
- /**
- * Implements support for the
- * Swahili voice synthesizer.
- */
- function speak() {
- }
- // "jsdoc/require-description-complete-sentence": ["error"|"warn", {"newlineBeforeCapsAssumesBadSentenceEnd":true}]
- // Message: A line of text is started with an uppercase character, but preceding line does not end the sentence.
-
- /**
- * Foo.
- *
- * @template TempA, TempB foo.
- */
- function quux (foo) {
-
- }
- // "jsdoc/require-description-complete-sentence": ["error"|"warn", {"tags":["template"]}]
- // Message: Sentence should start with an uppercase character.
- ````
-
- The following patterns are not considered problems:
-
- ````js
- /**
- * @param foo - Foo.
- */
- function quux () {
-
- }
-
- /**
- * Foo.
- */
- function quux () {
-
- }
-
- /**
- * Foo.
- * Bar.
- */
- function quux () {
-
- }
-
- /**
- * Foo.
- *
- * Bar.
- */
- function quux () {
-
- }
-
- /**
- * Тест.
- */
- function quux () {
-
- }
-
- /**
- * Foo
- * bar.
- */
- function quux () {
-
- }
-
- /**
- * @returns Foo bar.
- */
- function quux () {
-
- }
-
- /**
- * Foo. {@see Math.sin}.
- */
- function quux () {
-
- }
-
- /**
- * Foo {@see Math.sin} bar.
- */
- function quux () {
-
- }
-
- /**
- * Foo?
- *
- * Bar!
- *
- * Baz:
- * 1. Foo.
- * 2. Bar.
- */
- function quux () {
-
- }
-
- /**
- * Hello:
- * World.
- */
- function quux () {
-
- }
-
- /**
- * Hello: world.
- */
- function quux () {
-
- }
-
- /**
- *
- */
- function quux () {
-
- }
-
- /**
- * @description Foo.
- */
- function quux () {
-
- }
-
- /**
- * `foo` is a variable.
- */
- function quux () {
-
- }
-
- /**
- * Foo.
- *
- * `foo`.
- */
- function quux () {
-
- }
-
- /**
- * @param foo - `bar`.
- */
- function quux () {
-
- }
-
- /**
- * @returns {number} `foo`.
- */
- function quux () {
-
- }
-
- /**
- * Foo
- * `bar`.
- */
- function quux () {
-
- }
-
- /**
- * @example Foo
- */
- function quux () {
-
- }
-
- /**
- * @see Foo
- */
- function quux () {
-
- }
-
- /**
- * Foo.
- *
- * @param foo Foo.
- */
- function quux (foo) {
-
- }
-
- /**
- * Foo.
- *
- * @param foo Foo.
- */
- function quux (foo) {
-
- }
- // "jsdoc/require-description-complete-sentence": ["error"|"warn", {"tags":["param"]}]
-
- /**
- * @param foo Foo bar.
- */
- function quux (foo) {
-
- }
- // Settings: {"jsdoc":{"tagNamePreference":{"description":false}}}
- // "jsdoc/require-description-complete-sentence": ["error"|"warn", {"tags":["param"]}]
-
- /**
- *
- */
- function quux (foo) {
-
- }
- // Settings: {"jsdoc":{"tagNamePreference":{"description":false}}}
-
- /**
- * We stop loading Items when we have loaded:
- *
- * 1) The main Item;
- * 2) All its variants.
- */
-
- /**
- * This method is working on 2 steps.
- *
- * | Step | Comment |
- * |------|-------------|
- * | 1 | do it |
- * | 2 | do it again |
- */
-
- /**
- * This is something that
- * I want to test.
- */
- function quux () {
-
- }
-
- /**
- * When making HTTP requests, the
- * URL is super important.
- */
- function quux () {
-
- }
-
- /**
- * Sorry, but this isn't a complete sentence, Mr.
- */
- function quux () {
-
- }
-
- /**
- * Sorry, but this isn't a complete sentence Mr..
- */
- function quux () {
-
- }
- // "jsdoc/require-description-complete-sentence": ["error"|"warn", {"abbreviations":["Mr."]}]
-
- /**
- * Sorry, but this isn't a complete sentence Mr.
- */
- function quux () {
-
- }
-
- /**
- * Sorry, but this isn't a complete sentence Mr. and Mrs..
- */
- function quux () {
-
- }
- // "jsdoc/require-description-complete-sentence": ["error"|"warn", {"abbreviations":["Mr","Mrs"]}]
-
- /**
- * This is a complete sentence aMr.
- */
- function quux () {
-
- }
- // "jsdoc/require-description-complete-sentence": ["error"|"warn", {"abbreviations":["Mr"]}]
-
- /**
- * This is a complete sentence. But this isn't, Mr.
- */
- function quux () {
-
- }
-
- /**
- * This is a complete Mr. Sentence. But this isn't, Mr.
- */
- function quux () {
-
- }
-
- /**
- * This is a complete Mr. sentence.
- */
- function quux () {
-
- }
- // "jsdoc/require-description-complete-sentence": ["error"|"warn", {"abbreviations":["Mr"]}]
-
- /**
- * This is fun, i.e. enjoyable, but not superlatively so, e.g. not
- * super, wonderful, etc..
- */
- function quux () {
-
- }
- // "jsdoc/require-description-complete-sentence": ["error"|"warn", {"abbreviations":["etc","e.g.","i.e."]}]
-
-
- **
- * Do not have dynamic content; e.g. homepage. Here a simple unique id
- * suffices.
- */
- function quux () {
-
- }
- // "jsdoc/require-description-complete-sentence": ["error"|"warn", {"abbreviations":["etc","e.g.","i.e."]}]
-
- /**
- * Implements support for the
- * Swahili voice synthesizer.
- */
- function speak() {
- }
-
- /**
- * @param foo
- *
- * @returns {void}
- */
- export default (foo) => {
- foo()
- }
- ````
-
-
- <a name="eslint-plugin-jsdoc-rules-require-description"></a>
- ### <code>require-description</code>
-
- Requires that all functions have a description.
-
- * All functions must have an implicit description (e.g., text above tags) or
- have the option `descriptionStyle` set to `tag` (requiring `@description`
- (or `@desc` if that is set as your preferred tag name)).
- * Every jsdoc block description (or `@description` tag if `descriptionStyle`
- is `"tag"`) must have a non-empty description that explains the purpose of
- the method.
-
- <a name="eslint-plugin-jsdoc-rules-require-description-options-24"></a>
- #### Options
-
- An options object may have any of the following properties:
-
- - `contexts` - Set to an array of strings representing the AST context
- where you wish the rule to be applied (e.g., `ClassDeclaration` for ES6
- classes). Overrides the default contexts (see below). Set to `"any"` if
- you want the rule to apply to any jsdoc block throughout your files.
- - `exemptedBy` - Array of tags (e.g., `['type']`) whose presence on the
- document block avoids the need for a `@description`. Defaults to an
- array with `inheritdoc`. If you set this array, it will overwrite the
- default, so be sure to add back `inheritdoc` if you wish its presence
- to cause exemption of the rule.
- - `descriptionStyle` - Whether to accept implicit descriptions (`"body"`) or
- `@description` tags (`"tag"`) as satisfying the rule. Set to `"any"` to
- accept either style. Defaults to `"body"`.
- - `checkConstructors` - A value indicating whether `constructor`s should be
- checked. Defaults to `true`.
- - `checkGetters` - A value indicating whether getters should be checked.
- Defaults to `true`.
- - `checkSetters` - A value indicating whether setters should be checked.
- Defaults to `true`.
-
- | | |
- | -------- | ------------------------------------------------------------------------------------------------------------- |
- | Context | `ArrowFunctionExpression`, `FunctionDeclaration`, `FunctionExpression`; others when `contexts` option enabled |
- | Tags | `description` or jsdoc block |
- | Aliases | `desc` |
- | Recommended | false |
- | Options | `contexts`, `exemptedBy`, `descriptionStyle`, `checkConstructors`, `checkGetters`, `checkSetters` |
- | Settings | `ignoreReplacesDocs`, `overrideReplacesDocs`, `augmentsExtendsReplacesDocs`, `implementsReplacesDocs` |
-
- The following patterns are considered problems:
-
- ````js
- /**
- *
- */
- function quux () {
-
- }
- // "jsdoc/require-description": ["error"|"warn", {"descriptionStyle":"tag"}]
- // Message: Missing JSDoc @description declaration.
-
- /**
- *
- */
- function quux () {
-
- }
- // "jsdoc/require-description": ["error"|"warn", {"descriptionStyle":"any"}]
- // Message: Missing JSDoc block description or @description declaration.
-
- /**
- *
- */
- function quux () {
-
- }
- // "jsdoc/require-description": ["error"|"warn", {"descriptionStyle":"body"}]
- // Message: Missing JSDoc block description.
-
- /**
- * @desc Not a blank description
- */
- function quux () {
-
- }
- // "jsdoc/require-description": ["error"|"warn", {"descriptionStyle":"body"}]
- // Message: Remove the @desc tag to leave a plain block description or add additional description text above the @desc line.
-
- /**
- * @description Not a blank description
- */
- function quux () {
-
- }
- // "jsdoc/require-description": ["error"|"warn", {"descriptionStyle":"body"}]
- // Message: Remove the @description tag to leave a plain block description or add additional description text above the @description line.
-
- /**
- *
- */
- class quux {
-
- }
- // "jsdoc/require-description": ["error"|"warn", {"contexts":["ClassDeclaration"],"descriptionStyle":"tag"}]
- // Message: Missing JSDoc @description declaration.
-
- /**
- *
- */
- // "jsdoc/require-description": ["error"|"warn", {"contexts":["any"],"descriptionStyle":"tag"}]
- // Message: Missing JSDoc @description declaration.
-
- /**
- *
- */
- class quux {
-
- }
- // "jsdoc/require-description": ["error"|"warn", {"contexts":["ClassDeclaration"],"descriptionStyle":"tag"}]
- // Message: Missing JSDoc @description declaration.
-
- /**
- *
- */
- class quux {
-
- }
- // "jsdoc/require-description": ["error"|"warn", {"contexts":["ClassDeclaration"],"descriptionStyle":"tag"}]
- // Message: Missing JSDoc @description declaration.
-
- /**
- * @description
- */
- function quux () {
-
- }
- // "jsdoc/require-description": ["error"|"warn", {"descriptionStyle":"tag"}]
- // Message: Missing JSDoc @description description.
-
- /**
- *
- */
- interface quux {
-
- }
- // "jsdoc/require-description": ["error"|"warn", {"contexts":["TSInterfaceDeclaration"],"descriptionStyle":"tag"}]
- // Message: Missing JSDoc @description declaration.
-
- /**
- *
- */
- var quux = class {
-
- };
- // "jsdoc/require-description": ["error"|"warn", {"contexts":["ClassExpression"],"descriptionStyle":"tag"}]
- // Message: Missing JSDoc @description declaration.
-
- /**
- *
- */
- var quux = {
-
- };
- // "jsdoc/require-description": ["error"|"warn", {"contexts":["ObjectExpression"],"descriptionStyle":"tag"}]
- // Message: Missing JSDoc @description declaration.
-
- /**
- * @someDesc
- */
- function quux () {
-
- }
- // Settings: {"jsdoc":{"tagNamePreference":{"description":{"message":"Please avoid `{{tagName}}`; use `{{replacement}}` instead","replacement":"someDesc"}}}}
- // "jsdoc/require-description": ["error"|"warn", {"descriptionStyle":"tag"}]
- // Message: Missing JSDoc @someDesc description.
-
- /**
- * @description
- */
- function quux () {
-
- }
- // Settings: {"jsdoc":{"tagNamePreference":{"description":false}}}
- // "jsdoc/require-description": ["error"|"warn", {"descriptionStyle":"tag"}]
- // Message: Unexpected tag `@description`
-
- /**
- * @description
- */
- function quux () {
-
- }
- // Settings: {"jsdoc":{"tagNamePreference":{"description":false}}}
- // "jsdoc/require-description": ["error"|"warn", {"descriptionStyle":"any"}]
- // Message: Missing JSDoc block description or @description declaration.
-
- /**
- *
- */
- function quux () {
- }
- // "jsdoc/require-description": ["error"|"warn", {"exemptedBy":["notPresent"]}]
- // Message: Missing JSDoc block description.
-
- class TestClass {
- /**
- *
- */
- constructor() { }
- }
- // Message: Missing JSDoc block description.
-
- class TestClass {
- /**
- *
- */
- constructor() { }
- }
- // "jsdoc/require-description": ["error"|"warn", {"checkConstructors":true}]
- // Message: Missing JSDoc block description.
-
- class TestClass {
- /**
- *
- */
- get Test() { }
- }
- // Message: Missing JSDoc block description.
-
- class TestClass {
- /**
- *
- */
- get Test() { }
- }
- // "jsdoc/require-description": ["error"|"warn", {"checkGetters":true}]
- // Message: Missing JSDoc block description.
-
- class TestClass {
- /**
- *
- */
- set Test(value) { }
- }
- // Message: Missing JSDoc block description.
-
- class TestClass {
- /**
- *
- */
- set Test(value) { }
- }
- // "jsdoc/require-description": ["error"|"warn", {"checkSetters":true}]
- // Message: Missing JSDoc block description.
-
- /**
- *
- */
- class Foo {
- /**
- *
- */
- constructor() {}
-
- /**
- *
- */
- bar() {}
- }
- // "jsdoc/require-description": ["error"|"warn", {"checkConstructors":false,"contexts":["MethodDefinition"]}]
- // Message: Missing JSDoc block description.
-
- /**
- * @implements {Bar}
- */
- class quux {
-
- }
- // Settings: {"jsdoc":{"implementsReplacesDocs":false}}
- // "jsdoc/require-description": ["error"|"warn", {"contexts":[{"comment":"JsdocBlock[postDelimiter=\"\"]:has(JsdocTag[rawType=\"Bar\"])","context":"ClassDeclaration"}],"descriptionStyle":"tag"}]
- // Message: Missing JSDoc @description declaration.
-
- /**
- * Has some
- * description already.
- * @implements {Bar}
- */
- class quux {
-
- }
- // Settings: {"jsdoc":{"implementsReplacesDocs":false}}
- // "jsdoc/require-description": ["error"|"warn", {"contexts":[{"comment":"JsdocBlock[postDelimiter=\"\"]:has(JsdocTag[rawType=\"Bar\"])","context":"ClassDeclaration"}],"descriptionStyle":"tag"}]
- // Message: Missing JSDoc @description declaration.
-
- /**
- * @implements {Bar
- * | Foo}
- */
- class quux {
-
- }
- // Settings: {"jsdoc":{"implementsReplacesDocs":false}}
- // "jsdoc/require-description": ["error"|"warn", {"contexts":[{"comment":"JsdocBlock[postDelimiter=\"\"]:has(JsdocTypeUnion > JsdocTypeName[value=\"Bar\"]:nth-child(1))","context":"ClassDeclaration"}],"descriptionStyle":"tag"}]
- // Message: Missing JSDoc @description declaration.
-
- /**
- * @implements {Bar}
- */
- class quux {
-
- }
- // Settings: {"jsdoc":{"implementsReplacesDocs":false}}
- // "jsdoc/require-description": ["error"|"warn", {"contexts":[{"comment":"JsdocBlock[postDelimiter=\"\"]:has(JsdocTag[tag=\"implements\"])","context":"ClassDeclaration"}],"descriptionStyle":"tag"}]
- // Message: Missing JSDoc @description declaration.
-
- /**
- * @implements {Bar}
- */
- class quux {
-
- }
- // Settings: {"jsdoc":{"implementsReplacesDocs":false}}
- // "jsdoc/require-description": ["error"|"warn", {"contexts":[{"comment":"JsdocBlock[postDelimiter=\"\"]:has(JsdocTag[tag=\"implements\"])","context":"any"}],"descriptionStyle":"tag"}]
- // Message: Missing JSDoc @description declaration.
- ````
-
- The following patterns are not considered problems:
-
- ````js
- /**
- *
- */
-
- /**
- * @description
- * // arbitrary description content
- */
- function quux () {
-
- }
- // "jsdoc/require-description": ["error"|"warn", {"descriptionStyle":"tag"}]
-
- /**
- * @description
- * quux(); // does something useful
- */
- function quux () {
-
- }
- // "jsdoc/require-description": ["error"|"warn", {"descriptionStyle":"tag"}]
-
- /**
- * @description <caption>Valid usage</caption>
- * quux(); // does something useful
- *
- * @description <caption>Invalid usage</caption>
- * quux('random unwanted arg'); // results in an error
- */
- function quux () {
-
- }
- // "jsdoc/require-description": ["error"|"warn", {"descriptionStyle":"tag"}]
-
- /**
- *
- */
- class quux {
-
- }
- // "jsdoc/require-description": ["error"|"warn", {"descriptionStyle":"tag"}]
-
- /**
- *
- */
- function quux () {
-
- }
- // "jsdoc/require-description": ["error"|"warn", {"contexts":["ClassDeclaration"]}]
-
- /**
- * @type {MyCallback}
- */
- function quux () {
-
- }
- // "jsdoc/require-description": ["error"|"warn", {"exemptedBy":["type"]}]
-
- /**
- *
- */
- interface quux {
-
- }
- // "jsdoc/require-description": ["error"|"warn", {"descriptionStyle":"tag"}]
-
- interface quux {
- /**
- * If the thing should be checked.
- */
- checked?: boolean
- }
- // "jsdoc/require-description": ["error"|"warn", {"contexts":["TSPropertySignature"]}]
-
- /**
- *
- */
- var quux = class {
-
- };
- // "jsdoc/require-description": ["error"|"warn", {"descriptionStyle":"tag"}]
-
- /**
- *
- */
- var quux = {
-
- };
- // "jsdoc/require-description": ["error"|"warn", {"descriptionStyle":"tag"}]
-
- /**
- * Has an implicit description
- */
- function quux () {
-
- }
- // "jsdoc/require-description": ["error"|"warn", {"descriptionStyle":"body"}]
-
- /**
- * Has an implicit description
- */
- function quux () {
-
- }
-
- /**
- * Has an implicit description
- */
- function quux () {
-
- }
- // "jsdoc/require-description": ["error"|"warn", {"descriptionStyle":"any"}]
-
- /**
- * @description Has an explicit description
- */
- function quux () {
-
- }
- // "jsdoc/require-description": ["error"|"warn", {"descriptionStyle":"any"}]
-
- /**
- *
- */
- function quux () {
-
- }
- // Settings: {"jsdoc":{"tagNamePreference":{"description":false}}}
-
- class TestClass {
- /**
- * Test.
- */
- constructor() { }
- }
-
- class TestClass {
- /**
- *
- */
- constructor() { }
- }
- // "jsdoc/require-description": ["error"|"warn", {"checkConstructors":false}]
-
- class TestClass {
- /**
- * Test.
- */
- get Test() { }
- }
-
- class TestClass {
- /**
- *
- */
- get Test() { }
- }
- // "jsdoc/require-description": ["error"|"warn", {"checkGetters":false}]
-
- class TestClass {
- /**
- * Test.
- */
- set Test(value) { }
- }
-
- class TestClass {
- /**
- *
- */
- set Test(value) { }
- }
- // "jsdoc/require-description": ["error"|"warn", {"checkSetters":false}]
-
- /**
- * Multi
- * line
- */
- function quux () {
-
- }
-
- /** Single line */
- function quux () {
-
- }
-
- /** @description something */
- function quux () {
-
- }
- // "jsdoc/require-description": ["error"|"warn", {"descriptionStyle":"tag"}]
-
- /**
- * @implements {Bar}
- */
- class quux {
-
- }
- // Settings: {"jsdoc":{"implementsReplacesDocs":false}}
- // "jsdoc/require-description": ["error"|"warn", {"contexts":[{"comment":"JsdocBlock[postDelimiter=/\\s{4}/]:has(JsdocTag[rawType=\"class\"])","context":"ClassDeclaration"}],"descriptionStyle":"tag"}]
-
- /**
- * Has some
- * description already.
- */
- class quux {
-
- }
- // "jsdoc/require-description": ["error"|"warn", {"contexts":[{"comment":"JsdocBlock[postDelimiter=\"\"]:has(JsdocTag[rawType=\"{Bar}\"])","context":"ClassDeclaration"}],"descriptionStyle":"tag"}]
-
- /**
- * Has some
- * description already.
- */
- class quux {
-
- }
- // "jsdoc/require-description": ["error"|"warn", {"contexts":[{"comment":"JsdocBlock[postDelimiter=\"\"]:has(JsdocTag[rawType=\"{Bar}\"])","context":"any"}],"descriptionStyle":"tag"}]
-
- /**
- * Has some
- * description already.
- */
- // "jsdoc/require-description": ["error"|"warn", {"contexts":[{"comment":"JsdocBlock[postDelimiter=\"\"]:has(JsdocTag[rawType=\"{Bar}\"])","context":"any"}],"descriptionStyle":"tag"}]
- ````
-
-
- <a name="eslint-plugin-jsdoc-rules-require-example"></a>
- ### <code>require-example</code>
-
- Requires that all functions have examples.
-
- * All functions must have one or more `@example` tags.
- * Every example tag must have a non-empty description that explains the
- method's usage.
-
- <a name="eslint-plugin-jsdoc-rules-require-example-options-25"></a>
- #### Options
-
- This rule has an object option.
-
- <a name="eslint-plugin-jsdoc-rules-require-example-options-25-exemptedby"></a>
- ##### <code>exemptedBy</code>
-
- Array of tags (e.g., `['type']`) whose presence on the document
- block avoids the need for an `@example`. Defaults to an array with
- `inheritdoc`. If you set this array, it will overwrite the default,
- so be sure to add back `inheritdoc` if you wish its presence to cause
- exemption of the rule.
-
- <a name="eslint-plugin-jsdoc-rules-require-example-options-25-exemptnoarguments"></a>
- ##### <code>exemptNoArguments</code>
-
- Boolean to indicate that no-argument functions should not be reported for
- missing `@example` declarations.
-
- <a name="eslint-plugin-jsdoc-rules-require-example-options-25-contexts-6"></a>
- ##### <code>contexts</code>
-
- Set this to an array of strings representing the AST context (or an object with
- `context` and `comment` properties) where you wish the rule to be applied.
- (e.g., `ClassDeclaration` for ES6
- classes). Overrides the default contexts (see below). Set to `"any"` if you
- want the rule to apply to any jsdoc block throughout your files.
-
- See the ["AST and Selectors"](#eslint-plugin-jsdoc-advanced-ast-and-selectors)
- section of our README for more on the expected format.
-
- <a name="eslint-plugin-jsdoc-rules-require-example-options-25-checkconstructors"></a>
- ##### <code>checkConstructors</code>
-
- A value indicating whether `constructor`s should be checked.
- Defaults to `true`.
-
- <a name="eslint-plugin-jsdoc-rules-require-example-options-25-checkgetters"></a>
- ##### <code>checkGetters</code>
-
- A value indicating whether getters should be checked. Defaults to `false`.
-
- <a name="eslint-plugin-jsdoc-rules-require-example-options-25-checksetters"></a>
- ##### <code>checkSetters</code>
-
- A value indicating whether setters should be checked. Defaults to `false`.
-
- <a name="eslint-plugin-jsdoc-rules-require-example-fixer"></a>
- #### Fixer
-
- The fixer for `require-example` will add an empty `@example`, but it will still
- report a missing example description after this is added.
-
- |||
- |---|---|
- |Context|`ArrowFunctionExpression`, `FunctionDeclaration`, `FunctionExpression`; others when `contexts` option enabled|
- |Tags|`example`|
- |Recommended|false|
- |Options|`exemptedBy`, `exemptNoArguments`, `avoidExampleOnConstructors`, `contexts`|
- |Settings|`ignoreReplacesDocs`, `overrideReplacesDocs`, `augmentsExtendsReplacesDocs`, `implementsReplacesDocs`|
-
- The following patterns are considered problems:
-
- ````js
- /**
- *
- */
- function quux () {
-
- }
- // Message: Missing JSDoc @example declaration.
-
- /**
- *
- */
- function quux (someParam) {
-
- }
- // "jsdoc/require-example": ["error"|"warn", {"exemptNoArguments":true}]
- // Message: Missing JSDoc @example declaration.
-
- /**
- *
- */
- function quux () {
-
- }
- // Message: Missing JSDoc @example declaration.
-
- /**
- * @example
- */
- function quux () {
-
- }
- // Message: Missing JSDoc @example description.
-
- /**
- * @constructor
- */
- function quux () {
-
- }
- // Message: Missing JSDoc @example declaration.
-
- /**
- * @constructor
- * @example
- */
- function quux () {
-
- }
- // Message: Missing JSDoc @example description.
-
- /**
- *
- */
- class quux {
-
- }
- // "jsdoc/require-example": ["error"|"warn", {"contexts":["ClassDeclaration"]}]
- // Message: Missing JSDoc @example declaration.
-
- /**
- *
- */
- // "jsdoc/require-example": ["error"|"warn", {"contexts":["any"]}]
- // Message: Missing JSDoc @example declaration.
-
- /**
- *
- */
- function quux () {
- }
- // "jsdoc/require-example": ["error"|"warn", {"exemptedBy":["notPresent"]}]
- // Message: Missing JSDoc @example declaration.
-
- class TestClass {
- /**
- *
- */
- get Test() { }
- }
- // "jsdoc/require-example": ["error"|"warn", {"checkGetters":true}]
- // Message: Missing JSDoc @example declaration.
-
- class TestClass {
- /**
- * @example
- */
- get Test() { }
- }
- // "jsdoc/require-example": ["error"|"warn", {"checkGetters":true}]
- // Message: Missing JSDoc @example description.
-
- class TestClass {
- /**
- *
- */
- set Test(value) { }
- }
- // "jsdoc/require-example": ["error"|"warn", {"checkSetters":true}]
- // Message: Missing JSDoc @example declaration.
-
- class TestClass {
- /**
- * @example
- */
- set Test(value) { }
- }
- // "jsdoc/require-example": ["error"|"warn", {"checkSetters":true}]
- // Message: Missing JSDoc @example description.
- ````
-
- The following patterns are not considered problems:
-
- ````js
- /**
- *
- */
-
- /**
- * @example
- * // arbitrary example content
- */
- function quux () {
-
- }
-
- /**
- * @example
- * quux(); // does something useful
- */
- function quux () {
-
- }
-
- /**
- * @example <caption>Valid usage</caption>
- * quux(); // does something useful
- *
- * @example <caption>Invalid usage</caption>
- * quux('random unwanted arg'); // results in an error
- */
- function quux () {
-
- }
-
- /**
- * @constructor
- */
- function quux () {
-
- }
- // "jsdoc/require-example": ["error"|"warn", {"checkConstructors":false}]
-
- /**
- * @constructor
- * @example
- */
- function quux () {
-
- }
- // "jsdoc/require-example": ["error"|"warn", {"checkConstructors":false}]
-
- class Foo {
- /**
- *
- */
- constructor () {
-
- }
- }
- // "jsdoc/require-example": ["error"|"warn", {"checkConstructors":false}]
-
- /**
- * @inheritdoc
- */
- function quux () {
-
- }
-
- /**
- * @type {MyCallback}
- */
- function quux () {
-
- }
- // "jsdoc/require-example": ["error"|"warn", {"exemptedBy":["type"]}]
-
- /**
- * @example Some example code
- */
- class quux {
-
- }
- // "jsdoc/require-example": ["error"|"warn", {"contexts":["ClassDeclaration"]}]
-
- /**
- *
- */
- function quux () {
-
- }
- // "jsdoc/require-example": ["error"|"warn", {"contexts":["ClassDeclaration"]}]
-
- class TestClass {
- /**
- *
- */
- get Test() { }
- }
-
- class TestClass {
- /**
- * @example
- */
- get Test() { }
- }
-
- class TestClass {
- /**
- * @example Test
- */
- get Test() { }
- }
- // "jsdoc/require-example": ["error"|"warn", {"checkGetters":true}]
-
- class TestClass {
- /**
- *
- */
- set Test(value) { }
- }
-
- class TestClass {
- /**
- * @example
- */
- set Test(value) { }
- }
- // "jsdoc/require-example": ["error"|"warn", {"checkSetters":false}]
-
- class TestClass {
- /**
- * @example Test
- */
- set Test(value) { }
- }
- // "jsdoc/require-example": ["error"|"warn", {"checkSetters":true}]
-
- /**
- *
- */
- function quux () {
-
- }
- // "jsdoc/require-example": ["error"|"warn", {"exemptNoArguments":true}]
- ````
-
-
- <a name="eslint-plugin-jsdoc-rules-require-file-overview"></a>
- ### <code>require-file-overview</code>
-
- Checks that:
-
- 1. All files have a `@file`, `@fileoverview`, or `@overview` tag.
- 2. Duplicate file overview tags within a given file will be reported
- 3. File overview tags will be reported which are not, as per
- [the docs](https://jsdoc.app/tags-file.html), "at the beginning of
- the file"–where beginning of the file is interpreted in this rule
- as being when the overview tag is not preceded by anything other than
- a comment.
-
- <a name="eslint-plugin-jsdoc-rules-require-file-overview-options-26"></a>
- #### Options
-
- <a name="eslint-plugin-jsdoc-rules-require-file-overview-options-26-tags-5"></a>
- ##### <code>tags</code>
-
- The keys of this object are tag names, and the values are configuration
- objects indicating what will be checked for these whole-file tags.
-
- Each configuration object has the following boolean keys (which default
- to `false` when this option is supplied): `mustExist`, `preventDuplicates`,
- `initialCommentsOnly`. These correspond to the three items above.
-
- When no `tags` is present, the default is:
-
- ```json
- {
- "file": {
- "initialCommentsOnly": true,
- "mustExist": true,
- "preventDuplicates": true,
- }
- }
- ```
-
- You can add additional tag names and/or override `file` if you supply this
- option, e.g., in place of or in addition to `file`, giving other potential
- file global tags like `@license`, `@copyright`, `@author`, `@module` or
- `@exports`, optionally restricting them to a single use or preventing them
- from being preceded by anything besides comments.
-
- For example:
-
- ```js
- {
- "license": {
- "mustExist": true,
- "preventDuplicates": true,
- }
- }
- ```
-
- This would require one and only one `@license` in the file, though because
- `initialCommentsOnly` is absent and defaults to `false`, the `@license`
- can be anywhere.
-
- In the case of `@license`, you can use this rule along with the
- `check-values` rule (with its `allowedLicenses` or `licensePattern` options),
- to enforce a license whitelist be present on every JS file.
-
- Note that if you choose to use `preventDuplicates` with `license`, you still
- have a way to allow multiple licenses for the whole page by using the SPDX
- "AND" expression, e.g., `@license (MIT AND GPL-3.0)`.
-
- Note that the tag names are the main jsdoc tag name, so you should use `file`
- in this configuration object regardless of whether you have configured
- `fileoverview` instead of `file` on `tagNamePreference` (i.e., `fileoverview`
- will be checked, but you must use `file` on the configuration object).
-
- |||
- |---|---|
- |Context|Everywhere|
- |Tags|`file`; others when `tags` set|
- |Aliases|`fileoverview`, `overview`|
- |Recommended|false|
- |Options|`tags`|
-
- The following patterns are considered problems:
-
- ````js
-
- // Message: Missing @file
-
-
- // "jsdoc/require-file-overview": ["error"|"warn", {"tags":{"file":{"initialCommentsOnly":true,"mustExist":true,"preventDuplicates":true}}}]
- // Message: Missing @file
-
-
- // "jsdoc/require-file-overview": ["error"|"warn", {"tags":{"file":{"mustExist":true}}}]
- // Message: Missing @file
-
-
- // "jsdoc/require-file-overview": ["error"|"warn", {"tags":{"author":{"initialCommentsOnly":false,"mustExist":true,"preventDuplicates":false}}}]
- // Message: Missing @author
-
- /**
- *
- */
- // Message: Missing @file
-
- /**
- *
- */
- function quux () {}
- // Message: Missing @file
-
- /**
- *
- */
- function quux () {}
- // Settings: {"jsdoc":{"tagNamePreference":{"file":"fileoverview"}}}
- // Message: Missing @fileoverview
-
- /**
- *
- */
- function quux () {}
- // Settings: {"jsdoc":{"tagNamePreference":{"file":"overview"}}}
- // Message: Missing @overview
-
- /**
- *
- */
- function quux () {}
- // Settings: {"jsdoc":{"tagNamePreference":{"file":false}}}
- // Message: `settings.jsdoc.tagNamePreference` cannot block @file for the `require-file-overview` rule
-
- /**
- *
- */
- function quux () {}
- // Settings: {"jsdoc":{"tagNamePreference":{"file":false}}}
- // "jsdoc/require-file-overview": ["error"|"warn", {"tags":{"file":{"initialCommentsOnly":false,"mustExist":true,"preventDuplicates":false}}}]
- // Message: `settings.jsdoc.tagNamePreference` cannot block @file for the `require-file-overview` rule
-
- /**
- *
- */
- function quux () {}
- // Settings: {"jsdoc":{"tagNamePreference":{"file":{"message":"Don't use file"}}}}
- // Message: `settings.jsdoc.tagNamePreference` cannot block @file for the `require-file-overview` rule
-
- /**
- * @param a
- */
- function quux (a) {}
- // Message: Missing @file
-
- /**
- * @param a
- */
- function quux (a) {}
-
- /**
- * @param b
- */
- function bar (b) {}
- // Message: Missing @file
-
- /**
- * @file
- */
-
- /**
- * @file
- */
- // Message: Duplicate @file
-
- /**
- * @copyright
- */
-
- /**
- * @copyright
- */
- // "jsdoc/require-file-overview": ["error"|"warn", {"tags":{"copyright":{"initialCommentsOnly":false,"mustExist":false,"preventDuplicates":true}}}]
- // Message: Duplicate @copyright
-
- function quux () {
- }
- /**
- * @file
- */
- // Message: @file should be at the beginning of the file
-
- function quux () {
- }
- /**
- * @license
- */
- // "jsdoc/require-file-overview": ["error"|"warn", {"tags":{"license":{"initialCommentsOnly":true,"mustExist":false,"preventDuplicates":false}}}]
- // Message: @license should be at the beginning of the file
-
- function quux () {
- }
- /**
- * @license
- */
- // "jsdoc/require-file-overview": ["error"|"warn", {"tags":{"license":{"initialCommentsOnly":true}}}]
- // Message: @license should be at the beginning of the file
-
- /**
- * @file
- */
-
- /**
- * @file
- */
- // "jsdoc/require-file-overview": ["error"|"warn", {"tags":{"file":{"initialCommentsOnly":true,"preventDuplicates":true}}}]
- // Message: Duplicate @file
- ````
-
- The following patterns are not considered problems:
-
- ````js
- /**
- * @file
- */
-
- /**
- * @file
- */
-
- /**
- * @file
- */
- // "jsdoc/require-file-overview": ["error"|"warn", {"tags":{"license":{"initialCommentsOnly":true,"preventDuplicates":true}}}]
-
- // Ok preceded by comment
- /**
- * @file
- */
-
- /**
- * @fileoverview
- */
- // Settings: {"jsdoc":{"tagNamePreference":{"file":"fileoverview"}}}
-
- /**
- * @overview
- */
- // Settings: {"jsdoc":{"tagNamePreference":{"file":"overview"}}}
-
- /**
- * @file Description of file
- */
-
- /**
- * @file Description of file
- */
- function quux () {
- }
-
- /**
- *
- */
-
- function quux () {
- }
- /**
- *
- */
- // "jsdoc/require-file-overview": ["error"|"warn", {"tags":{"license":{"initialCommentsOnly":true,"mustExist":false,"preventDuplicates":false}}}]
-
- function quux () {
- }
- /**
- *
- */
- // "jsdoc/require-file-overview": ["error"|"warn", {"tags":{"license":{"initialCommentsOnly":false,"mustExist":false,"preventDuplicates":false}}}]
-
- function quux () {
- }
- /**
- *
- */
- // "jsdoc/require-file-overview": ["error"|"warn", {"tags":{"license":{"initialCommentsOnly":false,"mustExist":false,"preventDuplicates":true}}}]
-
- /**
- * @license MIT
- */
-
- var a
-
- /**
- * @type {Array}
- */
- // "jsdoc/require-file-overview": ["error"|"warn", {"tags":{"license":{"initialCommentsOnly":true,"mustExist":false,"preventDuplicates":false}}}]
- ````
-
-
- <a name="eslint-plugin-jsdoc-rules-require-hyphen-before-param-description"></a>
- ### <code>require-hyphen-before-param-description</code>
-
- Requires (or disallows) a hyphen before the `@param` description.
-
- <a name="eslint-plugin-jsdoc-rules-require-hyphen-before-param-description-options-27"></a>
- #### Options
-
- This rule takes one optional string argument and an optional options object.
-
- If the string is `"always"` then a problem is raised when there is no hyphen
- before the description. If it is `"never"` then a problem is raised when there
- is a hyphen before the description. The default value is `"always"`.
-
- The options object may have the following properties to indicate behavior for
- other tags besides the `@param` tag (or the `@arg` tag if so set):
-
- - `tags` - Object whose keys indicate different tags to check for the
- presence or absence of hyphens; the key value should be "always" or "never",
- indicating how hyphens are to be applied, e.g., `{property: 'never'}`
- to ensure `@property` never uses hyphens. A key can also be set as `*`, e.g.,
- `'*': 'always'` to apply hyphen checking to any tag (besides the preferred
- `@param` tag which follows the main string option setting and besides any
- other `tags` entries).
-
- |||
- |---|---|
- |Context|everywhere|
- |Tags|`param` and optionally other tags within `tags`|
- |Aliases|`arg`, `argument`; potentially `prop` or other aliases|
- |Recommended|false|
- |Options|a string matching `"always" or "never"` followed by an optional object with a `tags` property|
-
- The following patterns are considered problems:
-
- ````js
- /**
- * @param foo Foo.
- */
- function quux () {
-
- }
- // "jsdoc/require-hyphen-before-param-description": ["error"|"warn", "always"]
- // Message: There must be a hyphen before @param description.
-
- /**
- * @param foo Foo.
- */
- function quux () {
-
- }
- // "jsdoc/require-hyphen-before-param-description": ["error"|"warn", "always",{"tags":{"*":"never"}}]
- // Message: There must be a hyphen before @param description.
-
- /**
- * @param foo Foo.
- * @returns {SomeType} - Hyphen here.
- */
- function quux () {
-
- }
- // "jsdoc/require-hyphen-before-param-description": ["error"|"warn", "always",{"tags":{"*":"never","returns":"always"}}]
- // Message: There must be a hyphen before @param description.
-
- /**
- * @param foo Foo.
- */
- function quux () {
-
- }
- // Message: There must be a hyphen before @param description.
-
- /**
- * @param foo - Foo.
- */
- function quux () {
-
- }
- // "jsdoc/require-hyphen-before-param-description": ["error"|"warn", "never"]
- // Message: There must be no hyphen before @param description.
-
- /**
- * @param foo - Foo.
- */
- function quux () {
-
- }
- // "jsdoc/require-hyphen-before-param-description": ["error"|"warn", "never"]
- // Message: There must be no hyphen before @param description.
-
- /**
- * @param foo - foo
- * @param foo foo
- */
- function quux () {
-
- }
- // "jsdoc/require-hyphen-before-param-description": ["error"|"warn", "always"]
- // Message: There must be a hyphen before @param description.
-
- /**
- * @param foo foo
- * bar
- * @param bar - bar
- */
- function quux () {
-
- }
- // "jsdoc/require-hyphen-before-param-description": ["error"|"warn", "always"]
- // Message: There must be a hyphen before @param description.
-
- /**
- * @param foo
- */
- function quux (foo) {
-
- }
- // Settings: {"jsdoc":{"tagNamePreference":{"param":false}}}
- // Message: Unexpected tag `@param`
-
- /**
- * @typedef {SomeType} ATypeDefName
- * @property foo Foo.
- */
- // "jsdoc/require-hyphen-before-param-description": ["error"|"warn", "always",{"tags":{"property":"always"}}]
- // Message: There must be a hyphen before @property description.
-
- /**
- * @template TempA, TempB A desc.
- */
- // "jsdoc/require-hyphen-before-param-description": ["error"|"warn", "always",{"tags":{"template":"always"}}]
- // Message: There must be a hyphen before @template description.
-
- /**
- * @typedef {SomeType} ATypeDefName
- * @property foo - Foo.
- */
- // "jsdoc/require-hyphen-before-param-description": ["error"|"warn", "never",{"tags":{"property":"never"}}]
- // Message: There must be no hyphen before @property description.
-
- /**
- * @param foo Foo.
- * @returns {SomeType} - A description.
- */
- function quux () {
-
- }
- // "jsdoc/require-hyphen-before-param-description": ["error"|"warn", "always",{"tags":{"returns":"never"}}]
- // Message: There must be a hyphen before @param description.
- ````
-
- The following patterns are not considered problems:
-
- ````js
- /**
- * @param foo - Foo.
- */
- function quux () {
-
- }
- // "jsdoc/require-hyphen-before-param-description": ["error"|"warn", "always"]
-
- /**
- * @param foo - Foo.
- */
- function quux () {
-
- }
- // "jsdoc/require-hyphen-before-param-description": ["error"|"warn", "always"]
-
- /**
- * @param foo - Foo.
- * @returns {SomeType} A description.
- */
- function quux () {
-
- }
- // "jsdoc/require-hyphen-before-param-description": ["error"|"warn", "always",{"tags":{"returns":"never"}}]
-
- /**
- * @param foo Foo.
- */
- function quux () {
-
- }
- // "jsdoc/require-hyphen-before-param-description": ["error"|"warn", "never"]
-
- /**
- * @param foo
- */
- function quux () {
-
- }
-
- /**
- *
- */
- function quux () {
-
- }
- // "jsdoc/require-hyphen-before-param-description": ["error"|"warn", "always",{"tags":{"*":"always"}}]
-
- /**
- * @typedef {SomeType} ATypeDefName
- * @property foo - Foo.
- */
- // "jsdoc/require-hyphen-before-param-description": ["error"|"warn", "always",{"tags":{"property":"always"}}]
-
- /**
- * @typedef {SomeType} ATypeDefName
- * @property foo Foo.
- */
- // "jsdoc/require-hyphen-before-param-description": ["error"|"warn", "never",{"tags":{"property":"never"}}]
-
- /**
- * @typedef {SomeType} ATypeDefName
- * @property foo - Foo.
- */
- // "jsdoc/require-hyphen-before-param-description": ["error"|"warn", "never",{"tags":{"*":"always"}}]
-
- /** Entry point for module.
- *
- * @param {!Array<string>} argv Command-line arguments.
- */
- function main(argv) {
- };
- // "jsdoc/require-hyphen-before-param-description": ["error"|"warn", "never"]
- ````
-
-
- <a name="eslint-plugin-jsdoc-rules-require-jsdoc"></a>
- ### <code>require-jsdoc</code>
-
- Checks for presence of jsdoc comments, on class declarations as well as
- functions.
-
- <a name="eslint-plugin-jsdoc-rules-require-jsdoc-options-28"></a>
- #### Options
-
- Accepts one optional options object with the following optional keys.
-
- <a name="eslint-plugin-jsdoc-rules-require-jsdoc-options-28-publiconly"></a>
- ##### <code>publicOnly</code>
-
- This option will insist that missing jsdoc blocks are only reported for
- function bodies / class declarations that are exported from the module.
- May be a boolean or object. If set to `true`, the defaults below will be
- used. If unset, jsdoc block reporting will not be limited to exports.
-
- This object supports the following optional boolean keys (`false` unless
- otherwise noted):
-
- - `ancestorsOnly` - Only check node ancestors to check if node is exported
- - `esm` - ESM exports are checked for JSDoc comments (Defaults to `true`)
- - `cjs` - CommonJS exports are checked for JSDoc comments (Defaults to `true`)
- - `window` - Window global exports are checked for JSDoc comments
-
- <a name="eslint-plugin-jsdoc-rules-require-jsdoc-options-28-require"></a>
- ##### <code>require</code>
-
- An object with the following optional boolean keys which all default to
- `false` except as noted, indicating the contexts where the rule will apply:
-
- - `ArrowFunctionExpression`
- - `ClassDeclaration`
- - `ClassExpression`
- - `FunctionDeclaration` (defaults to `true`)
- - `FunctionExpression`
- - `MethodDefinition`
-
- <a name="eslint-plugin-jsdoc-rules-require-jsdoc-options-28-contexts-7"></a>
- ##### <code>contexts</code>
-
- Set this to an array of strings or objects representing the additional AST
- contexts where you wish the rule to be applied (e.g., `Property` for
- properties). If specified as an object, it should have a `context` property
- and can have an `inlineCommentBlock` property which, if set to `true`, will
- add an inline `/** */` instead of the regular, multi-line, indented jsdoc
- block which will otherwise be added. Defaults to an empty array.
-
- Note that you may need to disable `require` items (e.g., `MethodDefinition`)
- if you are specifying a more precise form in `contexts` (e.g., `MethodDefinition:not([accessibility="private"] > FunctionExpression`).
-
- See the ["AST and Selectors"](#eslint-plugin-jsdoc-advanced-ast-and-selectors)
- section of our README for more on the expected format.
-
- <a name="eslint-plugin-jsdoc-rules-require-jsdoc-options-28-exemptemptyconstructors"></a>
- ##### <code>exemptEmptyConstructors</code>
-
- Default: true
-
- When `true`, the rule will not report missing jsdoc blocks above constructors
- with no parameters or return values (this is enabled by default as the class
- name or description should be seen as sufficient to convey intent).
-
- <a name="eslint-plugin-jsdoc-rules-require-jsdoc-options-28-exemptemptyfunctions"></a>
- ##### <code>exemptEmptyFunctions</code>
-
- Default: false.
-
- When `true`, the rule will not report missing jsdoc blocks above
- functions/methods with no parameters or return values (intended where
- function/method names are sufficient for themselves as documentation).
-
- <a name="eslint-plugin-jsdoc-rules-require-jsdoc-options-28-checkconstructors-1"></a>
- ##### <code>checkConstructors</code>
-
- A value indicating whether `constructor`s should be checked. Defaults to
- `true`. When `true`, `exemptEmptyConstructors` may still avoid reporting when
- no parameters or return values are found.
-
- <a name="eslint-plugin-jsdoc-rules-require-jsdoc-options-28-checkgetters-1"></a>
- ##### <code>checkGetters</code>
-
- A value indicating whether getters should be checked. Besides setting as a
- boolean, this option can be set to the string `"no-setter"` to indicate that
- getters should be checked but only when there is no setter. This may be useful
- if one only wishes documentation on one of the two accessors. Defaults to
- `false`.
-
- <a name="eslint-plugin-jsdoc-rules-require-jsdoc-options-28-checksetters-1"></a>
- ##### <code>checkSetters</code>
-
- A value indicating whether setters should be checked. Besides setting as a
- boolean, this option can be set to the string `"no-getter"` to indicate that
- setters should be checked but only when there is no getter. This may be useful
- if one only wishes documentation on one of the two accessors. Defaults to
- `false`.
-
- <a name="eslint-plugin-jsdoc-rules-require-jsdoc-options-28-enablefixer-2"></a>
- ##### <code>enableFixer</code>
-
- A boolean on whether to enable the fixer (which adds an empty jsdoc block).
- Defaults to `true`.
-
- |||
- |---|---|
- |Context|`ArrowFunctionExpression`, `ClassDeclaration`, `ClassExpression`, `FunctionDeclaration`, `FunctionExpression`; others when `contexts` option enabled|
- |Tags|N/A|
- |Recommended|true|
- |Options|`publicOnly`, `require`, `contexts`, `exemptEmptyConstructors`, `exemptEmptyFunctions`, `enableFixer`|
-
- The following patterns are considered problems:
-
- ````js
- /** This is comment */
- export interface Foo {
- /** This is comment x2 */
- tom: string;
- catchJerry(): boolean;
- }
- // "jsdoc/require-jsdoc": ["error"|"warn", {"contexts":["TSInterfaceDeclaration","TSMethodSignature","TSPropertySignature"],"publicOnly":{"ancestorsOnly":true},"require":{"ClassDeclaration":true,"ClassExpression":true,"MethodDefinition":true}}]
- // Message: Missing JSDoc comment.
-
- /** This is comment */
- export interface Foo {
- /** This is comment x2 */
- tom: string;
- jerry: number;
- }
- // "jsdoc/require-jsdoc": ["error"|"warn", {"contexts":["TSInterfaceDeclaration","TSMethodSignature","TSPropertySignature"],"publicOnly":{"ancestorsOnly":true},"require":{"ClassDeclaration":true,"ClassExpression":true,"MethodDefinition":true}}]
- // Message: Missing JSDoc comment.
-
- /** This is comment */
- export interface Foo {
- bar(): string;
- }
- // "jsdoc/require-jsdoc": ["error"|"warn", {"contexts":["TSInterfaceDeclaration","TSMethodSignature","TSPropertySignature"],"publicOnly":{"ancestorsOnly":true}}]
- // Message: Missing JSDoc comment.
-
- /** This is comment */
- export interface Foo {
- bar: string;
- }
- // "jsdoc/require-jsdoc": ["error"|"warn", {"contexts":["TSInterfaceDeclaration","TSMethodSignature","TSPropertySignature"],"publicOnly":{"ancestorsOnly":true,"esm":true}}]
- // Message: Missing JSDoc comment.
-
- /**
- * Foo interface documentation.
- */
- export interface Foo extends Bar {
- /**
- * baz method documentation.
- */
- baz(): void;
-
- meow(): void;
- }
- // "jsdoc/require-jsdoc": ["error"|"warn", {"contexts":["TSMethodSignature"],"publicOnly":{"ancestorsOnly":true}}]
- // Message: Missing JSDoc comment.
-
- function quux (foo) {
-
- }
- // Message: Missing JSDoc comment.
-
- /**
- * @func myFunction
- */
- function myFunction() {
-
- }
- // Settings: {"jsdoc":{"maxLines":3,"minLines":2}}
- // Message: Missing JSDoc comment.
-
- /**
- * @func myFunction
- */
-
-
- function myFunction() {
-
- }
- // Settings: {"jsdoc":{"maxLines":2}}
- // Message: Missing JSDoc comment.
-
- /** @func myFunction */ function myFunction() {
-
- }
- // Settings: {"jsdoc":{"minLines":1}}
- // Message: Missing JSDoc comment.
-
- function myFunction() {
-
- }
- // "jsdoc/require-jsdoc": ["error"|"warn", {"enableFixer":false}]
- // Message: Missing JSDoc comment.
-
- export var test = function () {
-
- };
- // "jsdoc/require-jsdoc": ["error"|"warn", {"publicOnly":true,"require":{"FunctionExpression":true}}]
- // Message: Missing JSDoc comment.
-
- function test () {
-
- }
- export var test2 = test;
- // "jsdoc/require-jsdoc": ["error"|"warn", {"publicOnly":true,"require":{"FunctionDeclaration":true}}]
- // Message: Missing JSDoc comment.
-
- export const test = () => {
-
- };
- // "jsdoc/require-jsdoc": ["error"|"warn", {"publicOnly":true,"require":{"ArrowFunctionExpression":true}}]
- // Message: Missing JSDoc comment.
-
- export const test = () => {
-
- };
- // "jsdoc/require-jsdoc": ["error"|"warn", {"contexts":["ArrowFunctionExpression"],"publicOnly":true}]
- // Message: Missing JSDoc comment.
-
- export const test = () => {
-
- };
- // "jsdoc/require-jsdoc": ["error"|"warn", {"contexts":[{"context":"ArrowFunctionExpression"}],"publicOnly":true}]
- // Message: Missing JSDoc comment.
-
- export let test = class {
-
- };
- // "jsdoc/require-jsdoc": ["error"|"warn", {"publicOnly":true,"require":{"ClassExpression":true}}]
- // Message: Missing JSDoc comment.
-
- export default function () {}
- // "jsdoc/require-jsdoc": ["error"|"warn", {"publicOnly":{"cjs":false,"esm":true,"window":false},"require":{"FunctionDeclaration":true}}]
- // Message: Missing JSDoc comment.
-
- export default () => {}
- // "jsdoc/require-jsdoc": ["error"|"warn", {"publicOnly":{"cjs":false,"esm":true,"window":false},"require":{"ArrowFunctionExpression":true}}]
- // Message: Missing JSDoc comment.
-
- export default (function () {})
- // "jsdoc/require-jsdoc": ["error"|"warn", {"publicOnly":{"cjs":false,"esm":true,"window":false},"require":{"FunctionExpression":true}}]
- // Message: Missing JSDoc comment.
-
- export default class {}
- // "jsdoc/require-jsdoc": ["error"|"warn", {"publicOnly":{"cjs":false,"esm":true,"window":false},"require":{"ClassDeclaration":true}}]
- // Message: Missing JSDoc comment.
-
- function quux (foo) {
-
- }
- // Message: Missing JSDoc comment.
-
- function quux (foo) {
-
- }
- // "jsdoc/require-jsdoc": ["error"|"warn", {"exemptEmptyFunctions":true}]
- // Message: Missing JSDoc comment.
-
- function quux (foo) {
-
- }
- // Settings: {"jsdoc":{"minLines":2}}
- // "jsdoc/require-jsdoc": ["error"|"warn", {"exemptEmptyFunctions":true}]
- // Message: Missing JSDoc comment.
-
- function myFunction() {}
- // Message: Missing JSDoc comment.
-
- /**
- * Description for A.
- */
- class A {
- constructor(xs) {
- this.a = xs;
- }
- }
- // "jsdoc/require-jsdoc": ["error"|"warn", {"require":{"ClassDeclaration":true,"MethodDefinition":true}}]
- // Message: Missing JSDoc comment.
-
- class A {
- /**
- * Description for constructor.
- * @param {object[]} xs - xs
- */
- constructor(xs) {
- this.a = xs;
- }
- }
- // "jsdoc/require-jsdoc": ["error"|"warn", {"require":{"ClassDeclaration":true,"MethodDefinition":true}}]
- // Message: Missing JSDoc comment.
-
- class A extends B {
- /**
- * Description for constructor.
- * @param {object[]} xs - xs
- */
- constructor(xs) {
- this.a = xs;
- }
- }
- // "jsdoc/require-jsdoc": ["error"|"warn", {"require":{"ClassDeclaration":true,"MethodDefinition":true}}]
- // Message: Missing JSDoc comment.
-
- export class A extends B {
- /**
- * Description for constructor.
- * @param {object[]} xs - xs
- */
- constructor(xs) {
- this.a = xs;
- }
- }
- // "jsdoc/require-jsdoc": ["error"|"warn", {"require":{"ClassDeclaration":true,"MethodDefinition":true}}]
- // Message: Missing JSDoc comment.
-
- export default class A extends B {
- /**
- * Description for constructor.
- * @param {object[]} xs - xs
- */
- constructor(xs) {
- this.a = xs;
- }
- }
- // "jsdoc/require-jsdoc": ["error"|"warn", {"require":{"ClassDeclaration":true,"MethodDefinition":true}}]
- // Message: Missing JSDoc comment.
-
- var myFunction = () => {}
- // "jsdoc/require-jsdoc": ["error"|"warn", {"require":{"ArrowFunctionExpression":true}}]
- // Message: Missing JSDoc comment.
-
- var myFunction = () => () => {}
- // "jsdoc/require-jsdoc": ["error"|"warn", {"require":{"ArrowFunctionExpression":true}}]
- // Message: Missing JSDoc comment.
-
- var foo = function() {}
- // "jsdoc/require-jsdoc": ["error"|"warn", {"require":{"FunctionExpression":true}}]
- // Message: Missing JSDoc comment.
-
- const foo = {bar() {}}
- // "jsdoc/require-jsdoc": ["error"|"warn", {"require":{"FunctionExpression":true}}]
- // Message: Missing JSDoc comment.
-
- var foo = {bar: function() {}}
- // "jsdoc/require-jsdoc": ["error"|"warn", {"require":{"FunctionExpression":true}}]
- // Message: Missing JSDoc comment.
-
- function foo (abc) {}
- // "jsdoc/require-jsdoc": ["error"|"warn", {"exemptEmptyFunctions":false}]
- // Message: Missing JSDoc comment.
-
- function foo () {
- return true;
- }
- // "jsdoc/require-jsdoc": ["error"|"warn", {"exemptEmptyFunctions":false}]
- // Message: Missing JSDoc comment.
-
- module.exports = function quux () {
-
- }
- // "jsdoc/require-jsdoc": ["error"|"warn", {"publicOnly":true,"require":{"FunctionExpression":true}}]
- // Message: Missing JSDoc comment.
-
- module.exports = function quux () {
-
- }
- // "jsdoc/require-jsdoc": ["error"|"warn", {"publicOnly":{"ancestorsOnly":true},"require":{"FunctionExpression":true}}]
- // Message: Missing JSDoc comment.
-
- module.exports = {
- method: function() {
-
- }
- }
- // "jsdoc/require-jsdoc": ["error"|"warn", {"publicOnly":true,"require":{"FunctionExpression":true}}]
- // Message: Missing JSDoc comment.
-
- module.exports = {
- test: {
- test2: function() {
-
- }
- }
- }
- // "jsdoc/require-jsdoc": ["error"|"warn", {"publicOnly":true,"require":{"FunctionExpression":true}}]
- // Message: Missing JSDoc comment.
-
- module.exports = {
- test: {
- test2: function() {
-
- }
- }
- }
- // "jsdoc/require-jsdoc": ["error"|"warn", {"publicOnly":{"ancestorsOnly":true},"require":{"FunctionExpression":true}}]
- // Message: Missing JSDoc comment.
-
- const test = module.exports = function () {
-
- }
- // "jsdoc/require-jsdoc": ["error"|"warn", {"publicOnly":true,"require":{"FunctionExpression":true}}]
- // Message: Missing JSDoc comment.
-
- /**
- *
- */
- const test = module.exports = function () {
-
- }
-
- test.prototype.method = function() {}
- // "jsdoc/require-jsdoc": ["error"|"warn", {"publicOnly":true,"require":{"FunctionExpression":true}}]
- // Message: Missing JSDoc comment.
-
- const test = function () {
-
- }
- module.exports = {
- test: test
- }
- // "jsdoc/require-jsdoc": ["error"|"warn", {"publicOnly":true,"require":{"FunctionExpression":true}}]
- // Message: Missing JSDoc comment.
-
- const test = () => {
-
- }
- module.exports = {
- test: test
- }
- // "jsdoc/require-jsdoc": ["error"|"warn", {"publicOnly":true,"require":{"ArrowFunctionExpression":true}}]
- // Message: Missing JSDoc comment.
-
- class Test {
- method() {
-
- }
- }
- module.exports = Test;
- // "jsdoc/require-jsdoc": ["error"|"warn", {"publicOnly":true,"require":{"MethodDefinition":true}}]
- // Message: Missing JSDoc comment.
-
- export default function quux () {
-
- }
- // "jsdoc/require-jsdoc": ["error"|"warn", {"publicOnly":true,"require":{"FunctionExpression":true}}]
- // Message: Missing JSDoc comment.
-
- export default function quux () {
-
- }
- // "jsdoc/require-jsdoc": ["error"|"warn", {"publicOnly":{"ancestorsOnly":true},"require":{"FunctionExpression":true}}]
- // Message: Missing JSDoc comment.
-
- function quux () {
-
- }
- export default quux;
- // "jsdoc/require-jsdoc": ["error"|"warn", {"publicOnly":true,"require":{"FunctionExpression":true}}]
- // Message: Missing JSDoc comment.
-
- export function test() {
-
- }
- // "jsdoc/require-jsdoc": ["error"|"warn", {"publicOnly":true,"require":{"FunctionExpression":true}}]
- // Message: Missing JSDoc comment.
-
- export function test() {
-
- }
- // "jsdoc/require-jsdoc": ["error"|"warn", {"publicOnly":{"ancestorsOnly":true},"require":{"FunctionExpression":true}}]
- // Message: Missing JSDoc comment.
-
- var test = function () {
-
- }
- var test2 = 2;
- export { test, test2 }
- // "jsdoc/require-jsdoc": ["error"|"warn", {"publicOnly":true,"require":{"FunctionExpression":true}}]
- // Message: Missing JSDoc comment.
-
- var test = function () {
-
- }
- export { test as test2 }
- // "jsdoc/require-jsdoc": ["error"|"warn", {"publicOnly":true,"require":{"FunctionExpression":true}}]
- // Message: Missing JSDoc comment.
-
- export default class A {
-
- }
- // "jsdoc/require-jsdoc": ["error"|"warn", {"publicOnly":true,"require":{"ClassDeclaration":true}}]
- // Message: Missing JSDoc comment.
-
- export default class A {
-
- }
- // "jsdoc/require-jsdoc": ["error"|"warn", {"publicOnly":{"ancestorsOnly":true},"require":{"ClassDeclaration":true}}]
- // Message: Missing JSDoc comment.
-
- var test = function () {
-
- }
- // "jsdoc/require-jsdoc": ["error"|"warn", {"publicOnly":{"window":true},"require":{"FunctionExpression":true}}]
- // Message: Missing JSDoc comment.
-
- window.test = function () {
-
- }
- // "jsdoc/require-jsdoc": ["error"|"warn", {"publicOnly":{"window":true},"require":{"FunctionExpression":true}}]
- // Message: Missing JSDoc comment.
-
- function test () {
-
- }
- // "jsdoc/require-jsdoc": ["error"|"warn", {"publicOnly":{"window":true}}]
- // Message: Missing JSDoc comment.
-
- module.exports = function() {
-
- }
- // "jsdoc/require-jsdoc": ["error"|"warn", {"publicOnly":{"cjs":true,"esm":false,"window":false},"require":{"FunctionExpression":true}}]
- // Message: Missing JSDoc comment.
-
- export function someMethod() {
-
- }
- // "jsdoc/require-jsdoc": ["error"|"warn", {"publicOnly":{"cjs":false,"esm":true,"window":false},"require":{"FunctionDeclaration":true}}]
- // Message: Missing JSDoc comment.
-
- export function someMethod() {
-
- }
- // "jsdoc/require-jsdoc": ["error"|"warn", {"publicOnly":{"cjs":false,"esm":true,"window":false},"require":{"FunctionDeclaration":true}}]
- // Message: Missing JSDoc comment.
-
- const myObject = {
- myProp: true
- };
- // "jsdoc/require-jsdoc": ["error"|"warn", {"contexts":["Property"]}]
- // Message: Missing JSDoc comment.
-
- /**
- * Foo interface documentation.
- */
- export interface Foo extends Bar {
- /**
- * baz method documentation.
- */
- baz(): void;
-
- meow(): void;
- }
- // "jsdoc/require-jsdoc": ["error"|"warn", {"contexts":["TSMethodSignature"]}]
- // Message: Missing JSDoc comment.
-
- class MyClass {
- someProperty: boolean; // Flow type annotation.
- }
- // "jsdoc/require-jsdoc": ["error"|"warn", {"exemptEmptyFunctions":true,"require":{"ClassDeclaration":true}}]
- // Message: Missing JSDoc comment.
-
- export default class Test {
- constructor(a) {
- this.a = a;
- }
- }
- // "jsdoc/require-jsdoc": ["error"|"warn", {"publicOnly":true,"require":{"ArrowFunctionExpression":false,"ClassDeclaration":false,"ClassExpression":false,"FunctionDeclaration":false,"FunctionExpression":false,"MethodDefinition":true}}]
- // Message: Missing JSDoc comment.
-
- export default class Test {
- constructor(a) {
- this.a = a;
- }
- private abc(a) {
- this.a = a;
- }
- }
- // "jsdoc/require-jsdoc": ["error"|"warn", {"contexts":["MethodDefinition:not([accessibility=\"private\"]) > FunctionExpression"],"publicOnly":true,"require":{"ArrowFunctionExpression":false,"ClassDeclaration":false,"ClassExpression":false,"FunctionDeclaration":false,"FunctionExpression":false,"MethodDefinition":false}}]
- // Message: Missing JSDoc comment.
-
- e = function () {
- };
- // "jsdoc/require-jsdoc": ["error"|"warn", {"require":{"FunctionDeclaration":false,"FunctionExpression":true}}]
- // Message: Missing JSDoc comment.
-
- /**
- *
- */
- export class Class {
- test = 1;
-
- foo() {
- this.test = 2;
- }
- }
- // "jsdoc/require-jsdoc": ["error"|"warn", {"require":{"FunctionDeclaration":false,"MethodDefinition":true}}]
- // Message: Missing JSDoc comment.
-
- class Dog {
- eat() {
-
- }
- }
- // "jsdoc/require-jsdoc": ["error"|"warn", {"require":{"FunctionDeclaration":false,"MethodDefinition":true}}]
- // Message: Missing JSDoc comment.
-
- const hello = name => {
- document.body.textContent = "Hello, " + name + "!";
- };
- // "jsdoc/require-jsdoc": ["error"|"warn", {"require":{"ArrowFunctionExpression":true,"FunctionDeclaration":false}}]
- // Message: Missing JSDoc comment.
-
- export const loginSuccessAction = (): BaseActionPayload => ({ type: LOGIN_SUCCESSFUL });
- // "jsdoc/require-jsdoc": ["error"|"warn", {"require":{"ArrowFunctionExpression":true,"FunctionDeclaration":false}}]
- // Message: Missing JSDoc comment.
-
- export type Container = {
- constants?: ObjByString;
- enums?: { [key in string]: TypescriptEnum };
- helpers?: { [key in string]: AnyFunction };
- };
- // "jsdoc/require-jsdoc": ["error"|"warn", {"contexts":["TSTypeAliasDeclaration",{"context":"TSPropertySignature","inlineCommentBlock":true}]}]
- // Message: Missing JSDoc comment.
-
- class Foo {
- constructor() {}
-
- bar() {}
- }
- // "jsdoc/require-jsdoc": ["error"|"warn", {"contexts":["MethodDefinition[key.name!=\"constructor\"]"],"require":{"ClassDeclaration":true}}]
- // Message: Missing JSDoc comment.
-
- class Example extends React.PureComponent {
- componentDidMount() {}
-
- render() {}
-
- someOtherMethod () {}
- }
- // "jsdoc/require-jsdoc": ["error"|"warn", {"contexts":["MethodDefinition:not([key.name=\"componentDidMount\"]):not([key.name=\"render\"])"],"require":{"ClassDeclaration":true}}]
- // Message: Missing JSDoc comment.
-
- function foo(arg: boolean): boolean {
- return arg;
- }
-
- function bar(arg: true): true;
- function bar(arg: false): false;
- function bar(arg: boolean): boolean {
- return arg;
- }
- // "jsdoc/require-jsdoc": ["error"|"warn", {"contexts":["TSDeclareFunction:not(TSDeclareFunction + TSDeclareFunction)","FunctionDeclaration:not(TSDeclareFunction + FunctionDeclaration)"],"require":{"FunctionDeclaration":false}}]
- // Message: Missing JSDoc comment.
-
- export function foo(arg: boolean): boolean {
- return arg;
- }
-
- export function bar(arg: true): true;
- export function bar(arg: false): false;
- export function bar(arg: boolean): boolean {
- return arg;
- }
- // "jsdoc/require-jsdoc": ["error"|"warn", {"contexts":["ExportNamedDeclaration[declaration.type=\"TSDeclareFunction\"]:not(ExportNamedDeclaration[declaration.type=\"TSDeclareFunction\"] + ExportNamedDeclaration[declaration.type=\"TSDeclareFunction\"])","ExportNamedDeclaration[declaration.type=\"FunctionDeclaration\"]:not(ExportNamedDeclaration[declaration.type=\"TSDeclareFunction\"] + ExportNamedDeclaration[declaration.type=\"FunctionDeclaration\"])"],"require":{"FunctionDeclaration":false}}]
- // Message: Missing JSDoc comment.
-
- module.exports.foo = (bar) => {
- return bar + "biz"
- }
- // "jsdoc/require-jsdoc": ["error"|"warn", {"publicOnly":false,"require":{"ArrowFunctionExpression":true,"FunctionDeclaration":true,"FunctionExpression":true,"MethodDefinition":true}}]
- // Message: Missing JSDoc comment.
-
- class Animal {
-
- #name: string;
-
- private species: string;
-
- public color: string;
-
- @SomeAnnotation('optionalParameter')
- tail: boolean;
- }
- // "jsdoc/require-jsdoc": ["error"|"warn", {"contexts":["ClassProperty"]}]
- // Message: Missing JSDoc comment.
-
- @Entity('users')
- export class User {}
- // "jsdoc/require-jsdoc": ["error"|"warn", {"require":{"ClassDeclaration":true}}]
- // Message: Missing JSDoc comment.
-
- /**
- *
- */
- class Foo {
- constructor() {}
- }
- // "jsdoc/require-jsdoc": ["error"|"warn", {"exemptEmptyConstructors":false,"require":{"MethodDefinition":true}}]
- // Message: Missing JSDoc comment.
-
- /**
- *
- */
- class Foo {
- constructor(notEmpty) {}
- }
- // "jsdoc/require-jsdoc": ["error"|"warn", {"exemptEmptyConstructors":true,"require":{"MethodDefinition":true}}]
- // Message: Missing JSDoc comment.
-
- /**
- *
- */
- class Foo {
- constructor() {
- const notEmpty = true;
- return notEmpty;
- }
- }
- // "jsdoc/require-jsdoc": ["error"|"warn", {"exemptEmptyConstructors":true,"require":{"MethodDefinition":true}}]
- // Message: Missing JSDoc comment.
-
- /**
- *
- */
- function quux() {
-
- }
- // Settings: {"jsdoc":{"structuredTags":{"see":{"name":false,"required":["name"]}}}}
- // Message: Cannot add "name" to `require` with the tag's `name` set to `false`
-
- class Test {
- aFunc() {}
- }
- // "jsdoc/require-jsdoc": ["error"|"warn", {"checkConstructors":false,"require":{"ArrowFunctionExpression":true,"ClassDeclaration":false,"ClassExpression":true,"FunctionDeclaration":true,"FunctionExpression":true,"MethodDefinition":true}}]
- // Message: Missing JSDoc comment.
-
- class Test {
- aFunc = () => {}
- anotherFunc() {}
- }
- // "jsdoc/require-jsdoc": ["error"|"warn", {"require":{"ArrowFunctionExpression":true,"ClassDeclaration":false,"ClassExpression":true,"FunctionDeclaration":true,"FunctionExpression":true,"MethodDefinition":true}}]
- // Message: Missing JSDoc comment.
-
- export enum testEnum {
- A, B
- }
- // "jsdoc/require-jsdoc": ["error"|"warn", {"contexts":["TSEnumDeclaration"],"publicOnly":true}]
- // Message: Missing JSDoc comment.
-
- export interface Test {
- aFunc: () => void;
- aVar: string;
- }
- // "jsdoc/require-jsdoc": ["error"|"warn", {"contexts":["TSInterfaceDeclaration"],"publicOnly":true}]
- // Message: Missing JSDoc comment.
-
- export type testType = string | number;
- // "jsdoc/require-jsdoc": ["error"|"warn", {"contexts":["TSTypeAliasDeclaration"],"publicOnly":true}]
- // Message: Missing JSDoc comment.
-
- export interface Foo {
- bar: number;
- baz: string;
- quux(): void;
- }
- // "jsdoc/require-jsdoc": ["error"|"warn", {"contexts":["TSPropertySignature","TSMethodSignature"],"publicOnly":true}]
- // Message: Missing JSDoc comment.
-
- export class MyComponentComponent {
- @Output()
- public changed = new EventEmitter();
-
- public test = 'test';
-
- @Input()
- public value = new EventEmitter();
- }
- // "jsdoc/require-jsdoc": ["error"|"warn", {"contexts":["ClassProperty:has(Decorator[expression.callee.name=\"Input\"])"]}]
- // Message: Missing JSDoc comment.
-
- requestAnimationFrame(draw)
-
- function bench() {
- }
- // Message: Missing JSDoc comment.
-
- class Foo {
- set aName (val) {}
- }
- // "jsdoc/require-jsdoc": ["error"|"warn", {"checkSetters":"no-getter","contexts":["MethodDefinition > FunctionExpression"]}]
- // Message: Missing JSDoc comment.
-
- class Foo {
- get aName () {}
- }
- // "jsdoc/require-jsdoc": ["error"|"warn", {"checkGetters":"no-setter","contexts":["MethodDefinition > FunctionExpression"]}]
- // Message: Missing JSDoc comment.
-
- const obj = {
- get aName () {},
- }
- // "jsdoc/require-jsdoc": ["error"|"warn", {"checkGetters":"no-setter","contexts":["Property > FunctionExpression"]}]
- // Message: Missing JSDoc comment.
-
- function comment () {
- return "comment";
- }
- // "jsdoc/require-jsdoc": ["error"|"warn", {"enableFixer":true,"fixerMessage":" TODO: add comment"}]
- // Message: Missing JSDoc comment.
-
- function comment () {
- return "comment";
- }
- // "jsdoc/require-jsdoc": ["error"|"warn", {"contexts":["any",{"context":"FunctionDeclaration","inlineCommentBlock":true}],"fixerMessage":"TODO: add comment "}]
- // Message: Missing JSDoc comment.
-
- function comment () {
- return "comment";
- }
- // "jsdoc/require-jsdoc": ["error"|"warn", {"enableFixer":false,"fixerMessage":" TODO: add comment"}]
- // Message: Missing JSDoc comment.
- ````
-
- The following patterns are not considered problems:
-
- ````js
- interface FooBar {
- fooBar: string;
- }
- // "jsdoc/require-jsdoc": ["error"|"warn", {"contexts":["TSInterfaceDeclaration","TSMethodSignature","TSPropertySignature"],"publicOnly":{"ancestorsOnly":true}}]
-
- /** This is comment */
- interface FooBar {
- fooBar: string;
- }
- // "jsdoc/require-jsdoc": ["error"|"warn", {"contexts":["TSInterfaceDeclaration","TSMethodSignature","TSPropertySignature"],"publicOnly":{"ancestorsOnly":true}}]
-
- /** This is comment */
- export class Foo {
- someMethod() {
- interface FooBar {
- fooBar: string;
- }
- }
- }
- // "jsdoc/require-jsdoc": ["error"|"warn", {"contexts":["TSInterfaceDeclaration","TSMethodSignature","TSPropertySignature"],"publicOnly":{"ancestorsOnly":true}}]
-
- /** This is comment */
- function someFunciton() {
- interface FooBar {
- fooBar: string;
- }
- }
- // "jsdoc/require-jsdoc": ["error"|"warn", {"contexts":["TSInterfaceDeclaration","TSMethodSignature","TSPropertySignature"],"publicOnly":{"ancestorsOnly":true}}]
-
- /** This is comment */
- export function foo() {
- interface bar {
- fooBar: string;
- }
- }
- // "jsdoc/require-jsdoc": ["error"|"warn", {"contexts":["TSInterfaceDeclaration","TSMethodSignature","TSPropertySignature"],"publicOnly":{"ancestorsOnly":true}}]
-
- /**
- *
- */
-
- var array = [1,2,3];
- array.forEach(function() {});
-
- /**
- * @class MyClass
- **/
- function MyClass() {}
-
- /**
- Function doing something
- */
- function myFunction() {}
- /**
- Function doing something
- */
- var myFunction = function() {};
- /**
- Function doing something
- */
- Object.myFunction = function () {};
- var obj = {
- /**
- * Function doing something
- **/
- myFunction: function () {} };
-
- /**
- @func myFunction
- */
- function myFunction() {}
- /**
- @method myFunction
- */
- function myFunction() {}
- /**
- @function myFunction
- */
- function myFunction() {}
-
- /**
- @func myFunction
- */
- var myFunction = function () {}
- /**
- @method myFunction
- */
- var myFunction = function () {}
- /**
- @function myFunction
- */
- var myFunction = function () {}
-
- /**
- @func myFunction
- */
- Object.myFunction = function() {}
- /**
- @method myFunction
- */
- Object.myFunction = function() {}
- /**
- @function myFunction
- */
- Object.myFunction = function() {}
- (function(){})();
-
- var object = {
- /**
- * @func myFunction - Some function
- */
- myFunction: function() {} }
- var object = {
- /**
- * @method myFunction - Some function
- */
- myFunction: function() {} }
- var object = {
- /**
- * @function myFunction - Some function
- */
- myFunction: function() {} }
-
- var array = [1,2,3];
- array.filter(function() {});
- Object.keys(this.options.rules || {}).forEach(function(name) {}.bind(this));
- var object = { name: 'key'};
- Object.keys(object).forEach(function() {})
-
- /**
- * @func myFunction
- */
-
- function myFunction() {
-
- }
- // Settings: {"jsdoc":{"maxLines":2,"minLines":0}}
-
- /**
- * @func myFunction
- */
-
-
- function myFunction() {
-
- }
- // Settings: {"jsdoc":{"maxLines":3,"minLines":0}}
-
- /** @func myFunction */ function myFunction() {
-
- }
- // Settings: {"jsdoc":{"maxLines":0,"minLines":0}}
-
- /**
- * @func myFunction
- */
-
- function myFunction() {
-
- }
- // Settings: {"jsdoc":{"maxLines":3,"minLines":2}}
-
- function myFunction() {}
- // "jsdoc/require-jsdoc": ["error"|"warn", {"require":{"ClassDeclaration":true,"FunctionDeclaration":false,"MethodDefinition":true}}]
-
- var myFunction = function() {}
- // "jsdoc/require-jsdoc": ["error"|"warn", {"require":{"ClassDeclaration":true,"FunctionDeclaration":false,"MethodDefinition":true}}]
-
- /**
- * Description for A.
- */
- class A {
- /**
- * Description for constructor.
- * @param {object[]} xs - xs
- */
- constructor(xs) {
- this.a = xs;
- }
- }
- // "jsdoc/require-jsdoc": ["error"|"warn", {"require":{"ClassDeclaration":true,"MethodDefinition":true}}]
-
- /**
- * Description for A.
- */
- class App extends Component {
- /**
- * Description for constructor.
- * @param {object[]} xs - xs
- */
- constructor(xs) {
- this.a = xs;
- }
- }
- // "jsdoc/require-jsdoc": ["error"|"warn", {"require":{"ClassDeclaration":true,"MethodDefinition":true}}]
-
- /**
- * Description for A.
- */
- export default class App extends Component {
- /**
- * Description for constructor.
- * @param {object[]} xs - xs
- */
- constructor(xs) {
- this.a = xs;
- }
- }
- // "jsdoc/require-jsdoc": ["error"|"warn", {"require":{"ClassDeclaration":true,"MethodDefinition":true}}]
-
- /**
- * Description for A.
- */
- export class App extends Component {
- /**
- * Description for constructor.
- * @param {object[]} xs - xs
- */
- constructor(xs) {
- this.a = xs;
- }
- }
- // "jsdoc/require-jsdoc": ["error"|"warn", {"require":{"ClassDeclaration":true,"MethodDefinition":true}}]
-
- class A {
- constructor(xs) {
- this.a = xs;
- }
- }
- // "jsdoc/require-jsdoc": ["error"|"warn", {"require":{"ClassDeclaration":false,"MethodDefinition":false}}]
-
- /**
- * Function doing something
- */
- var myFunction = () => {}
- // "jsdoc/require-jsdoc": ["error"|"warn", {"require":{"ArrowFunctionExpression":true}}]
-
- /**
- * Function doing something
- */
- var myFunction = function () {}
- // "jsdoc/require-jsdoc": ["error"|"warn", {"require":{"ArrowFunctionExpression":true}}]
-
- /**
- * Function doing something
- */
- var myFunction = () => {}
- // "jsdoc/require-jsdoc": ["error"|"warn", {"require":{"ArrowFunctionExpression":false}}]
-
- /**
- Function doing something
- */
- var myFunction = () => () => {}
- // "jsdoc/require-jsdoc": ["error"|"warn", {"require":{"ArrowFunctionExpression":true}}]
-
- setTimeout(() => {}, 10);
- // "jsdoc/require-jsdoc": ["error"|"warn", {"require":{"ArrowFunctionExpression":true}}]
-
- /**
- JSDoc Block
- */
- var foo = function() {}
- // "jsdoc/require-jsdoc": ["error"|"warn", {"require":{"FunctionExpression":true}}]
-
- const foo = {/**
- JSDoc Block
- */
- bar() {}}
- // "jsdoc/require-jsdoc": ["error"|"warn", {"require":{"FunctionExpression":true}}]
-
- var foo = {/**
- JSDoc Block
- */
- bar: function() {}}
- // "jsdoc/require-jsdoc": ["error"|"warn", {"require":{"FunctionExpression":true}}]
-
- var foo = { [function() {}]: 1 };
- // "jsdoc/require-jsdoc": ["error"|"warn", {"require":{"FunctionExpression":true}}]
-
- function foo () {}
- // "jsdoc/require-jsdoc": ["error"|"warn", {"exemptEmptyFunctions":true}]
-
- function foo () {
- return;
- }
- // "jsdoc/require-jsdoc": ["error"|"warn", {"exemptEmptyFunctions":true}]
-
- const test = {};
- /**
- * test
- */
- test.method = function () {
-
- }
- module.exports = {
- prop: { prop2: test.method }
- }
- // "jsdoc/require-jsdoc": ["error"|"warn", {"publicOnly":true,"require":{"FunctionExpression":true}}]
-
- /**
- *
- */
- function test() {
-
- }
-
- module.exports = {
- prop: { prop2: test }
- }
- // "jsdoc/require-jsdoc": ["error"|"warn", {"publicOnly":true,"require":{"FunctionExpression":true}}]
-
- /**
- *
- */
- test = function() {
-
- }
-
- module.exports = {
- prop: { prop2: test }
- }
- // "jsdoc/require-jsdoc": ["error"|"warn", {"publicOnly":{"cjs":true,"esm":false,"window":false},"require":{"FunctionExpression":true}}]
-
- /**
- *
- */
- test = function() {
-
- }
-
- exports.someMethod = {
- prop: { prop2: test }
- }
- // "jsdoc/require-jsdoc": ["error"|"warn", {"publicOnly":{"cjs":false,"esm":true,"window":false},"require":{"FunctionExpression":true}}]
-
- /**
- *
- */
- const test = () => {
-
- }
-
- module.exports = {
- prop: { prop2: test }
- }
- // "jsdoc/require-jsdoc": ["error"|"warn", {"publicOnly":true,"require":{"ArrowFunctionExpression":true}}]
-
- const test = () => {
-
- }
- module.exports = {
- prop: { prop2: test }
- }
- // "jsdoc/require-jsdoc": ["error"|"warn", {"publicOnly":{"ancestorsOnly":true},"require":{"ArrowFunctionExpression":true}}]
-
- /**
- *
- */
- window.test = function() {
-
- }
-
- module.exports = {
- prop: window
- }
- // "jsdoc/require-jsdoc": ["error"|"warn", {"publicOnly":true,"require":{"FunctionExpression":true}}]
-
- test = function() {
-
- }
-
- /**
- *
- */
- test = function() {
-
- }
-
- module.exports = {
- prop: { prop2: test }
- }
- // "jsdoc/require-jsdoc": ["error"|"warn", {"publicOnly":true,"require":{"FunctionExpression":true}}]
-
- test = function() {
-
- }
-
- test = 2;
-
- module.exports = {
- prop: { prop2: test }
- }
- // "jsdoc/require-jsdoc": ["error"|"warn", {"publicOnly":true,"require":{"FunctionExpression":true}}]
-
- /**
- *
- */
- function test() {
-
- }
-
- /**
- *
- */
- test.prototype.method = function() {
-
- }
-
- module.exports = {
- prop: { prop2: test }
- }
- // "jsdoc/require-jsdoc": ["error"|"warn", {"publicOnly":true,"require":{"FunctionExpression":true}}]
-
- class Test {
- /**
- * Test
- */
- method() {
-
- }
- }
- module.exports = Test;
- // "jsdoc/require-jsdoc": ["error"|"warn", {"publicOnly":true,"require":{"MethodDefinition":true}}]
-
- /**
- *
- */
- export default function quux () {
-
- }
- // "jsdoc/require-jsdoc": ["error"|"warn", {"publicOnly":true,"require":{"FunctionExpression":true}}]
-
- /**
- *
- */
- export default function quux () {
-
- }
- // "jsdoc/require-jsdoc": ["error"|"warn", {"publicOnly":{"ancestorsOnly":true},"require":{"FunctionExpression":true}}]
-
- /**
- *
- */
- function quux () {
-
- }
- export default quux;
- // "jsdoc/require-jsdoc": ["error"|"warn", {"publicOnly":true,"require":{"FunctionExpression":true}}]
-
- function quux () {
-
- }
- export default quux;
- // "jsdoc/require-jsdoc": ["error"|"warn", {"publicOnly":{"ancestorsOnly":true},"require":{"FunctionExpression":true}}]
-
- /**
- *
- */
- export function test() {
-
- }
- // "jsdoc/require-jsdoc": ["error"|"warn", {"publicOnly":true,"require":{"FunctionExpression":true}}]
-
- /**
- *
- */
- export function test() {
-
- }
- // "jsdoc/require-jsdoc": ["error"|"warn", {"publicOnly":{"ancestorsOnly":true},"require":{"FunctionExpression":true}}]
-
- /**
- *
- */
- var test = function () {
-
- }
- var test2 = 2;
- export { test, test2 }
- // "jsdoc/require-jsdoc": ["error"|"warn", {"publicOnly":true,"require":{"FunctionExpression":true}}]
-
- /**
- *
- */
- var test = function () {
-
- }
- export { test as test2 }
- // "jsdoc/require-jsdoc": ["error"|"warn", {"publicOnly":true,"require":{"FunctionExpression":true}}]
-
- /**
- *
- */
- export default class A {
-
- }
- // "jsdoc/require-jsdoc": ["error"|"warn", {"publicOnly":{"ancestorsOnly":true},"require":{"ClassDeclaration":true}}]
-
- /**
- *
- */
- var test = function () {
-
- }
- // "jsdoc/require-jsdoc": ["error"|"warn", {"publicOnly":{"window":true},"require":{"FunctionExpression":true}}]
-
- let test = function () {
-
- }
- // "jsdoc/require-jsdoc": ["error"|"warn", {"publicOnly":{"window":true},"require":{"FunctionExpression":true}}]
-
- let test = class {
-
- }
- // "jsdoc/require-jsdoc": ["error"|"warn", {"publicOnly":true,"require":{"ClassExpression":false}}]
-
- /**
- *
- */
- let test = class {
-
- }
- // "jsdoc/require-jsdoc": ["error"|"warn", {"publicOnly":true,"require":{"ClassExpression":true}}]
-
- export function someMethod() {
-
- }
- // "jsdoc/require-jsdoc": ["error"|"warn", {"publicOnly":{"cjs":true,"esm":false,"window":false},"require":{"FunctionDeclaration":true}}]
-
- export function someMethod() {
-
- }
- // "jsdoc/require-jsdoc": ["error"|"warn", {"publicOnly":{"cjs":true,"esm":false,"window":false},"require":{"FunctionDeclaration":true}}]
-
- exports.someMethod = function() {
-
- }
- // "jsdoc/require-jsdoc": ["error"|"warn", {"publicOnly":{"cjs":false,"esm":true,"window":false},"require":{"FunctionExpression":true}}]
-
- const myObject = {
- myProp: true
- };
- // "jsdoc/require-jsdoc": ["error"|"warn", {"contexts":[]}]
-
- function bear() {}
- /**
- *
- */
- function quux () {
- }
- export default quux;
- // "jsdoc/require-jsdoc": ["error"|"warn", {"publicOnly":true,"require":{"FunctionExpression":true}}]
-
- /**
- * This example interface is great!
- */
- export interface Example {
- /**
- * My super test string!
- */
- test: string
- }
- // "jsdoc/require-jsdoc": ["error"|"warn", {"contexts":["TSInterfaceDeclaration"]}]
-
- /**
- * This example interface is great!
- */
- interface Example {
- /**
- * My super test string!
- */
- test: string
- }
- // "jsdoc/require-jsdoc": ["error"|"warn", {"contexts":["TSInterfaceDeclaration"]}]
-
- /**
- * This example type is great!
- */
- export type Example = {
- /**
- * My super test string!
- */
- test: string
- };
- // "jsdoc/require-jsdoc": ["error"|"warn", {"contexts":["TSTypeAliasDeclaration"]}]
-
- /**
- * This example type is great!
- */
- type Example = {
- /**
- * My super test string!
- */
- test: string
- };
- // "jsdoc/require-jsdoc": ["error"|"warn", {"contexts":["TSTypeAliasDeclaration"]}]
-
- /**
- * This example enum is great!
- */
- export enum Example {
- /**
- * My super test enum!
- */
- test = 123
- }
- // "jsdoc/require-jsdoc": ["error"|"warn", {"contexts":["TSEnumDeclaration"]}]
-
- /**
- * This example enum is great!
- */
- enum Example {
- /**
- * My super test enum!
- */
- test = 123
- }
- // "jsdoc/require-jsdoc": ["error"|"warn", {"contexts":["TSEnumDeclaration"]}]
-
- const foo = {...{}};
- function bar() {}
- // "jsdoc/require-jsdoc": ["error"|"warn", {"exemptEmptyFunctions":false,"publicOnly":true,"require":{"ArrowFunctionExpression":true,"ClassDeclaration":true,"ClassExpression":true,"FunctionDeclaration":true,"FunctionExpression":false,"MethodDefinition":true}}]
-
- /**
- * Class documentation
- */
- @logged
- export default class Foo {
- // ....
- }
- // "jsdoc/require-jsdoc": ["error"|"warn", {"exemptEmptyFunctions":false,"require":{"ClassDeclaration":true}}]
-
- const a = {};
- const b = {
- ...a
- };
-
- export default b;
- // "jsdoc/require-jsdoc": ["error"|"warn", {"contexts":["ObjectExpression"],"exemptEmptyFunctions":false,"publicOnly":true}]
-
- /**
- * Foo interface documentation.
- */
- export interface Foo extends Bar {
- /**
- * baz method documentation.
- */
- baz(): void;
-
- /**
- * meow method documentation.
- */
- meow(): void;
- }
- // "jsdoc/require-jsdoc": ["error"|"warn", {"contexts":["TSMethodSignature"]}]
-
- export default class Test {
- private abc(a) {
- this.a = a;
- }
- }
- // "jsdoc/require-jsdoc": ["error"|"warn", {"contexts":["MethodDefinition:not([accessibility=\"private\"]) > FunctionExpression"],"publicOnly":true,"require":{"ArrowFunctionExpression":false,"ClassDeclaration":false,"ClassExpression":false,"FunctionDeclaration":false,"FunctionExpression":false,"MethodDefinition":false}}]
-
- /**
- * Basic application controller.
- */
- @Controller()
- export class AppController {
- /**
- * Returns the application information.
- *
- * @returns ...
- */
- @Get('/info')
- public getInfo(): string {
- return 'OK';
- }
- }
- // "jsdoc/require-jsdoc": ["error"|"warn", {"require":{"ArrowFunctionExpression":false,"ClassDeclaration":true,"ClassExpression":true,"FunctionDeclaration":true,"FunctionExpression":false,"MethodDefinition":true}}]
-
- /**
- * Entity to represent a user in the system.
- */
- @Entity('users')
- export class User {
- }
- // "jsdoc/require-jsdoc": ["error"|"warn", {"require":{"ArrowFunctionExpression":false,"ClassDeclaration":true,"ClassExpression":true,"FunctionDeclaration":true,"FunctionExpression":false,"MethodDefinition":true}}]
-
- /**
- * Entity to represent a user in the system.
- */
- @Entity('users', getVal())
- export class User {
- }
- // "jsdoc/require-jsdoc": ["error"|"warn", {"require":{"ArrowFunctionExpression":false,"ClassDeclaration":true,"ClassExpression":true,"FunctionDeclaration":true,"FunctionExpression":false,"MethodDefinition":true}}]
-
- /**
- *
- */
- class Foo {
- constructor() {}
- }
- // "jsdoc/require-jsdoc": ["error"|"warn", {"exemptEmptyConstructors":true,"require":{"MethodDefinition":true}}]
-
- /**
- *
- */
- class Foo {
- constructor() {}
- }
- // "jsdoc/require-jsdoc": ["error"|"warn", {"checkConstructors":false,"require":{"MethodDefinition":true}}]
-
- class Foo {
- get aName () {}
- set aName (val) {}
- }
- // "jsdoc/require-jsdoc": ["error"|"warn", {"checkGetters":"no-setter","checkSetters":false,"contexts":["MethodDefinition > FunctionExpression"]}]
-
- const obj = {
- get aName () {},
- set aName (val) {}
- }
- // "jsdoc/require-jsdoc": ["error"|"warn", {"checkGetters":"no-setter","checkSetters":false,"contexts":["Property > FunctionExpression"]}]
-
- class Foo {
- set aName (val) {}
- }
- // "jsdoc/require-jsdoc": ["error"|"warn", {"checkSetters":false,"contexts":["MethodDefinition > FunctionExpression"]}]
-
- class Foo {
- get aName () {}
- }
- // "jsdoc/require-jsdoc": ["error"|"warn", {"checkGetters":false,"contexts":["MethodDefinition > FunctionExpression"]}]
-
- class Foo {
- /**
- *
- */
- set aName (val) {}
- }
- // "jsdoc/require-jsdoc": ["error"|"warn", {"checkSetters":"no-getter","contexts":["MethodDefinition > FunctionExpression"]}]
-
- class Foo {
- /**
- *
- */
- get aName () {}
- }
- // "jsdoc/require-jsdoc": ["error"|"warn", {"checkGetters":"no-setter","contexts":["MethodDefinition > FunctionExpression"]}]
-
- class Foo {
- get aName () {}
- set aName (val) {}
- }
- // "jsdoc/require-jsdoc": ["error"|"warn", {"checkGetters":false,"checkSetters":"no-getter","contexts":["MethodDefinition > FunctionExpression"]}]
-
- class Base {
- constructor() {
- }
- }
- // "jsdoc/require-jsdoc": ["error"|"warn", {"contexts":["MethodDefinition"],"exemptEmptyConstructors":true}]
-
- /**
- * This is a text.
- */
- export function a(); // Reports an error
- // "jsdoc/require-jsdoc": ["error"|"warn", {"contexts":["TSDeclareFunction"],"require":{"FunctionDeclaration":true}}]
-
- /**
- * Foo
- */
- export function foo(): void {
- function bar(): void {
- console.log('bar');
- }
-
- console.log('foo');
- }
- // "jsdoc/require-jsdoc": ["error"|"warn", {"publicOnly":true}]
-
- const foo = {
- bar: () => {
- // ...
- }
- }
- // "jsdoc/require-jsdoc": ["error"|"warn", {"contexts":[":not(Property) > ArrowFunctionExpression"],"require":{"ArrowFunctionExpression":false,"ClassDeclaration":true,"ClassExpression":true}}]
-
- /** Defines the current user's settings. */
- @Injectable({
- providedIn: 'root',
- })
- @State<Partial<UserSettingsStateModel>>
- ({
- name: 'userSettings',
- defaults: {
- isDev: !environment.production,
- },
- })
- export class UserSettingsState { }
- // "jsdoc/require-jsdoc": ["error"|"warn", {"require":{"ClassDeclaration":true}}]
-
- /**
- * Entity to represent a user in the system.
- */
- @Entity('users')
- export class User {
- }
- // "jsdoc/require-jsdoc": ["error"|"warn", {"contexts":["Decorator"],"require":{"FunctionDeclaration":false}}]
- ````
-
-
- <a name="eslint-plugin-jsdoc-rules-require-param-description"></a>
- ### <code>require-param-description</code>
-
- Requires that each `@param` tag has a `description` value.
-
- <a name="eslint-plugin-jsdoc-rules-require-param-description-options-29"></a>
- #### Options
-
- <a name="eslint-plugin-jsdoc-rules-require-param-description-options-29-contexts-8"></a>
- ##### <code>contexts</code>
-
- Set this to an array of strings representing the AST context (or an object with
- `context` and `comment` properties) where you wish the rule to be applied.
- Overrides the default contexts (see below). Set to `"any"` if you want
- the rule to apply to any jsdoc block throughout your files (as is necessary
- for finding function blocks not attached to a function declaration or
- expression, i.e., `@callback` or `@function` (or its aliases `@func` or
- `@method`) (including those associated with an `@interface`).
-
- See the ["AST and Selectors"](#eslint-plugin-jsdoc-advanced-ast-and-selectors)
- section of our README for more on the expected format.
-
- |||
- |---|---|
- |Context|`ArrowFunctionExpression`, `FunctionDeclaration`, `FunctionExpression`; others when `contexts` option enabled|
- |Tags|`param`|
- |Aliases|`arg`, `argument`|
- |Recommended|true|
- |Options|`contexts`|
-
- The following patterns are considered problems:
-
- ````js
- /**
- * @param foo
- */
- function quux (foo) {
-
- }
- // Message: Missing JSDoc @param "foo" description.
-
- /**
- * @param foo
- */
- function quux (foo) {
-
- }
- // "jsdoc/require-param-description": ["error"|"warn", {"contexts":["any"]}]
- // Message: Missing JSDoc @param "foo" description.
-
- /**
- * @function
- * @param foo
- */
- // "jsdoc/require-param-description": ["error"|"warn", {"contexts":["any"]}]
- // Message: Missing JSDoc @param "foo" description.
-
- /**
- * @callback
- * @param foo
- */
- // "jsdoc/require-param-description": ["error"|"warn", {"contexts":["any"]}]
- // Message: Missing JSDoc @param "foo" description.
-
- /**
- * @arg foo
- */
- function quux (foo) {
-
- }
- // Settings: {"jsdoc":{"tagNamePreference":{"param":"arg"}}}
- // Message: Missing JSDoc @arg "foo" description.
-
- /**
- * @param foo
- */
- function quux (foo) {
-
- }
- // Settings: {"jsdoc":{"tagNamePreference":{"param":false}}}
- // Message: Unexpected tag `@param`
- ````
-
- The following patterns are not considered problems:
-
- ````js
- /**
- *
- */
- function quux (foo) {
-
- }
-
- /**
- * @param foo Foo.
- */
- function quux (foo) {
-
- }
-
- /**
- * @param foo Foo.
- */
- function quux (foo) {
-
- }
- // "jsdoc/require-param-description": ["error"|"warn", {"contexts":["any"]}]
-
- /**
- * @function
- * @param foo
- */
-
- /**
- * @callback
- * @param foo
- */
- ````
-
-
- <a name="eslint-plugin-jsdoc-rules-require-param-name"></a>
- ### <code>require-param-name</code>
-
- Requires that all function parameters have names.
-
- > The `@param` tag requires you to specify the name of the parameter you are documenting. You can also include the parameter's type, enclosed in curly brackets, and a description of the parameter.
- >
- > [JSDoc](https://jsdoc.app/tags-param.html#overview)
-
- <a name="eslint-plugin-jsdoc-rules-require-param-name-options-30"></a>
- #### Options
-
- <a name="eslint-plugin-jsdoc-rules-require-param-name-options-30-contexts-9"></a>
- ##### <code>contexts</code>
-
- Set this to an array of strings representing the AST context (or an object with
- `context` and `comment` properties) where you wish the rule to be applied.
- Overrides the default contexts (see below). Set to `"any"` if you want
- the rule to apply to any jsdoc block throughout your files (as is necessary
- for finding function blocks not attached to a function declaration or
- expression, i.e., `@callback` or `@function` (or its aliases `@func` or
- `@method`) (including those associated with an `@interface`).
-
- See the ["AST and Selectors"](#eslint-plugin-jsdoc-advanced-ast-and-selectors)
- section of our README for more on the expected format.
-
- |||
- |---|---|
- |Context|`ArrowFunctionExpression`, `FunctionDeclaration`, `FunctionExpression`; others when `contexts` option enabled|
- |Tags|`param`|
- |Aliases|`arg`, `argument`|
- |Recommended|true|
- |Options|`contexts`|
-
- The following patterns are considered problems:
-
- ````js
- /**
- * @param
- */
- function quux (foo) {
-
- }
- // Message: There must be an identifier after @param type.
-
- /**
- * @param {string}
- */
- function quux (foo) {
-
- }
- // Message: There must be an identifier after @param tag.
-
- /**
- * @param {string}
- */
- function quux (foo) {
-
- }
- // "jsdoc/require-param-name": ["error"|"warn", {"contexts":["any"]}]
- // Message: There must be an identifier after @param tag.
-
- /**
- * @function
- * @param {string}
- */
- // "jsdoc/require-param-name": ["error"|"warn", {"contexts":["any"]}]
- // Message: There must be an identifier after @param tag.
-
- /**
- * @callback
- * @param {string}
- */
- // "jsdoc/require-param-name": ["error"|"warn", {"contexts":["any"]}]
- // Message: There must be an identifier after @param tag.
-
- /**
- * @param foo
- */
- function quux (foo) {
-
- }
- // Settings: {"jsdoc":{"tagNamePreference":{"param":false}}}
- // Message: Unexpected tag `@param`
- ````
-
- The following patterns are not considered problems:
-
- ````js
- /**
- * @param foo
- */
- function quux (foo) {
-
- }
-
- /**
- * @param foo
- */
- function quux (foo) {
-
- }
- // "jsdoc/require-param-name": ["error"|"warn", {"contexts":["any"]}]
-
- /**
- * @param {string} foo
- */
- function quux (foo) {
-
- }
-
- /**
- * @function
- * @param
- */
-
- /**
- * @callback
- * @param
- */
-
- /**
- * @param {Function} [processor=data => data] A function to run
- */
- function processData(processor) {
- return processor(data)
- }
-
- /** Example with multi-line param type.
- *
- * @param {function(
- * number
- * )} cb Callback.
- */
- function example(cb) {
- cb(42);
- }
- ````
-
-
- <a name="eslint-plugin-jsdoc-rules-require-param-type"></a>
- ### <code>require-param-type</code>
-
- Requires that each `@param` tag has a `type` value.
-
- <a name="eslint-plugin-jsdoc-rules-require-param-type-options-31"></a>
- #### Options
-
- <a name="eslint-plugin-jsdoc-rules-require-param-type-options-31-contexts-10"></a>
- ##### <code>contexts</code>
-
- Set this to an array of strings representing the AST context (or an object with
- `context` and `comment` properties) where you wish the rule to be applied.
- Overrides the default contexts (see below). Set to `"any"` if you want
- the rule to apply to any jsdoc block throughout your files (as is necessary
- for finding function blocks not attached to a function declaration or
- expression, i.e., `@callback` or `@function` (or its aliases `@func` or
- `@method`) (including those associated with an `@interface`).
-
- See the ["AST and Selectors"](#eslint-plugin-jsdoc-advanced-ast-and-selectors)
- section of our README for more on the expected format.
-
- |||
- |---|---|
- |Context|`ArrowFunctionExpression`, `FunctionDeclaration`, `FunctionExpression`; others when `contexts` option enabled|
- |Tags|`param`|
- |Aliases|`arg`, `argument`|
- |Recommended|true|
- |Options|`contexts`|
-
- The following patterns are considered problems:
-
- ````js
- /**
- * @param foo
- */
- function quux (foo) {
-
- }
- // Message: Missing JSDoc @param "foo" type.
-
- /**
- * @param foo
- */
- function quux (foo) {
-
- }
- // "jsdoc/require-param-type": ["error"|"warn", {"contexts":["any"]}]
- // Message: Missing JSDoc @param "foo" type.
-
- /**
- * @function
- * @param foo
- */
- // "jsdoc/require-param-type": ["error"|"warn", {"contexts":["any"]}]
- // Message: Missing JSDoc @param "foo" type.
-
- /**
- * @callback
- * @param foo
- */
- // "jsdoc/require-param-type": ["error"|"warn", {"contexts":["any"]}]
- // Message: Missing JSDoc @param "foo" type.
-
- /**
- * @arg foo
- */
- function quux (foo) {
-
- }
- // Settings: {"jsdoc":{"tagNamePreference":{"param":"arg"}}}
- // Message: Missing JSDoc @arg "foo" type.
-
- /**
- * @param foo
- */
- function quux (foo) {
-
- }
- // Settings: {"jsdoc":{"tagNamePreference":{"param":false}}}
- // Message: Unexpected tag `@param`
- ````
-
- The following patterns are not considered problems:
-
- ````js
- /**
- *
- */
- function quux (foo) {
-
- }
-
- /**
- * @param {number} foo
- */
- function quux (foo) {
-
- }
-
- /**
- * @param {number} foo
- */
- function quux (foo) {
-
- }
- // "jsdoc/require-param-type": ["error"|"warn", {"contexts":["any"]}]
-
- /**
- * @function
- * @param foo
- */
-
- /**
- * @callback
- * @param foo
- */
- ````
-
-
- <a name="eslint-plugin-jsdoc-rules-require-param"></a>
- ### <code>require-param</code>
-
- Requires that all function parameters are documented.
-
- <a name="eslint-plugin-jsdoc-rules-require-param-fixer-1"></a>
- #### Fixer
-
- Adds `@param <name>` for each tag present in the function signature but
- missing in the jsdoc. Can be disabled by setting the `enableFixer`
- option to `false`.
-
- <a name="eslint-plugin-jsdoc-rules-require-param-fixer-1-destructured-object-and-array-naming"></a>
- ##### Destructured object and array naming
-
- When the fixer is applied to destructured objects, only the input name is
- used.
-
- So for:
-
- ```js
- /**
- * @param cfg
- */
- function quux ({foo: bar, baz: bax = 5}) {
- }
- ```
-
- ..the fixed jsdoc will be:
-
- ```js
- /**
- * @param cfg
- * @param cfg.foo
- * @param cfg.baz
- */
- ```
-
- This is because the input to the function is the relevant item for
- understanding the function's input, not how the variable is renamed
- for internal use (the signature itself documents that).
-
- For destructured arrays, the input name is merely the array index.
-
- So for:
-
- ```js
- /**
- * @param cfg
- */
- function quux ([foo, bar]) {
- }
- ```
-
- ..the fixed jsdoc will be:
-
- ```js
- /**
- * @param cfg
- * @param cfg."0"
- * @param cfg."1"
- */
- ```
-
- <a name="eslint-plugin-jsdoc-rules-require-param-fixer-1-missing-root-fixing"></a>
- ##### Missing root fixing
-
- Note that unless `enableRootFixer` (or `enableFixer`) is set to `false`,
- missing roots will be added and auto-incremented. The default behavior
- is for "root" to be auto-inserted for missing roots, followed by a
- 0-based auto-incrementing number.
-
- So for:
-
- ```js
- function quux ({foo}, {bar}, {baz}) {
- }
- ```
-
- ...the default jsdoc that would be added if the fixer is enabled would be:
-
- ```js
- /**
- * @param root0
- * @param root0.foo
- * @param root1
- * @param root1.bar
- * @param root2
- * @param root2.baz
- */
- ```
-
- The name of "root" can be configured with `unnamedRootBase` (which also allows
- cycling through a list of multiple root names before there is need for any
- numeric component).
-
- And one can have the count begin at another number (e.g., `1`) by changing
- `autoIncrementBase` from the default of `0`.
-
- <a name="eslint-plugin-jsdoc-rules-require-param-fixer-1-rest-element-restelement-insertions"></a>
- ##### Rest Element (<code>RestElement</code>) insertions
-
- The fixer will automatically report/insert
- [jsdoc repeatable parameters](https://jsdoc.app/tags-param.html#multiple-types-and-repeatable-parameters)
- if missing.
-
- ```js
- /**
- * @param {GenericArray} cfg
- * @param {number} cfg."0"
- */
- function baar ([a, ...extra]) {
- //
- }
- ```
-
- ..becomes:
-
- ```js
- /**
- * @param {GenericArray} cfg
- * @param {number} cfg."0"
- * @param {...any} cfg."1"
- */
- function baar ([a, ...extra]) {
- //
- }
- ```
-
- Note that the type `any` is included since we don't know of any specific
- type to use.
-
- To disable such rest element insertions, set `enableRestElementFixer` to
- `false`.
-
- Note too that the following will be reported even though there is an item
- corresponding to `extra`:
-
- ```js
- /**
- * @param {GenericArray} cfg
- * @param {number} cfg."0"
- * @param {any} cfg."1"
- */
- function baar ([a, ...extra]) {
- //
- }
- ```
-
- ...because it does not use the `...` syntax in the type.
-
- <a name="eslint-plugin-jsdoc-rules-require-param-fixer-1-object-rest-property-insertions"></a>
- ##### Object Rest Property insertions
-
- If the `checkRestProperty` option is set to `true` (`false` by default),
- missing rest properties will be reported with documentation auto-inserted:
-
- ```js
- /**
- * @param cfg
- * @param cfg.num
- */
- function quux ({num, ...extra}) {
- }
- ```
-
- ...becomes:
-
- ```js
- /**
- * @param cfg
- * @param cfg.num
- * @param cfg.extra
- */
- function quux ({num, ...extra}) {
- }
- ```
-
- You may wish to manually note in your jsdoc for `extra` that this is a
- rest property, however, as jsdoc
- [does not appear](https://github.com/jsdoc/jsdoc/issues/1773)
- to currently support syntax or output to distinguish rest properties from
- other properties, so in looking at the docs alone without looking at the
- function signature, it may appear that there is an actual property named
- `extra`.
-
- <a name="eslint-plugin-jsdoc-rules-require-param-options-32"></a>
- #### Options
-
- An options object accepts the following optional properties:
-
- <a name="eslint-plugin-jsdoc-rules-require-param-options-32-enablefixer-3"></a>
- ##### <code>enableFixer</code>
-
- Whether to enable the fixer. Defaults to `true`.
-
- <a name="eslint-plugin-jsdoc-rules-require-param-options-32-enablerootfixer"></a>
- ##### <code>enableRootFixer</code>
-
- Whether to enable the auto-adding of incrementing roots (see the "Fixer"
- section). Defaults to `true`. Has no effect if `enableFixer` is set to
- `false`.
-
- <a name="eslint-plugin-jsdoc-rules-require-param-options-32-enablerestelementfixer"></a>
- ##### <code>enableRestElementFixer</code>
-
- Whether to enable the rest element fixer (see
- "Rest Element (`RestElement`) insertions"). Defaults to `true`.
-
- <a name="eslint-plugin-jsdoc-rules-require-param-options-32-checkrestproperty-1"></a>
- ##### <code>checkRestProperty</code>
-
- If set to `true`, will report (and add fixer insertions) for missing rest
- properties. Defaults to `false`.
-
- If set to `true`, note that you can still document the subproperties of the
- rest property using other jsdoc features, e.g., `@typedef`:
-
- ```js
- /**
- * @typedef ExtraOptions
- * @property innerProp1
- * @property innerProp2
- */
-
- /**
- * @param cfg
- * @param cfg.num
- * @param {ExtraOptions} extra
- */
- function quux ({num, ...extra}) {
- }
- ```
-
- Setting this option to `false` (the default) may be useful in cases where
- you already have separate `@param` definitions for each of the properties
- within the rest property.
-
- For example, with the option disabled, this will not give an error despite
- `extra` not having any definition:
-
- ```js
- /**
- * @param cfg
- * @param cfg.num
- */
- function quux ({num, ...extra}) {
- }
- ```
-
- Nor will this:
-
- ```js
- /**
- * @param cfg
- * @param cfg.num
- * @param cfg.innerProp1
- * @param cfg.innerProp2
- */
- function quux ({num, ...extra}) {
- }
- ```
-
- <a name="eslint-plugin-jsdoc-rules-require-param-options-32-autoincrementbase"></a>
- ##### <code>autoIncrementBase</code>
-
- Numeric to indicate the number at which to begin auto-incrementing roots.
- Defaults to `0`.
-
- <a name="eslint-plugin-jsdoc-rules-require-param-options-32-unnamedrootbase"></a>
- ##### <code>unnamedRootBase</code>
-
- An array of root names to use in the fixer when roots are missing. Defaults
- to `['root']`. Note that only when all items in the array besides the last
- are exhausted will auto-incrementing occur. So, with
- `unnamedRootBase: ['arg', 'config']`, the following:
-
- ```js
- function quux ({foo}, [bar], {baz}) {
- }
- ```
-
- ...will get the following jsdoc block added:
-
- ```js
- /**
- * @param arg
- * @param arg.foo
- * @param config0
- * @param config0."0" (`bar`)
- * @param config1
- * @param config1.baz
- */
- ```
-
- <a name="eslint-plugin-jsdoc-rules-require-param-options-32-exemptedby-1"></a>
- ##### <code>exemptedBy</code>
-
- Array of tags (e.g., `['type']`) whose presence on the document block
- avoids the need for a `@param`. Defaults to an array with
- `inheritdoc`. If you set this array, it will overwrite the default,
- so be sure to add back `inheritdoc` if you wish its presence to cause
- exemption of the rule.
-
- <a name="eslint-plugin-jsdoc-rules-require-param-options-32-checktypespattern-1"></a>
- ##### <code>checkTypesPattern</code>
-
- When one specifies a type, unless it is of a generic type, like `object`
- or `array`, it may be considered unnecessary to have that object's
- destructured components required, especially where generated docs will
- link back to the specified type. For example:
-
- ```js
- /**
- * @param {SVGRect} bbox - a SVGRect
- */
- export const bboxToObj = function ({x, y, width, height}) {
- return {x, y, width, height};
- };
- ```
-
- By default `checkTypesPattern` is set to
- `/^(?:[oO]bject|[aA]rray|PlainObject|Generic(?:Object|Array))$/u`,
- meaning that destructuring will be required only if the type of the `@param`
- (the text between curly brackets) is a match for "Object" or "Array" (with or
- without initial caps), "PlainObject", or "GenericObject", "GenericArray" (or
- if no type is present). So in the above example, the lack of a match will
- mean that no complaint will be given about the undocumented destructured
- parameters.
-
- Note that the `/` delimiters are optional, but necessary to add flags.
-
- Defaults to using (only) the `u` flag, so to add your own flags, encapsulate
- your expression as a string, but like a literal, e.g., `/^object$/ui`.
-
- You could set this regular expression to a more expansive list, or you
- could restrict it such that even types matching those strings would not
- need destructuring.
-
- <a name="eslint-plugin-jsdoc-rules-require-param-options-32-contexts-11"></a>
- ##### <code>contexts</code>
-
- Set this to an array of strings representing the AST context (or an object with
- `context` and `comment` properties) where you wish the rule to be applied.
- Overrides the default contexts (see below). May be useful for adding such as
- `TSMethodSignature` in TypeScript or restricting the contexts
- which are checked.
-
- See the ["AST and Selectors"](#eslint-plugin-jsdoc-advanced-ast-and-selectors)
- section of our README for more on the expected format.
-
- <a name="eslint-plugin-jsdoc-rules-require-param-options-32-checkconstructors-2"></a>
- ##### <code>checkConstructors</code>
-
- A value indicating whether `constructor`s should be checked. Defaults to
- `true`.
-
- <a name="eslint-plugin-jsdoc-rules-require-param-options-32-checkgetters-2"></a>
- ##### <code>checkGetters</code>
-
- A value indicating whether getters should be checked. Defaults to `false`.
-
- <a name="eslint-plugin-jsdoc-rules-require-param-options-32-checksetters-2"></a>
- ##### <code>checkSetters</code>
-
- A value indicating whether setters should be checked. Defaults to `false`.
-
- <a name="eslint-plugin-jsdoc-rules-require-param-options-32-checkdestructured-1"></a>
- ##### <code>checkDestructured</code>
-
- Whether to require destructured properties. Defaults to `true`.
-
- <a name="eslint-plugin-jsdoc-rules-require-param-options-32-checkdestructuredroots"></a>
- ##### <code>checkDestructuredRoots</code>
-
- Whether to check the existence of a corresponding `@param` for root objects
- of destructured properties (e.g., that for `function ({a, b}) {}`, that there
- is something like `@param myRootObj` defined that can correspond to
- the `{a, b}` object parameter).
-
- If `checkDestructuredRoots` is `false`, `checkDestructured` will also be
- implied to be `false` (i.e., the inside of the roots will not be checked
- either, e.g., it will also not complain if `a` or `b` do not have their own
- documentation). Defaults to `true`.
-
- <a name="eslint-plugin-jsdoc-rules-require-param-options-32-usedefaultobjectproperties-1"></a>
- ##### <code>useDefaultObjectProperties</code>
-
- Set to `true` if you wish to expect documentation of properties on objects
- supplied as default values. Defaults to `false`.
-
- | | |
- | -------- | ----------------------------------------------------------------------------- |
- | Context | `ArrowFunctionExpression`, `FunctionDeclaration`, `FunctionExpression`; others when `contexts` option enabled |
- | Tags | `param` |
- | Aliases | `arg`, `argument` |
- |Recommended | true|
- | Options | `autoIncrementBase`, `checkDestructured`, `checkDestructuredRoots`, `contexts`, `enableFixer`, `enableRootFixer`, `enableRestElementFixer`, `checkRestProperty`, `exemptedBy`, `checkConstructors`, `checkGetters`, `checkSetters`, `checkTypesPattern`, `unnamedRootBase`, `useDefaultObjectProperties`|
- | Settings | `ignoreReplacesDocs`, `overrideReplacesDocs`, `augmentsExtendsReplacesDocs`, `implementsReplacesDocs`|
-
- The following patterns are considered problems:
-
- ````js
- /**
- *
- */
- function quux (foo) {
-
- }
- // Message: Missing JSDoc @param "foo" declaration.
-
- /**
- *
- */
- function quux (foo) {
-
- }
- // "jsdoc/require-param": ["error"|"warn", {"contexts":["FunctionDeclaration"]}]
- // Message: Missing JSDoc @param "foo" declaration.
-
- /**
- *
- */
- function quux ({foo}) {
-
- }
- // Message: Missing JSDoc @param "root0" declaration.
-
- /**
- * @param foo
- */
- function quux (foo, bar, {baz}) {
-
- }
- // "jsdoc/require-param": ["error"|"warn", {"checkDestructured":false}]
- // Message: Missing JSDoc @param "bar" declaration.
-
- /**
- * @param foo
- */
- function quux (foo, bar, {baz}) {
-
- }
- // "jsdoc/require-param": ["error"|"warn", {"checkDestructuredRoots":false}]
- // Message: Missing JSDoc @param "bar" declaration.
-
- /**
- *
- */
- function quux ({foo}) {
-
- }
- // "jsdoc/require-param": ["error"|"warn", {"enableFixer":false}]
- // Message: Missing JSDoc @param "root0" declaration.
-
- /**
- *
- */
- function quux ({foo: bar = 5} = {}) {
-
- }
- // Message: Missing JSDoc @param "root0" declaration.
-
- /**
- * @param
- */
- function quux ({foo}) {
-
- }
- // Message: Missing JSDoc @param "root0" declaration.
-
- /**
- * @param
- */
- function quux ({foo}) {
-
- }
- // "jsdoc/require-param": ["error"|"warn", {"autoIncrementBase":1}]
- // Message: Missing JSDoc @param "root1" declaration.
-
- /**
- * @param options
- */
- function quux ({foo}) {
-
- }
- // Message: Missing JSDoc @param "options.foo" declaration.
-
- /**
- * @param
- */
- function quux ({ foo, bar: { baz }}) {
-
- }
- // Message: Missing JSDoc @param "root0" declaration.
-
- /**
- *
- */
- function quux ({foo}, {bar}) {
-
- }
- // "jsdoc/require-param": ["error"|"warn", {"unnamedRootBase":["arg"]}]
- // Message: Missing JSDoc @param "arg0" declaration.
-
- /**
- *
- */
- function quux ({foo}, {bar}) {
-
- }
- // "jsdoc/require-param": ["error"|"warn", {"unnamedRootBase":["arg","config"]}]
- // Message: Missing JSDoc @param "arg" declaration.
-
- /**
- *
- */
- function quux ({foo}, {bar}) {
-
- }
- // "jsdoc/require-param": ["error"|"warn", {"enableRootFixer":false,"unnamedRootBase":["arg","config"]}]
- // Message: Missing JSDoc @param "arg" declaration.
-
- /**
- *
- */
- function quux (foo, bar) {
-
- }
- // Message: Missing JSDoc @param "foo" declaration.
-
- /**
- * @param foo
- */
- function quux (foo, bar) {
-
- }
- // Message: Missing JSDoc @param "bar" declaration.
-
- /**
- * @param bar
- */
- function quux (foo, bar, baz) {
-
- }
- // Message: Missing JSDoc @param "foo" declaration.
-
- /**
- * @param foo
- * @param bar
- */
- function quux (foo, bar, baz) {
-
- }
- // Message: Missing JSDoc @param "baz" declaration.
-
- /**
- * @param baz
- */
- function quux (foo, bar, baz) {
-
- }
- // Message: Missing JSDoc @param "foo" declaration.
-
- /**
- * @param
- */
- function quux (foo) {
-
- }
- // Settings: {"jsdoc":{"tagNamePreference":{"param":"arg"}}}
- // Message: Missing JSDoc @arg "foo" declaration.
-
- /**
- * @param foo
- */
- function quux (foo, bar) {
-
- }
- // Message: Missing JSDoc @param "bar" declaration.
-
- /**
- * @override
- */
- function quux (foo) {
-
- }
- // Settings: {"jsdoc":{"overrideReplacesDocs":false}}
- // Message: Missing JSDoc @param "foo" declaration.
-
- /**
- * @ignore
- */
- function quux (foo) {
-
- }
- // Settings: {"jsdoc":{"ignoreReplacesDocs":false}}
- // Message: Missing JSDoc @param "foo" declaration.
-
- /**
- * @implements
- */
- function quux (foo) {
-
- }
- // Settings: {"jsdoc":{"implementsReplacesDocs":false}}
- // Message: Missing JSDoc @param "foo" declaration.
-
- /**
- * @augments
- */
- function quux (foo) {
-
- }
- // Message: Missing JSDoc @param "foo" declaration.
-
- /**
- * @extends
- */
- function quux (foo) {
-
- }
- // Message: Missing JSDoc @param "foo" declaration.
-
- /**
- * @override
- */
- class A {
- /**
- *
- */
- quux (foo) {
-
- }
- }
- // Settings: {"jsdoc":{"overrideReplacesDocs":false}}
- // Message: Missing JSDoc @param "foo" declaration.
-
- /**
- * @ignore
- */
- class A {
- /**
- *
- */
- quux (foo) {
-
- }
- }
- // Settings: {"jsdoc":{"ignoreReplacesDocs":false}}
- // Message: Missing JSDoc @param "foo" declaration.
-
- /**
- * @implements
- */
- class A {
- /**
- *
- */
- quux (foo) {
-
- }
- }
- // Settings: {"jsdoc":{"implementsReplacesDocs":false}}
- // Message: Missing JSDoc @param "foo" declaration.
-
- /**
- * @augments
- */
- class A {
- /**
- *
- */
- quux (foo) {
-
- }
- }
- // Message: Missing JSDoc @param "foo" declaration.
-
- /**
- * @extends
- */
- class A {
- /**
- *
- */
- quux (foo) {
-
- }
- }
- // Message: Missing JSDoc @param "foo" declaration.
-
- export class SomeClass {
- /**
- * @param property
- */
- constructor(private property: string, private foo: number) {}
- }
- // Message: Missing JSDoc @param "foo" declaration.
-
- /**
- * @param
- */
- function quux (foo) {
-
- }
- // Settings: {"jsdoc":{"tagNamePreference":{"param":false}}}
- // Message: Unexpected tag `@param`
-
- /**
- *
- */
- function quux ({bar, baz}, foo) {
- }
- // Message: Missing JSDoc @param "root0" declaration.
-
- /**
- *
- */
- function quux (foo, {bar, baz}) {
- }
- // Message: Missing JSDoc @param "foo" declaration.
-
- /**
- *
- */
- function quux ([bar, baz], foo) {
- }
- // Message: Missing JSDoc @param "root0" declaration.
-
- /**
- *
- */
- function quux (foo) {
- }
- // "jsdoc/require-param": ["error"|"warn", {"exemptedBy":["notPresent"]}]
- // Message: Missing JSDoc @param "foo" declaration.
-
- /**
- * @inheritdoc
- */
- function quux (foo) {
-
- }
- // "jsdoc/require-param": ["error"|"warn", {"exemptedBy":[]}]
- // Message: Missing JSDoc @param "foo" declaration.
-
- /**
- * @inheritdoc
- */
- function quux (foo) {
-
- }
- // Settings: {"jsdoc":{"mode":"closure"}}
- // Message: Missing JSDoc @param "foo" declaration.
-
- /**
- * Assign the project to a list of employees.
- * @param {object[]} employees - The employees who are responsible for the project.
- * @param {string} employees[].name - The name of an employee.
- * @param {string} employees[].department - The employee's department.
- */
- function assign (employees, name) {
-
- };
- // Message: Missing JSDoc @param "name" declaration.
-
- interface ITest {
- /**
- * Test description.
- */
- TestMethod(id: number): void;
- }
- // "jsdoc/require-param": ["error"|"warn", {"contexts":["TSMethodSignature"]}]
- // Message: Missing JSDoc @param "id" declaration.
-
- /**
- * A test class.
- */
- abstract class TestClass
- {
- /**
- * A test method.
- */
- abstract TestFunction(id);
- }
- // "jsdoc/require-param": ["error"|"warn", {"contexts":["TSEmptyBodyFunctionExpression"]}]
- // Message: Missing JSDoc @param "id" declaration.
-
- /**
- * A test class.
- */
- declare class TestClass
- {
- /**
- *
- */
- TestMethod(id);
- }
- // "jsdoc/require-param": ["error"|"warn", {"contexts":["TSEmptyBodyFunctionExpression"]}]
- // Message: Missing JSDoc @param "id" declaration.
-
- /**
- * A test function.
- */
- declare let TestFunction: (id) => void;
- // "jsdoc/require-param": ["error"|"warn", {"contexts":["TSFunctionType"]}]
- // Message: Missing JSDoc @param "id" declaration.
-
- /**
- * A test function.
- */
- let TestFunction: (id) => void;
- // "jsdoc/require-param": ["error"|"warn", {"contexts":["TSFunctionType"]}]
- // Message: Missing JSDoc @param "id" declaration.
-
- /**
- * A test function.
- */
- function test(
- processor: (id: number) => string
- ) {
- return processor(10);
- }
- // "jsdoc/require-param": ["error"|"warn", {"contexts":["TSFunctionType"]}]
- // Message: Missing JSDoc @param "id" declaration.
-
- /**
- * A test function.
- */
- let test = (processor: (id: number) => string) =>
- {
- return processor(10);
- }
- // "jsdoc/require-param": ["error"|"warn", {"contexts":["TSFunctionType"]}]
- // Message: Missing JSDoc @param "id" declaration.
-
- class TestClass {
- /**
- * A class property.
- */
- public Test: (id: number) => string;
- }
- // "jsdoc/require-param": ["error"|"warn", {"contexts":["TSFunctionType"]}]
- // Message: Missing JSDoc @param "id" declaration.
-
- class TestClass {
- /**
- * A class method.
- */
- public TestMethod(): (id: number) => string
- {
- }
- }
- // "jsdoc/require-param": ["error"|"warn", {"contexts":["TSFunctionType"]}]
- // Message: Missing JSDoc @param "id" declaration.
-
- interface TestInterface {
- /**
- * An interface property.
- */
- public Test: (id: number) => string;
- }
- // "jsdoc/require-param": ["error"|"warn", {"contexts":["TSFunctionType"]}]
- // Message: Missing JSDoc @param "id" declaration.
-
- interface TestInterface {
- /**
- * An interface method.
- */
- public TestMethod(): (id: number) => string;
- }
- // "jsdoc/require-param": ["error"|"warn", {"contexts":["TSFunctionType"]}]
- // Message: Missing JSDoc @param "id" declaration.
-
- /**
- * A function with return type
- */
- function test(): (id: number) => string;
- // "jsdoc/require-param": ["error"|"warn", {"contexts":["TSFunctionType"]}]
- // Message: Missing JSDoc @param "id" declaration.
-
- /**
- * A function with return type
- */
- let test = (): (id: number) => string =>
- {
- return (id) => `${id}`;
- }
- // "jsdoc/require-param": ["error"|"warn", {"contexts":["TSFunctionType"]}]
- // Message: Missing JSDoc @param "id" declaration.
-
- /**
- * @param baz
- * @param options
- */
- function quux (baz, {foo: bar}) {
-
- }
- // Message: Missing JSDoc @param "options.foo" declaration.
-
- class Client {
- /**
- * Set collection data.
- * @param {Object} data The collection data object.
- * @param {number} data.last_modified
- * @param {Object} options The options object.
- * @param {Object} [options.headers] The headers object option.
- * @param {Number} [options.retry=0] Number of retries to make
- * when faced with transient errors.
- * @param {Boolean} [options.safe] The safe option.
- * @param {Boolean} [options.patch] The patch option.
- * @param {Number} [options.last_modified] The last_modified option.
- * @return {Promise<Object, Error>}
- */
- async setData(
- data: { last_modified?: number },
- options: {
- headers?: Record<string, string>;
- safe?: boolean;
- retry?: number;
- patch?: boolean;
- last_modified?: number;
- permissions?: [];
- } = {}
- ) {}
- }
- // Message: Missing JSDoc @param "options.permissions" declaration.
-
- /**
- *
- */
- function quux (foo) {
-
- }
- // "jsdoc/require-param": ["error"|"warn", {"enableFixer":false}]
- // Message: Missing JSDoc @param "foo" declaration.
-
- class Client {
- /**
- * Set collection data.
- * @return {Promise<Object, Error>}
- */
- async setData(
- data: { last_modified?: number }
- ) {}
- }
- // Message: Missing JSDoc @param "data" declaration.
-
- /**
- * @param cfg
- * @param cfg.num
- */
- function quux ({num, ...extra}) {
- }
- // "jsdoc/require-param": ["error"|"warn", {"checkRestProperty":true}]
- // Message: Missing JSDoc @param "cfg.extra" declaration.
-
- /**
- * @param cfg
- * @param cfg.opts
- * @param cfg.opts.num
- */
- function quux ({opts: {num, ...extra}}) {
- }
- // "jsdoc/require-param": ["error"|"warn", {"checkRestProperty":true}]
- // Message: Missing JSDoc @param "cfg.opts.extra" declaration.
-
- /**
- * @param {GenericArray} cfg
- * @param {number} cfg."0"
- */
- function baar ([a, ...extra]) {
- //
- }
- // Message: Missing JSDoc @param "cfg."1"" declaration.
-
- /**
- * @param a
- */
- function baar (a, ...extra) {
- //
- }
- // Message: Missing JSDoc @param "extra" declaration.
-
- /**
- * Converts an SVGRect into an object.
- * @param {SVGRect} bbox - a SVGRect
- */
- const bboxToObj = function ({x, y, width, height}) {
- return {x, y, width, height};
- };
- // "jsdoc/require-param": ["error"|"warn", {"checkTypesPattern":"SVGRect"}]
- // Message: Missing JSDoc @param "bbox.x" declaration.
-
- /**
- * Converts an SVGRect into an object.
- * @param {object} bbox - a SVGRect
- */
- const bboxToObj = function ({x, y, width, height}) {
- return {x, y, width, height};
- };
- // Message: Missing JSDoc @param "bbox.x" declaration.
-
- module.exports = class GraphQL {
- /**
- * @param fetchOptions
- * @param cacheKey
- */
- fetch = ({ url, ...options }, cacheKey) => {
- }
- };
- // "jsdoc/require-param": ["error"|"warn", {"checkRestProperty":true}]
- // Message: Missing JSDoc @param "fetchOptions.url" declaration.
-
- (function() {
- /**
- * A function.
- */
- function f(param) {
- return !param;
- }
- })();
- // Message: Missing JSDoc @param "param" declaration.
-
- /**
- * Description.
- * @param {Object} options
- * @param {Object} options.foo
- */
- function quux ({ foo: { bar } }) {}
- // Message: Missing JSDoc @param "options.foo.bar" declaration.
-
- /**
- * Description.
- * @param {FooBar} options
- * @param {FooBar} options.foo
- */
- function quux ({ foo: { bar } }) {}
- // "jsdoc/require-param": ["error"|"warn", {"checkTypesPattern":"FooBar"}]
- // Message: Missing JSDoc @param "options.foo.bar" declaration.
-
- /**
- * Description.
- * @param {Object} options
- * @param {FooBar} foo
- */
- function quux ({ foo: { bar } }) {}
- // Message: Missing JSDoc @param "options.foo" declaration.
-
- /**
- * Description.
- * @param {Object} options
- * @param options.foo
- */
- function quux ({ foo: { bar } }) {}
- // Message: Missing JSDoc @param "options.foo.bar" declaration.
-
- /**
- * Description.
- * @param {object} options Options.
- * @param {object} options.foo A description.
- * @param {object} options.foo.bar
- */
- function foo({ foo: { bar: { baz } }}) {}
- // Message: Missing JSDoc @param "options.foo.bar.baz" declaration.
-
- /**
- * Returns a number.
- * @param {Object} props Props.
- * @param {Object} props.prop Prop.
- * @return {number} A number.
- */
- export function testFn1 ({ prop = { a: 1, b: 2 } }) {
- }
- // "jsdoc/require-param": ["error"|"warn", {"useDefaultObjectProperties":true}]
- // Message: Missing JSDoc @param "props.prop.a" declaration.
-
- /** Foo. */
- function foo(a, b, c) {}
- // Message: Missing JSDoc @param "a" declaration.
- ````
-
- The following patterns are not considered problems:
-
- ````js
- /**
- * @param foo
- */
- function quux (foo) {
-
- }
-
- /**
- * @param root0
- * @param root0.foo
- */
- function quux ({foo}) {
-
- }
-
- /**
- * @param root0
- * @param root0.foo
- * @param root1
- * @param root1.bar
- */
- function quux ({foo}, {bar}) {
-
- }
-
- /**
- * @param arg0
- * @param arg0.foo
- * @param arg1
- * @param arg1.bar
- */
- function quux ({foo}, {bar}) {
-
- }
- // "jsdoc/require-param": ["error"|"warn", {"unnamedRootBase":["arg"]}]
-
- /**
- * @param arg
- * @param arg.foo
- * @param config0
- * @param config0.bar
- * @param config1
- * @param config1.baz
- */
- function quux ({foo}, {bar}, {baz}) {
-
- }
- // "jsdoc/require-param": ["error"|"warn", {"unnamedRootBase":["arg","config"]}]
-
- /**
- * @inheritdoc
- */
- function quux (foo) {
-
- }
-
- /**
- * @inheritDoc
- */
- function quux (foo) {
-
- }
-
- /**
- * @arg foo
- */
- function quux (foo) {
-
- }
- // Settings: {"jsdoc":{"tagNamePreference":{"param":"arg"}}}
-
- /**
- * @override
- * @param foo
- */
- function quux (foo) {
-
- }
-
- /**
- * @override
- */
- function quux (foo) {
-
- }
-
- /**
- * @override
- */
- class A {
- /**
- *
- */
- quux (foo) {
-
- }
- }
-
- /**
- * @override
- */
- function quux (foo) {
-
- }
- // Settings: {"jsdoc":{"overrideReplacesDocs":true}}
-
- /**
- * @ignore
- */
- function quux (foo) {
-
- }
- // Settings: {"jsdoc":{"ignoreReplacesDocs":true}}
-
- /**
- * @implements
- */
- class A {
- /**
- *
- */
- quux (foo) {
-
- }
- }
-
- /**
- * @implements
- */
- function quux (foo) {
-
- }
-
- /**
- * @implements
- */
- function quux (foo) {
-
- }
- // Settings: {"jsdoc":{"implementsReplacesDocs":true}}
-
- /**
- * @implements
- * @param foo
- */
- function quux (foo) {
-
- }
-
- /**
- * @augments
- */
- function quux (foo) {
-
- }
- // Settings: {"jsdoc":{"augmentsExtendsReplacesDocs":true}}
-
- /**
- * @augments
- * @param foo
- */
- function quux (foo) {
-
- }
-
- /**
- * @extends
- */
- function quux (foo) {
-
- }
- // Settings: {"jsdoc":{"augmentsExtendsReplacesDocs":true}}
-
- /**
- * @extends
- * @param foo
- */
- function quux (foo) {
-
- }
-
- /**
- * @augments
- */
- function quux (foo) {
-
- }
- // Settings: {"jsdoc":{"augmentsExtendsReplacesDocs":true}}
-
- /**
- * @extends
- */
- function quux (foo) {
-
- }
- // Settings: {"jsdoc":{"augmentsExtendsReplacesDocs":true}}
-
- /**
- * @override
- */
- class A {
- /**
- * @param foo
- */
- quux (foo) {
-
- }
- }
-
- /**
- * @override
- */
- class A {
- /**
- *
- */
- quux (foo) {
-
- }
- }
- // Settings: {"jsdoc":{"overrideReplacesDocs":true}}
-
- /**
- * @ignore
- */
- class A {
- /**
- *
- */
- quux (foo) {
-
- }
- }
- // Settings: {"jsdoc":{"ignoreReplacesDocs":true}}
-
- /**
- * @implements
- */
- class A {
- /**
- *
- */
- quux (foo) {
-
- }
- }
- // Settings: {"jsdoc":{"implementsReplacesDocs":true}}
-
- /**
- * @implements
- */
- class A {
- /**
- * @param foo
- */
- quux (foo) {
-
- }
- }
-
- /**
- * @augments
- */
- class A {
- /**
- *
- */
- quux (foo) {
-
- }
- }
- // Settings: {"jsdoc":{"augmentsExtendsReplacesDocs":true}}
-
- /**
- * @augments
- */
- class A {
- /**
- * @param foo
- */
- quux (foo) {
-
- }
- }
-
- /**
- * @extends
- */
- class A {
- /**
- *
- */
- quux (foo) {
-
- }
- }
- // Settings: {"jsdoc":{"augmentsExtendsReplacesDocs":true}}
-
- /**
- * @extends
- */
- class A {
- /**
- * @param foo
- */
- quux (foo) {
-
- }
- }
-
- /**
- * @augments
- */
- class A {
- /**
- *
- */
- quux (foo) {
-
- }
- }
- // Settings: {"jsdoc":{"augmentsExtendsReplacesDocs":true}}
-
- /**
- * @extends
- */
- class A {
- /**
- *
- */
- quux (foo) {
-
- }
- }
- // Settings: {"jsdoc":{"augmentsExtendsReplacesDocs":true}}
-
- /**
- * @internal
- */
- function quux (foo) {
-
- }
- // Settings: {"jsdoc":{"ignoreInternal":true}}
-
- /**
- * @private
- */
- function quux (foo) {
-
- }
- // Settings: {"jsdoc":{"ignorePrivate":true}}
-
- /**
- * @access private
- */
- function quux (foo) {
-
- }
- // Settings: {"jsdoc":{"ignorePrivate":true}}
-
- // issue 182: optional chaining
- /** @const {boolean} test */
- const test = something?.find(_ => _)
-
- /** @type {RequestHandler} */
- function foo(req, res, next) {}
-
- /**
- * @type {MyCallback}
- */
- function quux () {
-
- }
- // "jsdoc/require-param": ["error"|"warn", {"exemptedBy":["type"]}]
-
- /**
- * @override
- */
- var A = class {
- /**
- *
- */
- quux (foo) {
-
- }
- }
-
- export class SomeClass {
- /**
- * @param property
- */
- constructor(private property: string) {}
- }
-
- /**
- * Assign the project to an employee.
- *
- * @param {object} employee - The employee who is responsible for the project.
- * @param {string} employee.name - The name of the employee.
- * @param {string} employee.department - The employee's department.
- */
- function assign({name, department}) {
- // ...
- }
-
- export abstract class StephanPlugin<O, D> {
-
- /**
- * Called right after Stephan loads the plugin file.
- *
- * @example
- *```typescript
- * type Options = {
- * verbose?: boolean;
- * token?: string;
- * }
- * ```
- *
- * Note that your Options type should only have optional properties...
- *
- * @param args Arguments compiled and provided by StephanClient.
- * @param args.options The options as provided by the user, or an empty object if not provided.
- * @param args.client The options as provided by the user, or an empty object if not provided.
- * @param defaultOptions The default options as provided by the plugin, or an empty object.
- */
- public constructor({options, client}: {
- options: O;
- client: unknown;
- }, defaultOptions: D) {
-
- }
- }
-
- /**
- *
- */
- function quux (foo) {
-
- }
- // "jsdoc/require-param": ["error"|"warn", {"contexts":["ArrowFunctionExpression"]}]
-
- /**
- * A function with return type
- *
- * @param id
- */
- let test = (): (id: number) => string =>
- {
- return (id) => `${id}`;
- }
- // "jsdoc/require-param": ["error"|"warn", {"contexts":["TSFunctionType"]}]
-
- /** @abstract */
- class base {
- /** @param {boolean} arg0 */
- constructor(arg0) {}
- }
-
- class foo extends base {
- /** @inheritDoc */
- constructor(arg0) {
- super(arg0);
- this.arg0 = arg0;
- }
- }
- // Settings: {"jsdoc":{"mode":"closure"}}
-
- export abstract class StephanPlugin<O, D> {
-
- /**
- * Called right after Stephan loads the plugin file.
- *
- * @example
- *```typescript
- * type Options = {
- * verbose?: boolean;
- * token?: string;
- * }
- * ```
- *
- * Note that your Options type should only have optional properties...
- *
- * @param args Arguments compiled and provided by StephanClient.
- * @param args.options The options as provided by the user, or an empty object if not provided.
- * @param args.client The options as provided by the user, or an empty object if not provided.
- * @param args.client.name The name of the client.
- * @param defaultOptions The default options as provided by the plugin, or an empty object.
- */
- public constructor({ options, client: { name } }: {
- options: O;
- client: { name: string };
- }, defaultOptions: D) {
-
- }
- }
-
- /**
- * @param {string} cb
- */
- function createGetter (cb) {
- return function (...args) {
- cb();
- };
- }
-
- /**
- * @param cfg
- * @param cfg.num
- */
- function quux ({num, ...extra}) {
- }
-
- /**
- * @param {GenericArray} cfg
- * @param {number} cfg."0"
- */
- function baar ([a, ...extra]) {
- //
- }
- // "jsdoc/require-param": ["error"|"warn", {"enableRestElementFixer":false}]
-
- /**
- * @param a
- */
- function baar (a, ...extra) {
- //
- }
- // "jsdoc/require-param": ["error"|"warn", {"enableRestElementFixer":false}]
-
- /**
- * Converts an SVGRect into an object.
- * @param {SVGRect} bbox - a SVGRect
- */
- const bboxToObj = function ({x, y, width, height}) {
- return {x, y, width, height};
- };
-
- /**
- * Converts an SVGRect into an object.
- * @param {object} bbox - a SVGRect
- */
- const bboxToObj = function ({x, y, width, height}) {
- return {x, y, width, height};
- };
- // "jsdoc/require-param": ["error"|"warn", {"checkTypesPattern":"SVGRect"}]
-
- class CSS {
- /**
- * Set one or more CSS properties for the set of matched elements.
- *
- * @param {Object} propertyObject - An object of property-value pairs to set.
- */
- setCssObject(propertyObject: {[key: string]: string | number}): void {
- }
- }
-
- /**
- * @param foo
- * @param bar
- * @param cfg
- */
- function quux (foo, bar, {baz}) {
-
- }
- // "jsdoc/require-param": ["error"|"warn", {"checkDestructured":false}]
-
- /**
- * @param foo
- * @param bar
- */
- function quux (foo, bar, {baz}) {
-
- }
- // "jsdoc/require-param": ["error"|"warn", {"checkDestructuredRoots":false}]
-
- /**
- * @param root
- * @param root.foo
- */
- function quux ({"foo": bar}) {
-
- }
-
- /**
- * @param root
- * @param root."foo"
- */
- function quux ({foo: bar}) {
-
- }
-
- /**
- * Description.
- * @param {string} b Description `/**`.
- */
- module.exports = function a(b) {
- console.info(b);
- };
-
- /**
- * Description.
- * @param {Object} options Options.
- * @param {FooBar} options.foo foo description.
- */
- function quux ({ foo: { bar } }) {}
-
- /**
- * Description.
- * @param {FooBar} options
- * @param {Object} options.foo
- */
- function quux ({ foo: { bar } }) {}
- // "jsdoc/require-param": ["error"|"warn", {"checkTypesPattern":"FooBar"}]
-
- /**
- * @param obj
- * @param obj.data
- * @param obj.data."0"
- * @param obj.data."1"
- * @param obj.data."2"
- * @param obj.defaulting
- * @param obj.defaulting."0"
- * @param obj.defaulting."1"
- */
- function Item({
- data: [foo, bar, ...baz],
- defaulting: [quux, xyz] = []
- }) {
- }
-
- /**
- * Returns a number.
- * @param {Object} props Props.
- * @param {Object} props.prop Prop.
- * @return {number} A number.
- */
- export function testFn1 ({ prop = { a: 1, b: 2 } }) {
- }
- // "jsdoc/require-param": ["error"|"warn", {"useDefaultObjectProperties":false}]
- ````
-
-
- <a name="eslint-plugin-jsdoc-rules-require-property"></a>
- ### <code>require-property</code>
-
- Requires that all `@typedef` and `@namespace` tags have `@property`
- when their type is a plain `object`, `Object`, or `PlainObject`.
-
- Note that any other type, including a subtype of object such as
- `object<string, string>`, will not be reported.
-
- <a name="eslint-plugin-jsdoc-rules-require-property-fixer-2"></a>
- #### Fixer
-
- The fixer for `require-property` will add an empty `@property`.
-
- |||
- |---|---|
- |Context|Everywhere|
- |Tags|`typedef`, `namespace`|
- |Recommended|true|
-
- The following patterns are considered problems:
-
- ````js
- /**
- * @typedef {object} SomeTypedef
- */
- // Message: Missing JSDoc @property.
-
- class Test {
- /**
- * @typedef {object} SomeTypedef
- */
- quux () {}
- }
- // Message: Missing JSDoc @property.
-
- /**
- * @typedef {PlainObject} SomeTypedef
- */
- // Settings: {"jsdoc":{"tagNamePreference":{"property":"prop"}}}
- // Message: Missing JSDoc @prop.
-
- /**
- * @namespace {Object} SomeName
- */
- // Message: Missing JSDoc @property.
- ````
-
- The following patterns are not considered problems:
-
- ````js
- /**
- *
- */
-
- /**
- * @property
- */
-
- /**
- * @typedef {Object} SomeTypedef
- * @property {SomeType} propName Prop description
- */
-
- /**
- * @typedef {object} SomeTypedef
- * @prop {SomeType} propName Prop description
- */
- // Settings: {"jsdoc":{"tagNamePreference":{"property":"prop"}}}
-
- /**
- * @typedef {object} SomeTypedef
- * @property
- * // arbitrary property content
- */
-
- /**
- * @typedef {object<string, string>} SomeTypedef
- */
-
- /**
- * @typedef {string} SomeTypedef
- */
-
- /**
- * @namespace {object} SomeName
- * @property {SomeType} propName Prop description
- */
-
- /**
- * @namespace {object} SomeName
- * @property
- * // arbitrary property content
- */
-
- /**
- * @typedef {object} SomeTypedef
- * @property someProp
- * @property anotherProp This with a description
- * @property {anotherType} yetAnotherProp This with a type and desc.
- */
- function quux () {
-
- }
- ````
-
-
- <a name="eslint-plugin-jsdoc-rules-require-property-description"></a>
- ### <code>require-property-description</code>
-
- Requires that each `@property` tag has a `description` value.
-
- |||
- |---|---|
- |Context|everywhere|
- |Tags|`property`|
- |Aliases|`prop`|
- |Recommended|true|
-
- The following patterns are considered problems:
-
- ````js
- /**
- * @typedef {SomeType} SomeTypedef
- * @property foo
- */
- // Message: Missing JSDoc @property "foo" description.
-
- /**
- * @typedef {SomeType} SomeTypedef
- * @prop foo
- */
- // Settings: {"jsdoc":{"tagNamePreference":{"property":"prop"}}}
- // Message: Missing JSDoc @prop "foo" description.
-
- /**
- * @typedef {SomeType} SomeTypedef
- * @property foo
- */
- // Settings: {"jsdoc":{"tagNamePreference":{"property":false}}}
- // Message: Unexpected tag `@property`
- ````
-
- The following patterns are not considered problems:
-
- ````js
- /**
- * @typedef {SomeType} SomeTypedef
- */
-
- /**
- * @typedef {SomeType} SomeTypedef
- * @property foo Foo.
- */
-
- /**
- * @namespace {SomeType} SomeName
- * @property foo Foo.
- */
-
- /**
- * @class
- * @property foo Foo.
- */
-
- /**
- * Typedef with multi-line property type.
- *
- * @typedef {object} MyType
- * @property {function(
- * number
- * )} numberEater Method which takes a number.
- */
- ````
-
-
- <a name="eslint-plugin-jsdoc-rules-require-property-name"></a>
- ### <code>require-property-name</code>
-
- Requires that all function `@property` tags have names.
-
- |||
- |---|---|
- |Context|everywhere|
- |Tags|`property`|
- |Aliases|`prop`|
- |Recommended|true|
-
- The following patterns are considered problems:
-
- ````js
- /**
- * @typedef {SomeType} SomeTypedef
- * @property
- */
- // Message: There must be an identifier after @property type.
-
- /**
- * @typedef {SomeType} SomeTypedef
- * @property {string}
- */
- // Message: There must be an identifier after @property tag.
-
- /**
- * @typedef {SomeType} SomeTypedef
- * @property foo
- */
- // Settings: {"jsdoc":{"tagNamePreference":{"property":false}}}
- // Message: Unexpected tag `@property`
- ````
-
- The following patterns are not considered problems:
-
- ````js
- /**
- * @typedef {SomeType} SomeTypedef
- * @property foo
- */
-
- /**
- * @typedef {SomeType} SomeTypedef
- * @property {string} foo
- */
-
- /**
- * @namespace {SomeType} SomeName
- * @property {string} foo
- */
-
- /**
- * @class
- * @property {string} foo
- */
- ````
-
-
- <a name="eslint-plugin-jsdoc-rules-require-property-type"></a>
- ### <code>require-property-type</code>
-
- Requires that each `@property` tag has a `type` value.
-
- |||
- |---|---|
- |Context|everywhere|
- |Tags|`property`|
- |Aliases|`prop`|
- |Recommended|true|
-
- The following patterns are considered problems:
-
- ````js
- /**
- * @typedef {SomeType} SomeTypedef
- * @property foo
- */
- // Message: Missing JSDoc @property "foo" type.
-
- /**
- * @typedef {SomeType} SomeTypedef
- * @prop foo
- */
- // Settings: {"jsdoc":{"tagNamePreference":{"property":"prop"}}}
- // Message: Missing JSDoc @prop "foo" type.
-
- /**
- * @typedef {SomeType} SomeTypedef
- * @property foo
- */
- // Settings: {"jsdoc":{"tagNamePreference":{"property":false}}}
- // Message: Unexpected tag `@property`
- ````
-
- The following patterns are not considered problems:
-
- ````js
- /**
- * @typedef {SomeType} SomeTypedef
- */
-
- /**
- * @typedef {SomeType} SomeTypedef
- * @property {number} foo
- */
-
- /**
- * @namespace {SomeType} SomeName
- * @property {number} foo
- */
-
- /**
- * @class
- * @property {number} foo
- */
- ````
-
-
- <a name="eslint-plugin-jsdoc-rules-require-returns-check"></a>
- ### <code>require-returns-check</code>
-
- Requires a return statement (or non-`undefined` Promise resolve value) in
- function bodies if a `@returns` tag (without a `void` or `undefined` type)
- is specified in the function's jsdoc comment.
-
- Will also report `@returns {void}` and `@returns {undefined}` if `exemptAsync`
- is set to `false` no non-`undefined` returned or resolved value is found.
-
- Will also report if multiple `@returns` tags are present.
-
- <a name="eslint-plugin-jsdoc-rules-require-returns-check-options-33"></a>
- #### Options
-
- - `exemptGenerators`- Because a generator might be labeled as having a
- `IterableIterator` `@returns` value (along with an iterator type
- corresponding to the type of any `yield` statements), projects might wish to
- leverage `@returns` in generators even without a` return` statement. This
- option is therefore `true` by default in `typescript` mode (in "jsdoc" mode,
- one might be more likely to take advantage of `@yields`). Set it to `false`
- if you wish for a missing `return` to be flagged regardless.
- - `exemptAsync` - By default, functions which return a `Promise` that are not
- detected as resolving with a non-`undefined` value and `async` functions
- (even ones that do not explicitly return a value, as these are returning a
- `Promise` implicitly) will be exempted from reporting by this rule.
- If you wish to insist that only `Promise`'s which resolve to
- non-`undefined` values or `async` functions with explicit `return`'s will
- be exempted from reporting (i.e., that `async` functions can be reported
- if they lack an explicit (non-`undefined`) `return` when a `@returns` is
- present), you can set `exemptAsync` to `false` on the options object.
- - `reportMissingReturnForUndefinedTypes` - If `true` and no return or
- resolve value is found, this setting will even insist that reporting occur
- with `void` or `undefined` (including as an indicated `Promise` type).
- Unlike `require-returns`, with this option in the rule, one can
- *discourage* the labeling of `undefined` types. Defaults to `false`.
-
- |||
- |---|---|
- |Context|`ArrowFunctionExpression`, `FunctionDeclaration`, `FunctionExpression`|
- |Tags|`returns`|
- |Aliases|`return`|
- |Options|`exemptAsync`, `reportMissingReturnForUndefinedTypes`|
- |Recommended|true|
-
- The following patterns are considered problems:
-
- ````js
- /**
- * @returns
- */
- function quux (foo) {
-
- }
- // Message: JSDoc @returns declaration present but return expression not available in function.
-
- /**
- * @return
- */
- function quux (foo) {
-
- }
- // Settings: {"jsdoc":{"tagNamePreference":{"returns":"return"}}}
- // Message: JSDoc @return declaration present but return expression not available in function.
-
- /**
- * @returns
- */
- const quux = () => {}
- // Message: JSDoc @returns declaration present but return expression not available in function.
-
- /**
- * @returns {undefined} Foo.
- * @returns {String} Foo.
- */
- function quux () {
-
- return foo;
- }
- // Message: Found more than one @returns declaration.
-
- const language = {
- /**
- * @param {string} name
- * @returns {string}
- */
- get name() {
- this._name = name;
- }
- }
- // Message: JSDoc @returns declaration present but return expression not available in function.
-
- class Foo {
- /**
- * @returns {string}
- */
- bar () {
- }
- }
- // Message: JSDoc @returns declaration present but return expression not available in function.
-
- /**
- * @returns
- */
- function quux () {
-
- }
- // Settings: {"jsdoc":{"tagNamePreference":{"returns":false}}}
- // Message: Unexpected tag `@returns`
-
- /**
- * @returns {string}
- */
- function f () {
- function g() {
- return 'foo'
- }
-
- () => {
- return 5
- }
- }
- // Message: JSDoc @returns declaration present but return expression not available in function.
-
- /**
- * @returns {Promise<void>}
- */
- async function quux() {}
- // "jsdoc/require-returns-check": ["error"|"warn", {"exemptAsync":false}]
- // Message: JSDoc @returns declaration present but return expression not available in function.
-
- /**
- * @returns {IterableIterator<any>}
- */
- function * quux() {}
- // Settings: {"jsdoc":{"mode":"jsdoc"}}
- // Message: JSDoc @returns declaration present but return expression not available in function.
-
- /**
- * @returns {IterableIterator<any>}
- */
- function * quux() {}
- // Settings: {"jsdoc":{"mode":"typescript"}}
- // "jsdoc/require-returns-check": ["error"|"warn", {"exemptGenerators":false}]
- // Message: JSDoc @returns declaration present but return expression not available in function.
-
- /**
- * @returns {Promise<void>}
- */
- function quux() {
- return new Promise((resolve, reject) => {})
- }
- // "jsdoc/require-returns-check": ["error"|"warn", {"exemptAsync":false}]
- // Message: JSDoc @returns declaration present but return expression not available in function.
-
- /**
- * @returns {Promise<void>}
- */
- function quux() {
- return new Promise((resolve, reject) => {
- setTimeout(() => {
- resolve();
- });
- })
- }
- // "jsdoc/require-returns-check": ["error"|"warn", {"exemptAsync":false}]
- // Message: JSDoc @returns declaration present but return expression not available in function.
-
- /**
- * Description.
- * @returns {string}
- */
- async function foo() {
- return new Promise(resolve => resolve());
- }
- // "jsdoc/require-returns-check": ["error"|"warn", {"exemptAsync":false}]
- // Message: JSDoc @returns declaration present but return expression not available in function.
-
- /**
- * Description.
- * @returns {void}
- */
- async function foo() {
- return new Promise(resolve => resolve());
- }
- // "jsdoc/require-returns-check": ["error"|"warn", {"exemptAsync":false,"reportMissingReturnForUndefinedTypes":true}]
- // Message: JSDoc @returns declaration present but return expression not available in function.
-
- /**
- * @returns { void } Foo.
- */
- function quux () {}
- // "jsdoc/require-returns-check": ["error"|"warn", {"reportMissingReturnForUndefinedTypes":true}]
- // Message: JSDoc @returns declaration present but return expression not available in function.
- ````
-
- The following patterns are not considered problems:
-
- ````js
- /**
- * @returns Foo.
- */
- function quux () {
-
- return foo;
- }
-
- /**
- * @returns {string} Foo.
- */
- function quux () {
-
- return foo;
- }
-
- /**
- * @returns {string} Foo.
- */
- function quux () {
-
- return foo;
- }
-
- /**
- *
- */
- function quux () {
- }
-
- /**
- * @returns {*} Foo.
- */
- const quux = () => foo;
-
- /**
- * @returns {undefined} Foo.
- */
- function quux () {}
-
- /**
- * @returns { void } Foo.
- */
- function quux () {}
-
- /**
- * @returns {Promise<void>}
- */
- async function quux() {}
-
- /**
- * @returns {Promise<void>}
- */
- const quux = async function () {}
-
- /**
- * @returns {Promise<void>}
- */
- const quux = async () => {}
-
- /**
- * @returns Foo.
- * @abstract
- */
- function quux () {
- throw new Error('must be implemented by subclass!');
- }
-
- /**
- * @returns Foo.
- * @virtual
- */
- function quux () {
- throw new Error('must be implemented by subclass!');
- }
-
- /**
- * @returns Foo.
- * @constructor
- */
- function quux () {
- }
-
- /**
- * @interface
- */
- class Foo {
- /**
- * @returns {string}
- */
- bar () {
- }
- }
-
- /**
- * @record
- */
- class Foo {
- /**
- * @returns {string}
- */
- bar () {
- }
- }
- // Settings: {"jsdoc":{"mode":"closure"}}
-
- /**
- * @returns {undefined} Foo.
- */
- function quux () {
- }
-
- /**
- * @returns {void} Foo.
- */
- function quux () {
- }
-
- /**
- * @returns {void} Foo.
- */
- function quux () {
- return undefined;
- }
-
- /**
- * @returns {void} Foo.
- */
- function quux () {
- return;
- }
-
- /**
- *
- */
- function quux () {
- return undefined;
- }
-
- /**
- *
- */
- function quux () {
- return;
- }
-
- /**
- * @returns {true}
- */
- function quux () {
- try {
- return true;
- } catch (err) {
- }
- return;
- }
-
- /**
- * @returns {true}
- */
- function quux () {
- try {
- } finally {
- return true;
- }
- return;
- }
-
- /**
- * @returns {true}
- */
- function quux () {
- try {
- return;
- } catch (err) {
- }
- return true;
- }
-
- /**
- * @returns {true}
- */
- function quux () {
- try {
- something();
- } catch (err) {
- return true;
- }
- return;
- }
-
- /**
- * @returns {true}
- */
- function quux () {
- switch (true) {
- case 'abc':
- return true;
- }
- return;
- }
-
- /**
- * @returns {true}
- */
- function quux () {
- switch (true) {
- case 'abc':
- return;
- }
- return true;
- }
-
- /**
- * @returns {true}
- */
- function quux () {
- for (const i of abc) {
- return true;
- }
- return;
- }
-
- /**
- * @returns {true}
- */
- function quux () {
- for (const a in b) {
- return true;
- }
- }
-
- /**
- * @returns {true}
- */
- function quux () {
- for (let i=0; i<n; i+=1) {
- return true;
- }
- }
-
- /**
- * @returns {true}
- */
- function quux () {
- while(true) {
- return true
- }
- }
-
- /**
- * @returns {true}
- */
- function quux () {
- do {
- return true
- }
- while(true)
- }
-
- /**
- * @returns {true}
- */
- function quux () {
- if (true) {
- return;
- }
- return true;
- }
-
- /**
- * @returns {true}
- */
- function quux () {
- if (true) {
- return true;
- }
- }
-
- /**
- * @returns {true}
- */
- function quux () {
- var a = {};
- with (a) {
- return true;
- }
- }
-
- /**
- * @returns {true}
- */
- function quux () {
- if (true) {
- return;
- } else {
- return true;
- }
- return;
- }
-
- /**
- * @returns {Promise<number>}
- */
- async function quux() {
- return 5;
- }
-
- /**
- * @returns {Promise<number>}
- */
- async function quux() {
- return 5;
- }
- // "jsdoc/require-returns-check": ["error"|"warn", {"exemptAsync":false}]
-
- /**
- * @returns {Promise<void>}
- */
- function quux() {
- return new Promise((resolve, reject) => {
- setTimeout(() => {
- resolve(true);
- });
- })
- }
- // "jsdoc/require-returns-check": ["error"|"warn", {"exemptAsync":false}]
-
- /**
- * Description.
- * @returns {void}
- */
- async function foo() {
- return new Promise(resolve => resolve());
- }
- // "jsdoc/require-returns-check": ["error"|"warn", {"reportMissingReturnForUndefinedTypes":true}]
-
- /**
- * @returns { void } Foo.
- */
- function quux () {
- return undefined;
- }
- // "jsdoc/require-returns-check": ["error"|"warn", {"reportMissingReturnForUndefinedTypes":true}]
-
- /**
- * @returns { string } Foo.
- */
- function quux () {
- return 'abc';
- }
- // "jsdoc/require-returns-check": ["error"|"warn", {"reportMissingReturnForUndefinedTypes":true}]
-
- /**
- * @returns {IterableIterator<any>}
- */
- function * quux() {}
- // Settings: {"jsdoc":{"mode":"typescript"}}
-
- /**
- * @returns {IterableIterator<any>}
- */
- function * quux() {}
- // Settings: {"jsdoc":{"mode":"jsdoc"}}
- // "jsdoc/require-returns-check": ["error"|"warn", {"exemptGenerators":true}]
- ````
-
-
- <a name="eslint-plugin-jsdoc-rules-require-returns-description"></a>
- ### <code>require-returns-description</code>
-
- Requires that the `@returns` tag has a `description` value. The error
- will not be reported if the return value is `void` or `undefined`
- or if it is `Promise<void>` or `Promise<undefined>`.
-
- <a name="eslint-plugin-jsdoc-rules-require-returns-description-options-34"></a>
- #### Options
-
- <a name="eslint-plugin-jsdoc-rules-require-returns-description-options-34-contexts-12"></a>
- ##### <code>contexts</code>
-
- Set this to an array of strings representing the AST context (or an object with
- `context` and `comment` properties) where you wish the rule to be applied.
- Overrides the default contexts (see below). Set to `"any"` if you want
- the rule to apply to any jsdoc block throughout your files (as is necessary
- for finding function blocks not attached to a function declaration or
- expression, i.e., `@callback` or `@function` (or its aliases `@func` or
- `@method`) (including those associated with an `@interface`).
-
- See the ["AST and Selectors"](#eslint-plugin-jsdoc-advanced-ast-and-selectors)
- section of our README for more on the expected format.
-
- |||
- |---|---|
- |Context|`ArrowFunctionExpression`, `FunctionDeclaration`, `FunctionExpression`; others when `contexts` option enabled|
- |Tags|`returns`|
- |Aliases|`return`|
- |Recommended|true|
- |Options|`contexts`|
-
- The following patterns are considered problems:
-
- ````js
- /**
- * @returns
- */
- function quux (foo) {
-
- }
- // Message: Missing JSDoc @returns description.
-
- /**
- * @returns {string}
- */
- function quux (foo) {
-
- }
- // Message: Missing JSDoc @returns description.
-
- /**
- * @returns {string}
- */
- function quux (foo) {
-
- }
- // "jsdoc/require-returns-description": ["error"|"warn", {"contexts":["any"]}]
- // Message: Missing JSDoc @returns description.
-
- /**
- * @function
- * @returns {string}
- */
- // "jsdoc/require-returns-description": ["error"|"warn", {"contexts":["any"]}]
- // Message: Missing JSDoc @returns description.
-
- /**
- * @callback
- * @returns {string}
- */
- // "jsdoc/require-returns-description": ["error"|"warn", {"contexts":["any"]}]
- // Message: Missing JSDoc @returns description.
-
- /**
- * @return
- */
- function quux (foo) {
-
- }
- // Settings: {"jsdoc":{"tagNamePreference":{"returns":"return"}}}
- // Message: Missing JSDoc @return description.
-
- /**
- * @returns
- */
- function quux () {
-
- }
- // Settings: {"jsdoc":{"tagNamePreference":{"returns":false}}}
- // Message: Unexpected tag `@returns`
- ````
-
- The following patterns are not considered problems:
-
- ````js
- /**
- *
- */
- function quux () {
-
- }
-
- /**
- * @returns Foo.
- */
- function quux () {
-
- }
-
- /**
- * @returns Foo.
- */
- function quux () {
-
- }
- // "jsdoc/require-returns-description": ["error"|"warn", {"contexts":["any"]}]
-
- /**
- * @returns {undefined}
- */
- function quux () {
-
- }
-
- /**
- * @returns {void}
- */
- function quux () {
-
- }
-
- /**
- * @returns {Promise<void>}
- */
- function quux () {
-
- }
-
- /**
- * @returns {Promise<undefined>}
- */
- function quux () {
-
- }
-
- /**
- * @function
- * @returns
- */
-
- /**
- * @callback
- * @returns
- */
- ````
-
-
- <a name="eslint-plugin-jsdoc-rules-require-returns-type"></a>
- ### <code>require-returns-type</code>
-
- Requires that `@returns` tag has `type` value.
-
- <a name="eslint-plugin-jsdoc-rules-require-returns-type-options-35"></a>
- #### Options
-
- <a name="eslint-plugin-jsdoc-rules-require-returns-type-options-35-contexts-13"></a>
- ##### <code>contexts</code>
-
- Set this to an array of strings representing the AST context (or an object with
- `context` and `comment` properties) where you wish the rule to be applied.
- Overrides the default contexts (see below). Set to `"any"` if you want
- the rule to apply to any jsdoc block throughout your files (as is necessary
- for finding function blocks not attached to a function declaration or
- expression, i.e., `@callback` or `@function` (or its aliases `@func` or
- `@method`) (including those associated with an `@interface`).
-
- See the ["AST and Selectors"](#eslint-plugin-jsdoc-advanced-ast-and-selectors)
- section of our README for more on the expected format.
-
- |||
- |---|---|
- |Context|`ArrowFunctionExpression`, `FunctionDeclaration`, `FunctionExpression`; others when `contexts` option enabled|
- |Tags|`returns`|
- |Aliases|`return`|
- |Recommended|true|
- |Options|`contexts`|
-
- The following patterns are considered problems:
-
- ````js
- /**
- * @returns
- */
- function quux () {
-
- }
- // Message: Missing JSDoc @returns type.
-
- /**
- * @returns Foo.
- */
- function quux () {
-
- }
- // Message: Missing JSDoc @returns type.
-
- /**
- * @returns Foo.
- */
- function quux () {
-
- }
- // "jsdoc/require-returns-type": ["error"|"warn", {"contexts":["any"]}]
- // Message: Missing JSDoc @returns type.
-
- /**
- * @function
- * @returns Foo.
- */
- // "jsdoc/require-returns-type": ["error"|"warn", {"contexts":["any"]}]
- // Message: Missing JSDoc @returns type.
-
- /**
- * @callback
- * @returns Foo.
- */
- // "jsdoc/require-returns-type": ["error"|"warn", {"contexts":["any"]}]
- // Message: Missing JSDoc @returns type.
-
- /**
- * @return Foo.
- */
- function quux () {
-
- }
- // Settings: {"jsdoc":{"tagNamePreference":{"returns":"return"}}}
- // Message: Missing JSDoc @return type.
-
- /**
- * @returns
- */
- function quux () {
-
- }
- // Settings: {"jsdoc":{"tagNamePreference":{"returns":false}}}
- // Message: Unexpected tag `@returns`
- ````
-
- The following patterns are not considered problems:
-
- ````js
- /**
- * @returns {number}
- */
- function quux () {
-
- }
-
- /**
- * @returns {number}
- */
- function quux () {
-
- }
- // "jsdoc/require-returns-type": ["error"|"warn", {"contexts":["any"]}]
-
- /**
- * @function
- * @returns Foo.
- */
-
- /**
- * @callback
- * @returns Foo.
- */
- ````
-
-
- <a name="eslint-plugin-jsdoc-rules-require-returns"></a>
- ### <code>require-returns</code>
-
- Requires that returns are documented.
-
- Will also report if multiple `@returns` tags are present.
-
- <a name="eslint-plugin-jsdoc-rules-require-returns-options-36"></a>
- #### Options
-
- - `checkConstructors` - A value indicating whether `constructor`s should
- be checked for `@returns` tags. Defaults to `false`.
- - `checkGetters` - Boolean to determine whether getter methods should
- be checked for `@returns` tags. Defaults to `true`.
- - `exemptedBy` - Array of tags (e.g., `['type']`) whose presence on the
- document block avoids the need for a `@returns`. Defaults to an array
- with `inheritdoc`. If you set this array, it will overwrite the default,
- so be sure to add back `inheritdoc` if you wish its presence to cause
- exemption of the rule.
- - `forceRequireReturn` - Set to `true` to always insist on
- `@returns` documentation regardless of implicit or explicit `return`'s
- in the function. May be desired to flag that a project is aware of an
- `undefined`/`void` return. Defaults to `false`.
- - `forceReturnsWithAsync` - By default `async` functions that do not explicitly
- return a value pass this rule as an `async` function will always return a
- `Promise`, even if the `Promise` resolves to void. You can force all
- `async` functions (including ones with an explicit `Promise` but no
- detected non-`undefined` `resolve` value) to require `@return`
- documentation by setting `forceReturnsWithAsync` to `true` on the options
- object. This may be useful for flagging that there has been consideration
- of return type. Defaults to `false`.
- - `contexts` - Set this to an array of strings representing the AST context
- (or an object with `context` and `comment` properties) where you wish
- the rule to be applied.
- Overrides the default contexts (see below). Set to `"any"` if you want
- the rule to apply to any jsdoc block throughout your files (as is necessary
- for finding function blocks not attached to a function declaration or
- expression, i.e., `@callback` or `@function` (or its aliases `@func` or
- `@method`) (including those associated with an `@interface`). This
- rule will only apply on non-default contexts when there is such a tag
- present and the `forceRequireReturn` option is set or if the
- `forceReturnsWithAsync` option is set with a present `@async` tag
- (since we are not checking against the actual `return` values in these
- cases).
-
- | | |
- | -------- | ------- |
- | Context | `ArrowFunctionExpression`, `FunctionDeclaration`, `FunctionExpression`; others when `contexts` option enabled |
- | Tags | `returns` |
- | Aliases | `return` |
- |Recommended|true|
- | Options | `checkConstructors`, `checkGetters`, `contexts`, `exemptedBy`, `forceRequireReturn`, `forceReturnsWithAsync` |
- | Settings | `ignoreReplacesDocs`, `overrideReplacesDocs`, `augmentsExtendsReplacesDocs`, `implementsReplacesDocs` |
-
- The following patterns are considered problems:
-
- ````js
- /**
- *
- */
- function quux (foo) {
-
- return foo;
- }
- // Message: Missing JSDoc @returns declaration.
-
- /**
- *
- */
- const foo = () => ({
- bar: 'baz'
- })
- // Message: Missing JSDoc @returns declaration.
-
- /**
- *
- */
- const foo = bar=>({ bar })
- // Message: Missing JSDoc @returns declaration.
-
- /**
- *
- */
- const foo = bar => bar.baz()
- // Message: Missing JSDoc @returns declaration.
-
- /**
- *
- */
- function quux (foo) {
-
- return foo;
- }
- // Settings: {"jsdoc":{"tagNamePreference":{"returns":"return"}}}
- // Message: Missing JSDoc @return declaration.
-
- /**
- *
- */
- async function quux() {
- }
- // "jsdoc/require-returns": ["error"|"warn", {"forceRequireReturn":true}]
- // Message: Missing JSDoc @returns declaration.
-
- /**
- *
- */
- const quux = async function () {}
- // "jsdoc/require-returns": ["error"|"warn", {"forceRequireReturn":true}]
- // Message: Missing JSDoc @returns declaration.
-
- /**
- *
- */
- const quux = async () => {}
- // "jsdoc/require-returns": ["error"|"warn", {"forceRequireReturn":true}]
- // Message: Missing JSDoc @returns declaration.
-
- /**
- *
- */
- async function quux () {}
- // "jsdoc/require-returns": ["error"|"warn", {"forceRequireReturn":true}]
- // Message: Missing JSDoc @returns declaration.
-
- /**
- *
- */
- function quux () {
- }
- // "jsdoc/require-returns": ["error"|"warn", {"forceRequireReturn":true}]
- // Message: Missing JSDoc @returns declaration.
-
- /**
- *
- */
- function quux () {
- }
- // "jsdoc/require-returns": ["error"|"warn", {"contexts":["any"],"forceRequireReturn":true}]
- // Message: Missing JSDoc @returns declaration.
-
- /**
- * @function
- */
- // "jsdoc/require-returns": ["error"|"warn", {"contexts":["any"],"forceRequireReturn":true}]
- // Message: Missing JSDoc @returns declaration.
-
- /**
- * @callback
- */
- // "jsdoc/require-returns": ["error"|"warn", {"contexts":["any"],"forceRequireReturn":true}]
- // Message: Missing JSDoc @returns declaration.
-
- const language = {
- /**
- * @param {string} name
- */
- get name() {
- return this._name;
- }
- }
- // Message: Missing JSDoc @returns declaration.
-
- /**
- *
- */
- async function quux () {
- }
- // "jsdoc/require-returns": ["error"|"warn", {"forceReturnsWithAsync":true}]
- // Message: Missing JSDoc @returns declaration.
-
- /**
- * @function
- * @async
- */
- // "jsdoc/require-returns": ["error"|"warn", {"contexts":["any"],"forceReturnsWithAsync":true}]
- // Message: Missing JSDoc @returns declaration.
-
- /**
- * @callback
- * @async
- */
- // "jsdoc/require-returns": ["error"|"warn", {"contexts":["any"],"forceReturnsWithAsync":true}]
- // Message: Missing JSDoc @returns declaration.
-
- /**
- * @returns {undefined}
- * @returns {void}
- */
- function quux (foo) {
-
- return foo;
- }
- // Message: Found more than one @returns declaration.
-
- /**
- * @returns
- */
- function quux () {
-
- }
- // Settings: {"jsdoc":{"tagNamePreference":{"returns":false}}}
- // Message: Unexpected tag `@returns`
-
- /**
- * @param foo
- */
- function quux (foo) {
- return 'bar';
- }
- // "jsdoc/require-returns": ["error"|"warn", {"exemptedBy":["notPresent"]}]
- // Message: Missing JSDoc @returns declaration.
-
- /**
- * @param {array} a
- */
- async function foo(a) {
- return;
- }
- // "jsdoc/require-returns": ["error"|"warn", {"forceReturnsWithAsync":true}]
- // Message: Missing JSDoc @returns declaration.
-
- /**
- * @param {array} a
- */
- async function foo(a) {
- return Promise.all(a);
- }
- // "jsdoc/require-returns": ["error"|"warn", {"forceReturnsWithAsync":true}]
- // Message: Missing JSDoc @returns declaration.
-
- class foo {
- /** gets bar */
- get bar() {
- return 0;
- }
- }
- // "jsdoc/require-returns": ["error"|"warn", {"checkGetters":true}]
- // Message: Missing JSDoc @returns declaration.
-
- class TestClass {
- /**
- *
- */
- constructor() {
- return new Map();
- }
- }
- // "jsdoc/require-returns": ["error"|"warn", {"checkConstructors":true}]
- // Message: Missing JSDoc @returns declaration.
-
- class TestClass {
- /**
- *
- */
- get Test() {
- return 0;
- }
- }
- // "jsdoc/require-returns": ["error"|"warn", {"checkGetters":true}]
- // Message: Missing JSDoc @returns declaration.
-
- class quux {
- /**
- *
- */
- quux () {
- }
- }
- // "jsdoc/require-returns": ["error"|"warn", {"contexts":["any"],"forceRequireReturn":true}]
- // Message: Missing JSDoc @returns declaration.
-
- /**
- * @param {array} a
- */
- async function foo(a) {
- return Promise.all(a);
- }
- // Message: Missing JSDoc @returns declaration.
-
- /**
- *
- */
- function quux (foo) {
-
- return new Promise(function (resolve, reject) {
- resolve(foo);
- });
- }
- // Message: Missing JSDoc @returns declaration.
-
- /**
- *
- */
- function quux (foo) {
-
- return new Promise(function (resolve, reject) {
- setTimeout(() => {
- resolve(true);
- });
- });
- }
- // Message: Missing JSDoc @returns declaration.
-
- /**
- *
- */
- function quux (foo) {
-
- return new Promise(function (resolve, reject) {
- foo(resolve);
- });
- }
- // Message: Missing JSDoc @returns declaration.
-
- /**
- *
- */
- function quux () {
- return new Promise((resolve, reject) => {
- while(true) {
- resolve(true);
- }
- });
- }
- // Message: Missing JSDoc @returns declaration.
-
- /**
- *
- */
- function quux () {
- return new Promise((resolve, reject) => {
- do {
- resolve(true);
- }
- while(true)
- });
- }
- // Message: Missing JSDoc @returns declaration.
-
- /**
- *
- */
- function quux () {
- return new Promise((resolve, reject) => {
- if (true) {
- resolve(true);
- }
- return;
- });
- }
- // Message: Missing JSDoc @returns declaration.
-
- /**
- *
- */
- function quux () {
- return new Promise((resolve, reject) => {
- if (true) {
- resolve(true);
- }
- });
- }
- // Message: Missing JSDoc @returns declaration.
-
- /**
- *
- */
- function quux () {
- var a = {};
- return new Promise((resolve, reject) => {
- with (a) {
- resolve(true);
- }
- });
- }
- // Message: Missing JSDoc @returns declaration.
-
- /**
- *
- */
- function quux () {
- var a = {};
- return new Promise((resolve, reject) => {
- try {
- resolve(true);
- } catch (err) {}
- });
- }
- // Message: Missing JSDoc @returns declaration.
-
- /**
- *
- */
- function quux () {
- var a = {};
- return new Promise((resolve, reject) => {
- try {
- } catch (err) {
- resolve(true);
- }
- });
- }
- // Message: Missing JSDoc @returns declaration.
-
- /**
- *
- */
- function quux () {
- var a = {};
- return new Promise((resolve, reject) => {
- try {
- } catch (err) {
- } finally {
- resolve(true);
- }
- });
- }
- // Message: Missing JSDoc @returns declaration.
-
- /**
- *
- */
- function quux () {
- var a = {};
- return new Promise((resolve, reject) => {
- switch (a) {
- case 'abc':
- resolve(true);
- }
- });
- }
- // Message: Missing JSDoc @returns declaration.
-
- /**
- *
- */
- function quux () {
- return new Promise((resolve, reject) => {
- if (true) {
- resolve();
- } else {
- resolve(true);
- }
- });
- }
- // Message: Missing JSDoc @returns declaration.
-
- /**
- *
- */
- function quux () {
- return new Promise((resolve, reject) => {
- for (let i = 0; i < 5 ; i++) {
- resolve(true);
- }
- });
- }
- // Message: Missing JSDoc @returns declaration.
-
- /**
- *
- */
- function quux () {
- return new Promise((resolve, reject) => {
- for (const i of obj) {
- resolve(true);
- }
- });
- }
- // Message: Missing JSDoc @returns declaration.
-
- /**
- *
- */
- function quux () {
- return new Promise((resolve, reject) => {
- for (const i in obj) {
- resolve(true);
- }
- });
- }
- // Message: Missing JSDoc @returns declaration.
-
- /**
- *
- */
- function quux () {
- return new Promise((resolve, reject) => {
- if (true) {
- return;
- } else {
- resolve(true);
- }
- });
- }
- // Message: Missing JSDoc @returns declaration.
-
- /**
- *
- */
- function quux () {
- return new Promise((resolve, reject) => {
- function a () {
- resolve(true);
- }
- a();
- });
- }
- // Message: Missing JSDoc @returns declaration.
-
- /**
- *
- */
- function quux () {
- return new Promise();
- }
- // "jsdoc/require-returns": ["error"|"warn", {"forceReturnsWithAsync":true}]
- // Message: Missing JSDoc @returns declaration.
-
- /**
- *
- */
- async function quux () {
- return new Promise();
- }
- // "jsdoc/require-returns": ["error"|"warn", {"forceReturnsWithAsync":true}]
- // Message: Missing JSDoc @returns declaration.
-
- /**
- *
- */
- async function quux () {
- return new Promise((resolve, reject) => {});
- }
- // "jsdoc/require-returns": ["error"|"warn", {"forceReturnsWithAsync":true}]
- // Message: Missing JSDoc @returns declaration.
-
- export class A {
- /**
- * Description.
- */
- public f(): string {
- return "";
- }
- }
-
- export interface B {
- /**
- * Description.
- */
- f(): string;
-
- /**
- * Description.
- */
- g: () => string;
-
- /**
- * Description.
- */
- h(): void;
-
- /**
- * Description.
- */
- i: () => void;
- }
-
- /**
- * Description.
- */
- export function f(): string {
- return "";
- }
- // "jsdoc/require-returns": ["error"|"warn", {"contexts":[":not(BlockStatement) > FunctionDeclaration","MethodDefinition","TSMethodSignature","TSPropertySignature > TSTypeAnnotation > TSFunctionType"]}]
- // Message: Missing JSDoc @returns declaration.
- ````
-
- The following patterns are not considered problems:
-
- ````js
- /**
- * @returns Foo.
- */
- function quux () {
-
- return foo;
- }
-
- /**
- * @returns Foo.
- */
- function quux () {
-
- return foo;
- }
- // "jsdoc/require-returns": ["error"|"warn", {"contexts":["any"]}]
-
- /**
- *
- */
- function quux () {
- }
-
- /**
- *
- */
- function quux (bar) {
- bar.filter(baz => {
- return baz.corge();
- })
- }
-
- /**
- * @returns Array
- */
- function quux (bar) {
- return bar.filter(baz => {
- return baz.corge();
- })
- }
-
- /**
- * @returns Array
- */
- const quux = (bar) => bar.filter(({ corge }) => corge())
-
- /**
- * @inheritdoc
- */
- function quux (foo) {
- }
-
- /**
- * @override
- */
- function quux (foo) {
- }
-
- /**
- * @constructor
- */
- function quux (foo) {
- return true;
- }
-
- /**
- * @implements
- */
- function quux (foo) {
- return true;
- }
-
- /**
- * @override
- */
- function quux (foo) {
-
- return foo;
- }
-
- /**
- * @class
- */
- function quux (foo) {
- return true;
- }
-
- /**
- * @constructor
- */
- function quux (foo) {
-
- }
-
- /**
- * @returns {object}
- */
- function quux () {
-
- return {a: foo};
- }
-
- /**
- * @returns {object}
- */
- const quux = () => ({a: foo});
-
- /**
- * @returns {object}
- */
- const quux = () => {
- return {a: foo}
- };
-
- /**
- * @returns {void}
- */
- function quux () {
- }
-
- /**
- * @returns {void}
- */
- const quux = () => {
-
- }
-
- /**
- * @returns {undefined}
- */
- function quux () {
- }
-
- /**
- * @returns {undefined}
- */
- const quux = () => {
-
- }
-
- /**
- *
- */
- function quux () {
- }
-
- /**
- *
- */
- const quux = () => {
-
- }
-
- class Foo {
- /**
- *
- */
- constructor () {
- }
- }
- // "jsdoc/require-returns": ["error"|"warn", {"forceRequireReturn":true}]
-
- const language = {
- /**
- * @param {string} name
- */
- set name(name) {
- this._name = name;
- }
- }
-
- /**
- * @returns {void}
- */
- function quux () {
- }
- // "jsdoc/require-returns": ["error"|"warn", {"forceRequireReturn":true}]
-
- /**
- * @returns {void}
- */
- function quux () {
- return undefined;
- }
-
- /**
- * @returns {void}
- */
- function quux () {
- return undefined;
- }
- // "jsdoc/require-returns": ["error"|"warn", {"forceRequireReturn":true}]
-
- /**
- * @returns {void}
- */
- function quux () {
- return;
- }
-
- /**
- * @returns {void}
- */
- function quux () {
- }
- // "jsdoc/require-returns": ["error"|"warn", {"forceRequireReturn":true}]
-
- /**
- * @returns {void}
- */
- function quux () {
- return;
- }
- // "jsdoc/require-returns": ["error"|"warn", {"forceRequireReturn":true}]
-
- /** @type {RequestHandler} */
- function quux (req, res , next) {
- return;
- }
-
- /**
- * @returns {Promise}
- */
- async function quux () {
- }
- // "jsdoc/require-returns": ["error"|"warn", {"forceRequireReturn":true}]
-
- /**
- * @returns {Promise}
- */
- async function quux () {
- }
- // "jsdoc/require-returns": ["error"|"warn", {"forceReturnsWithAsync":true}]
-
- /**
- *
- */
- async function quux () {}
-
- /**
- *
- */
- const quux = async function () {}
-
- /**
- *
- */
- const quux = async () => {}
-
- /** foo class */
- class foo {
- /** foo constructor */
- constructor () {
- // =>
- this.bar = true;
- }
- }
-
- export default foo;
-
- /**
- *
- */
- function quux () {
- }
- // "jsdoc/require-returns": ["error"|"warn", {"forceReturnsWithAsync":true}]
-
- /**
- * @type {MyCallback}
- */
- function quux () {
-
- }
- // "jsdoc/require-returns": ["error"|"warn", {"exemptedBy":["type"]}]
-
- /**
- * @param {array} a
- */
- async function foo(a) {
- return;
- }
-
- /**
- *
- */
- // "jsdoc/require-returns": ["error"|"warn", {"contexts":["any"]}]
-
- /**
- * @async
- */
- // "jsdoc/require-returns": ["error"|"warn", {"contexts":["any"]}]
-
- /**
- * @function
- */
- // "jsdoc/require-returns": ["error"|"warn", {"forceRequireReturn":true}]
-
- /**
- * @callback
- */
- // "jsdoc/require-returns": ["error"|"warn", {"forceRequireReturn":true}]
-
- /**
- * @function
- * @async
- */
- // "jsdoc/require-returns": ["error"|"warn", {"forceReturnsWithAsync":true}]
-
- /**
- * @callback
- * @async
- */
- // "jsdoc/require-returns": ["error"|"warn", {"forceReturnsWithAsync":true}]
-
- /**
- * @function
- */
- // "jsdoc/require-returns": ["error"|"warn", {"contexts":["any"],"forceReturnsWithAsync":true}]
-
- /**
- * @callback
- */
- // "jsdoc/require-returns": ["error"|"warn", {"contexts":["any"],"forceReturnsWithAsync":true}]
-
- class foo {
- get bar() {
- return 0;
- }
- }
- // "jsdoc/require-returns": ["error"|"warn", {"checkGetters":false}]
-
- class foo {
- /** @returns zero */
- get bar() {
- return 0;
- }
- }
- // "jsdoc/require-returns": ["error"|"warn", {"checkGetters":true}]
-
- class foo {
- /** @returns zero */
- get bar() {
- return 0;
- }
- }
- // "jsdoc/require-returns": ["error"|"warn", {"checkGetters":false}]
-
- class TestClass {
- /**
- *
- */
- constructor() { }
- }
-
- class TestClass {
- /**
- * @returns A map.
- */
- constructor() {
- return new Map();
- }
- }
-
- class TestClass {
- /**
- *
- */
- constructor() { }
- }
- // "jsdoc/require-returns": ["error"|"warn", {"checkConstructors":false}]
-
- class TestClass {
- /**
- *
- */
- get Test() { }
- }
-
- class TestClass {
- /**
- * @returns A number.
- */
- get Test() {
- return 0;
- }
- }
-
- class TestClass {
- /**
- *
- */
- get Test() {
- return 0;
- }
- }
- // "jsdoc/require-returns": ["error"|"warn", {"checkGetters":false}]
-
- /**
- *
- */
- function quux (foo) {
-
- return new Promise(function (resolve, reject) {
- resolve();
- });
- }
-
- /**
- *
- */
- function quux (foo) {
-
- return new Promise(function (resolve, reject) {
- setTimeout(() => {
- resolve();
- });
- });
- }
-
- /**
- *
- */
- function quux (foo) {
-
- return new Promise(function (resolve, reject) {
- foo();
- });
- }
-
- /**
- *
- */
- function quux (foo) {
-
- return new Promise(function (resolve, reject) {
- abc((resolve) => {
- resolve(true);
- });
- });
- }
-
- /**
- *
- */
- function quux (foo) {
-
- return new Promise(function (resolve, reject) {
- abc(function (resolve) {
- resolve(true);
- });
- });
- }
-
- /**
- *
- */
- function quux () {
- return new Promise((resolve, reject) => {
- if (true) {
- resolve();
- }
- });
- return;
- }
-
- /**
- *
- */
- function quux () {
- return new Promise();
- }
-
- /**
- * Description.
- */
- async function foo() {
- return new Promise(resolve => resolve());
- }
- ````
-
-
- <a name="eslint-plugin-jsdoc-rules-require-throws"></a>
- ### <code>require-throws</code>
-
- Requires that throw statements are documented.
-
- <a name="eslint-plugin-jsdoc-rules-require-throws-options-37"></a>
- #### Options
-
- - `exemptedBy` - Array of tags (e.g., `['type']`) whose presence on the
- document block avoids the need for a `@throws`. Defaults to an array
- with `inheritdoc`. If you set this array, it will overwrite the default,
- so be sure to add back `inheritdoc` if you wish its presence to cause
- exemption of the rule.
- - `contexts` - Set this to an array of strings representing the AST context
- (or an object with `context` and `comment` properties) where you wish
- the rule to be applied.
- Overrides the default contexts (see below). Set to `"any"` if you want
- the rule to apply to any jsdoc block throughout your files (as is necessary
- for finding function blocks not attached to a function declaration or
- expression, i.e., `@callback` or `@function` (or its aliases `@func` or
- `@method`) (including those associated with an `@interface`).
-
- ```js
- 'jsdoc/require-throws': 'error',
- ```
-
- | | |
- | -------- | --- |
- | Context | `ArrowFunctionExpression`, `FunctionDeclaration`, `FunctionExpression`; others when `contexts` option enabled |
- | Tags | `throws` |
- | Aliases | `exception` |
- |Recommended|true|
- | Options | `contexts`, `exemptedBy` |
- | Settings | `ignoreReplacesDocs`, `overrideReplacesDocs`, `augmentsExtendsReplacesDocs`, `implementsReplacesDocs` |
-
- The following patterns are considered problems:
-
- ````js
- /**
- *
- */
- function quux (foo) {
- throw new Error('err')
- }
- // Message: Missing JSDoc @throws declaration.
-
- /**
- *
- */
- const quux = function (foo) {
- throw new Error('err')
- }
- // Message: Missing JSDoc @throws declaration.
-
- /**
- *
- */
- const quux = (foo) => {
- throw new Error('err')
- }
- // Message: Missing JSDoc @throws declaration.
-
- /**
- *
- */
- function quux (foo) {
- while(true) {
- throw new Error('err')
- }
- }
- // Message: Missing JSDoc @throws declaration.
-
- /**
- *
- */
- function quux (foo) {
- do {
- throw new Error('err')
- } while(true)
- }
- // Message: Missing JSDoc @throws declaration.
-
- /**
- *
- */
- function quux (foo) {
- for(var i = 0; i <= 10; i++) {
- throw new Error('err')
- }
- }
- // Message: Missing JSDoc @throws declaration.
-
- /**
- *
- */
- function quux (foo) {
- for(num in [1,2,3]) {
- throw new Error('err')
- }
- }
- // Message: Missing JSDoc @throws declaration.
-
- /**
- *
- */
- function quux (foo) {
- for(const num of [1,2,3]) {
- throw new Error('err')
- }
- }
- // Message: Missing JSDoc @throws declaration.
-
- /**
- *
- */
- function quux (foo) {
- for(const index in [1,2,3]) {
- throw new Error('err')
- }
- }
- // Message: Missing JSDoc @throws declaration.
-
- /**
- *
- */
- function quux (foo) {
- with(foo) {
- throw new Error('err')
- }
- }
- // Message: Missing JSDoc @throws declaration.
-
- /**
- *
- */
- function quux (foo) {
- if (true) {
- throw new Error('err')
- }
- }
- // Message: Missing JSDoc @throws declaration.
-
- /**
- *
- */
- function quux (foo) {
- if (false) {
- // do nothing
- } else {
- throw new Error('err')
- }
- }
- // Message: Missing JSDoc @throws declaration.
-
- /**
- *
- */
- function quux (foo) {
- try {
- throw new Error('err')
- } catch(e) {
- throw new Error(e.message)
- }
- }
- // Message: Missing JSDoc @throws declaration.
-
- /**
- *
- */
- function quux (foo) {
- try {
- // do nothing
- } finally {
- throw new Error(e.message)
- }
- }
- // Message: Missing JSDoc @throws declaration.
-
- /**
- *
- */
- function quux (foo) {
- const a = 'b'
- switch(a) {
- case 'b':
- throw new Error('err')
- }
- }
- // Message: Missing JSDoc @throws declaration.
-
- /**
- * @throws
- */
- function quux () {
-
- }
- // Settings: {"jsdoc":{"tagNamePreference":{"throws":false}}}
- // Message: Unexpected tag `@throws`
-
- /**
- *
- */
- const directThrowAfterArrow = (b) => {
- const a = () => {};
- if (b) {
- throw new Error('oops')
- }
- return a;
- };
- // Message: Missing JSDoc @throws declaration.
- ````
-
- The following patterns are not considered problems:
-
- ````js
- /**
- * @throws An error.
- */
- function quux () {
- throw new Error('err')
- }
-
- /**
- *
- */
- function quux (foo) {
- try {
- throw new Error('err')
- } catch(e) {}
- }
-
- /**
- * @inheritdoc
- */
- function quux (foo) {
- throw new Error('err')
- }
-
- /**
- * @abstract
- */
- function quux (foo) {
- throw new Error('err')
- }
-
- /**
- *
- */
- function quux (foo) {
- }
-
- /**
- * @type {MyCallback}
- */
- function quux () {
- throw new Error('err')
- }
- // "jsdoc/require-throws": ["error"|"warn", {"exemptedBy":["type"]}]
-
- /**
- *
- */
- const itself = (n) => n;
-
- /**
- * Not tracking on nested function
- */
- const nested = () => () => {throw new Error('oops');};
-
- /**
- */
- async function foo() {
- throw Error("bar");
- }
- ````
-
-
- <a name="eslint-plugin-jsdoc-rules-require-yields"></a>
- ### <code>require-yields</code>
-
- Requires that yields are documented.
-
- Will also report if multiple `@yields` tags are present.
-
- See the `next`, `forceRequireNext`, and `nextWithGeneratorTag` options for an
- option to expect a non-standard `@next` tag.
-
- <a name="eslint-plugin-jsdoc-rules-require-yields-options-38"></a>
- #### Options
-
- - `exemptedBy` - Array of tags (e.g., `['type']`) whose presence on the
- document block avoids the need for a `@yields`. Defaults to an array
- with `inheritdoc`. If you set this array, it will overwrite the default,
- so be sure to add back `inheritdoc` if you wish its presence to cause
- exemption of the rule.
- - `forceRequireYields` - Set to `true` to always insist on
- `@yields` documentation for generators even if there are only
- expressionless `yield` statements in the function. May be desired to flag
- that a project is aware of an `undefined`/`void` yield. Defaults to
- `false`.
- - `contexts` - Set this to an array of strings representing the AST context
- (or an object with `context` and `comment` properties) where you wish
- the rule to be applied.
- Overrides the default contexts (see below). Set to `"any"` if you want
- the rule to apply to any jsdoc block throughout your files (as is necessary
- for finding function blocks not attached to a function declaration or
- expression, i.e., `@callback` or `@function` (or its aliases `@func` or
- `@method`) (including those associated with an `@interface`). This
- rule will only apply on non-default contexts when there is such a tag
- present and the `forceRequireYields` option is set or if the
- `withGeneratorTag` option is set with a present `@generator` tag
- (since we are not checking against the actual `yield` values in these
- cases).
- - `withGeneratorTag` - If a `@generator` tag is present on a block, require
- `@yields`/`@yield`. Defaults to `true`. See `contexts` to `any` if you want
- to catch `@generator` with `@callback` or such not attached to a function.
- - `next` - If `true`, this option will insist that any use of a `yield` return
- value (e.g., `const rv = yield;` or `const rv = yield value;`) has a
- (non-standard) `@next` tag (in addition to any `@yields` tag) so as to be
- able to document the type expected to be supplied into the iterator
- (the `Generator` iterator that is returned by the call to the generator
- function) to the iterator (e.g., `it.next(value)`). The tag will not be
- expected if the generator function body merely has plain `yield;` or
- `yield value;` statements without returning the values. Defaults to
- `false`.
- - `forceRequireNext` - Set to `true` to always insist on
- `@next` documentation even if there are no `yield` statements in the
- function or none return values. May be desired to flag that a project is
- aware of the expected yield return being `undefined`. Defaults to `false`.
- - `nextWithGeneratorTag` - If a `@generator` tag is present on a block, require
- (non-standard ) `@next` (see `next` option). This will require using `void`
- or `undefined` in cases where generators do not use the `next()`-supplied
- incoming `yield`-returned value. Defaults to `false`. See `contexts` to
- `any` if you want to catch `@generator` with `@callback` or such not
- attached to a function.
-
- |||
- |---|---|
- |Context|Generator functions (`FunctionDeclaration`, `FunctionExpression`; others when `contexts` option enabled)|
- |Tags|`yields`|
- |Aliases|`yield`|
- |Recommended|true|
- | Options | `contexts`, `exemptedBy`, `withGeneratorTag`, `nextWithGeneratorTag`, `forceRequireYields`, `next` |
- | Settings | `ignoreReplacesDocs`, `overrideReplacesDocs`, `augmentsExtendsReplacesDocs`, `implementsReplacesDocs` |
-
- The following patterns are considered problems:
-
- ````js
- /**
- *
- */
- function * quux (foo) {
-
- yield foo;
- }
- // Message: Missing JSDoc @yields declaration.
-
- /**
- * @yields
- */
- function * quux (foo) {
-
- const retVal = yield foo;
- }
- // "jsdoc/require-yields": ["error"|"warn", {"next":true}]
- // Message: Missing JSDoc @next declaration.
-
- /**
- * @yields
- */
- function * quux (foo) {
-
- const retVal = yield;
- }
- // "jsdoc/require-yields": ["error"|"warn", {"next":true}]
- // Message: Missing JSDoc @next declaration.
-
- /**
- * @yields {void}
- */
- function * quux () {
- }
- // "jsdoc/require-yields": ["error"|"warn", {"forceRequireNext":true}]
- // Message: Missing JSDoc @next declaration.
-
- /**
- * @yields {void}
- */
- function * quux () {
- yield;
- }
- // "jsdoc/require-yields": ["error"|"warn", {"forceRequireNext":true}]
- // Message: Missing JSDoc @next declaration.
-
- /**
- *
- */
- function * quux (foo) {
-
- const a = yield foo;
- }
- // Message: Missing JSDoc @yields declaration.
-
- /**
- *
- */
- function * quux (foo) {
- yield foo;
- }
- // Settings: {"jsdoc":{"tagNamePreference":{"yields":"yield"}}}
- // Message: Missing JSDoc @yield declaration.
-
- /**
- * @yields
- */
- function * quux (foo) {
- const val = yield foo;
- }
- // Settings: {"jsdoc":{"tagNamePreference":{"next":"yield-returns"}}}
- // "jsdoc/require-yields": ["error"|"warn", {"next":true}]
- // Message: Missing JSDoc @yield-returns declaration.
-
- /**
- * @yields
- * @next
- */
- function * quux () {
- const ret = yield 5;
- }
- // Settings: {"jsdoc":{"tagNamePreference":{"next":false}}}
- // "jsdoc/require-yields": ["error"|"warn", {"next":true}]
- // Message: Unexpected tag `@next`
-
- /**
- *
- */
- function * quux() {
- yield 5;
- }
- // "jsdoc/require-yields": ["error"|"warn", {"forceRequireYields":true}]
- // Message: Missing JSDoc @yields declaration.
-
- /**
- *
- */
- function * quux() {
- yield;
- }
- // "jsdoc/require-yields": ["error"|"warn", {"forceRequireYields":true}]
- // Message: Missing JSDoc @yields declaration.
-
- /**
- *
- */
- const quux = async function * () {
- yield;
- }
- // "jsdoc/require-yields": ["error"|"warn", {"forceRequireYields":true}]
- // Message: Missing JSDoc @yields declaration.
-
- /**
- *
- */
- async function * quux () {
- yield;
- }
- // "jsdoc/require-yields": ["error"|"warn", {"forceRequireYields":true}]
- // Message: Missing JSDoc @yields declaration.
-
- /**
- *
- */
- function * quux () {
- yield;
- }
- // "jsdoc/require-yields": ["error"|"warn", {"contexts":["any"],"forceRequireYields":true}]
- // Message: Missing JSDoc @yields declaration.
-
- /**
- * @function
- * @generator
- */
- // "jsdoc/require-yields": ["error"|"warn", {"contexts":["any"],"forceRequireYields":true}]
- // Message: Missing JSDoc @yields declaration.
-
- /**
- * @callback
- * @generator
- */
- // "jsdoc/require-yields": ["error"|"warn", {"contexts":["any"],"forceRequireYields":true}]
- // Message: Missing JSDoc @yields declaration.
-
- /**
- * @yields {undefined}
- * @yields {void}
- */
- function * quux (foo) {
-
- return foo;
- }
- // Message: Found more than one @yields declaration.
-
- /**
- * @yields
- */
- function * quux () {
-
- }
- // Settings: {"jsdoc":{"tagNamePreference":{"yields":false}}}
- // Message: Unexpected tag `@yields`
-
- /**
- * @param foo
- */
- function * quux (foo) {
- yield 'bar';
- }
- // "jsdoc/require-yields": ["error"|"warn", {"exemptedBy":["notPresent"]}]
- // Message: Missing JSDoc @yields declaration.
-
- /**
- * @param {array} a
- */
- async function * foo(a) {
- return;
- }
- // "jsdoc/require-yields": ["error"|"warn", {"forceRequireYields":true}]
- // Message: Missing JSDoc @yields declaration.
-
- /**
- * @param {array} a
- */
- async function * foo(a) {
- yield Promise.all(a);
- }
- // "jsdoc/require-yields": ["error"|"warn", {"forceRequireYields":true}]
- // Message: Missing JSDoc @yields declaration.
-
- class quux {
- /**
- *
- */
- * quux () {
- yield;
- }
- }
- // "jsdoc/require-yields": ["error"|"warn", {"contexts":["any"],"forceRequireYields":true}]
- // Message: Missing JSDoc @yields declaration.
-
- /**
- * @param {array} a
- */
- async function * foo(a) {
- yield Promise.all(a);
- }
- // Message: Missing JSDoc @yields declaration.
-
- /**
- * @generator
- */
- // "jsdoc/require-yields": ["error"|"warn", {"contexts":["any"],"withGeneratorTag":true}]
- // Message: Missing JSDoc @yields declaration.
-
- /**
- * @generator
- * @yields
- */
- // "jsdoc/require-yields": ["error"|"warn", {"contexts":["any"],"nextWithGeneratorTag":true}]
- // Message: Missing JSDoc @next declaration.
-
- /**
- *
- */
- function * quux () {
- if (true) {
- yield;
- }
- yield true;
- }
- // Message: Missing JSDoc @yields declaration.
-
- /**
- *
- */
- function * quux () {
- try {
- yield true;
- } catch (err) {
- }
- yield;
- }
- // Message: Missing JSDoc @yields declaration.
-
- /**
- *
- */
- function * quux () {
- try {
- } finally {
- yield true;
- }
- yield;
- }
- // Message: Missing JSDoc @yields declaration.
-
- /**
- *
- */
- function * quux () {
- try {
- yield;
- } catch (err) {
- }
- yield true;
- }
- // Message: Missing JSDoc @yields declaration.
-
- /**
- *
- */
- function * quux () {
- try {
- something();
- } catch (err) {
- yield true;
- }
- yield;
- }
- // Message: Missing JSDoc @yields declaration.
-
- /**
- *
- */
- function * quux () {
- switch (true) {
- case 'abc':
- yield true;
- }
- yield;
- }
- // Message: Missing JSDoc @yields declaration.
-
- /**
- *
- */
- function * quux () {
- switch (true) {
- case 'abc':
- yield;
- }
- yield true;
- }
- // Message: Missing JSDoc @yields declaration.
-
- /**
- *
- */
- function * quux () {
- for (const i of abc) {
- yield true;
- }
- yield;
- }
- // Message: Missing JSDoc @yields declaration.
-
- /**
- *
- */
- function * quux () {
- for (const a in b) {
- yield true;
- }
- }
- // Message: Missing JSDoc @yields declaration.
-
- /**
- *
- */
- function * quux () {
- for (let i=0; i<n; i+=1) {
- yield true;
- }
- }
- // Message: Missing JSDoc @yields declaration.
-
- /**
- *
- */
- function * quux () {
- while(true) {
- yield true
- }
- }
- // Message: Missing JSDoc @yields declaration.
-
- /**
- *
- */
- function * quux () {
- do {
- yield true
- }
- while(true)
- }
- // Message: Missing JSDoc @yields declaration.
-
- /**
- *
- */
- function * quux () {
- if (true) {
- yield;
- }
- yield true;
- }
- // Message: Missing JSDoc @yields declaration.
-
- /**
- *
- */
- function * quux () {
- if (true) {
- yield true;
- }
- }
- // Message: Missing JSDoc @yields declaration.
-
- /**
- *
- */
- function * quux () {
- var a = {};
- with (a) {
- yield true;
- }
- }
- // Message: Missing JSDoc @yields declaration.
-
- /**
- *
- */
- function * quux () {
- if (true) {
- yield;
- } else {
- yield true;
- }
- yield;
- }
- // Message: Missing JSDoc @yields declaration.
- ````
-
- The following patterns are not considered problems:
-
- ````js
- /**
- * @yields Foo.
- */
- function * quux () {
-
- yield foo;
- }
-
- /**
- * @yields Foo.
- */
- function * quux () {
-
- yield foo;
- }
- // "jsdoc/require-yields": ["error"|"warn", {"contexts":["any"]}]
-
- /**
- *
- */
- function * quux () {
- }
-
- /**
- *
- */
- function * quux () {
- yield;
- }
-
- /**
- *
- */
- function quux (bar) {
- bar.doSomething(function * (baz) {
- yield baz.corge();
- })
- }
-
- /**
- * @yields {Array}
- */
- function * quux (bar) {
- yield bar.doSomething(function * (baz) {
- yield baz.corge();
- })
- }
-
- /**
- * @inheritdoc
- */
- function * quux (foo) {
- }
-
- /**
- * @override
- */
- function * quux (foo) {
- }
-
- /**
- * @constructor
- */
- function * quux (foo) {
- }
-
- /**
- * @implements
- */
- function * quux (foo) {
- yield;
- }
-
- /**
- * @override
- */
- function * quux (foo) {
-
- yield foo;
- }
-
- /**
- * @class
- */
- function * quux (foo) {
- yield foo;
- }
-
- /**
- * @constructor
- */
- function * quux (foo) {
- }
-
- /**
- * @yields {object}
- */
- function * quux () {
-
- yield {a: foo};
- }
-
- /**
- * @yields {void}
- */
- function * quux () {
- }
-
- /**
- * @yields {undefined}
- */
- function * quux () {
- }
-
- /**
- *
- */
- function * quux () {
- }
-
- /**
- * @yields {void}
- */
- function quux () {
- }
- // "jsdoc/require-yields": ["error"|"warn", {"forceRequireYields":true}]
-
- /**
- * @yields {void}
- * @next {void}
- */
- function * quux () {
- }
- // "jsdoc/require-yields": ["error"|"warn", {"forceRequireNext":true}]
-
- /**
- * @yields {void}
- */
- function * quux () {
- yield undefined;
- }
-
- /**
- * @yields {void}
- */
- function * quux () {
- yield undefined;
- }
- // "jsdoc/require-yields": ["error"|"warn", {"forceRequireYields":true}]
-
- /**
- * @yields {void}
- */
- function * quux () {
- yield;
- }
-
- /**
- * @yields {void}
- */
- function * quux () {
- }
- // "jsdoc/require-yields": ["error"|"warn", {"forceRequireYields":true}]
-
- /**
- * @yields {void}
- */
- function * quux () {
- yield;
- }
- // "jsdoc/require-yields": ["error"|"warn", {"forceRequireYields":true}]
-
- /** @type {SpecialIterator} */
- function * quux () {
- yield 5;
- }
-
- /**
- * @yields {Something}
- */
- async function * quux () {
- }
- // "jsdoc/require-yields": ["error"|"warn", {"forceRequireYields":true}]
-
- /**
- *
- */
- async function * quux () {}
-
- /**
- *
- */
- const quux = async function * () {}
-
- /**
- * @type {MyCallback}
- */
- function * quux () {
- yield;
- }
- // "jsdoc/require-yields": ["error"|"warn", {"exemptedBy":["type"]}]
-
- /**
- * @param {array} a
- */
- async function * foo (a) {
- yield;
- }
-
- /**
- *
- */
- // "jsdoc/require-yields": ["error"|"warn", {"contexts":["any"]}]
-
- /**
- * @function
- */
- // "jsdoc/require-yields": ["error"|"warn", {"contexts":["any"]}]
-
- /**
- * @function
- */
- // "jsdoc/require-yields": ["error"|"warn", {"forceRequireYields":true}]
-
- /**
- * @callback
- */
- // "jsdoc/require-yields": ["error"|"warn", {"forceRequireYields":true}]
-
- /**
- * @generator
- */
- // "jsdoc/require-yields": ["error"|"warn", {"withGeneratorTag":true}]
-
- /**
- * @generator
- */
- // "jsdoc/require-yields": ["error"|"warn", {"nextWithGeneratorTag":true}]
-
- /**
- * @generator
- * @yields
- */
- // "jsdoc/require-yields": ["error"|"warn", {"contexts":["any"],"withGeneratorTag":true}]
-
- /**
- * @generator
- * @yields
- * @next
- */
- // "jsdoc/require-yields": ["error"|"warn", {"contexts":["any"],"nextWithGeneratorTag":true}]
-
- /**
- * @generator
- */
- // "jsdoc/require-yields": ["error"|"warn", {"contexts":["any"],"withGeneratorTag":false}]
-
- /**
- * @generator
- * @yields
- */
- // "jsdoc/require-yields": ["error"|"warn", {"contexts":["any"],"nextWithGeneratorTag":false}]
-
- /**
- * @yields
- */
- function * quux (foo) {
-
- const a = yield foo;
- }
-
- /**
- * @yields
- * @next
- */
- function * quux (foo) {
- let a = yield;
- }
- // "jsdoc/require-yields": ["error"|"warn", {"next":true}]
-
- /**
- * @yields
- * @next
- */
- function * quux (foo) {
- const a = yield foo;
- }
- // "jsdoc/require-yields": ["error"|"warn", {"next":true}]
-
- /**
- *
- */
- // "jsdoc/require-yields": ["error"|"warn", {"contexts":["any"],"nextWithGeneratorTag":true}]
-
- /**
- *
- */
- // "jsdoc/require-yields": ["error"|"warn", {"contexts":["any"],"next":true}]
-
- /**
- *
- */
- function quux () {}
- // "jsdoc/require-yields": ["error"|"warn", {"contexts":["any"],"next":true}]
-
- /**
- * @yields {void}
- */
- function * quux () {
- yield;
- }
- // "jsdoc/require-yields": ["error"|"warn", {"next":true}]
-
- /**
- *
- */
- function * quux (foo) {
- const a = function * bar () {
- yield foo;
- }
- }
- ````
-
-
- <a name="eslint-plugin-jsdoc-rules-require-yields-check"></a>
- ### <code>require-yields-check</code>
-
- Ensures that if a `@yields` is present that a `yield` (or `yield` with a
- value) is present in the function body (or that if a `@next` is present that
- there is a `yield` with a return value present).
-
- Please also note that JavaScript does allow generators not to have `yield`
- (e.g., with just a return or even no explicit return), but if you want to
- enforce that all generators (except wholly empty ones) have a `yield` in the
- function body, you can use the ESLint
- [`require-yield`](https://eslint.org/docs/rules/require-yield) rule. In
- conjunction with this, you can also use the `checkGeneratorsOnly` option
- as an optimization so that this rule won't need to do its own checking within
- function bodies.
-
- Will also report if multiple `@yields` tags are present.
-
- <a name="eslint-plugin-jsdoc-rules-require-yields-check-options-39"></a>
- #### Options
-
- - `checkGeneratorsOnly` - Avoids checking the function body and merely insists
- that all generators have `@yields`. This can be an optimization with the
- ESLint `require-yield` rule, as that rule already ensures a `yield` is
- present in generators, albeit assuming the generator is not empty).
- Defaults to `false`.
- - `next` - If `true`, this option will insist that any use of a (non-standard)
- `@next` tag (in addition to any `@yields` tag) will be matched by a `yield`
- which uses a return value in the body of the generator (e.g.,
- `const rv = yield;` or `const rv = yield value;`). This (non-standard)
- tag is intended to be used to indicate a type and/or description of
- the value expected to be supplied by the user when supplied to the iterator
- by its `next` method, as with `it.next(value)` (with the iterator being
- the `Generator` iterator that is returned by the call to the generator
- function). This option will report an error if the generator function body
- merely has plain `yield;` or `yield value;` statements without returning
- the values. Defaults to `false`.
-
- |||
- |---|---|
- |Context|`ArrowFunctionExpression`, `FunctionDeclaration`, `FunctionExpression`|
- |Tags|`yields`|
- |Aliases|`yield`|
- |Recommended|true|
- |Options|`checkGeneratorsOnly`|
- The following patterns are considered problems:
-
- ````js
- /**
- * @yields
- */
- function * quux (foo) {
-
- }
- // Message: JSDoc @yields declaration present but yield expression not available in function.
-
- /**
- * @yields
- */
- function quux (foo) {
-
- }
- // "jsdoc/require-yields-check": ["error"|"warn", {"checkGeneratorsOnly":true}]
- // Message: JSDoc @yields declaration present but yield expression not available in function.
-
- /**
- * @next
- */
- function quux (foo) {
-
- }
- // "jsdoc/require-yields-check": ["error"|"warn", {"checkGeneratorsOnly":true,"next":true}]
- // Message: JSDoc @next declaration present but yield expression with return value not available in function.
-
- /**
- * @next {SomeType}
- */
- function * quux (foo) {
-
- }
- // "jsdoc/require-yields-check": ["error"|"warn", {"next":true}]
- // Message: JSDoc @next declaration present but yield expression with return value not available in function.
-
- /**
- * @next {SomeType}
- */
- function * quux (foo) {
- yield;
- }
- // "jsdoc/require-yields-check": ["error"|"warn", {"next":true}]
- // Message: JSDoc @next declaration present but yield expression with return value not available in function.
-
- /**
- * @next {SomeType}
- */
- function * quux (foo) {
- yield 5;
- }
- // "jsdoc/require-yields-check": ["error"|"warn", {"next":true}]
- // Message: JSDoc @next declaration present but yield expression with return value not available in function.
-
- /**
- * @yield
- */
- function * quux (foo) {
-
- }
- // Settings: {"jsdoc":{"tagNamePreference":{"yields":"yield"}}}
- // Message: JSDoc @yield declaration present but yield expression not available in function.
-
- /**
- * @yield-returns {Something}
- */
- function * quux (foo) {
- yield;
- }
- // Settings: {"jsdoc":{"tagNamePreference":{"next":"yield-returns"}}}
- // "jsdoc/require-yields-check": ["error"|"warn", {"next":true}]
- // Message: JSDoc @yield-returns declaration present but yield expression with return value not available in function.
-
- /**
- * @yields {undefined} Foo.
- * @yields {String} Foo.
- */
- function * quux () {
-
- yield foo;
- }
- // Message: Found more than one @yields declaration.
-
- class Foo {
- /**
- * @yields {string}
- */
- * bar () {
- }
- }
- // Message: JSDoc @yields declaration present but yield expression not available in function.
-
- /**
- * @yields
- */
- function * quux () {
-
- }
- // Settings: {"jsdoc":{"tagNamePreference":{"yields":false}}}
- // Message: Unexpected tag `@yields`
-
- /**
- * @next
- */
- function * quux () {
-
- }
- // Settings: {"jsdoc":{"tagNamePreference":{"next":false}}}
- // "jsdoc/require-yields-check": ["error"|"warn", {"next":true}]
- // Message: Unexpected tag `@next`
-
- /**
- * @yields {string}
- */
- function * f () {
- function * g() {
- yield 'foo'
- }
- }
- // Message: JSDoc @yields declaration present but yield expression not available in function.
-
- /**
- * @yields {Promise<void>}
- */
- async function * quux() {}
- // Message: JSDoc @yields declaration present but yield expression not available in function.
-
- /**
- * @yields {Promise<void>}
- */
- const quux = async function * () {}
- // Message: JSDoc @yields declaration present but yield expression not available in function.
- ````
-
- The following patterns are not considered problems:
-
- ````js
- /**
- * @yields Foo.
- */
- function * quux () {
-
- yield foo;
- }
-
- /**
- * @yields {string} Foo.
- */
- function * quux () {
-
- yield foo;
- }
-
- /**
- * @yields {string} Foo.
- */
- function * quux () {
-
- yield foo;
- }
-
- /**
- *
- */
- function * quux () {
- }
-
- /**
- * @yields {undefined} Foo.
- */
- function * quux () {}
-
- /**
- * @yields { void } Foo.
- */
- function quux () {}
-
- /**
- * @yields Foo.
- * @abstract
- */
- function * quux () {
- throw new Error('must be implemented by subclass!');
- }
-
- /**
- * @yields Foo.
- * @virtual
- */
- function * quux () {
- throw new Error('must be implemented by subclass!');
- }
-
- /**
- * @yields Foo.
- * @constructor
- */
- function * quux () {
- }
-
- /**
- * @interface
- */
- class Foo {
- /**
- * @yields {string}
- */
- * bar () {
- }
- }
-
- /**
- * @record
- */
- class Foo {
- /**
- * @yields {string}
- */
- * bar () {
- }
- }
- // Settings: {"jsdoc":{"mode":"closure"}}
-
- /**
- * @yields {undefined} Foo.
- */
- function * quux () {
- }
-
- /**
- * @yields {void} Foo.
- */
- function * quux () {
- }
-
- /**
- * @yields {void} Foo.
- */
- function * quux () {
- yield undefined;
- }
-
- /**
- * @yields {void} Foo.
- */
- function * quux () {
- yield;
- }
-
- /**
- *
- */
- function * quux () {
- yield undefined;
- }
-
- /**
- *
- */
- function * quux () {
- yield;
- }
-
- /**
- * @yields {true}
- */
- function * quux () {
- try {
- yield true;
- } catch (err) {
- }
- yield;
- }
-
- /**
- * @yields {true}
- */
- function * quux () {
- try {
- } finally {
- yield true;
- }
- yield;
- }
-
- /**
- * @yields {true}
- */
- function * quux () {
- try {
- yield;
- } catch (err) {
- }
- yield true;
- }
-
- /**
- * @yields {true}
- */
- function * quux () {
- try {
- something();
- } catch (err) {
- yield true;
- }
- yield;
- }
-
- /**
- * @yields {true}
- */
- function * quux () {
- switch (true) {
- case 'abc':
- yield true;
- }
- yield;
- }
-
- /**
- * @yields {true}
- */
- function * quux () {
- switch (true) {
- case 'abc':
- yield;
- }
- yield true;
- }
-
- /**
- * @yields {true}
- */
- function * quux () {
- for (const i of abc) {
- yield true;
- }
- yield;
- }
-
- /**
- * @yields {true}
- */
- function * quux () {
- for (const a in b) {
- yield true;
- }
- }
-
- /**
- * @yields {true}
- */
- function * quux () {
- for (let i=0; i<n; i+=1) {
- yield true;
- }
- }
-
- /**
- * @yields {true}
- */
- function * quux () {
- while(true) {
- yield true
- }
- }
-
- /**
- * @yields {true}
- */
- function * quux () {
- do {
- yield true
- }
- while(true)
- }
-
- /**
- * @yields {true}
- */
- function * quux () {
- if (true) {
- yield;
- }
- yield true;
- }
-
- /**
- * @yields {true}
- */
- function * quux () {
- if (true) {
- yield true;
- }
- }
-
- /**
- * @yields {true}
- */
- function * quux () {
- var a = {};
- with (a) {
- yield true;
- }
- }
-
- /**
- * @yields {true}
- */
- function * quux () {
- if (true) {
- yield;
- } else {
- yield true;
- }
- yield;
- }
-
- /**
- * @next {void}
- */
- function * quux (foo) {
-
- }
- // "jsdoc/require-yields-check": ["error"|"warn", {"next":true}]
-
- /**
- * @next {SomeType}
- */
- function * quux (foo) {
- const a = yield;
- }
- // "jsdoc/require-yields-check": ["error"|"warn", {"next":true}]
-
- /**
- * @next {SomeType}
- */
- function * quux (foo) {
- const a = yield 5;
- }
- // "jsdoc/require-yields-check": ["error"|"warn", {"next":true}]
- ````
-
-
- <a name="eslint-plugin-jsdoc-rules-tag-lines"></a>
- ### <code>tag-lines</code>
-
- Enforces lines (or no lines) between tags.
-
- <a name="eslint-plugin-jsdoc-rules-tag-lines-options-40"></a>
- #### Options
-
- The first option is a single string set to "always", "never", or "any"
- (defaults to "never").
-
- "any" is only useful with `tags` (allowing non-enforcement of lines except
- for particular tags).
-
- The second option is an object with the following optional properties.
-
- <a name="eslint-plugin-jsdoc-rules-tag-lines-options-40-count-defaults-to-1"></a>
- ##### <code>count</code> (defaults to 1)
-
- Use with "always" to indicate the number of lines to require be present.
-
- <a name="eslint-plugin-jsdoc-rules-tag-lines-options-40-noendlines-defaults-to-false"></a>
- ##### <code>noEndLines</code> (defaults to <code>false</code>)
-
- Use with "always" to indicate the normal lines to be added after tags should
- not be added after the final tag.
-
- <a name="eslint-plugin-jsdoc-rules-tag-lines-options-40-tags-default-to-empty-object"></a>
- ##### <code>tags</code> (default to empty object)
-
- Overrides the default behavior depending on specific tags.
-
- An object whose keys are tag names and whose values are objects with the
- following keys:
-
- 1. `lines` - Set to `always`, `never`, or `any` to override.
- 2. `count` - Overrides main `count` (for "always")
-
- |||
- |---|---|
- |Context|everywhere|
- |Tags|Any|
- |Recommended|true|
- |Settings|N/A|
- |Options|(a string matching `"always" or "never"` and optional object with `count` and `noEndLines`)|
-
- The following patterns are considered problems:
-
- ````js
- /**
- * Some description
- * @param {string} a
- * @param {number} b
- */
- // "jsdoc/tag-lines": ["error"|"warn", "always"]
- // Message: Expected 1 line between tags but found 0
-
- /**
- * Some description
- * @param {string} a
- * @param {number} b
- */
- // "jsdoc/tag-lines": ["error"|"warn", "always",{"count":2}]
- // Message: Expected 2 lines between tags but found 0
-
- /**
- * Some description
- * @param {string} a
- *
- * @param {number} b
- */
- // "jsdoc/tag-lines": ["error"|"warn", "always",{"count":2}]
- // Message: Expected 2 lines between tags but found 1
-
- /**
- * Some description
- * @param {string} a
- * @param {number} b
- */
- // "jsdoc/tag-lines": ["error"|"warn", "always",{"noEndLines":true}]
- // Message: Expected 1 line between tags but found 0
-
- /**
- * Some description
- * @param {string} a
- *
- * @param {number} b
- *
- */
- // "jsdoc/tag-lines": ["error"|"warn", "never"]
- // Message: Expected no lines between tags
-
- /**
- * Some description
- * @param {string} a
- *
- * @param {number} b
- *
- */
- // Message: Expected no lines between tags
-
- /**
- * Some description
- * @param {string} a
- *
- * @param {number} b
- * @param {number} c
- */
- // "jsdoc/tag-lines": ["error"|"warn", "always"]
- // Message: Expected 1 line between tags but found 0
-
- /**
- * Some description
- * @param {string} a
- * @param {number} b
- */
- // "jsdoc/tag-lines": ["error"|"warn", "never",{"tags":{"param":{"lines":"always"}}}]
- // Message: Expected 1 line between tags but found 0
-
- /**
- * Some description
- * @param {string} a
- * @param {number} b
- */
- // "jsdoc/tag-lines": ["error"|"warn", "never",{"tags":{"param":{"lines":"always"}}}]
- // Message: Expected 1 line between tags but found 0
-
- /**
- * Some description
- * @param {string} a
- * @param {number} b
- *
- */
- // "jsdoc/tag-lines": ["error"|"warn", "always",{"tags":{"param":{"lines":"never"}}}]
- // Message: Expected no lines between tags
-
- /**
- * Some description
- * @param {string} a
- *
- * @param {number} b
- */
- // "jsdoc/tag-lines": ["error"|"warn", "never",{"count":2,"tags":{"param":{"lines":"always"}}}]
- // Message: Expected 2 lines between tags but found 1
-
- /**
- * Some description
- * @param {string} a
- *
- * @param {number} b
- */
- // "jsdoc/tag-lines": ["error"|"warn", "never",{"count":5,"tags":{"param":{"count":2,"lines":"always"}}}]
- // Message: Expected 2 lines between tags but found 1
-
- /**
- * Some description
- * @param {string} a
- * @param {number} b
- */
- // "jsdoc/tag-lines": ["error"|"warn", "always",{"tags":{"anotherTag":{"lines":"never"}}}]
- // Message: Expected 1 line between tags but found 0
-
- /**
- * Some description
- * @param {string} A broken up
- *
- * tag description.
- * @param {number} b
- *
- */
- // "jsdoc/tag-lines": ["error"|"warn", "always"]
- // Message: Expected 1 line between tags but found 0
-
- /**
- * Some description
- * @param {number} b
- *
- * @returns {string} A broken up
- *
- * tag description.
- */
- // "jsdoc/tag-lines": ["error"|"warn", "always"]
- // Message: Expected 1 line between tags but found 0
- ````
-
- The following patterns are not considered problems:
-
- ````js
- /**
- * Some description
- * @param {string} a
- * @param {number} b
- */
-
- /**
- * Some description
- * @param {string} a
- * @param {number} b
- */
- // "jsdoc/tag-lines": ["error"|"warn", "never"]
-
- /**
- * @param {string} a
- *
- * @param {string} a
- */
- // "jsdoc/tag-lines": ["error"|"warn", "always",{"noEndLines":true}]
-
- /**
- * @param {string} a
- */
- // "jsdoc/tag-lines": ["error"|"warn", "never",{"noEndLines":true}]
-
- /** @param {number} b */
- // "jsdoc/tag-lines": ["error"|"warn", "never",{"noEndLines":true}]
-
- /**
- * Some description
- * @param {string} a
- *
- * @param {number} b
- *
- */
- // "jsdoc/tag-lines": ["error"|"warn", "always"]
-
- /**
- * Some description
- * @param {string} a
- *
- *
- * @param {number} b
- *
- *
- */
- // "jsdoc/tag-lines": ["error"|"warn", "always",{"count":2}]
-
- /**
- * Some description
- * @param {string} a
- * @param {number} b
- */
- // "jsdoc/tag-lines": ["error"|"warn", "never",{"tags":{"param":{"lines":"any"}}}]
-
- /**
- * Some description
- * @param {string} a
- * @param {number} b
- */
- // "jsdoc/tag-lines": ["error"|"warn", "always",{"tags":{"param":{"lines":"any"}}}]
-
- /**
- * Some description
- * @param {string} a
- * @param {number} b
- */
- // "jsdoc/tag-lines": ["error"|"warn", "always",{"tags":{"param":{"lines":"never"}}}]
-
- /**
- * Some description
- * @param {number} a
- * @param {number} b
- */
- // "jsdoc/tag-lines": ["error"|"warn", "never",{"tags":{"param":{"lines":"any"}}}]
-
- /**
- * Some description
- * @param {number} a
- *
- * @param {number} b
- */
- // "jsdoc/tag-lines": ["error"|"warn", "never",{"tags":{"param":{"lines":"any"}}}]
-
- /**
- * Some description
- * @param {number} a
- * @param {number} b
- */
- // "jsdoc/tag-lines": ["error"|"warn", "never",{"tags":{"param":{"lines":"never"}}}]
-
- /**
- * Some description
- * @param {string} a
- *
- *
- * @param {number} b
- *
- *
- */
- // "jsdoc/tag-lines": ["error"|"warn", "never",{"count":5,"tags":{"param":{"count":2,"lines":"always"}}}]
-
- /**
- * Some description
- * @param {string} a
- * @param {number} b
- */
- // "jsdoc/tag-lines": ["error"|"warn", "never",{"tags":{"anotherTag":{"lines":"always"}}}]
-
- /**
- * Some description
- * @param {string} a
- *
- * This is still part of `@param`.
- * @returns {SomeType} An extended
- * description.
- */
- // "jsdoc/tag-lines": ["error"|"warn", "never"]
-
- /**
- * Some description
- * @param {string} a
- * @returns {SomeType} An extended
- * description.
- *
- * This is still part of `@returns`.
- */
- // "jsdoc/tag-lines": ["error"|"warn", "never"]
-
- /**
- * Some description
- * @param {string} a
- *
- * This is still part of `@param`.
- *
- * @returns {SomeType} An extended
- * description.
- *
- */
- // "jsdoc/tag-lines": ["error"|"warn", "always"]
-
- /**
- * Some description
- * @param {string} a
- *
- * @returns {SomeType} An extended
- * description.
- *
- * This is still part of `@returns`.
- *
- */
- // "jsdoc/tag-lines": ["error"|"warn", "always"]
- ````
-
-
- <a name="eslint-plugin-jsdoc-rules-valid-types"></a>
- ### <code>valid-types</code>
-
- Requires all types to be valid JSDoc, Closure, or TypeScript compiler types
- without syntax errors. Note that what determines a valid type is handled by
- our type parsing engine, [jsdoctypeparser](https://github.com/jsdoctypeparser/jsdoctypeparser),
- using [`settings.jsdoc.mode`](#eslint-plugin-jsdoc-settings-mode) to
- determine whether to use jsdoctypeparser's "permissive" mode or the stricter
- "jsdoc", "typescript", "closure" modes.
-
- The following tags have their "type" portions (the segment within brackets)
- checked (though those portions may sometimes be confined to namepaths,
- e.g., `@modifies`):
-
- 1. Tags with required types: `@type`, `@implements`
- 1. Tags with required types in Closure or TypeScript: `@this`,
- `@define` (Closure only)
- 1. Tags with optional types: `@enum`, `@member` (`@var`), `@typedef`,
- `@augments` (or `@extends`), `@class` (or `@constructor`), `@constant`
- (or `@const`), `@module` (module paths are not planned for TypeScript),
- `@namespace`, `@throws`, `@exception`, `@yields` (or `@yield`),
- `@modifies` (undocumented jsdoc); `@param` (`@arg`, `@argument`),
- `@property` (`@prop`), and `@returns` (`@return`) also fall into this
- category, but while this rule will check their type validity, we leave
- the requiring of the type portion to the rules `require-param-type`,
- `require-property-type`, and `require-returns-type`, respectively.
- 1. Tags with types that are available optionally in Closure: `@export`,
- `@package`, `@private`, `@protected`, `@public`, `@static`;
- `@template` (TypeScript also)
- 1. Tags with optional types that may take free text instead: `@throws`
-
- The following tags have their name/namepath portion (the non-whitespace
- text after the tag name) checked:
-
- 1. Name(path)-defining tags requiring namepath: `@event`, `@callback`,
- `@external`, `@host`, `@name`, `@typedef`, and `@template`
- (TypeScript/Closure only); `@param` (`@arg`, `@argument`) and `@property`
- (`@prop`) also fall into this category, but while this rule will check
- their namepath validity, we leave the requiring of the name portion
- to the rules `require-param-name` and `require-property-name`,
- respectively.
- 1. Name(path)-defining tags (which may have value without namepath or their
- namepath can be expressed elsewhere on the block):
- `@class`, `@constructor`, `@constant`, `@const`, `@function`, `@func`,
- `@method`, `@interface` (TypeScript tag only), `@member`, `@var`,
- `@mixin`, `@namespace`, `@module` (module paths are not planned for
- TypeScript)
- 1. Name(path)-pointing tags requiring namepath: `@alias`, `@augments`,
- `@extends`, `@lends`, `@memberof`, `@memberof!`, `@mixes`, `@this`
- (jsdoc only)
- 1. Name(path)-pointing tags (which may have value without namepath or their
- namepath can be expressed elsewhere on the block): `@listens`, `@fires`,
- `@emits`.
- 1. Name(path)-pointing tags which may have free text or a namepath: `@see`
- 1. Name(path)-pointing tags (multiple names in one): `@borrows`
-
- ...with the following applying to the above sets:
-
- - Expect tags in set 1-4 to have a valid namepath if present
- - Prevent sets 2 and 4 from being empty by setting `allowEmptyNamepaths` to
- `false` as these tags might have some indicative value without a path
- or may allow a name expressed elsewhere on the block (but sets 1 and 3 will
- always fail if empty)
- - For the special case of set 6, i.e.,
- `@borrows <that namepath> as <this namepath>`,
- check that both namepaths are present and valid and ensure there is an `as `
- between them. In the case of `<this namepath>`, it can be preceded by
- one of the name path operators, `#`, `.`, or `~`.
- - For the special case of `@memberof` and `@memberof!` (part of set 3), as
- per the [specification](https://jsdoc.app/tags-memberof.html), they also
- allow `#`, `.`, or `~` at the end (which is not allowed at the end of
- normal paths).
-
- If you define your own tags, `settings.jsdoc.structuredTags` will allow
- these custom tags to be checked, with the name portion of tags checked for
- valid namepaths (based on the tag's `name` value), their type portions checked
- for valid types (based on the tag's `type` value), and either portion checked
- for presence (based on `false` `name` or `type` values or their `required`
- value). See the setting for more details.
-
- <a name="eslint-plugin-jsdoc-rules-valid-types-options-41"></a>
- #### Options
-
- - `allowEmptyNamepaths` (default: true) - Set to `false` to bulk disallow
- empty name paths with namepath groups 2 and 4 (these might often be
- expected to have an accompanying name path, though they have some
- indicative value without one; these may also allow names to be defined
- in another manner elsewhere in the block); you can use
- `settings.jsdoc.structuredTags` with the `required` key set to "name" if you
- wish to require name paths on a tag-by-tag basis.
-
- |||
- |---|---|
- |Context|everywhere|
- |Tags|For name only unless otherwise stated: `alias`, `augments`, `borrows`, `callback`, `class` (for name and type), `constant` (for name and type), `enum` (for type), `event`, `external`, `fires`, `function`, `implements` (for type), `interface`, `lends`, `listens`, `member` (for name and type), `memberof`, `memberof!`, `mixes`, `mixin`, `modifies`, `module` (for name and type), `name`, `namespace` (for name and type), `param` (for name and type), `property` (for name and type), `returns` (for type), `see` (optionally for name), `this`, `throws` (for type), `type` (for type), `typedef` (for name and type), `yields` (for type)|
- |Aliases|`extends`, `constructor`, `const`, `host`, `emits`, `func`, `method`, `var`, `arg`, `argument`, `prop`, `return`, `exception`, `yield`|
- |Closure-only|For type only: `package`, `private`, `protected`, `public`, `static`|
- |Recommended|true|
- |Options|`allowEmptyNamepaths`|
- |Settings|`mode`, `structuredTags`|
-
- The following patterns are considered problems:
-
- ````js
- /**
- * @param {Array<string} foo
- */
- function quux() {
-
- }
- // Message: Syntax error in type: Array<string
-
- /**
- * @memberof module:namespace.SomeClass<~
- */
- function quux() {
-
- }
- // Message: Syntax error in namepath: module:namespace.SomeClass<~
-
- /**
- * @param someParam<~
- */
- function quux() {
-
- }
- // Message: Syntax error in namepath: someParam<~
-
- /**
- * @memberof module:namespace.SomeClass~<
- */
- function quux() {
-
- }
- // Message: Syntax error in namepath: module:namespace.SomeClass~<
-
- /**
- * @borrows foo% as bar
- */
- function quux() {
-
- }
- // Message: Syntax error in namepath: foo%
-
- /**
- * @borrows #foo as bar
- */
- function quux() {
-
- }
- // Message: Syntax error in namepath: #foo
-
- /**
- * @borrows foo as bar%
- */
- function quux() {
-
- }
- // Message: Syntax error in namepath: bar%
-
- /**
- * @borrows foo
- */
- function quux() {
-
- }
- // Message: @borrows must have an "as" expression. Found ""
-
- /**
- * @see foo%
- */
- function quux() {
-
- }
- // Settings: {"jsdoc":{"structuredTags":{"see":{"name":"namepath-referencing","required":["name"]}}}}
- // Message: Syntax error in namepath: foo%
-
- /**
- * @mixes module:namespace.SomeClass~
- */
- function quux() {
-
- }
- // Message: Syntax error in namepath: module:namespace.SomeClass~
-
- /**
- * @callback
- */
- function quux() {
-
- }
- // "jsdoc/valid-types": ["error"|"warn", {"allowEmptyNamepaths":false}]
- // Message: Tag @callback must have a name/namepath.
-
- /**
- * @constant {str%ng}
- */
- const FOO = 'foo';
- // Message: Syntax error in type: str%ng
-
- /**
- * @typedef {str%ng} UserString
- */
- // Message: Syntax error in type: str%ng
-
- /**
- * @typedef {string} UserStr%ng
- */
- // Message: Syntax error in namepath: UserStr%ng
-
- /**
- * @this
- */
- class Bar {};
- // "jsdoc/valid-types": ["error"|"warn", {"allowEmptyNamepaths":false}]
- // Message: Tag @this must have either a type or namepath in "jsdoc" mode.
-
- /**
- * @aCustomTag
- */
- // Settings: {"jsdoc":{"structuredTags":{"aCustomTag":{"required":["typeOrNameRequired"]}}}}
- // "jsdoc/valid-types": ["error"|"warn", {"allowEmptyNamepaths":false}]
- // Message: Tag @aCustomTag must have either a type or namepath.
-
- /**
- * @type
- */
- let foo;
- // Message: Tag @type must have a type.
-
- /**
- * @modifies {bar | foo<}
- */
- function quux (foo, bar, baz) {}
- // Message: Syntax error in type: bar | foo<
-
- /**
- * @private {BadTypeChecked<}
- */
- function quux () {}
- // Settings: {"jsdoc":{"mode":"closure"}}
- // Message: Syntax error in type: BadTypeChecked<
-
- /**
- * @this {BadTypeChecked<}
- */
- function quux () {}
- // Settings: {"jsdoc":{"mode":"closure"}}
- // Message: Syntax error in type: BadTypeChecked<
-
- /**
- * @define
- */
- function quux () {}
- // Settings: {"jsdoc":{"mode":"closure"}}
- // Message: Tag @define must have a type in "closure" mode.
-
- /**
- * @this
- */
- let foo;
- // Settings: {"jsdoc":{"mode":"closure"}}
- // Message: Tag @this must have a type in "closure" mode.
-
- /**
- * Foo function.
- *
- * @param {[number, string]} bar - The bar array.
- */
- function foo(bar) {}
- // Settings: {"jsdoc":{"mode":"jsdoc"}}
- // Message: Syntax error in type: [number, string]
-
- /**
- * @interface name<
- */
- // Settings: {"jsdoc":{"mode":"jsdoc"}}
- // Message: Syntax error in namepath: name<
-
- /**
- * @module name<
- */
- // Settings: {"jsdoc":{"mode":"jsdoc"}}
- // Message: Syntax error in namepath: name<
-
- /**
- * @module module:name<
- */
- // Settings: {"jsdoc":{"mode":"jsdoc"}}
- // Message: Syntax error in namepath: module:name<
-
- /**
- * @interface name
- */
- // Settings: {"jsdoc":{"mode":"closure"}}
- // Message: @interface should not have a name in "closure" mode.
-
- /**
- * @aCustomTag name
- */
- // Settings: {"jsdoc":{"structuredTags":{"aCustomTag":{"name":false}}}}
- // Message: @aCustomTag should not have a name.
-
- /**
- * @typedef {SomeType}
- */
- function quux () {}
- // Settings: {"jsdoc":{"mode":"jsdoc"}}
- // "jsdoc/valid-types": ["error"|"warn", {"allowEmptyNamepaths":false}]
- // Message: Tag @typedef must have a name/namepath in "jsdoc" mode.
-
- /**
- * @private {SomeType}
- */
- function quux () {}
- // Settings: {"jsdoc":{"mode":"jsdoc"}}
- // Message: @private should not have a bracketed type in "jsdoc" mode.
-
- /**
- * @aCustomTag {SomeType}
- */
- function quux () {}
- // Settings: {"jsdoc":{"structuredTags":{"aCustomTag":{"type":false}}}}
- // Message: @aCustomTag should not have a bracketed type.
-
- /**
- * @see foo%
- */
- function quux() {
-
- }
- // Settings: {"jsdoc":{"structuredTags":{"see":{"name":false,"required":["name"]}}}}
- // Message: Cannot add "name" to `require` with the tag's `name` set to `false`
-
- /**
- * @see foo%
- */
- function quux() {
-
- }
- // Settings: {"jsdoc":{"structuredTags":{"see":{"required":["type"],"type":false}}}}
- // Message: Cannot add "type" to `require` with the tag's `type` set to `false`
-
- /**
- * @see foo%
- */
- function quux() {
-
- }
- // Settings: {"jsdoc":{"structuredTags":{"see":{"name":false,"required":["typeOrNameRequired"]}}}}
- // Message: Cannot add "typeOrNameRequired" to `require` with the tag's `name` set to `false`
-
- /**
- * @see foo%
- */
- function quux() {
-
- }
- // Settings: {"jsdoc":{"structuredTags":{"see":{"required":["typeOrNameRequired"],"type":false}}}}
- // Message: Cannot add "typeOrNameRequired" to `require` with the tag's `type` set to `false`
-
- /**
- * @template T<~, R
- * @param {function(!T): !R} parser
- * @return {function(!Array<!T>): !Array<!R>}
- */
- parseArray = function(parser) {
- return function(array) {
- return array.map(parser);
- };
- };
- // Settings: {"jsdoc":{"mode":"closure"}}
- // Message: Syntax error in namepath: T<~
-
- /**
- * @template T, R<~
- * @param {function(!T): !R} parser
- * @return {function(!Array<!T>): !Array<!R>}
- */
- parseArray = function(parser) {
- return function(array) {
- return array.map(parser);
- };
- };
- // Settings: {"jsdoc":{"mode":"closure"}}
- // Message: Syntax error in namepath: R<~
-
- /**
- * @template T, R<~
- * @param {function(!T): !R} parser
- * @return {function(!Array<!T>): !Array<!R>}
- */
- parseArray = function(parser) {
- return function(array) {
- return array.map(parser);
- };
- };
- // Settings: {"jsdoc":{"mode":"closure"}}
- // Message: Syntax error in namepath: R<~
- ````
-
- The following patterns are not considered problems:
-
- ````js
- /**
- * @param {Array<string>} foo
- */
- function quux() {
-
- }
-
- /**
- * @param {string} foo
- */
- function quux() {
-
- }
-
- /**
- * @param foo
- */
- function quux() {
-
- }
-
- /**
- * @borrows foo as bar
- */
- function quux() {
-
- }
-
- /**
- * @borrows foo as #bar
- */
- function quux() {
-
- }
-
- /**
- * @see foo%
- */
- function quux() {
-
- }
-
- /**
- * @alias module:namespace.SomeClass#event:ext_anevent
- */
- function quux() {
-
- }
-
- /**
- * @callback foo
- */
- function quux() {
-
- }
-
- /**
- * @callback
- */
- function quux() {
-
- }
- // "jsdoc/valid-types": ["error"|"warn", {"allowEmptyNamepaths":true}]
-
- /**
- * @class
- */
- function quux() {
-
- }
-
- /**
- * @see {@link foo}
- */
- function quux() {
-
- }
- // Settings: {"jsdoc":{"structuredTags":{"see":{"name":"namepath-referencing","required":["name"]}}}}
-
- /**
- *
- * @fires {module:namespace.SomeClass#event:ext_anevent}
- */
- function quux() {
-
- }
-
- /**
- * @memberof module:namespace.SomeClass~
- */
- function quux() {
-
- }
-
- /**
- * @memberof! module:namespace.SomeClass.
- */
- function quux() {
-
- }
-
- /**
- *
- */
- function quux() {
-
- }
-
- /**
- * @aCustomTag
- */
- function quux() {
-
- }
-
- /**
- * @constant {string}
- */
- const FOO = 'foo';
-
- /**
- * @constant {string} FOO
- */
- const FOO = 'foo';
-
- /**
- * @extends Foo
- */
- class Bar {};
-
- /**
- * @extends Foo<String>
- */
- class Bar {};
-
- /**
- * @extends {Foo<String>}
- */
- class Bar {};
- // Settings: {"jsdoc":{"mode":"closure"}}
-
- /**
- * @typedef {number | string} UserDefinedType
- */
-
- /**
- * @typedef {number | string}
- */
- let UserDefinedGCCType;
- // Settings: {"jsdoc":{"mode":"closure"}}
-
- /**
- * @modifies {foo | bar}
- */
- function quux (foo, bar, baz) {}
-
- /**
- * @this {Navigator}
- */
- function quux () {}
- // Settings: {"jsdoc":{"mode":"closure"}}
-
- /**
- * @export {SomeType}
- */
- function quux () {}
- // Settings: {"jsdoc":{"mode":"closure"}}
-
- /**
- * @define {boolean}
- */
- function quux () {}
- // Settings: {"jsdoc":{"mode":"closure"}}
-
- /**
- * @define
- */
- function quux () {}
-
- /**
- * Foo function.
- *
- * @interface foo
- */
- function foo(bar) {}
- // Settings: {"jsdoc":{"mode":"typescript"}}
-
- /**
- * Foo function.
- *
- * @param {[number, string]} bar - The bar array.
- */
- function foo(bar) {}
- // Settings: {"jsdoc":{"mode":"typescript"}}
-
- /**
- * Foo function.
- *
- * @param {[number, string]} bar - The bar array.
- */
- function foo(bar) {}
-
- /**
- * Foo function.
- *
- * @param {[number, string]} bar - The bar array.
- */
- function foo(bar) {}
- // Settings: {"jsdoc":{"mode":"permissive"}}
-
- /**
- * @typedef {SomeType}
- */
- function quux () {}
- // Settings: {"jsdoc":{"mode":"closure"}}
- // "jsdoc/valid-types": ["error"|"warn", {"allowEmptyNamepaths":false}]
-
- /**
- * @private {SomeType}
- */
- function quux () {}
- // Settings: {"jsdoc":{"mode":"closure"}}
-
- /**
- * @param
- */
- function quux() {
-
- }
- // "jsdoc/valid-types": ["error"|"warn", {"allowEmptyNamepaths":false}]
-
- /**
- * @see
- */
- function quux() {
-
- }
- // Settings: {"jsdoc":{"structuredTags":{"see":{"name":"namepath-referencing"}}}}
-
- /**
- * @template T, R
- * @param {function(!T): !R} parser
- * @return {function(!Array<!T>): !Array<!R>}
- */
- parseArray = function(parser) {
- return function(array) {
- return array.map(parser);
- };
- };
- // Settings: {"jsdoc":{"mode":"closure"}}
-
- /**
- * @template T, R<~
- * @param {function(!T): !R} parser
- * @return {function(!Array<!T>): !Array<!R>}
- */
- parseArray = function(parser) {
- return function(array) {
- return array.map(parser);
- };
- };
- // Settings: {"jsdoc":{"mode":"jsdoc"}}
-
- /**
- * @template {string} K - K must be a string or string literal
- * @template {{ serious: string }} Seriousalizable - must have a serious property
- * @param {K} key
- * @param {Seriousalizable} object
- */
- function seriousalize(key, object) {
- // ????
- }
- // Settings: {"jsdoc":{"mode":"typescript"}}
-
- /**
- * @module foo/bar
- */
-
- /**
- * @module module:foo/bar
- */
-
- /**
- * @template invalid namepath,T Description
- */
- function f() {}
- // Settings: {"jsdoc":{"mode":"closure"}}
-
- /**
- * Description of complicated type.
- *
- * @template T Description of the T type parameter.
- * @template U - Like other tags, this can have an optional hyphen before the description.
- * @template V,W More parameters
- * @template W,X - Also with a hyphen
- */
- type ComplicatedType<T, U, V, W, X> = never
-
- /** Multi-line typedef for an options object type.
- *
- * @typedef {{
- * prop: number
- * }} MyOptions
- */
-
- /**
- * @extends {SomeType}
- */
- class quux {}
- // Settings: {"jsdoc":{"mode":"typescript"}}
- ````
-
-
|