eslint-plugin-jsdoc 37.2.5 → 37.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -8548,6 +8548,25 @@ function quux () {
8548
8548
  */
8549
8549
  function quux () {
8550
8550
 
8551
+ }
8552
+ // "jsdoc/no-missing-syntax": ["error"|"warn", {"contexts":[{"comment":"JsdocBlock[postDelimiter=\"\"]:has(JsdocTypeUnion > JsdocTypeName[value=\"Bar\"]:nth-child(1))","context":"any"},{"comment":"JsdocBlock[postDelimiter=\"\"]:has(JsdocTypeUnion > JsdocTypeName[value=\"Foo\"]:nth-child(1))","context":":function"}]}]
8553
+ // Message: Syntax is required: :function with JsdocBlock[postDelimiter=""]:has(JsdocTypeUnion > JsdocTypeName[value="Foo"]:nth-child(1))
8554
+
8555
+ /**
8556
+ * @private
8557
+ * Object holding values of some custom enum
8558
+ */
8559
+ const MY_ENUM = Object.freeze({
8560
+ VAL_A: "myvala"
8561
+ } as const);
8562
+ // "jsdoc/no-missing-syntax": ["error"|"warn", {"contexts":[{"comment":"JsdocBlock[postDelimiter=\"\"]:has(JsdocTag[tag=/private|protected/])","context":":declaration","message":"Requiring private/protected tags here"},{"comment":"JsdocBlock[postDelimiter=\"\"]:has(JsdocTag[tag=\"enum\"])","context":"any","message":"@enum required on declarations"}]}]
8563
+ // Message: @enum required on declarations
8564
+
8565
+ /**
8566
+ * @implements {Bar|Foo}
8567
+ */
8568
+ function quux () {
8569
+
8551
8570
  }
8552
8571
  // "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}}`."}]}]
8553
8572
  // Message: Problematically missing function syntax: `FunctionDeclaration` with `JsdocBlock[postDelimiter=""]:has(JsdocTypeUnion > JsdocTypeName[value="Foo"]:nth-child(1))`.
@@ -8661,6 +8680,14 @@ function quux () {
8661
8680
 
8662
8681
  }
8663
8682
  // "jsdoc/no-missing-syntax": ["error"|"warn", {"contexts":[{"comment":"JsdocBlock[postDelimiter=\"\"]:has(JsdocTypeUnion > JsdocTypeName[value=\"Bar\"]:nth-child(1))","context":"FunctionDeclaration"},{"comment":"JsdocBlock[postDelimiter=\"\"]:has(JsdocTypeUnion > JsdocTypeName[value=\"Foo\"]:nth-child(2))","context":"FunctionDeclaration"}]}]
8683
+
8684
+ /**
8685
+ * @implements {Bar|Foo}
8686
+ */
8687
+ function quux () {
8688
+
8689
+ }
8690
+ // "jsdoc/no-missing-syntax": ["error"|"warn", {"contexts":[{"comment":"JsdocBlock[postDelimiter=\"\"]:has(JsdocTypeUnion > JsdocTypeName[value=\"Bar\"]:nth-child(1))","context":"any"},{"comment":"JsdocBlock[postDelimiter=\"\"]:has(JsdocTypeUnion > JsdocTypeName[value=\"Foo\"]:nth-child(2))","context":"FunctionDeclaration"}]}]
8664
8691
  ````
8665
8692
 
8666
8693
 
@@ -8955,6 +8982,15 @@ function quux () {
8955
8982
  */
8956
8983
  function quux () {
8957
8984
 
8985
+ }
8986
+ // "jsdoc/no-restricted-syntax": ["error"|"warn", {"contexts":[{"comment":"JsdocBlock[postDelimiter=\"\"]:has(JsdocTypeUnion > JsdocTypeName[value=\"Bar\"]:nth-child(1))","context":"FunctionDeclaration","message":"The bar one: {{context}}."},{"comment":"JsdocBlock[postDelimiter=\"\"]:has(JsdocTypeUnion > JsdocTypeName[value=\"Foo\"]:nth-child(1))","context":"FunctionDeclaration","message":"The foo one: {{context}}."}]}]
8987
+ // Message: The bar one: FunctionDeclaration.
8988
+
8989
+ /**
8990
+ * @implements {Bar|Foo}
8991
+ */
8992
+ function quux () {
8993
+
8958
8994
  }
8959
8995
  // Message: Rule `no-restricted-syntax` is missing a `context` option.
8960
8996
 
@@ -8996,6 +9032,16 @@ function a () {}
8996
9032
  */
8997
9033
  // "jsdoc/no-restricted-syntax": ["error"|"warn", {"contexts":[{"comment":"JsdocBlock:has(JsdocTag[name=/opt_/])","context":"any","message":"Only allowing names not matching `/^opt_/i`."}]}]
8998
9034
  // Message: Only allowing names not matching `/^opt_/i`.
9035
+
9036
+ /**
9037
+ * @enum {String}
9038
+ * Object holding values of some custom enum
9039
+ */
9040
+ const MY_ENUM = Object.freeze({
9041
+ VAL_A: "myvala"
9042
+ } as const);
9043
+ // "jsdoc/no-restricted-syntax": ["error"|"warn", {"contexts":[{"comment":"JsdocBlock[postDelimiter=\"\"]:has(JsdocTag ~ JsdocTag[tag=/private|protected/])","context":"any","message":"Access modifier tags must come first"},{"comment":"JsdocBlock[postDelimiter=\"\"]:has(JsdocTag[tag=\"enum\"])","context":":declaration","message":"@enum not allowed on declarations"}]}]
9044
+ // Message: @enum not allowed on declarations
8999
9045
  ````
9000
9046
 
9001
9047
  The following patterns are not considered problems:
@@ -16591,6 +16637,19 @@ function quux () {
16591
16637
  return undefined;
16592
16638
  }
16593
16639
 
16640
+ /**
16641
+ * @returns {never} Foo.
16642
+ */
16643
+ function quux () {
16644
+ }
16645
+
16646
+ /**
16647
+ * @returns {never} Foo.
16648
+ */
16649
+ function quux () {
16650
+ return undefined;
16651
+ }
16652
+
16594
16653
  /**
16595
16654
  * @returns {void} Foo.
16596
16655
  */
@@ -19537,6 +19596,12 @@ function * quux () {
19537
19596
  function * quux () {
19538
19597
  }
19539
19598
 
19599
+ /**
19600
+ * @yields {never} Foo.
19601
+ */
19602
+ function * quux () {
19603
+ }
19604
+
19540
19605
  /**
19541
19606
  * @yields {void} Foo.
19542
19607
  */
@@ -19743,6 +19808,14 @@ function * quux (foo) {
19743
19808
  const a = yield 5;
19744
19809
  }
19745
19810
  // "jsdoc/require-yields-check": ["error"|"warn", {"next":true}]
19811
+
19812
+ /**
19813
+ * @next {never}
19814
+ */
19815
+ function * quux (foo) {
19816
+
19817
+ }
19818
+ // "jsdoc/require-yields-check": ["error"|"warn", {"next":true}]
19746
19819
  ````
19747
19820
 
19748
19821
 
@@ -20488,6 +20561,27 @@ parseArray = function(parser) {
20488
20561
  };
20489
20562
  // Settings: {"jsdoc":{"mode":"closure"}}
20490
20563
  // Message: Syntax error in namepath: R<~
20564
+
20565
+ /**
20566
+ * @suppress
20567
+ */
20568
+ function quux () {}
20569
+ // Settings: {"jsdoc":{"mode":"closure"}}
20570
+ // Message: Tag @suppress must have a type in "closure" mode.
20571
+
20572
+ /**
20573
+ * @suppress {visibility} sth
20574
+ */
20575
+ function quux () {}
20576
+ // Settings: {"jsdoc":{"mode":"closure"}}
20577
+ // Message: @suppress should not have a name in "closure" mode.
20578
+
20579
+ /**
20580
+ * @suppress {visibility|blah}
20581
+ */
20582
+ function quux () {}
20583
+ // Settings: {"jsdoc":{"mode":"closure"}}
20584
+ // Message: Syntax error in supresss type: blah
20491
20585
  ````
20492
20586
 
20493
20587
  The following patterns are not considered problems:
@@ -20803,6 +20897,13 @@ type ComplicatedType<T, U, V, W, X> = never
20803
20897
  */
20804
20898
  class quux {}
20805
20899
  // Settings: {"jsdoc":{"mode":"typescript"}}
20900
+
20901
+ /**
20902
+ * @suppress {visibility|underscore}
20903
+ */
20904
+ function quux() {
20905
+ }
20906
+ // Settings: {"jsdoc":{"mode":"closure"}}
20806
20907
  ````
20807
20908
 
20808
20909
 
@@ -140,7 +140,7 @@ const getDefaultTagStructureForMode = mode => {
140
140
  ['typeAllowed', true]])], ['see', new Map([// Signature allows for "namepath" or text, so user must configure to
141
141
  // 'namepath-referencing' to enforce checks
142
142
  ['nameContents', 'text']])], ['static', new Map([// Does not show a signature nor show curly brackets in the example
143
- ['typeAllowed', isClosureOrPermissive]])], ['template', new Map([['nameContents', isJsdoc ? 'text' : 'namepath-referencing'], // Though defines `nameContents: 'namepath-defining'` in a sense, it is
143
+ ['typeAllowed', isClosureOrPermissive]])], ['suppress', new Map([['nameContents', !isClosure], ['typeRequired', isClosure]])], ['template', new Map([['nameContents', isJsdoc ? 'text' : 'namepath-referencing'], // Though defines `nameContents: 'namepath-defining'` in a sense, it is
144
144
  // not parseable in the same way for template (e.g., allowing commas),
145
145
  // so not adding
146
146
  ['typeAllowed', isTypescriptOrClosure || isPermissive]])], ['this', new Map([// Signature seems to require a "namepath" (and no counter-examples)
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/getDefaultTagStructureForMode.js"],"names":["getDefaultTagStructureForMode","mode","isJsdoc","isClosure","isTypescript","isPermissive","isJsdocOrTypescript","isTypescriptOrClosure","isClosureOrPermissive","isJsdocTypescriptOrPermissive","Map"],"mappings":";;;;;;;AAAA,MAAMA,6BAA6B,GAAIC,IAAD,IAAU;AAC9C,QAAMC,OAAO,GAAGD,IAAI,KAAK,OAAzB;AACA,QAAME,SAAS,GAAGF,IAAI,KAAK,SAA3B;AACA,QAAMG,YAAY,GAAGH,IAAI,KAAK,YAA9B;AACA,QAAMI,YAAY,GAAGJ,IAAI,KAAK,YAA9B;AAEA,QAAMK,mBAAmB,GAAGJ,OAAO,IAAIE,YAAvC;AACA,QAAMG,qBAAqB,GAAGH,YAAY,IAAID,SAA9C;AACA,QAAMK,qBAAqB,GAAGL,SAAS,IAAIE,YAA3C;AACA,QAAMI,6BAA6B,GAAGH,mBAAmB,IAAID,YAA7D,CAT8C,CAW9C;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;;AAEA,SAAO,IAAIK,GAAJ,CAAQ,CACb,CAAC,OAAD,EAAU,IAAIA,GAAJ,CAAQ,CAChB;AACA,GAAC,cAAD,EAAiB,sBAAjB,CAFgB,EAIhB;AACA,GAAC,oBAAD,EAAuB,IAAvB,CALgB,CAAR,CAAV,CADa,EASb,CAAC,KAAD,EAAQ,IAAIA,GAAJ,CAAQ,CACd,CAAC,cAAD,EAAiB,mBAAjB,CADc,EAGd;AACA,GAAC,cAAD,EAAiB,IAAjB,CAJc,EAMd;AACA;AACA,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AAY,IAAIA,GAAJ,CAAQ,CAClB;AACA;AACA,GAAC,cAAD,EAAiB,mBAAjB,CAHkB,EAKlB;AACA,GAAC,cAAD,EAAiBD,6BAAjB,CANkB,EAQlB;AACA,GAAC,aAAD,EAAgB,IAAhB,CATkB,EAWlB;AACA,GAAC,oBAAD,EAAuB,IAAvB,CAZkB,CAAR,CAAZ,CApYa,EAmZb,CAAC,KAAD,EAAQ,IAAIC,GAAJ,CAAQ,CACd;AACA,GAAC,cAAD,EAAiB,mBAAjB,CAFc,EAId;AACA,GAAC,aAAD,EAAgB,IAAhB,CALc,CAAR,CAAR,CAnZa,EA2Zb,CAAC,QAAD,EAAW,IAAIA,GAAJ,CAAQ,CACjB;AACA,GAAC,aAAD,EAAgB,IAAhB,CAFiB,CAAR,CAAX,CA3Za,EA+Zb,CAAC,OAAD,EAAU,IAAIA,GAAJ,CAAQ,CAChB;AACA,GAAC,aAAD,EAAgB,IAAhB,CAFgB,CAAR,CAAV,CA/Za,CAAR,CAAP;AAoaD,CA7cD;;eA+ceV,6B","sourcesContent":["const getDefaultTagStructureForMode = (mode) => {\n const isJsdoc = mode === 'jsdoc';\n const isClosure = mode === 'closure';\n const isTypescript = mode === 'typescript';\n const isPermissive = mode === 'permissive';\n\n const isJsdocOrTypescript = isJsdoc || isTypescript;\n const isTypescriptOrClosure = isTypescript || isClosure;\n const isClosureOrPermissive = isClosure || isPermissive;\n const isJsdocTypescriptOrPermissive = isJsdocOrTypescript || isPermissive;\n\n // Properties:\n // `nameContents` - 'namepath-referencing'|'namepath-defining'|'text'|false\n // `typeAllowed` - boolean\n // `nameRequired` - boolean\n // `typeRequired` - boolean\n // `typeOrNameRequired` - boolean\n\n // All of `typeAllowed` have a signature with \"type\" except for\n // `augments`/`extends` (\"namepath\")\n // `param`/`arg`/`argument` (no signature)\n // `property`/`prop` (no signature)\n // `modifies` (undocumented)\n\n // None of the `nameContents: 'namepath-defining'` show as having curly\n // brackets for their name/namepath\n\n // Among `namepath-defining` and `namepath-referencing`, these do not seem\n // to allow curly brackets in their doc signature or examples (`modifies`\n // references namepaths within its type brackets and `param` is\n // name-defining but not namepath-defining, so not part of these groups)\n\n // Todo: Should support special processing for \"name\" as distinct from\n // \"namepath\" (e.g., param can't define a namepath)\n\n // Once checking inline tags:\n // Todo: Re: `typeOrNameRequired`, `@link` (or @linkcode/@linkplain) seems\n // to require a namepath OR URL and might be checked as such.\n // Todo: Should support a `tutorialID` type (for `@tutorial` block and\n // inline)\n\n return new Map([\n ['alias', new Map([\n // Signature seems to require a \"namepath\" (and no counter-examples)\n ['nameContents', 'namepath-referencing'],\n\n // \"namepath\"\n ['typeOrNameRequired', true],\n ])],\n\n ['arg', new Map([\n ['nameContents', 'namepath-defining'],\n\n // See `param`\n ['nameRequired', true],\n\n // Has no formal signature in the docs but shows curly brackets\n // in the examples\n ['typeAllowed', true],\n ])],\n\n ['argument', new Map([\n ['nameContents', 'namepath-defining'],\n\n // See `param`\n ['nameRequired', true],\n\n // Has no formal signature in the docs but shows curly brackets\n // in the examples\n ['typeAllowed', true],\n ])],\n\n ['augments', new Map([\n // Signature seems to require a \"namepath\" (and no counter-examples)\n ['nameContents', 'namepath-referencing'],\n\n // Does not show curly brackets in either the signature or examples\n ['typeAllowed', true],\n\n // \"namepath\"\n ['typeOrNameRequired', true],\n ])],\n\n ['borrows', new Map([\n // `borrows` has a different format, however, so needs special parsing;\n // seems to require both, and as \"namepath\"'s\n ['nameContents', 'namepath-referencing'],\n\n // \"namepath\"\n ['typeOrNameRequired', true],\n ])],\n\n ['callback', new Map([\n // Seems to require a \"namepath\" in the signature (with no\n // counter-examples)\n ['nameContents', 'namepath-defining'],\n\n // \"namepath\"\n ['nameRequired', true],\n ])],\n\n ['class', new Map([\n // Allows for \"name\"'s in signature, but indicated as optional\n ['nameContents', 'namepath-defining'],\n\n ['typeAllowed', true],\n ])],\n\n ['const', new Map([\n // Allows for \"name\"'s in signature, but indicated as optional\n ['nameContents', 'namepath-defining'],\n\n ['typeAllowed', true],\n ])],\n ['constant', new Map([\n // Allows for \"name\"'s in signature, but indicated as optional\n ['nameContents', 'namepath-defining'],\n\n ['typeAllowed', true],\n ])],\n ['constructor', new Map([\n // Allows for \"name\"'s in signature, but indicated as optional\n ['nameContents', 'namepath-defining'],\n\n ['typeAllowed', true],\n ])],\n\n ['define', new Map([\n ['typeRequired', isClosure],\n ])],\n\n ['emits', new Map([\n // Signature seems to require a \"name\" (of an event) and no counter-examples\n ['nameContents', 'namepath-referencing'],\n ])],\n\n ['enum', new Map([\n // Has example showing curly brackets but not in doc signature\n ['typeAllowed', true],\n ])],\n\n ['event', new Map([\n // The doc signature of `event` seems to require a \"name\"\n ['nameRequired', true],\n\n // Appears to require a \"name\" in its signature, albeit somewhat\n // different from other \"name\"'s (including as described\n // at https://jsdoc.app/about-namepaths.html )\n ['nameContents', 'namepath-defining'],\n ])],\n\n ['exception', new Map([\n // Shows curly brackets in the signature and in the examples\n ['typeAllowed', true],\n ])],\n\n ['export', new Map([\n ['typeAllowed', isClosureOrPermissive],\n ])],\n\n ['extends', new Map([\n // Signature seems to require a \"namepath\" (and no counter-examples)\n ['nameContents', 'namepath-referencing'],\n\n // Does not show curly brackets in either the signature or examples\n ['typeAllowed', isTypescriptOrClosure || isPermissive],\n\n ['nameRequired', isJsdoc],\n\n // \"namepath\"\n ['typeOrNameRequired', isTypescriptOrClosure || isPermissive],\n ])],\n\n ['external', new Map([\n // Appears to require a \"name\" in its signature, albeit somewhat\n // different from other \"name\"'s (including as described\n // at https://jsdoc.app/about-namepaths.html )\n ['nameContents', 'namepath-defining'],\n\n // \"name\" (and a special syntax for the `external` name)\n ['nameRequired', true],\n ])],\n\n ['fires', new Map([\n // Signature seems to require a \"name\" (of an event) and no\n // counter-examples\n ['nameContents', 'namepath-referencing'],\n ])],\n\n ['function', new Map([\n // Allows for \"name\"'s in signature, but indicated as optional\n ['nameContents', 'namepath-defining'],\n ])],\n ['func', new Map([\n // Allows for \"name\"'s in signature, but indicated as optional\n ['nameContents', 'namepath-defining'],\n ])],\n\n ['host', new Map([\n // Appears to require a \"name\" in its signature, albeit somewhat\n // different from other \"name\"'s (including as described\n // at https://jsdoc.app/about-namepaths.html )\n ['nameContents', 'namepath-defining'],\n\n // See `external`\n ['nameRequired', true],\n\n // \"namepath\"\n ['typeOrNameRequired', true],\n ])],\n\n ['interface', new Map([\n // Allows for \"name\" in signature, but indicates as optional\n [\n 'nameContents',\n isJsdocTypescriptOrPermissive ? 'namepath-defining' : false,\n ],\n ])],\n\n ['implements', new Map([\n // Shows curly brackets in the doc signature and examples\n // \"typeExpression\"\n ['typeRequired', true],\n ])],\n\n ['lends', new Map([\n // Signature seems to require a \"namepath\" (and no counter-examples)\n ['nameContents', 'namepath-referencing'],\n\n // \"namepath\"\n ['typeOrNameRequired', true],\n ])],\n\n ['listens', new Map([\n // Signature seems to require a \"name\" (of an event) and no\n // counter-examples\n ['nameContents', 'namepath-referencing'],\n ])],\n\n ['member', new Map([\n // Allows for \"name\"'s in signature, but indicated as optional\n ['nameContents', 'namepath-defining'],\n\n // Has example showing curly brackets but not in doc signature\n ['typeAllowed', true],\n ])],\n\n ['memberof', new Map([\n // Signature seems to require a \"namepath\" (and no counter-examples),\n // though it allows an incomplete namepath ending with connecting symbol\n ['nameContents', 'namepath-referencing'],\n\n // \"namepath\"\n ['typeOrNameRequired', true],\n ])],\n ['memberof!', new Map([\n // Signature seems to require a \"namepath\" (and no counter-examples),\n // though it allows an incomplete namepath ending with connecting symbol\n ['nameContents', 'namepath-referencing'],\n\n // \"namepath\"\n ['typeOrNameRequired', true],\n ])],\n\n ['method', new Map([\n // Allows for \"name\"'s in signature, but indicated as optional\n ['nameContents', 'namepath-defining'],\n ])],\n ['mixes', new Map([\n // Signature seems to require a \"OtherObjectPath\" with no\n // counter-examples\n ['nameContents', 'namepath-referencing'],\n\n // \"OtherObjectPath\"\n ['typeOrNameRequired', true],\n ])],\n\n ['mixin', new Map([\n // Allows for \"name\"'s in signature, but indicated as optional\n ['nameContents', 'namepath-defining'],\n ])],\n\n ['modifies', new Map([\n // Has no documentation, but test example has curly brackets, and\n // \"name\" would be suggested rather than \"namepath\" based on example;\n // not sure if name is required\n ['typeAllowed', true],\n ])],\n\n ['module', new Map([\n // Optional \"name\" and no curly brackets\n // this block impacts `no-undefined-types` and `valid-types` (search for\n // \"isNamepathDefiningTag|tagMightHaveNamepath|tagMightHaveEitherTypeOrNamePosition\")\n ['nameContents', isJsdoc ? 'namepath-defining' : 'text'],\n\n // Shows the signature with curly brackets but not in the example\n ['typeAllowed', true],\n ])],\n\n ['name', new Map([\n // Seems to require a \"namepath\" in the signature (with no\n // counter-examples)\n ['nameContents', 'namepath-defining'],\n\n // \"namepath\"\n ['nameRequired', true],\n\n // \"namepath\"\n ['typeOrNameRequired', true],\n ])],\n\n ['namespace', new Map([\n // Allows for \"name\"'s in signature, but indicated as optional\n ['nameContents', 'namepath-defining'],\n\n // Shows the signature with curly brackets but not in the example\n ['typeAllowed', true],\n ])],\n ['package', new Map([\n // Shows the signature with curly brackets but not in the example\n // \"typeExpression\"\n ['typeAllowed', isClosureOrPermissive],\n ])],\n\n ['param', new Map([\n ['nameContents', 'namepath-defining'],\n\n // Though no signature provided requiring, per\n // https://jsdoc.app/tags-param.html:\n // \"The @param tag requires you to specify the name of the parameter you\n // are documenting.\"\n ['nameRequired', true],\n\n // Has no formal signature in the docs but shows curly brackets\n // in the examples\n ['typeAllowed', true],\n ])],\n\n ['private', new Map([\n // Shows the signature with curly brackets but not in the example\n // \"typeExpression\"\n ['typeAllowed', isClosureOrPermissive],\n ])],\n\n ['prop', new Map([\n ['nameContents', 'namepath-defining'],\n\n // See `property`\n ['nameRequired', true],\n\n // Has no formal signature in the docs but shows curly brackets\n // in the examples\n ['typeAllowed', true],\n ])],\n\n ['property', new Map([\n ['nameContents', 'namepath-defining'],\n\n // No docs indicate required, but since parallel to `param`, we treat as\n // such:\n ['nameRequired', true],\n\n // Has no formal signature in the docs but shows curly brackets\n // in the examples\n ['typeAllowed', true],\n ])],\n\n ['protected', new Map([\n // Shows the signature with curly brackets but not in the example\n // \"typeExpression\"\n ['typeAllowed', isClosureOrPermissive],\n ])],\n\n ['public', new Map([\n // Does not show a signature nor show curly brackets in the example\n ['typeAllowed', isClosureOrPermissive],\n ])],\n\n ['returns', new Map([\n // Shows curly brackets in the signature and in the examples\n ['typeAllowed', true],\n ])],\n ['return', new Map([\n // Shows curly brackets in the signature and in the examples\n ['typeAllowed', true],\n ])],\n\n ['see', new Map([\n // Signature allows for \"namepath\" or text, so user must configure to\n // 'namepath-referencing' to enforce checks\n ['nameContents', 'text'],\n ])],\n\n ['static', new Map([\n // Does not show a signature nor show curly brackets in the example\n ['typeAllowed', isClosureOrPermissive],\n ])],\n\n ['template', new Map([\n ['nameContents', isJsdoc ? 'text' : 'namepath-referencing'],\n\n // Though defines `nameContents: 'namepath-defining'` in a sense, it is\n // not parseable in the same way for template (e.g., allowing commas),\n // so not adding\n ['typeAllowed', isTypescriptOrClosure || isPermissive],\n ])],\n\n ['this', new Map([\n // Signature seems to require a \"namepath\" (and no counter-examples)\n // Not used with namepath in Closure/TypeScript, however\n ['nameContents', isJsdoc ? 'namepath-referencing' : false],\n\n ['typeRequired', isTypescriptOrClosure],\n\n // namepath\n ['typeOrNameRequired', isJsdoc],\n ])],\n\n ['throws', new Map([\n // Shows curly brackets in the signature and in the examples\n ['typeAllowed', true],\n ])],\n\n ['type', new Map([\n // Shows curly brackets in the doc signature and examples\n // \"typeName\"\n ['typeRequired', true],\n ])],\n\n ['typedef', new Map([\n // Seems to require a \"namepath\" in the signature (with no\n // counter-examples)\n ['nameContents', 'namepath-defining'],\n\n // \"namepath\"\n ['nameRequired', isJsdocTypescriptOrPermissive],\n\n // Has example showing curly brackets but not in doc signature\n ['typeAllowed', true],\n\n // \"namepath\"\n ['typeOrNameRequired', true],\n ])],\n\n ['var', new Map([\n // Allows for \"name\"'s in signature, but indicated as optional\n ['nameContents', 'namepath-defining'],\n\n // Has example showing curly brackets but not in doc signature\n ['typeAllowed', true],\n ])],\n\n ['yields', new Map([\n // Shows curly brackets in the signature and in the examples\n ['typeAllowed', true],\n ])],\n ['yield', new Map([\n // Shows curly brackets in the signature and in the examples\n ['typeAllowed', true],\n ])],\n ]);\n};\n\nexport default getDefaultTagStructureForMode;\n"],"file":"getDefaultTagStructureForMode.js"}
1
+ {"version":3,"sources":["../src/getDefaultTagStructureForMode.js"],"names":["getDefaultTagStructureForMode","mode","isJsdoc","isClosure","isTypescript","isPermissive","isJsdocOrTypescript","isTypescriptOrClosure","isClosureOrPermissive","isJsdocTypescriptOrPermissive","Map"],"mappings":";;;;;;;AAAA,MAAMA,6BAA6B,GAAIC,IAAD,IAAU;AAC9C,QAAMC,OAAO,GAAGD,IAAI,KAAK,OAAzB;AACA,QAAME,SAAS,GAAGF,IAAI,KAAK,SAA3B;AACA,QAAMG,YAAY,GAAGH,IAAI,KAAK,YAA9B;AACA,QAAMI,YAAY,GAAGJ,IAAI,KAAK,YAA9B;AAEA,QAAMK,mBAAmB,GAAGJ,OAAO,IAAIE,YAAvC;AACA,QAAMG,qBAAqB,GAAGH,YAAY,IAAID,SAA9C;AACA,QAAMK,qBAAqB,GAAGL,SAAS,IAAIE,YAA3C;AACA,QAAMI,6BAA6B,GAAGH,mBAAmB,IAAID,YAA7D,CAT8C,CAW9C;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;;AAEA,SAAO,IAAIK,GAAJ,CAAQ,CACb,CAAC,OAAD,EAAU,IAAIA,GAAJ,CAAQ,CAChB;AACA,GAAC,cAAD,EAAiB,sBAAjB,CAFgB,EAIhB;AACA,GAAC,oBAAD,EAAuB,IAAvB,CALgB,CAAR,CAAV,CADa,EASb,CAAC,KAAD,EAAQ,IAAIA,GAAJ,CAAQ,CACd,CAAC,cAAD,EAAiB,mBAAjB,CADc,EAGd;AACA,GAAC,cAAD,EA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AAC,aAAD,EAAgB,IAAhB,CAFiB,CAAR,CAAX,CA9Xa,EAmYb,CAAC,MAAD,EAAS,IAAIA,GAAJ,CAAQ,CACf;AACA;AACA,GAAC,cAAD,EAAiB,IAAjB,CAHe,CAAR,CAAT,CAnYa,EAyYb,CAAC,SAAD,EAAY,IAAIA,GAAJ,CAAQ,CAClB;AACA;AACA,GAAC,cAAD,EAAiB,mBAAjB,CAHkB,EAKlB;AACA,GAAC,cAAD,EAAiBD,6BAAjB,CANkB,EAQlB;AACA,GAAC,aAAD,EAAgB,IAAhB,CATkB,EAWlB;AACA,GAAC,oBAAD,EAAuB,IAAvB,CAZkB,CAAR,CAAZ,CAzYa,EAwZb,CAAC,KAAD,EAAQ,IAAIC,GAAJ,CAAQ,CACd;AACA,GAAC,cAAD,EAAiB,mBAAjB,CAFc,EAId;AACA,GAAC,aAAD,EAAgB,IAAhB,CALc,CAAR,CAAR,CAxZa,EAgab,CAAC,QAAD,EAAW,IAAIA,GAAJ,CAAQ,CACjB;AACA,GAAC,aAAD,EAAgB,IAAhB,CAFiB,CAAR,CAAX,CAhaa,EAoab,CAAC,OAAD,EAAU,IAAIA,GAAJ,CAAQ,CAChB;AACA,GAAC,aAAD,EAAgB,IAAhB,CAFgB,CAAR,CAAV,CApaa,CAAR,CAAP;AAyaD,CAldD;;eAodeV,6B","sourcesContent":["const getDefaultTagStructureForMode = (mode) => {\n const isJsdoc = mode === 'jsdoc';\n const isClosure = mode === 'closure';\n const isTypescript = mode === 'typescript';\n const isPermissive = mode === 'permissive';\n\n const isJsdocOrTypescript = isJsdoc || isTypescript;\n const isTypescriptOrClosure = isTypescript || isClosure;\n const isClosureOrPermissive = isClosure || isPermissive;\n const isJsdocTypescriptOrPermissive = isJsdocOrTypescript || isPermissive;\n\n // Properties:\n // `nameContents` - 'namepath-referencing'|'namepath-defining'|'text'|false\n // `typeAllowed` - boolean\n // `nameRequired` - boolean\n // `typeRequired` - boolean\n // `typeOrNameRequired` - boolean\n\n // All of `typeAllowed` have a signature with \"type\" except for\n // `augments`/`extends` (\"namepath\")\n // `param`/`arg`/`argument` (no signature)\n // `property`/`prop` (no signature)\n // `modifies` (undocumented)\n\n // None of the `nameContents: 'namepath-defining'` show as having curly\n // brackets for their name/namepath\n\n // Among `namepath-defining` and `namepath-referencing`, these do not seem\n // to allow curly brackets in their doc signature or examples (`modifies`\n // references namepaths within its type brackets and `param` is\n // name-defining but not namepath-defining, so not part of these groups)\n\n // Todo: Should support special processing for \"name\" as distinct from\n // \"namepath\" (e.g., param can't define a namepath)\n\n // Once checking inline tags:\n // Todo: Re: `typeOrNameRequired`, `@link` (or @linkcode/@linkplain) seems\n // to require a namepath OR URL and might be checked as such.\n // Todo: Should support a `tutorialID` type (for `@tutorial` block and\n // inline)\n\n return new Map([\n ['alias', new Map([\n // Signature seems to require a \"namepath\" (and no counter-examples)\n ['nameContents', 'namepath-referencing'],\n\n // \"namepath\"\n ['typeOrNameRequired', true],\n ])],\n\n ['arg', new Map([\n ['nameContents', 'namepath-defining'],\n\n // See `param`\n ['nameRequired', true],\n\n // Has no formal signature in the docs but shows curly brackets\n // in the examples\n ['typeAllowed', true],\n ])],\n\n ['argument', new Map([\n ['nameContents', 'namepath-defining'],\n\n // See `param`\n ['nameRequired', true],\n\n // Has no formal signature in the docs but shows curly brackets\n // in the examples\n ['typeAllowed', true],\n ])],\n\n ['augments', new Map([\n // Signature seems to require a \"namepath\" (and no counter-examples)\n ['nameContents', 'namepath-referencing'],\n\n // Does not show curly brackets in either the signature or examples\n ['typeAllowed', true],\n\n // \"namepath\"\n ['typeOrNameRequired', true],\n ])],\n\n ['borrows', new Map([\n // `borrows` has a different format, however, so needs special parsing;\n // seems to require both, and as \"namepath\"'s\n ['nameContents', 'namepath-referencing'],\n\n // \"namepath\"\n ['typeOrNameRequired', true],\n ])],\n\n ['callback', new Map([\n // Seems to require a \"namepath\" in the signature (with no\n // counter-examples)\n ['nameContents', 'namepath-defining'],\n\n // \"namepath\"\n ['nameRequired', true],\n ])],\n\n ['class', new Map([\n // Allows for \"name\"'s in signature, but indicated as optional\n ['nameContents', 'namepath-defining'],\n\n ['typeAllowed', true],\n ])],\n\n ['const', new Map([\n // Allows for \"name\"'s in signature, but indicated as optional\n ['nameContents', 'namepath-defining'],\n\n ['typeAllowed', true],\n ])],\n ['constant', new Map([\n // Allows for \"name\"'s in signature, but indicated as optional\n ['nameContents', 'namepath-defining'],\n\n ['typeAllowed', true],\n ])],\n ['constructor', new Map([\n // Allows for \"name\"'s in signature, but indicated as optional\n ['nameContents', 'namepath-defining'],\n\n ['typeAllowed', true],\n ])],\n\n ['define', new Map([\n ['typeRequired', isClosure],\n ])],\n\n ['emits', new Map([\n // Signature seems to require a \"name\" (of an event) and no counter-examples\n ['nameContents', 'namepath-referencing'],\n ])],\n\n ['enum', new Map([\n // Has example showing curly brackets but not in doc signature\n ['typeAllowed', true],\n ])],\n\n ['event', new Map([\n // The doc signature of `event` seems to require a \"name\"\n ['nameRequired', true],\n\n // Appears to require a \"name\" in its signature, albeit somewhat\n // different from other \"name\"'s (including as described\n // at https://jsdoc.app/about-namepaths.html )\n ['nameContents', 'namepath-defining'],\n ])],\n\n ['exception', new Map([\n // Shows curly brackets in the signature and in the examples\n ['typeAllowed', true],\n ])],\n\n ['export', new Map([\n ['typeAllowed', isClosureOrPermissive],\n ])],\n\n ['extends', new Map([\n // Signature seems to require a \"namepath\" (and no counter-examples)\n ['nameContents', 'namepath-referencing'],\n\n // Does not show curly brackets in either the signature or examples\n ['typeAllowed', isTypescriptOrClosure || isPermissive],\n\n ['nameRequired', isJsdoc],\n\n // \"namepath\"\n ['typeOrNameRequired', isTypescriptOrClosure || isPermissive],\n ])],\n\n ['external', new Map([\n // Appears to require a \"name\" in its signature, albeit somewhat\n // different from other \"name\"'s (including as described\n // at https://jsdoc.app/about-namepaths.html )\n ['nameContents', 'namepath-defining'],\n\n // \"name\" (and a special syntax for the `external` name)\n ['nameRequired', true],\n ])],\n\n ['fires', new Map([\n // Signature seems to require a \"name\" (of an event) and no\n // counter-examples\n ['nameContents', 'namepath-referencing'],\n ])],\n\n ['function', new Map([\n // Allows for \"name\"'s in signature, but indicated as optional\n ['nameContents', 'namepath-defining'],\n ])],\n ['func', new Map([\n // Allows for \"name\"'s in signature, but indicated as optional\n ['nameContents', 'namepath-defining'],\n ])],\n\n ['host', new Map([\n // Appears to require a \"name\" in its signature, albeit somewhat\n // different from other \"name\"'s (including as described\n // at https://jsdoc.app/about-namepaths.html )\n ['nameContents', 'namepath-defining'],\n\n // See `external`\n ['nameRequired', true],\n\n // \"namepath\"\n ['typeOrNameRequired', true],\n ])],\n\n ['interface', new Map([\n // Allows for \"name\" in signature, but indicates as optional\n [\n 'nameContents',\n isJsdocTypescriptOrPermissive ? 'namepath-defining' : false,\n ],\n ])],\n\n ['implements', new Map([\n // Shows curly brackets in the doc signature and examples\n // \"typeExpression\"\n ['typeRequired', true],\n ])],\n\n ['lends', new Map([\n // Signature seems to require a \"namepath\" (and no counter-examples)\n ['nameContents', 'namepath-referencing'],\n\n // \"namepath\"\n ['typeOrNameRequired', true],\n ])],\n\n ['listens', new Map([\n // Signature seems to require a \"name\" (of an event) and no\n // counter-examples\n ['nameContents', 'namepath-referencing'],\n ])],\n\n ['member', new Map([\n // Allows for \"name\"'s in signature, but indicated as optional\n ['nameContents', 'namepath-defining'],\n\n // Has example showing curly brackets but not in doc signature\n ['typeAllowed', true],\n ])],\n\n ['memberof', new Map([\n // Signature seems to require a \"namepath\" (and no counter-examples),\n // though it allows an incomplete namepath ending with connecting symbol\n ['nameContents', 'namepath-referencing'],\n\n // \"namepath\"\n ['typeOrNameRequired', true],\n ])],\n ['memberof!', new Map([\n // Signature seems to require a \"namepath\" (and no counter-examples),\n // though it allows an incomplete namepath ending with connecting symbol\n ['nameContents', 'namepath-referencing'],\n\n // \"namepath\"\n ['typeOrNameRequired', true],\n ])],\n\n ['method', new Map([\n // Allows for \"name\"'s in signature, but indicated as optional\n ['nameContents', 'namepath-defining'],\n ])],\n ['mixes', new Map([\n // Signature seems to require a \"OtherObjectPath\" with no\n // counter-examples\n ['nameContents', 'namepath-referencing'],\n\n // \"OtherObjectPath\"\n ['typeOrNameRequired', true],\n ])],\n\n ['mixin', new Map([\n // Allows for \"name\"'s in signature, but indicated as optional\n ['nameContents', 'namepath-defining'],\n ])],\n\n ['modifies', new Map([\n // Has no documentation, but test example has curly brackets, and\n // \"name\" would be suggested rather than \"namepath\" based on example;\n // not sure if name is required\n ['typeAllowed', true],\n ])],\n\n ['module', new Map([\n // Optional \"name\" and no curly brackets\n // this block impacts `no-undefined-types` and `valid-types` (search for\n // \"isNamepathDefiningTag|tagMightHaveNamepath|tagMightHaveEitherTypeOrNamePosition\")\n ['nameContents', isJsdoc ? 'namepath-defining' : 'text'],\n\n // Shows the signature with curly brackets but not in the example\n ['typeAllowed', true],\n ])],\n\n ['name', new Map([\n // Seems to require a \"namepath\" in the signature (with no\n // counter-examples)\n ['nameContents', 'namepath-defining'],\n\n // \"namepath\"\n ['nameRequired', true],\n\n // \"namepath\"\n ['typeOrNameRequired', true],\n ])],\n\n ['namespace', new Map([\n // Allows for \"name\"'s in signature, but indicated as optional\n ['nameContents', 'namepath-defining'],\n\n // Shows the signature with curly brackets but not in the example\n ['typeAllowed', true],\n ])],\n ['package', new Map([\n // Shows the signature with curly brackets but not in the example\n // \"typeExpression\"\n ['typeAllowed', isClosureOrPermissive],\n ])],\n\n ['param', new Map([\n ['nameContents', 'namepath-defining'],\n\n // Though no signature provided requiring, per\n // https://jsdoc.app/tags-param.html:\n // \"The @param tag requires you to specify the name of the parameter you\n // are documenting.\"\n ['nameRequired', true],\n\n // Has no formal signature in the docs but shows curly brackets\n // in the examples\n ['typeAllowed', true],\n ])],\n\n ['private', new Map([\n // Shows the signature with curly brackets but not in the example\n // \"typeExpression\"\n ['typeAllowed', isClosureOrPermissive],\n ])],\n\n ['prop', new Map([\n ['nameContents', 'namepath-defining'],\n\n // See `property`\n ['nameRequired', true],\n\n // Has no formal signature in the docs but shows curly brackets\n // in the examples\n ['typeAllowed', true],\n ])],\n\n ['property', new Map([\n ['nameContents', 'namepath-defining'],\n\n // No docs indicate required, but since parallel to `param`, we treat as\n // such:\n ['nameRequired', true],\n\n // Has no formal signature in the docs but shows curly brackets\n // in the examples\n ['typeAllowed', true],\n ])],\n\n ['protected', new Map([\n // Shows the signature with curly brackets but not in the example\n // \"typeExpression\"\n ['typeAllowed', isClosureOrPermissive],\n ])],\n\n ['public', new Map([\n // Does not show a signature nor show curly brackets in the example\n ['typeAllowed', isClosureOrPermissive],\n ])],\n\n ['returns', new Map([\n // Shows curly brackets in the signature and in the examples\n ['typeAllowed', true],\n ])],\n ['return', new Map([\n // Shows curly brackets in the signature and in the examples\n ['typeAllowed', true],\n ])],\n\n ['see', new Map([\n // Signature allows for \"namepath\" or text, so user must configure to\n // 'namepath-referencing' to enforce checks\n ['nameContents', 'text'],\n ])],\n\n ['static', new Map([\n // Does not show a signature nor show curly brackets in the example\n ['typeAllowed', isClosureOrPermissive],\n ])],\n\n ['suppress', new Map([\n ['nameContents', !isClosure],\n ['typeRequired', isClosure],\n ])],\n\n ['template', new Map([\n ['nameContents', isJsdoc ? 'text' : 'namepath-referencing'],\n\n // Though defines `nameContents: 'namepath-defining'` in a sense, it is\n // not parseable in the same way for template (e.g., allowing commas),\n // so not adding\n ['typeAllowed', isTypescriptOrClosure || isPermissive],\n ])],\n\n ['this', new Map([\n // Signature seems to require a \"namepath\" (and no counter-examples)\n // Not used with namepath in Closure/TypeScript, however\n ['nameContents', isJsdoc ? 'namepath-referencing' : false],\n\n ['typeRequired', isTypescriptOrClosure],\n\n // namepath\n ['typeOrNameRequired', isJsdoc],\n ])],\n\n ['throws', new Map([\n // Shows curly brackets in the signature and in the examples\n ['typeAllowed', true],\n ])],\n\n ['type', new Map([\n // Shows curly brackets in the doc signature and examples\n // \"typeName\"\n ['typeRequired', true],\n ])],\n\n ['typedef', new Map([\n // Seems to require a \"namepath\" in the signature (with no\n // counter-examples)\n ['nameContents', 'namepath-defining'],\n\n // \"namepath\"\n ['nameRequired', isJsdocTypescriptOrPermissive],\n\n // Has example showing curly brackets but not in doc signature\n ['typeAllowed', true],\n\n // \"namepath\"\n ['typeOrNameRequired', true],\n ])],\n\n ['var', new Map([\n // Allows for \"name\"'s in signature, but indicated as optional\n ['nameContents', 'namepath-defining'],\n\n // Has example showing curly brackets but not in doc signature\n ['typeAllowed', true],\n ])],\n\n ['yields', new Map([\n // Shows curly brackets in the signature and in the examples\n ['typeAllowed', true],\n ])],\n ['yield', new Map([\n // Shows curly brackets in the signature and in the examples\n ['typeAllowed', true],\n ])],\n ]);\n};\n\nexport default getDefaultTagStructureForMode;\n"],"file":"getDefaultTagStructureForMode.js"}
@@ -5,6 +5,8 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
 
8
+ var _esquery = _interopRequireDefault(require("esquery"));
9
+
8
10
  var _iterateJsdoc = _interopRequireDefault(require("../iterateJsdoc"));
9
11
 
10
12
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -28,14 +30,29 @@ const incrementSelector = (state, selector, comment) => {
28
30
  };
29
31
 
30
32
  var _default = (0, _iterateJsdoc.default)(({
33
+ context,
34
+ node,
31
35
  info: {
32
- selector,
33
36
  comment
34
37
  },
35
38
  state
36
39
  }) => {
40
+ var _foundContext$context;
41
+
42
+ if (!context.options[0]) {
43
+ // Handle error later
44
+ return;
45
+ }
46
+
47
+ const {
48
+ contexts
49
+ } = context.options[0];
50
+ const foundContext = contexts.find(cntxt => {
51
+ return typeof cntxt === 'string' ? _esquery.default.matches(node, _esquery.default.parse(cntxt)) : (!cntxt.context || cntxt.context === 'any' || _esquery.default.matches(node, _esquery.default.parse(cntxt.context))) && comment === cntxt.comment;
52
+ });
53
+ const contextStr = typeof foundContext === 'object' ? (_foundContext$context = foundContext.context) !== null && _foundContext$context !== void 0 ? _foundContext$context : 'any' : foundContext;
37
54
  setDefaults(state);
38
- incrementSelector(state, selector, comment);
55
+ incrementSelector(state, contextStr, comment);
39
56
  }, {
40
57
  contextSelected: true,
41
58
 
@@ -98,6 +115,7 @@ var _default = (0, _iterateJsdoc.default)(({
98
115
  });
99
116
  },
100
117
 
118
+ matchContext: true,
101
119
  meta: {
102
120
  docs: {
103
121
  description: 'Reports when certain comment structures are always expected.',
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/rules/noMissingSyntax.js"],"names":["setDefaults","state","selectorMap","incrementSelector","selector","comment","info","contextSelected","exit","context","options","length","report","loc","start","column","line","message","contexts","some","cntxt","contextStr","contextKey","undefined","minimum","Object","values","every","cmmnt","data","end","meta","docs","description","url","fixable","schema","additionalProperties","properties","items","anyOf","type"],"mappings":";;;;;;;AAAA;;;;AAEA,MAAMA,WAAW,GAAIC,KAAD,IAAW;AAC7B,MAAI,CAACA,KAAK,CAACC,WAAX,EAAwB;AACtBD,IAAAA,KAAK,CAACC,WAAN,GAAoB,EAApB;AACD;AACF,CAJD;;AAMA,MAAMC,iBAAiB,GAAG,CAACF,KAAD,EAAQG,QAAR,EAAkBC,OAAlB,KAA8B;AACtD,MAAI,CAACJ,KAAK,CAACC,WAAN,CAAkBE,QAAlB,CAAL,EAAkC;AAChCH,IAAAA,KAAK,CAACC,WAAN,CAAkBE,QAAlB,IAA8B,EAA9B;AACD;;AAED,MAAI,CAACH,KAAK,CAACC,WAAN,CAAkBE,QAAlB,EAA4BC,OAA5B,CAAL,EAA2C;AACzCJ,IAAAA,KAAK,CAACC,WAAN,CAAkBE,QAAlB,EAA4BC,OAA5B,IAAuC,CAAvC;AACD;;AAEDJ,EAAAA,KAAK,CAACC,WAAN,CAAkBE,QAAlB,EAA4BC,OAA5B;AACD,CAVD;;eAYe,2BAAa,CAAC;AAC3BC,EAAAA,IAAI,EAAE;AAACF,IAAAA,QAAD;AAAWC,IAAAA;AAAX,GADqB;AAE3BJ,EAAAA;AAF2B,CAAD,KAGtB;AACJD,EAAAA,WAAW,CAACC,KAAD,C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AAAA,UAAU,EAAE;AACVjC,gBAAAA,OAAO,EAAE;AACPoC,kBAAAA,IAAI,EAAE;AADC,iBADC;AAIVhC,gBAAAA,OAAO,EAAE;AACPgC,kBAAAA,IAAI,EAAE;AADC,iBAJC;AAOVxB,gBAAAA,OAAO,EAAE;AACPwB,kBAAAA,IAAI,EAAE;AADC,iBAPC;AAUVjB,gBAAAA,OAAO,EAAE;AACPiB,kBAAAA,IAAI,EAAE;AADC;AAVC,eAFd;AAgBEA,cAAAA,IAAI,EAAE;AAhBR,aAJK;AADF,WADC;AA0BRA,UAAAA,IAAI,EAAE;AA1BE;AADA,OAFd;AAgCEA,MAAAA,IAAI,EAAE;AAhCR,KADM,CANJ;AA0CJA,IAAAA,IAAI,EAAE;AA1CF;AA5DL,CAPY,C","sourcesContent":["import iterateJsdoc from '../iterateJsdoc';\n\nconst setDefaults = (state) => {\n if (!state.selectorMap) {\n state.selectorMap = {};\n }\n};\n\nconst incrementSelector = (state, selector, comment) => {\n if (!state.selectorMap[selector]) {\n state.selectorMap[selector] = {};\n }\n\n if (!state.selectorMap[selector][comment]) {\n state.selectorMap[selector][comment] = 0;\n }\n\n state.selectorMap[selector][comment]++;\n};\n\nexport default iterateJsdoc(({\n info: {selector, comment},\n state,\n}) => {\n setDefaults(state);\n\n incrementSelector(state, selector, comment);\n}, {\n contextSelected: true,\n exit ({\n context, state,\n }) {\n if (!context.options.length) {\n context.report({\n loc: {\n start: {\n column: 1,\n line: 1,\n },\n },\n message: 'Rule `no-missing-syntax` is missing a `context` option.',\n });\n\n return;\n }\n\n setDefaults(state);\n\n const {\n contexts,\n } = context.options[0];\n\n // Report when MISSING\n contexts.some((cntxt) => {\n const contextStr = typeof cntxt === 'object' ? cntxt.context ?? 'any' : cntxt;\n const comment = cntxt?.comment ?? '';\n\n const contextKey = contextStr === 'any' ? undefined : contextStr;\n\n if (\n (!state.selectorMap[contextKey] ||\n !state.selectorMap[contextKey][comment] ||\n state.selectorMap[contextKey][comment] < (cntxt?.minimum ?? 1)) &&\n (contextStr !== 'any' || Object.values(state.selectorMap).every((cmmnt) => {\n return !cmmnt[comment] || cmmnt[comment] < (cntxt?.minimum ?? 1);\n }))\n ) {\n const message = cntxt?.message ?? 'Syntax is required: {{context}}' +\n (comment ? ' with {{comment}}' : '');\n context.report({\n data: {\n comment,\n context: contextStr,\n },\n loc: {\n end: {line: 1},\n start: {line: 1},\n },\n message,\n });\n\n return true;\n }\n\n return false;\n });\n },\n meta: {\n docs: {\n description: 'Reports when certain comment structures are always expected.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-no-missing-syntax',\n },\n fixable: 'code',\n schema: [\n {\n additionalProperties: false,\n properties: {\n contexts: {\n items: {\n anyOf: [\n {\n type: 'string',\n },\n {\n additionalProperties: false,\n properties: {\n comment: {\n type: 'string',\n },\n context: {\n type: 'string',\n },\n message: {\n type: 'string',\n },\n minimum: {\n type: 'integer',\n },\n },\n type: 'object',\n },\n ],\n },\n type: 'array',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"file":"noMissingSyntax.js"}
1
+ {"version":3,"sources":["../../src/rules/noMissingSyntax.js"],"names":["setDefaults","state","selectorMap","incrementSelector","selector","comment","context","node","info","options","contexts","foundContext","find","cntxt","esquery","matches","parse","contextStr","contextSelected","exit","length","report","loc","start","column","line","message","some","contextKey","undefined","minimum","Object","values","every","cmmnt","data","end","matchContext","meta","docs","description","url","fixable","schema","additionalProperties","properties","items","anyOf","type"],"mappings":";;;;;;;AAAA;;AACA;;;;AAEA,MAAMA,WAAW,GAAIC,KAAD,IAAW;AAC7B,MAAI,CAACA,KAAK,CAACC,WAAX,EAAwB;AACtBD,IAAAA,KAAK,CAACC,WAAN,GAAoB,EAApB;AACD;AACF,CAJD;;AAMA,MAAMC,iBAAiB,GAAG,CAACF,KAAD,EAAQG,QAAR,EAAkBC,OAAlB,KAA8B;AACtD,MAAI,CAACJ,KAAK,CAACC,WAAN,CAAkBE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,oBAAoB,EAAE,KADxB;AAEEC,cAAAA,UAAU,EAAE;AACVxC,gBAAAA,OAAO,EAAE;AACP2C,kBAAAA,IAAI,EAAE;AADC,iBADC;AAIV1C,gBAAAA,OAAO,EAAE;AACP0C,kBAAAA,IAAI,EAAE;AADC,iBAJC;AAOVtB,gBAAAA,OAAO,EAAE;AACPsB,kBAAAA,IAAI,EAAE;AADC,iBAPC;AAUVlB,gBAAAA,OAAO,EAAE;AACPkB,kBAAAA,IAAI,EAAE;AADC;AAVC,eAFd;AAgBEA,cAAAA,IAAI,EAAE;AAhBR,aAJK;AADF,WADC;AA0BRA,UAAAA,IAAI,EAAE;AA1BE;AADA,OAFd;AAgCEA,MAAAA,IAAI,EAAE;AAhCR,KADM,CANJ;AA0CJA,IAAAA,IAAI,EAAE;AA1CF;AA7DL,CA3BY,C","sourcesContent":["import esquery from 'esquery';\nimport iterateJsdoc from '../iterateJsdoc';\n\nconst setDefaults = (state) => {\n if (!state.selectorMap) {\n state.selectorMap = {};\n }\n};\n\nconst incrementSelector = (state, selector, comment) => {\n if (!state.selectorMap[selector]) {\n state.selectorMap[selector] = {};\n }\n\n if (!state.selectorMap[selector][comment]) {\n state.selectorMap[selector][comment] = 0;\n }\n\n state.selectorMap[selector][comment]++;\n};\n\nexport default iterateJsdoc(({\n context,\n node,\n info: {comment},\n state,\n}) => {\n if (!context.options[0]) {\n // Handle error later\n return;\n }\n\n const {contexts} = context.options[0];\n\n const foundContext = contexts.find((cntxt) => {\n return typeof cntxt === 'string' ?\n esquery.matches(node, esquery.parse(cntxt)) :\n (!cntxt.context || cntxt.context === 'any' || esquery.matches(node, esquery.parse(cntxt.context))) &&\n comment === cntxt.comment;\n });\n\n const contextStr = typeof foundContext === 'object' ?\n foundContext.context ?? 'any' :\n foundContext;\n\n setDefaults(state);\n\n incrementSelector(state, contextStr, comment);\n}, {\n contextSelected: true,\n exit ({\n context, state,\n }) {\n if (!context.options.length) {\n context.report({\n loc: {\n start: {\n column: 1,\n line: 1,\n },\n },\n message: 'Rule `no-missing-syntax` is missing a `context` option.',\n });\n\n return;\n }\n\n setDefaults(state);\n\n const {\n contexts,\n } = context.options[0];\n\n // Report when MISSING\n contexts.some((cntxt) => {\n const contextStr = typeof cntxt === 'object' ? cntxt.context ?? 'any' : cntxt;\n const comment = cntxt?.comment ?? '';\n\n const contextKey = contextStr === 'any' ? undefined : contextStr;\n\n if (\n (!state.selectorMap[contextKey] ||\n !state.selectorMap[contextKey][comment] ||\n state.selectorMap[contextKey][comment] < (cntxt?.minimum ?? 1)) &&\n (contextStr !== 'any' || Object.values(state.selectorMap).every((cmmnt) => {\n return !cmmnt[comment] || cmmnt[comment] < (cntxt?.minimum ?? 1);\n }))\n ) {\n const message = cntxt?.message ?? 'Syntax is required: {{context}}' +\n (comment ? ' with {{comment}}' : '');\n context.report({\n data: {\n comment,\n context: contextStr,\n },\n loc: {\n end: {line: 1},\n start: {line: 1},\n },\n message,\n });\n\n return true;\n }\n\n return false;\n });\n },\n matchContext: true,\n meta: {\n docs: {\n description: 'Reports when certain comment structures are always expected.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-no-missing-syntax',\n },\n fixable: 'code',\n schema: [\n {\n additionalProperties: false,\n properties: {\n contexts: {\n items: {\n anyOf: [\n {\n type: 'string',\n },\n {\n additionalProperties: false,\n properties: {\n comment: {\n type: 'string',\n },\n context: {\n type: 'string',\n },\n message: {\n type: 'string',\n },\n minimum: {\n type: 'integer',\n },\n },\n type: 'object',\n },\n ],\n },\n type: 'array',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"file":"noMissingSyntax.js"}
@@ -5,14 +5,16 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
 
8
+ var _esquery = _interopRequireDefault(require("esquery"));
9
+
8
10
  var _iterateJsdoc = _interopRequireDefault(require("../iterateJsdoc"));
9
11
 
10
12
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
13
 
12
14
  var _default = (0, _iterateJsdoc.default)(({
15
+ node,
13
16
  context,
14
17
  info: {
15
- selector,
16
18
  comment
17
19
  },
18
20
  report
@@ -28,7 +30,7 @@ var _default = (0, _iterateJsdoc.default)(({
28
30
  contexts
29
31
  } = context.options[0];
30
32
  const foundContext = contexts.find(cntxt => {
31
- return cntxt === selector || typeof cntxt === 'object' && (!cntxt.context || cntxt.context === 'any' || selector === cntxt.context) && comment === cntxt.comment;
33
+ return typeof cntxt === 'string' ? _esquery.default.matches(node, _esquery.default.parse(cntxt)) : (!cntxt.context || cntxt.context === 'any' || _esquery.default.matches(node, _esquery.default.parse(cntxt.context))) && comment === cntxt.comment;
32
34
  }); // We are not on the *particular* matching context/comment, so don't assume
33
35
  // we need reporting
34
36
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/rules/noRestrictedSyntax.js"],"names":["context","info","selector","comment","report","options","length","contexts","foundContext","find","cntxt","contextStr","message","contextSelected","meta","docs","description","url","fixable","schema","additionalProperties","properties","items","anyOf","type","required"],"mappings":";;;;;;;AAAA;;;;eAEe,2BAAa,CAAC;AAC3BA,EAAAA,OAD2B;AAE3BC,EAAAA,IAAI,EAAE;AAACC,IAAAA,QAAD;AAAWC,IAAAA;AAAX,GAFqB;AAG3BC,EAAAA;AAH2B,CAAD,KAItB;AAAA;;AACJ,MAAI,CAACJ,OAAO,CAACK,OAAR,CAAgBC,MAArB,EAA6B;AAC3BF,IAAAA,MAAM,CAAC,4DAAD,CAAN;AAEA;AACD;;AAED,QAAM;AAACG,IAAAA;AAAD,MAAaP,OAAO,CAACK,OAAR,CAAgB,CAAhB,CAAnB;AAEA,QAAMG,YAAY,GAAGD,QAAQ,CAACE,IAAT,CAAeC,KAAD,IAAW;AAC5C,WAAOA,KAAK,KAAKR,QAAV,IACL,OAAOQ,KAAP,KAAiB,QAAjB,KACC,CAACA,KAAK,CAACV,OAAP,IAAkBU,KAAK,CAACV,OAAN,KAAkB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,EAAE;AAvBE;AADA,OAFd;AA6BEC,MAAAA,QAAQ,EAAE,CAAC,UAAD,CA7BZ;AA8BED,MAAAA,IAAI,EAAE;AA9BR,KADM,CANJ;AAwCJA,IAAAA,IAAI,EAAE;AAxCF;AAFL,CAnCY,C","sourcesContent":["import iterateJsdoc from '../iterateJsdoc';\n\nexport default iterateJsdoc(({\n context,\n info: {selector, comment},\n report,\n}) => {\n if (!context.options.length) {\n report('Rule `no-restricted-syntax` is missing a `context` option.');\n\n return;\n }\n\n const {contexts} = context.options[0];\n\n const foundContext = contexts.find((cntxt) => {\n return cntxt === selector ||\n typeof cntxt === 'object' &&\n (!cntxt.context || cntxt.context === 'any' || selector === cntxt.context) &&\n comment === cntxt.comment;\n });\n\n // We are not on the *particular* matching context/comment, so don't assume\n // we need reporting\n if (!foundContext) {\n return;\n }\n\n const contextStr = typeof foundContext === 'object' ?\n foundContext.context ?? 'any' :\n foundContext;\n const message = foundContext?.message ??\n 'Syntax is restricted: {{context}}.';\n\n report(message, null, null, {\n context: contextStr,\n });\n}, {\n contextSelected: true,\n meta: {\n docs: {\n description: 'Reports when certain comment structures are present.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-no-restricted-syntax',\n },\n fixable: 'code',\n schema: [\n {\n additionalProperties: false,\n properties: {\n contexts: {\n items: {\n anyOf: [\n {\n type: 'string',\n },\n {\n additionalProperties: false,\n properties: {\n comment: {\n type: 'string',\n },\n context: {\n type: 'string',\n },\n message: {\n type: 'string',\n },\n },\n type: 'object',\n },\n ],\n },\n type: 'array',\n },\n },\n required: ['contexts'],\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"file":"noRestrictedSyntax.js"}
1
+ {"version":3,"sources":["../../src/rules/noRestrictedSyntax.js"],"names":["node","context","info","comment","report","options","length","contexts","foundContext","find","cntxt","esquery","matches","parse","contextStr","message","contextSelected","meta","docs","description","url","fixable","schema","additionalProperties","properties","items","anyOf","type","required"],"mappings":";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AAI,EAAE;AACJC,IAAAA,IAAI,EAAE;AACJC,MAAAA,WAAW,EAAE,sDADT;AAEJC,MAAAA,GAAG,EAAE;AAFD,KADF;AAKJC,IAAAA,OAAO,EAAE,MALL;AAMJC,IAAAA,MAAM,EAAE,CACN;AACEC,MAAAA,oBAAoB,EAAE,KADxB;AAEEC,MAAAA,UAAU,EAAE;AACVjB,QAAAA,QAAQ,EAAE;AACRkB,UAAAA,KAAK,EAAE;AACLC,YAAAA,KAAK,EAAE,CACL;AACEC,cAAAA,IAAI,EAAE;AADR,aADK,EAIL;AACEJ,cAAAA,oBAAoB,EAAE,KADxB;AAEEC,cAAAA,UAAU,EAAE;AACVrB,gBAAAA,OAAO,EAAE;AACPwB,kBAAAA,IAAI,EAAE;AADC,iBADC;AAIV1B,gBAAAA,OAAO,EAAE;AACP0B,kBAAAA,IAAI,EAAE;AADC,iBAJC;AAOVZ,gBAAAA,OAAO,EAAE;AACPY,kBAAAA,IAAI,EAAE;AADC;AAPC,eAFd;AAaEA,cAAAA,IAAI,EAAE;AAbR,aAJK;AADF,WADC;AAuBRA,UAAAA,IAAI,EAAE;AAvBE;AADA,OAFd;AA6BEC,MAAAA,QAAQ,EAAE,CAAC,UAAD,CA7BZ;AA8BED,MAAAA,IAAI,EAAE;AA9BR,KADM,CANJ;AAwCJA,IAAAA,IAAI,EAAE;AAxCF;AAFL,CApCY,C","sourcesContent":["import esquery from 'esquery';\nimport iterateJsdoc from '../iterateJsdoc';\n\nexport default iterateJsdoc(({\n node,\n context,\n info: {comment},\n report,\n}) => {\n if (!context.options.length) {\n report('Rule `no-restricted-syntax` is missing a `context` option.');\n\n return;\n }\n\n const {contexts} = context.options[0];\n\n const foundContext = contexts.find((cntxt) => {\n return typeof cntxt === 'string' ?\n esquery.matches(node, esquery.parse(cntxt)) :\n (!cntxt.context || cntxt.context === 'any' || esquery.matches(node, esquery.parse(cntxt.context))) &&\n comment === cntxt.comment;\n });\n\n // We are not on the *particular* matching context/comment, so don't assume\n // we need reporting\n if (!foundContext) {\n return;\n }\n\n const contextStr = typeof foundContext === 'object' ?\n foundContext.context ?? 'any' :\n foundContext;\n const message = foundContext?.message ??\n 'Syntax is restricted: {{context}}.';\n\n report(message, null, null, {\n context: contextStr,\n });\n}, {\n contextSelected: true,\n meta: {\n docs: {\n description: 'Reports when certain comment structures are present.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-no-restricted-syntax',\n },\n fixable: 'code',\n schema: [\n {\n additionalProperties: false,\n properties: {\n contexts: {\n items: {\n anyOf: [\n {\n type: 'string',\n },\n {\n additionalProperties: false,\n properties: {\n comment: {\n type: 'string',\n },\n context: {\n type: 'string',\n },\n message: {\n type: 'string',\n },\n },\n type: 'object',\n },\n ],\n },\n type: 'array',\n },\n },\n required: ['contexts'],\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"file":"noRestrictedSyntax.js"}
@@ -65,10 +65,11 @@ var _default = (0, _iterateJsdoc.default)(({
65
65
  if (tags.length > 1) {
66
66
  report(`Found more than one @${tagName} declaration.`);
67
67
  return;
68
- } // In case a return value is declared in JSDoc, we also expect one in the code.
68
+ }
69
69
 
70
+ const [tag] = tags; // In case a return value is declared in JSDoc, we also expect one in the code.
70
71
 
71
- if ((reportMissingReturnForUndefinedTypes || utils.hasDefinedTypeTag(tags[0])) && !utils.hasValueOrExecutorHasNonEmptyResolveValue(exemptAsync) && (!exemptGenerators || !node.generator)) {
72
+ if (tag.type.trim() !== 'never' && (reportMissingReturnForUndefinedTypes || utils.hasDefinedTypeTag(tag)) && !utils.hasValueOrExecutorHasNonEmptyResolveValue(exemptAsync) && (!exemptGenerators || !node.generator)) {
72
73
  report(`JSDoc @${tagName} declaration present but return expression not available in function.`);
73
74
  }
74
75
  }, {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/rules/requireReturnsCheck.js"],"names":["canSkip","utils","settings","voidingTags","mode","push","hasATag","isConstructor","classHasTag","context","node","report","exemptAsync","exemptGenerators","reportMissingReturnForUndefinedTypes","options","isAsync","tagName","getPreferredTagName","tags","getTags","length","hasDefinedTypeTag","hasValueOrExecutorHasNonEmptyResolveValue","generator","meta","docs","description","url","schema","additionalProperties","properties","default","type"],"mappings":";;;;;;;AAAA;;;;AAEA,MAAMA,OAAO,GAAG,CAACC,KAAD,EAAQC,QAAR,KAAqB;AACnC,QAAMC,WAAW,GAAG,CAClB;AACA;AACA;AACA;AACA;AACA,YANkB,EAOlB,SAPkB,EASlB;AACA;AACA,SAXkB,EAYlB,aAZkB,EAalB,WAbkB,CAApB;;AAgBA,MAAID,QAAQ,CAACE,IAAT,KAAkB,SAAtB,EAAiC;AAC/B;AACAD,IAAAA,WAAW,CAACE,IAAZ,CAAiB,QAAjB;AACD;;AAED,SAAOJ,KAAK,CAACK,OAAN,CAAcH,WAAd,KACLF,KAAK,CAACM,aAAN,EADK,IAELN,KAAK,CAACO,WAAN,CAAkB,WAAlB,CAFK,IAGLN,QAAQ,CAACE,IAAT,KAAkB,SAAlB,IAA+BH,KAAK,CAACO,WAAN,CAAkB,QAAlB,CAHjC;AAID,CA1BD;;eA4Be,2BAAa,CAAC;AAC3BC,EAAAA,OAD2B;AAE3BC,EAAAA,IAF2B;AAG3BC,EAAAA,MAH2B;AAI3BT,EAAAA,QAJ2B;AAK3BD,EAAAA;AAL2B,CAAD,KAMtB;AACJ,QAAM;AACJW,IAAAA,WAAW,GAAG,IADV;AAEJC,IAAAA,gBAAgB,GAAGX,QAAQ,CAACE,IAAT,KAAkB,YAFjC;AAGJU,IAAAA,oCAAoC,GAAG;AAHnC,MAIFL,OAAO,CAACM,OAAR,CAAgB,CAAhB,KAAsB,EAJ1B;;AAMA,MAAIf,OAAO,CAACC,KAAD,EAAQC,QAAR,CAAX,EAA8B;AAC5B;AACD;;AAED,MAAIU,WAAW,IAAIX,KAAK,CAACe,OAAN,EAAnB,EAAoC;AAClC;AACD;;AAED,QAAMC,OAAO,GAAGhB,KAAK,CAACiB,mBAAN,CAA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C","sourcesContent":["import iterateJsdoc from '../iterateJsdoc';\n\nconst canSkip = (utils, settings) => {\n const voidingTags = [\n // An abstract function is by definition incomplete\n // so it is perfectly fine if a return is documented but\n // not present within the function.\n // A subclass may inherit the doc and implement the\n // missing return.\n 'abstract',\n 'virtual',\n\n // A constructor function returns `this` by default, so may be `@returns`\n // tag indicating this but no explicit return\n 'class',\n 'constructor',\n 'interface',\n ];\n\n if (settings.mode === 'closure') {\n // Structural Interface in GCC terms, equivalent to @interface tag as far as this rule is concerned\n voidingTags.push('record');\n }\n\n return utils.hasATag(voidingTags) ||\n utils.isConstructor() ||\n utils.classHasTag('interface') ||\n settings.mode === 'closure' && utils.classHasTag('record');\n};\n\nexport default iterateJsdoc(({\n context,\n node,\n report,\n settings,\n utils,\n}) => {\n const {\n exemptAsync = true,\n exemptGenerators = settings.mode === 'typescript',\n reportMissingReturnForUndefinedTypes = false,\n } = context.options[0] || {};\n\n if (canSkip(utils, settings)) {\n return;\n }\n\n if (exemptAsync && utils.isAsync()) {\n return;\n }\n\n const tagName = utils.getPreferredTagName({tagName: 'returns'});\n if (!tagName) {\n return;\n }\n\n const tags = utils.getTags(tagName);\n\n if (tags.length === 0) {\n return;\n }\n\n if (tags.length > 1) {\n report(`Found more than one @${tagName} declaration.`);\n\n return;\n }\n\n // In case a return value is declared in JSDoc, we also expect one in the code.\n if ((reportMissingReturnForUndefinedTypes || utils.hasDefinedTypeTag(tags[0])) && !utils.hasValueOrExecutorHasNonEmptyResolveValue(\n exemptAsync,\n ) && (!exemptGenerators || !node.generator)) {\n report(`JSDoc @${tagName} declaration present but return expression not available in function.`);\n }\n}, {\n meta: {\n docs: {\n description: 'Requires a return statement in function body if a `@returns` tag is specified in jsdoc comment.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-require-returns-check',\n },\n schema: [\n {\n additionalProperties: false,\n properties: {\n exemptAsync: {\n default: true,\n type: 'boolean',\n },\n exemptGenerators: {\n type: 'boolean',\n },\n reportMissingReturnForUndefinedTypes: {\n default: false,\n type: 'boolean',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"file":"requireReturnsCheck.js"}
1
+ {"version":3,"sources":["../../src/rules/requireReturnsCheck.js"],"names":["canSkip","utils","settings","voidingTags","mode","push","hasATag","isConstructor","classHasTag","context","node","report","exemptAsync","exemptGenerators","reportMissingReturnForUndefinedTypes","options","isAsync","tagName","getPreferredTagName","tags","getTags","length","tag","type","trim","hasDefinedTypeTag","hasValueOrExecutorHasNonEmptyResolveValue","generator","meta","docs","description","url","schema","additionalProperties","properties","default"],"mappings":";;;;;;;AAAA;;;;AAEA,MAAMA,OAAO,GAAG,CAACC,KAAD,EAAQC,QAAR,KAAqB;AACnC,QAAMC,WAAW,GAAG,CAClB;AACA;AACA;AACA;AACA;AACA,YANkB,EAOlB,SAPkB,EASlB;AACA;AACA,SAXkB,EAYlB,aAZkB,EAalB,WAbkB,CAApB;;AAgBA,MAAID,QAAQ,CAACE,IAAT,KAAkB,SAAtB,EAAiC;AAC/B;AACAD,IAAAA,WAAW,CAACE,IAAZ,CAAiB,QAAjB;AACD;;AAED,SAAOJ,KAAK,CAACK,OAAN,CAAcH,WAAd,KACLF,KAAK,CAACM,aAAN,EADK,IAELN,KAAK,CAACO,WAAN,CAAkB,WAAlB,CAFK,IAGLN,QAAQ,CAACE,IAAT,KAAkB,SAAlB,IAA+BH,KAAK,CAACO,WAAN,CAAkB,QAAlB,CAHjC;AAID,CA1BD;;eA4Be,2BAAa,CAAC;AAC3BC,EAAAA,OAD2B;AAE3BC,EAAAA,IAF2B;AAG3BC,EAAAA,MAH2B;AAI3BT,EAAAA,QAJ2B;AAK3BD,EAAAA;AAL2B,CAAD,KAMtB;AACJ,QAAM;AACJW,IAAAA,WAAW,GAAG,IADV;AAEJC,IAAAA,gBAAgB,GAAGX,QAAQ,CAACE,IAAT,KAAkB,YAFjC;AAGJU,IAAAA,oCAAoC,GAAG;AAHnC,MAIFL,O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EAAE;AAFK,SADH;AAKVV,QAAAA,gBAAgB,EAAE;AAChBU,UAAAA,IAAI,EAAE;AADU,SALR;AAQVT,QAAAA,oCAAoC,EAAE;AACpCqB,UAAAA,OAAO,EAAE,KAD2B;AAEpCZ,UAAAA,IAAI,EAAE;AAF8B;AAR5B,OAFd;AAeEA,MAAAA,IAAI,EAAE;AAfR,KADM,CALJ;AAwBJA,IAAAA,IAAI,EAAE;AAxBF;AADL,CArDY,C","sourcesContent":["import iterateJsdoc from '../iterateJsdoc';\n\nconst canSkip = (utils, settings) => {\n const voidingTags = [\n // An abstract function is by definition incomplete\n // so it is perfectly fine if a return is documented but\n // not present within the function.\n // A subclass may inherit the doc and implement the\n // missing return.\n 'abstract',\n 'virtual',\n\n // A constructor function returns `this` by default, so may be `@returns`\n // tag indicating this but no explicit return\n 'class',\n 'constructor',\n 'interface',\n ];\n\n if (settings.mode === 'closure') {\n // Structural Interface in GCC terms, equivalent to @interface tag as far as this rule is concerned\n voidingTags.push('record');\n }\n\n return utils.hasATag(voidingTags) ||\n utils.isConstructor() ||\n utils.classHasTag('interface') ||\n settings.mode === 'closure' && utils.classHasTag('record');\n};\n\nexport default iterateJsdoc(({\n context,\n node,\n report,\n settings,\n utils,\n}) => {\n const {\n exemptAsync = true,\n exemptGenerators = settings.mode === 'typescript',\n reportMissingReturnForUndefinedTypes = false,\n } = context.options[0] || {};\n\n if (canSkip(utils, settings)) {\n return;\n }\n\n if (exemptAsync && utils.isAsync()) {\n return;\n }\n\n const tagName = utils.getPreferredTagName({tagName: 'returns'});\n if (!tagName) {\n return;\n }\n\n const tags = utils.getTags(tagName);\n\n if (tags.length === 0) {\n return;\n }\n\n if (tags.length > 1) {\n report(`Found more than one @${tagName} declaration.`);\n\n return;\n }\n\n const [tag] = tags;\n\n // In case a return value is declared in JSDoc, we also expect one in the code.\n if (\n tag.type.trim() !== 'never' &&\n (\n reportMissingReturnForUndefinedTypes ||\n utils.hasDefinedTypeTag(tag)\n ) &&\n !utils.hasValueOrExecutorHasNonEmptyResolveValue(\n exemptAsync,\n ) && (!exemptGenerators || !node.generator)\n ) {\n report(`JSDoc @${tagName} declaration present but return expression not available in function.`);\n }\n}, {\n meta: {\n docs: {\n description: 'Requires a return statement in function body if a `@returns` tag is specified in jsdoc comment.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-require-returns-check',\n },\n schema: [\n {\n additionalProperties: false,\n properties: {\n exemptAsync: {\n default: true,\n type: 'boolean',\n },\n exemptGenerators: {\n type: 'boolean',\n },\n reportMissingReturnForUndefinedTypes: {\n default: false,\n type: 'boolean',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"file":"requireReturnsCheck.js"}
@@ -69,6 +69,10 @@ var _default = (0, _iterateJsdoc.default)(({
69
69
 
70
70
  if (preferredYieldTagName) {
71
71
  const shouldReportYields = () => {
72
+ if (yieldTag.type.trim() === 'never') {
73
+ return false;
74
+ }
75
+
72
76
  if (checkGeneratorsOnly && !utils.isGenerator()) {
73
77
  return true;
74
78
  }
@@ -87,6 +91,10 @@ var _default = (0, _iterateJsdoc.default)(({
87
91
 
88
92
  if (preferredNextTagName) {
89
93
  const shouldReportNext = () => {
94
+ if (nextTag.type.trim() === 'never') {
95
+ return false;
96
+ }
97
+
90
98
  if (checkGeneratorsOnly && !utils.isGenerator()) {
91
99
  return true;
92
100
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/rules/requireYieldsCheck.js"],"names":["canSkip","utils","settings","voidingTags","mode","push","hasATag","isConstructor","classHasTag","checkTagName","report","tagName","preferredTagName","getPreferredTagName","tags","getTags","length","context","next","checkGeneratorsOnly","options","preferredYieldTagName","yieldTag","shouldReportYields","isGenerator","hasDefinedTypeTag","hasYieldValue","preferredNextTagName","nextTag","shouldReportNext","hasYieldReturnValue","meta","docs","description","url","schema","additionalProperties","properties","default","type","contexts","items","anyOf","comment","exemptedBy"],"mappings":";;;;;;;AAAA;;;;AAEA,MAA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E;AACJC,MAAAA,WAAW,EAAE,+FADT;AAEJC,MAAAA,GAAG,EAAE;AAFD,KADF;AAKJC,IAAAA,MAAM,EAAE,CACN;AACEC,MAAAA,oBAAoB,EAAE,KADxB;AAEEC,MAAAA,UAAU,EAAE;AACVlB,QAAAA,mBAAmB,EAAE;AACnBmB,UAAAA,OAAO,EAAE,KADU;AAEnBC,UAAAA,IAAI,EAAE;AAFa,SADX;AAKVC,QAAAA,QAAQ,EAAE;AACRC,UAAAA,KAAK,EAAE;AACLC,YAAAA,KAAK,EAAE,CACL;AACEH,cAAAA,IAAI,EAAE;AADR,aADK,EAIL;AACEH,cAAAA,oBAAoB,EAAE,KADxB;AAEEC,cAAAA,UAAU,EAAE;AACVM,gBAAAA,OAAO,EAAE;AACPJ,kBAAAA,IAAI,EAAE;AADC,iBADC;AAIVtB,gBAAAA,OAAO,EAAE;AACPsB,kBAAAA,IAAI,EAAE;AADC;AAJC,eAFd;AAUEA,cAAAA,IAAI,EAAE;AAVR,aAJK;AADF,WADC;AAoBRA,UAAAA,IAAI,EAAE;AApBE,SALA;AA2BVK,QAAAA,UAAU,EAAE;AACVH,UAAAA,KAAK,EAAE;AACLF,YAAAA,IAAI,EAAE;AADD,WADG;AAIVA,UAAAA,IAAI,EAAE;AAJI,SA3BF;AAiCVrB,QAAAA,IAAI,EAAE;AACJoB,UAAAA,OAAO,EAAE,KADL;AAEJC,UAAAA,IAAI,EAAE;AAFF;AAjCI,OAFd;AAwCEA,MAAAA,IAAI,EAAE;AAxCR,KADM,CALJ;AAiDJA,IAAAA,IAAI,EAAE;AAjDF;AADL,CAnDY,C","sourcesContent":["import iterateJsdoc from '../iterateJsdoc';\n\nconst canSkip = (utils, settings) => {\n const voidingTags = [\n // An abstract function is by definition incomplete\n // so it is perfectly fine if a yield is documented but\n // not present within the function.\n // A subclass may inherit the doc and implement the\n // missing yield.\n 'abstract',\n 'virtual',\n\n // Constructor functions do not have a yield value\n // so we can bail here, too.\n 'class',\n 'constructor',\n\n // This seems to imply a class as well\n 'interface',\n ];\n\n if (settings.mode === 'closure') {\n // Structural Interface in GCC terms, equivalent to @interface tag as far as this rule is concerned\n voidingTags.push('record');\n }\n\n return utils.hasATag(voidingTags) ||\n utils.isConstructor() ||\n utils.classHasTag('interface') ||\n settings.mode === 'closure' && utils.classHasTag('record');\n};\n\nconst checkTagName = (utils, report, tagName) => {\n const preferredTagName = utils.getPreferredTagName({tagName});\n if (!preferredTagName) {\n return [];\n }\n\n const tags = utils.getTags(preferredTagName);\n\n if (tags.length === 0) {\n return [];\n }\n\n if (tags.length > 1) {\n report(`Found more than one @${preferredTagName} declaration.`);\n\n return [];\n }\n\n return [preferredTagName, tags[0]];\n};\n\nexport default iterateJsdoc(({\n context,\n report,\n settings,\n utils,\n}) => {\n if (canSkip(utils, settings)) {\n return;\n }\n\n const {\n next = false,\n checkGeneratorsOnly = false,\n } = context.options[0] || {};\n\n const [preferredYieldTagName, yieldTag] = checkTagName(\n utils, report, 'yields',\n );\n if (preferredYieldTagName) {\n const shouldReportYields = () => {\n if (checkGeneratorsOnly && !utils.isGenerator()) {\n return true;\n }\n\n return utils.hasDefinedTypeTag(yieldTag) && !utils.hasYieldValue();\n };\n\n // In case a yield value is declared in JSDoc, we also expect one in the code.\n if (shouldReportYields()) {\n report(`JSDoc @${preferredYieldTagName} declaration present but yield expression not available in function.`);\n }\n }\n\n if (next) {\n const [preferredNextTagName, nextTag] = checkTagName(\n utils, report, 'next',\n );\n if (preferredNextTagName) {\n const shouldReportNext = () => {\n if (checkGeneratorsOnly && !utils.isGenerator()) {\n return true;\n }\n\n return utils.hasDefinedTypeTag(nextTag) && !utils.hasYieldReturnValue();\n };\n\n if (shouldReportNext()) {\n report(`JSDoc @${preferredNextTagName} declaration present but yield expression with return value not available in function.`);\n }\n }\n }\n}, {\n meta: {\n docs: {\n description: 'Requires a yield statement in function body if a `@yields` tag is specified in jsdoc comment.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-require-yields-check',\n },\n schema: [\n {\n additionalProperties: false,\n properties: {\n checkGeneratorsOnly: {\n default: false,\n type: 'boolean',\n },\n contexts: {\n items: {\n anyOf: [\n {\n type: 'string',\n },\n {\n additionalProperties: false,\n properties: {\n comment: {\n type: 'string',\n },\n context: {\n type: 'string',\n },\n },\n type: 'object',\n },\n ],\n },\n type: 'array',\n },\n exemptedBy: {\n items: {\n type: 'string',\n },\n type: 'array',\n },\n next: {\n default: false,\n type: 'boolean',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"file":"requireYieldsCheck.js"}
1
+ {"version":3,"sources":["../../src/rules/requireYieldsCheck.js"],"names":["canSkip","utils","settings","voidingTags","mode","push","hasATag","isConstructor","classHasTag","checkTagName","report","tagName","preferredTagName","getPreferredTagName","tags","getTags","length","context","next","checkGeneratorsOnly","options","preferredYieldTagName","yieldTag","shouldReportYields","type","trim","isGenerator","hasDefinedTypeTag","hasYieldValue","preferredNextTagName","nextTag","shouldReportNext","hasYieldReturnValue","meta","docs","description","url","schema","additionalProperties","properties","default","contexts","items","anyOf","comment","exemptedBy"],"mappings":";;;;;;;AAAA;;;;AAEA,MAAMA,OAAO,GAAG,CAACC,KAAD,EAAQC,QAAR,KAAqB;AACnC,QAAMC,WAAW,GAAG,CAClB;AACA;AACA;AACA;AACA;AACA,YANkB,EAOlB,SAPkB,EASlB;AACA;AACA,SAXkB,EAYlB,aAZkB,EAclB;AACA,aAfkB,CAApB;;AAkBA,MAAID,QAAQ,CAACE,IAAT,KAAkB,SAAtB,EAAiC;AAC/B;AACAD,IAAAA,WAAW,CAACE,IAAZ,CAAiB,QAAjB;AACD;;AAED,SAAOJ,KAAK,CAACK,OAAN,CAAcH,WAAd,KACLF,KAAK,CAACM,aAAN,EADK,IAELN,KAAK,CAACO,WAAN,CAAkB,WAAlB,CAFK,IAGLN,QAAQ,CAACE,IAAT,KAAkB,SAAlB,IAA+BH,KAAK,CAACO,WAAN,CAAkB,QAAlB,CA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C,YAAAA,KAAK,EAAE,CACL;AACEnB,cAAAA,IAAI,EAAE;AADR,aADK,EAIL;AACEc,cAAAA,oBAAoB,EAAE,KADxB;AAEEC,cAAAA,UAAU,EAAE;AACVK,gBAAAA,OAAO,EAAE;AACPpB,kBAAAA,IAAI,EAAE;AADC,iBADC;AAIVP,gBAAAA,OAAO,EAAE;AACPO,kBAAAA,IAAI,EAAE;AADC;AAJC,eAFd;AAUEA,cAAAA,IAAI,EAAE;AAVR,aAJK;AADF,WADC;AAoBRA,UAAAA,IAAI,EAAE;AApBE,SALA;AA2BVqB,QAAAA,UAAU,EAAE;AACVH,UAAAA,KAAK,EAAE;AACLlB,YAAAA,IAAI,EAAE;AADD,WADG;AAIVA,UAAAA,IAAI,EAAE;AAJI,SA3BF;AAiCVN,QAAAA,IAAI,EAAE;AACJsB,UAAAA,OAAO,EAAE,KADL;AAEJhB,UAAAA,IAAI,EAAE;AAFF;AAjCI,OAFd;AAwCEA,MAAAA,IAAI,EAAE;AAxCR,KADM,CALJ;AAiDJA,IAAAA,IAAI,EAAE;AAjDF;AADL,CA3DY,C","sourcesContent":["import iterateJsdoc from '../iterateJsdoc';\n\nconst canSkip = (utils, settings) => {\n const voidingTags = [\n // An abstract function is by definition incomplete\n // so it is perfectly fine if a yield is documented but\n // not present within the function.\n // A subclass may inherit the doc and implement the\n // missing yield.\n 'abstract',\n 'virtual',\n\n // Constructor functions do not have a yield value\n // so we can bail here, too.\n 'class',\n 'constructor',\n\n // This seems to imply a class as well\n 'interface',\n ];\n\n if (settings.mode === 'closure') {\n // Structural Interface in GCC terms, equivalent to @interface tag as far as this rule is concerned\n voidingTags.push('record');\n }\n\n return utils.hasATag(voidingTags) ||\n utils.isConstructor() ||\n utils.classHasTag('interface') ||\n settings.mode === 'closure' && utils.classHasTag('record');\n};\n\nconst checkTagName = (utils, report, tagName) => {\n const preferredTagName = utils.getPreferredTagName({tagName});\n if (!preferredTagName) {\n return [];\n }\n\n const tags = utils.getTags(preferredTagName);\n\n if (tags.length === 0) {\n return [];\n }\n\n if (tags.length > 1) {\n report(`Found more than one @${preferredTagName} declaration.`);\n\n return [];\n }\n\n return [preferredTagName, tags[0]];\n};\n\nexport default iterateJsdoc(({\n context,\n report,\n settings,\n utils,\n}) => {\n if (canSkip(utils, settings)) {\n return;\n }\n\n const {\n next = false,\n checkGeneratorsOnly = false,\n } = context.options[0] || {};\n\n const [preferredYieldTagName, yieldTag] = checkTagName(\n utils, report, 'yields',\n );\n if (preferredYieldTagName) {\n const shouldReportYields = () => {\n if (yieldTag.type.trim() === 'never') {\n return false;\n }\n\n if (checkGeneratorsOnly && !utils.isGenerator()) {\n return true;\n }\n\n return utils.hasDefinedTypeTag(yieldTag) && !utils.hasYieldValue();\n };\n\n // In case a yield value is declared in JSDoc, we also expect one in the code.\n if (shouldReportYields()) {\n report(`JSDoc @${preferredYieldTagName} declaration present but yield expression not available in function.`);\n }\n }\n\n if (next) {\n const [preferredNextTagName, nextTag] = checkTagName(\n utils, report, 'next',\n );\n if (preferredNextTagName) {\n const shouldReportNext = () => {\n if (nextTag.type.trim() === 'never') {\n return false;\n }\n\n if (checkGeneratorsOnly && !utils.isGenerator()) {\n return true;\n }\n\n return utils.hasDefinedTypeTag(nextTag) && !utils.hasYieldReturnValue();\n };\n\n if (shouldReportNext()) {\n report(`JSDoc @${preferredNextTagName} declaration present but yield expression with return value not available in function.`);\n }\n }\n }\n}, {\n meta: {\n docs: {\n description: 'Requires a yield statement in function body if a `@yields` tag is specified in jsdoc comment.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-require-yields-check',\n },\n schema: [\n {\n additionalProperties: false,\n properties: {\n checkGeneratorsOnly: {\n default: false,\n type: 'boolean',\n },\n contexts: {\n items: {\n anyOf: [\n {\n type: 'string',\n },\n {\n additionalProperties: false,\n properties: {\n comment: {\n type: 'string',\n },\n context: {\n type: 'string',\n },\n },\n type: 'object',\n },\n ],\n },\n type: 'array',\n },\n exemptedBy: {\n items: {\n type: 'string',\n },\n type: 'array',\n },\n next: {\n default: false,\n type: 'boolean',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"file":"requireYieldsCheck.js"}
@@ -12,6 +12,10 @@ var _iterateJsdoc = _interopRequireDefault(require("../iterateJsdoc"));
12
12
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
13
 
14
14
  const asExpression = /as\s+/u;
15
+ const suppressTypes = new Set([// https://github.com/google/closure-compiler/wiki/@suppress-annotations
16
+ // https://github.com/google/closure-compiler/blob/master/src/com/google/javascript/jscomp/parsing/ParserConfig.properties#L154
17
+ 'accessControls', 'checkDebuggerStatement', 'checkPrototypalTypes', 'checkRegExp', 'checkTypes', 'checkVars', 'closureDepMethodUsageChecks', 'const', 'constantProperty', 'deprecated', 'duplicate', 'es5Strict', 'externsValidation', 'extraProvide', 'extraRequire', 'globalThis', 'invalidCasts', 'lateProvide', 'legacyGoogScopeRequire', 'lintChecks', 'messageConventions', 'misplacedTypeAnnotation', 'missingOverride', 'missingPolyfill', 'missingProperties', 'missingProvide', 'missingRequire', 'missingSourcesWarnings', 'moduleLoad', 'nonStandardJsDocs', 'partialAlias', 'polymer', 'reportUnknownTypes', 'strictMissingProperties', 'strictModuleDepCheck', 'strictPrimitiveOperators', 'suspiciousCode', // Not documented in enum
18
+ 'switch', 'transitionalSuspiciousCodeWarnings', 'undefinedNames', 'undefinedVars', 'underscore', 'unknownDefines', 'untranspilableFeatures', 'unusedLocalVariables', 'unusedPrivateMembers', 'useOfGoogProvide', 'uselessCode', 'visibility', 'with']);
15
19
 
16
20
  const tryParsePathIgnoreError = path => {
17
21
  try {
@@ -120,6 +124,27 @@ var _default = (0, _iterateJsdoc.default)(({
120
124
  continue;
121
125
  }
122
126
 
127
+ if (tag.tag === 'suppress' && mode === 'closure') {
128
+ let parsedTypes;
129
+
130
+ try {
131
+ parsedTypes = (0, _jsdocTypePrattParser.tryParse)(tag.type);
132
+ } catch {// Ignore
133
+ }
134
+
135
+ if (parsedTypes) {
136
+ (0, _jsdocTypePrattParser.traverse)(parsedTypes, node => {
137
+ const {
138
+ value: type
139
+ } = node;
140
+
141
+ if (type !== undefined && !suppressTypes.has(type)) {
142
+ report(`Syntax error in supresss type: ${type}`, null, tag);
143
+ }
144
+ });
145
+ }
146
+ }
147
+
123
148
  const otherModeMaps = ['jsdoc', 'typescript', 'closure', 'permissive'].filter(mde => {
124
149
  return mde !== mode;
125
150
  }).map(mde => {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/rules/validTypes.js"],"names":["asExpression","tryParsePathIgnoreError","path","jsdoc","report","utils","context","settings","allowEmptyNamepaths","options","mode","tag","tags","validNamepathParsing","namepath","tagName","handled","startsWith","endChar","slice","includes","startChar","charAt","validTypeParsing","type","thisNamepath","getTagDescription","replace","trim","test","thatNamepath","name","otherModeMaps","filter","mde","map","getTagStructureForMode","tagMightHaveNamePosition","modeInfo","mightHaveTypePosition","tagMightHaveTypePosition","tagMustHaveNamePosition","mustHaveTypePosition","tagMustHaveTypePosition","tagMissingRequiredTypeOrNamepath","hasTypePosition","Boolean","hasNameOrNamepathPosition","tagMightHaveNamepath","parseClosureTemplateTag","iterateAllJsdocs","meta","docs","description","url","schema","additionalProperies","properties","default"],"mappings":";;;;;;;AAAA;;AAGA;;;;AAEA,MAAMA,YAAY,GAAG,QAArB;;AAEA,MAAMC,uBAAuB,GAAIC,IAAD,IAAU;AACxC,MAAI;AACF,wCAASA,IAAT;AAEA,WAAO,IAAP;AACD,GAJD,CAIE,MAAM,CACN;AACD;;AAED,SAAO,KAAP;AACD,CAVD,C,CAYA;;;eACe,2BAAa,CAAC;AAC3BC,EAAAA,KAD2B;AAE3BC,EAAAA,MAF2B;AAG3BC,EAAAA,KAH2B;AAI3BC,EAAAA,OAJ2B;AAK3BC,EAAAA;AAL2B,CAAD,KAMtB;AACJ,QAAM;AACJC,IAAAA,mBAAmB,GAAG;AADlB,MAEFF,OAAO,CAACG,OAA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nC,GAAG,CAACa,IAAL,CAAjE;;AACA,QAAIqB,eAAJ,EAAqB;AACnBtB,MAAAA,gBAAgB,CAACZ,GAAG,CAACa,IAAL,CAAhB;AACD,KAjJ2B,CAmJ5B;;;AACA,UAAMuB,yBAAyB,GAAG,CAChCN,uBAAuB,KAAK,KAA5B,IACApC,KAAK,CAAC2C,oBAAN,CAA2BrC,GAAG,CAACA,GAA/B,CAFgC,KAG7BmC,OAAO,CAACnC,GAAG,CAACoB,IAAL,CAHZ;;AAKA,QAAIgB,yBAAJ,EAA+B;AAC7B,UAAIrC,IAAI,KAAK,OAAT,IAAoBC,GAAG,CAACA,GAAJ,KAAY,UAApC,EAAgD;AAC9C,aAAK,MAAMG,QAAX,IAAuBT,KAAK,CAAC4C,uBAAN,CAA8BtC,GAA9B,CAAvB,EAA2D;AACzDE,UAAAA,oBAAoB,CAACC,QAAD,CAApB;AACD;AACF,OAJD,MAIO;AACLD,QAAAA,oBAAoB,CAACF,GAAG,CAACoB,IAAL,EAAWpB,GAAG,CAACA,GAAf,CAApB;AACD;AACF;AACF;AACF,CA/Kc,EA+KZ;AACDuC,EAAAA,gBAAgB,EAAE,IADjB;AAEDC,EAAAA,IAAI,EAAE;AACJC,IAAAA,IAAI,EAAE;AACJC,MAAAA,WAAW,EAAE,uFADT;AAEJC,MAAAA,GAAG,EAAE;AAFD,KADF;AAKJC,IAAAA,MAAM,EAAE,CACN;AACEC,MAAAA,mBAAmB,EAAE,KADvB;AAEEC,MAAAA,UAAU,EAAE;AACVjD,QAAAA,mBAAmB,EAAE;AACnBkD,UAAAA,OAAO,EAAE,KADU;AAEnBlC,UAAAA,IAAI,EAAE;AAFa;AADX,OAFd;AAQEA,MAAAA,IAAI,EAAE;AARR,KADM,CALJ;AAiBJA,IAAAA,IAAI,EAAE;AAjBF;AAFL,CA/KY,C","sourcesContent":["import {\n tryParse, parse,\n} from 'jsdoc-type-pratt-parser';\nimport iterateJsdoc from '../iterateJsdoc';\n\nconst asExpression = /as\\s+/u;\n\nconst tryParsePathIgnoreError = (path) => {\n try {\n tryParse(path);\n\n return true;\n } catch {\n // Keep the original error for including the whole type\n }\n\n return false;\n};\n\n// eslint-disable-next-line complexity\nexport default iterateJsdoc(({\n jsdoc,\n report,\n utils,\n context,\n settings,\n}) => {\n const {\n allowEmptyNamepaths = false,\n } = context.options[0] || {};\n const {mode} = settings;\n\n for (const tag of jsdoc.tags) {\n const validNamepathParsing = function (namepath, tagName) {\n if (tryParsePathIgnoreError(namepath)) {\n return true;\n }\n\n let handled = false;\n\n if (tagName) {\n // eslint-disable-next-line default-case\n switch (tagName) {\n case 'module': {\n if (!namepath.startsWith('module:')) {\n handled = tryParsePathIgnoreError(`module:${namepath}`);\n }\n\n break;\n }\n\n case 'memberof': case 'memberof!': {\n const endChar = namepath.slice(-1);\n if (['#', '.', '~'].includes(endChar)) {\n handled = tryParsePathIgnoreError(namepath.slice(0, -1));\n }\n\n break;\n }\n\n case 'borrows': {\n const startChar = namepath.charAt();\n if (['#', '.', '~'].includes(startChar)) {\n handled = tryParsePathIgnoreError(namepath.slice(1));\n }\n }\n }\n }\n\n if (!handled) {\n report(`Syntax error in namepath: ${namepath}`, null, tag);\n\n return false;\n }\n\n return true;\n };\n\n const validTypeParsing = function (type) {\n try {\n if (mode === 'permissive') {\n tryParse(type);\n } else {\n parse(type, mode);\n }\n } catch {\n report(`Syntax error in type: ${type}`, null, tag);\n\n return false;\n }\n\n return true;\n };\n\n if (tag.tag === 'borrows') {\n const thisNamepath = utils.getTagDescription(tag).replace(asExpression, '')\n .trim();\n\n if (!asExpression.test(utils.getTagDescription(tag)) || !thisNamepath) {\n report(`@borrows must have an \"as\" expression. Found \"${utils.getTagDescription(tag)}\"`, null, tag);\n\n continue;\n }\n\n if (validNamepathParsing(thisNamepath, 'borrows')) {\n const thatNamepath = tag.name;\n\n validNamepathParsing(thatNamepath);\n }\n\n continue;\n }\n\n const otherModeMaps = ['jsdoc', 'typescript', 'closure', 'permissive'].filter(\n (mde) => {\n return mde !== mode;\n },\n ).map((mde) => {\n return utils.getTagStructureForMode(mde);\n });\n\n const tagMightHaveNamePosition = utils.tagMightHaveNamePosition(tag.tag, otherModeMaps);\n if (tagMightHaveNamePosition !== true && tag.name) {\n const modeInfo = tagMightHaveNamePosition === false ? '' : ` in \"${mode}\" mode`;\n report(`@${tag.tag} should not have a name${modeInfo}.`, null, tag);\n\n continue;\n }\n\n const mightHaveTypePosition = utils.tagMightHaveTypePosition(tag.tag, otherModeMaps);\n if (mightHaveTypePosition !== true && tag.type) {\n const modeInfo = mightHaveTypePosition === false ? '' : ` in \"${mode}\" mode`;\n report(`@${tag.tag} should not have a bracketed type${modeInfo}.`, null, tag);\n\n continue;\n }\n\n // REQUIRED NAME\n const tagMustHaveNamePosition = utils.tagMustHaveNamePosition(tag.tag, otherModeMaps);\n\n // Don't handle `@param` here though it does require name as handled by\n // `require-param-name` (`@property` would similarly seem to require one,\n // but is handled by `require-property-name`)\n if (tagMustHaveNamePosition !== false && !tag.name && !allowEmptyNamepaths && ![\n 'param', 'arg', 'argument',\n 'property', 'prop',\n ].includes(tag.tag) &&\n (tag.tag !== 'see' || !utils.getTagDescription(tag).includes('{@link'))\n ) {\n const modeInfo = tagMustHaveNamePosition === true ? '' : ` in \"${mode}\" mode`;\n report(`Tag @${tag.tag} must have a name/namepath${modeInfo}.`, null, tag);\n\n continue;\n }\n\n // REQUIRED TYPE\n const mustHaveTypePosition = utils.tagMustHaveTypePosition(tag.tag, otherModeMaps);\n if (mustHaveTypePosition !== false && !tag.type) {\n const modeInfo = mustHaveTypePosition === true ? '' : ` in \"${mode}\" mode`;\n report(`Tag @${tag.tag} must have a type${modeInfo}.`, null, tag);\n\n continue;\n }\n\n // REQUIRED TYPE OR NAME/NAMEPATH\n const tagMissingRequiredTypeOrNamepath = utils.tagMissingRequiredTypeOrNamepath(tag, otherModeMaps);\n if (tagMissingRequiredTypeOrNamepath !== false && !allowEmptyNamepaths) {\n const modeInfo = tagMissingRequiredTypeOrNamepath === true ? '' : ` in \"${mode}\" mode`;\n report(`Tag @${tag.tag} must have either a type or namepath${modeInfo}.`, null, tag);\n\n continue;\n }\n\n // VALID TYPE\n const hasTypePosition = mightHaveTypePosition === true && Boolean(tag.type);\n if (hasTypePosition) {\n validTypeParsing(tag.type);\n }\n\n // VALID NAME/NAMEPATH\n const hasNameOrNamepathPosition = (\n tagMustHaveNamePosition !== false ||\n utils.tagMightHaveNamepath(tag.tag)\n ) && Boolean(tag.name);\n\n if (hasNameOrNamepathPosition) {\n if (mode !== 'jsdoc' && tag.tag === 'template') {\n for (const namepath of utils.parseClosureTemplateTag(tag)) {\n validNamepathParsing(namepath);\n }\n } else {\n validNamepathParsing(tag.name, tag.tag);\n }\n }\n }\n}, {\n iterateAllJsdocs: true,\n meta: {\n docs: {\n description: 'Requires all types to be valid JSDoc or Closure compiler types without syntax errors.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-valid-types',\n },\n schema: [\n {\n additionalProperies: false,\n properties: {\n allowEmptyNamepaths: {\n default: false,\n type: 'boolean',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"file":"validTypes.js"}
1
+ {"version":3,"sources":["../../src/rules/validTypes.js"],"names":["asExpression","suppressTypes","Set","tryParsePathIgnoreError","path","jsdoc","report","utils","context","settings","allowEmptyNamepaths","options","mode","tag","tags","validNamepathParsing","namepath","tagName","handled","startsWith","endChar","slice","includes","startChar","charAt","validTypeParsing","type","thisNamepath","getTagDescription","replace","trim","test","thatNamepath","name","parsedTypes","node","value","undefined","has","otherModeMaps","filter","mde","map","getTagStructureForMode","tagMightHaveNamePosition","modeInfo","mightHaveTypePosition","tagMightHaveTypePosition","tagMustHaveNamePosition","mustHaveTypePosition","tagMustHaveTypePosition","tagMissingRequiredTypeOrNamepath","hasTypePosition","Boolean","hasNameOrNamepathPosition","tagMightHaveNamepath","parseClosureTemplateTag","iterateAllJsdocs","meta","docs","description","url","schema","additionalProperies","proper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D;AACF,OAJD,MAIO;AACLD,QAAAA,oBAAoB,CAACF,GAAG,CAACoB,IAAL,EAAWpB,GAAG,CAACA,GAAf,CAApB;AACD;AACF;AACF;AACF,CAlMc,EAkMZ;AACD4C,EAAAA,gBAAgB,EAAE,IADjB;AAEDC,EAAAA,IAAI,EAAE;AACJC,IAAAA,IAAI,EAAE;AACJC,MAAAA,WAAW,EAAE,uFADT;AAEJC,MAAAA,GAAG,EAAE;AAFD,KADF;AAKJC,IAAAA,MAAM,EAAE,CACN;AACEC,MAAAA,mBAAmB,EAAE,KADvB;AAEEC,MAAAA,UAAU,EAAE;AACVtD,QAAAA,mBAAmB,EAAE;AACnBuD,UAAAA,OAAO,EAAE,KADU;AAEnBvC,UAAAA,IAAI,EAAE;AAFa;AADX,OAFd;AAQEA,MAAAA,IAAI,EAAE;AARR,KADM,CALJ;AAiBJA,IAAAA,IAAI,EAAE;AAjBF;AAFL,CAlMY,C","sourcesContent":["import {\n tryParse, parse, traverse,\n} from 'jsdoc-type-pratt-parser';\nimport iterateJsdoc from '../iterateJsdoc';\n\nconst asExpression = /as\\s+/u;\n\nconst suppressTypes = new Set([\n // https://github.com/google/closure-compiler/wiki/@suppress-annotations\n // https://github.com/google/closure-compiler/blob/master/src/com/google/javascript/jscomp/parsing/ParserConfig.properties#L154\n 'accessControls',\n 'checkDebuggerStatement',\n 'checkPrototypalTypes',\n 'checkRegExp',\n 'checkTypes',\n 'checkVars',\n 'closureDepMethodUsageChecks',\n 'const',\n 'constantProperty',\n 'deprecated',\n 'duplicate',\n 'es5Strict',\n 'externsValidation',\n 'extraProvide',\n 'extraRequire',\n 'globalThis',\n 'invalidCasts',\n 'lateProvide',\n 'legacyGoogScopeRequire',\n 'lintChecks',\n 'messageConventions',\n 'misplacedTypeAnnotation',\n 'missingOverride',\n 'missingPolyfill',\n 'missingProperties',\n 'missingProvide',\n 'missingRequire',\n 'missingSourcesWarnings',\n 'moduleLoad',\n 'nonStandardJsDocs',\n 'partialAlias',\n 'polymer',\n 'reportUnknownTypes',\n 'strictMissingProperties',\n 'strictModuleDepCheck',\n 'strictPrimitiveOperators',\n 'suspiciousCode',\n\n // Not documented in enum\n 'switch',\n 'transitionalSuspiciousCodeWarnings',\n 'undefinedNames',\n 'undefinedVars',\n 'underscore',\n 'unknownDefines',\n 'untranspilableFeatures',\n 'unusedLocalVariables',\n 'unusedPrivateMembers',\n 'useOfGoogProvide',\n 'uselessCode',\n 'visibility',\n 'with',\n]);\n\nconst tryParsePathIgnoreError = (path) => {\n try {\n tryParse(path);\n\n return true;\n } catch {\n // Keep the original error for including the whole type\n }\n\n return false;\n};\n\n// eslint-disable-next-line complexity\nexport default iterateJsdoc(({\n jsdoc,\n report,\n utils,\n context,\n settings,\n}) => {\n const {\n allowEmptyNamepaths = false,\n } = context.options[0] || {};\n const {mode} = settings;\n\n for (const tag of jsdoc.tags) {\n const validNamepathParsing = function (namepath, tagName) {\n if (tryParsePathIgnoreError(namepath)) {\n return true;\n }\n\n let handled = false;\n\n if (tagName) {\n // eslint-disable-next-line default-case\n switch (tagName) {\n case 'module': {\n if (!namepath.startsWith('module:')) {\n handled = tryParsePathIgnoreError(`module:${namepath}`);\n }\n\n break;\n }\n\n case 'memberof': case 'memberof!': {\n const endChar = namepath.slice(-1);\n if (['#', '.', '~'].includes(endChar)) {\n handled = tryParsePathIgnoreError(namepath.slice(0, -1));\n }\n\n break;\n }\n\n case 'borrows': {\n const startChar = namepath.charAt();\n if (['#', '.', '~'].includes(startChar)) {\n handled = tryParsePathIgnoreError(namepath.slice(1));\n }\n }\n }\n }\n\n if (!handled) {\n report(`Syntax error in namepath: ${namepath}`, null, tag);\n\n return false;\n }\n\n return true;\n };\n\n const validTypeParsing = function (type) {\n try {\n if (mode === 'permissive') {\n tryParse(type);\n } else {\n parse(type, mode);\n }\n } catch {\n report(`Syntax error in type: ${type}`, null, tag);\n\n return false;\n }\n\n return true;\n };\n\n if (tag.tag === 'borrows') {\n const thisNamepath = utils.getTagDescription(tag).replace(asExpression, '')\n .trim();\n\n if (!asExpression.test(utils.getTagDescription(tag)) || !thisNamepath) {\n report(`@borrows must have an \"as\" expression. Found \"${utils.getTagDescription(tag)}\"`, null, tag);\n\n continue;\n }\n\n if (validNamepathParsing(thisNamepath, 'borrows')) {\n const thatNamepath = tag.name;\n\n validNamepathParsing(thatNamepath);\n }\n\n continue;\n }\n\n if (tag.tag === 'suppress' && mode === 'closure') {\n let parsedTypes;\n\n try {\n parsedTypes = tryParse(tag.type);\n } catch {\n // Ignore\n }\n\n if (parsedTypes) {\n traverse(parsedTypes, (node) => {\n const {value: type} = node;\n if (type !== undefined && !suppressTypes.has(type)) {\n report(`Syntax error in supresss type: ${type}`, null, tag);\n }\n });\n }\n }\n\n const otherModeMaps = ['jsdoc', 'typescript', 'closure', 'permissive'].filter(\n (mde) => {\n return mde !== mode;\n },\n ).map((mde) => {\n return utils.getTagStructureForMode(mde);\n });\n\n const tagMightHaveNamePosition = utils.tagMightHaveNamePosition(tag.tag, otherModeMaps);\n if (tagMightHaveNamePosition !== true && tag.name) {\n const modeInfo = tagMightHaveNamePosition === false ? '' : ` in \"${mode}\" mode`;\n report(`@${tag.tag} should not have a name${modeInfo}.`, null, tag);\n\n continue;\n }\n\n const mightHaveTypePosition = utils.tagMightHaveTypePosition(tag.tag, otherModeMaps);\n if (mightHaveTypePosition !== true && tag.type) {\n const modeInfo = mightHaveTypePosition === false ? '' : ` in \"${mode}\" mode`;\n report(`@${tag.tag} should not have a bracketed type${modeInfo}.`, null, tag);\n\n continue;\n }\n\n // REQUIRED NAME\n const tagMustHaveNamePosition = utils.tagMustHaveNamePosition(tag.tag, otherModeMaps);\n\n // Don't handle `@param` here though it does require name as handled by\n // `require-param-name` (`@property` would similarly seem to require one,\n // but is handled by `require-property-name`)\n if (tagMustHaveNamePosition !== false && !tag.name && !allowEmptyNamepaths && ![\n 'param', 'arg', 'argument',\n 'property', 'prop',\n ].includes(tag.tag) &&\n (tag.tag !== 'see' || !utils.getTagDescription(tag).includes('{@link'))\n ) {\n const modeInfo = tagMustHaveNamePosition === true ? '' : ` in \"${mode}\" mode`;\n report(`Tag @${tag.tag} must have a name/namepath${modeInfo}.`, null, tag);\n\n continue;\n }\n\n // REQUIRED TYPE\n const mustHaveTypePosition = utils.tagMustHaveTypePosition(tag.tag, otherModeMaps);\n if (mustHaveTypePosition !== false && !tag.type) {\n const modeInfo = mustHaveTypePosition === true ? '' : ` in \"${mode}\" mode`;\n report(`Tag @${tag.tag} must have a type${modeInfo}.`, null, tag);\n\n continue;\n }\n\n // REQUIRED TYPE OR NAME/NAMEPATH\n const tagMissingRequiredTypeOrNamepath = utils.tagMissingRequiredTypeOrNamepath(tag, otherModeMaps);\n if (tagMissingRequiredTypeOrNamepath !== false && !allowEmptyNamepaths) {\n const modeInfo = tagMissingRequiredTypeOrNamepath === true ? '' : ` in \"${mode}\" mode`;\n report(`Tag @${tag.tag} must have either a type or namepath${modeInfo}.`, null, tag);\n\n continue;\n }\n\n // VALID TYPE\n const hasTypePosition = mightHaveTypePosition === true && Boolean(tag.type);\n if (hasTypePosition) {\n validTypeParsing(tag.type);\n }\n\n // VALID NAME/NAMEPATH\n const hasNameOrNamepathPosition = (\n tagMustHaveNamePosition !== false ||\n utils.tagMightHaveNamepath(tag.tag)\n ) && Boolean(tag.name);\n\n if (hasNameOrNamepathPosition) {\n if (mode !== 'jsdoc' && tag.tag === 'template') {\n for (const namepath of utils.parseClosureTemplateTag(tag)) {\n validNamepathParsing(namepath);\n }\n } else {\n validNamepathParsing(tag.name, tag.tag);\n }\n }\n }\n}, {\n iterateAllJsdocs: true,\n meta: {\n docs: {\n description: 'Requires all types to be valid JSDoc or Closure compiler types without syntax errors.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-valid-types',\n },\n schema: [\n {\n additionalProperies: false,\n properties: {\n allowEmptyNamepaths: {\n default: false,\n type: 'boolean',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"file":"validTypes.js"}
package/package.json CHANGED
@@ -107,5 +107,5 @@
107
107
  "test-index": "cross-env BABEL_ENV=test mocha --recursive --require @babel/register --reporter progress --timeout 12000 test/rules/index.js",
108
108
  "test-no-cov": "cross-env BABEL_ENV=test mocha --reporter dot --recursive --require @babel/register --timeout 12000"
109
109
  },
110
- "version": "37.2.5"
110
+ "version": "37.3.0"
111
111
  }