eslint-plugin-jsdoc 44.2.3 → 44.2.5

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.
Files changed (120) hide show
  1. package/dist/WarnSettings.js +0 -1
  2. package/dist/WarnSettings.js.map +1 -1
  3. package/dist/alignTransform.js +87 -5
  4. package/dist/alignTransform.js.map +1 -1
  5. package/dist/bin/generateRule.js +4 -3
  6. package/dist/bin/generateRule.js.map +1 -1
  7. package/dist/exportParser.js +272 -71
  8. package/dist/exportParser.js.map +1 -1
  9. package/dist/generateRule.js +4 -3
  10. package/dist/generateRule.js.map +1 -1
  11. package/dist/iterateJsdoc.js +921 -357
  12. package/dist/iterateJsdoc.js.map +1 -1
  13. package/dist/jsdocUtils.js +270 -168
  14. package/dist/jsdocUtils.js.map +1 -1
  15. package/dist/rules/checkAlignment.js +6 -0
  16. package/dist/rules/checkAlignment.js.map +1 -1
  17. package/dist/rules/checkExamples.js +73 -9
  18. package/dist/rules/checkExamples.js.map +1 -1
  19. package/dist/rules/checkIndentation.js +12 -2
  20. package/dist/rules/checkIndentation.js.map +1 -1
  21. package/dist/rules/checkLineAlignment.js +71 -7
  22. package/dist/rules/checkLineAlignment.js.map +1 -1
  23. package/dist/rules/checkParamNames.js +29 -11
  24. package/dist/rules/checkParamNames.js.map +1 -1
  25. package/dist/rules/checkPropertyNames.js +13 -7
  26. package/dist/rules/checkPropertyNames.js.map +1 -1
  27. package/dist/rules/checkTagNames.js +45 -9
  28. package/dist/rules/checkTagNames.js.map +1 -1
  29. package/dist/rules/checkTypes.js +98 -41
  30. package/dist/rules/checkTypes.js.map +1 -1
  31. package/dist/rules/checkValues.js +7 -7
  32. package/dist/rules/checkValues.js.map +1 -1
  33. package/dist/rules/emptyTags.js +8 -1
  34. package/dist/rules/emptyTags.js.map +1 -1
  35. package/dist/rules/informativeDocs.js +27 -8
  36. package/dist/rules/informativeDocs.js.map +1 -1
  37. package/dist/rules/matchDescription.js +18 -1
  38. package/dist/rules/matchDescription.js.map +1 -1
  39. package/dist/rules/matchName.js +2 -2
  40. package/dist/rules/matchName.js.map +1 -1
  41. package/dist/rules/multilineBlocks.js +12 -1
  42. package/dist/rules/multilineBlocks.js.map +1 -1
  43. package/dist/rules/noBadBlocks.js +4 -6
  44. package/dist/rules/noBadBlocks.js.map +1 -1
  45. package/dist/rules/noBlankBlockDescriptions.js +2 -0
  46. package/dist/rules/noBlankBlockDescriptions.js.map +1 -1
  47. package/dist/rules/noMissingSyntax.js +53 -16
  48. package/dist/rules/noMissingSyntax.js.map +1 -1
  49. package/dist/rules/noMultiAsterisks.js +1 -6
  50. package/dist/rules/noMultiAsterisks.js.map +1 -1
  51. package/dist/rules/noRestrictedSyntax.js +12 -5
  52. package/dist/rules/noRestrictedSyntax.js.map +1 -1
  53. package/dist/rules/noTypes.js +3 -0
  54. package/dist/rules/noTypes.js.map +1 -1
  55. package/dist/rules/noUndefinedTypes.js +65 -27
  56. package/dist/rules/noUndefinedTypes.js.map +1 -1
  57. package/dist/rules/requireAsteriskPrefix.js +20 -0
  58. package/dist/rules/requireAsteriskPrefix.js.map +1 -1
  59. package/dist/rules/requireDescription.js +6 -2
  60. package/dist/rules/requireDescription.js.map +1 -1
  61. package/dist/rules/requireDescriptionCompleteSentence.js +75 -12
  62. package/dist/rules/requireDescriptionCompleteSentence.js.map +1 -1
  63. package/dist/rules/requireFileOverview.js +9 -4
  64. package/dist/rules/requireFileOverview.js.map +1 -1
  65. package/dist/rules/requireHyphenBeforeParamDescription.js +21 -7
  66. package/dist/rules/requireHyphenBeforeParamDescription.js.map +1 -1
  67. package/dist/rules/requireJsdoc.js +150 -29
  68. package/dist/rules/requireJsdoc.js.map +1 -1
  69. package/dist/rules/requireParam.js +116 -10
  70. package/dist/rules/requireParam.js.map +1 -1
  71. package/dist/rules/requireProperty.js +1 -1
  72. package/dist/rules/requireProperty.js.map +1 -1
  73. package/dist/rules/requireReturns.js +2 -3
  74. package/dist/rules/requireReturns.js.map +1 -1
  75. package/dist/rules/requireReturnsCheck.js +9 -2
  76. package/dist/rules/requireReturnsCheck.js.map +1 -1
  77. package/dist/rules/requireThrows.js +2 -3
  78. package/dist/rules/requireThrows.js.map +1 -1
  79. package/dist/rules/requireYields.js +9 -3
  80. package/dist/rules/requireYields.js.map +1 -1
  81. package/dist/rules/requireYieldsCheck.js +19 -5
  82. package/dist/rules/requireYieldsCheck.js.map +1 -1
  83. package/dist/rules/sortTags.js +67 -9
  84. package/dist/rules/sortTags.js.map +1 -1
  85. package/dist/rules/tagLines.js +22 -3
  86. package/dist/rules/tagLines.js.map +1 -1
  87. package/dist/rules/textEscaping.js +18 -4
  88. package/dist/rules/textEscaping.js.map +1 -1
  89. package/dist/rules/validTypes.js +26 -9
  90. package/dist/rules/validTypes.js.map +1 -1
  91. package/dist/tagNames.js +0 -2
  92. package/dist/tagNames.js.map +1 -1
  93. package/dist/utils/hasReturnValue.js +77 -48
  94. package/dist/utils/hasReturnValue.js.map +1 -1
  95. package/docs/rules/check-line-alignment.md +7 -0
  96. package/docs/rules/check-tag-names.md +15 -0
  97. package/docs/rules/no-missing-syntax.md +6 -0
  98. package/docs/rules/no-undefined-types.md +6 -0
  99. package/docs/rules/require-description-complete-sentence.md +525 -289
  100. package/docs/rules/require-description.md +289 -525
  101. package/docs/rules/require-file-overview.md +7 -0
  102. package/docs/rules/require-jsdoc.md +1 -1
  103. package/docs/rules/require-param-description.md +116 -1694
  104. package/docs/rules/require-param-name.md +58 -133
  105. package/docs/rules/require-param-type.md +119 -55
  106. package/docs/rules/require-param.md +1704 -111
  107. package/docs/rules/require-property-description.md +39 -79
  108. package/docs/rules/require-property-name.md +21 -30
  109. package/docs/rules/require-property-type.md +21 -21
  110. package/docs/rules/require-property.md +82 -33
  111. package/docs/rules/require-returns-check.md +636 -747
  112. package/docs/rules/require-returns-description.md +61 -933
  113. package/docs/rules/require-returns-type.md +42 -79
  114. package/docs/rules/require-returns.md +1081 -61
  115. package/docs/rules/require-yields-check.md +238 -517
  116. package/docs/rules/require-yields.md +517 -238
  117. package/docs/rules/valid-types.md +1 -1
  118. package/docs/settings.md +3 -1
  119. package/package.json +10 -9
  120. package/tsconfig.json +2 -3
@@ -4,14 +4,37 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- var _esquery = _interopRequireDefault(require("esquery"));
8
7
  var _iterateJsdoc = _interopRequireDefault(require("../iterateJsdoc"));
8
+ var _esquery = _interopRequireDefault(require("esquery"));
9
9
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
+ /**
11
+ * @typedef {{
12
+ * comment: string,
13
+ * context: string,
14
+ * message: string,
15
+ * minimum: import('../iterateJsdoc.js').Integer
16
+ * }} ContextObject
17
+ */
18
+
19
+ /**
20
+ * @typedef {string|ContextObject} Context
21
+ */
22
+ /**
23
+ * @param {import('../iterateJsdoc.js').StateObject} state
24
+ * @returns {void}
25
+ */
10
26
  const setDefaults = state => {
11
27
  if (!state.selectorMap) {
12
28
  state.selectorMap = {};
13
29
  }
14
30
  };
31
+
32
+ /**
33
+ * @param {import('../iterateJsdoc.js').StateObject} state
34
+ * @param {string} selector
35
+ * @param {string} comment
36
+ * @returns {void}
37
+ */
15
38
  const incrementSelector = (state, selector, comment) => {
16
39
  if (!state.selectorMap[selector]) {
17
40
  state.selectorMap[selector] = {};
@@ -34,19 +57,21 @@ var _default = (0, _iterateJsdoc.default)(({
34
57
  // Handle error later
35
58
  return;
36
59
  }
37
- const {
38
- contexts
39
- } = context.options[0];
60
+
61
+ /**
62
+ * @type {Context[]}
63
+ */
64
+ const contexts = context.options[0].contexts;
40
65
  const foundContext = contexts.find(cntxt => {
41
- return typeof cntxt === 'string' ? _esquery.default.matches(node, _esquery.default.parse(cntxt), null, {
66
+ return typeof cntxt === 'string' ? _esquery.default.matches( /** @type {import('../iterateJsdoc.js').Node} */node, _esquery.default.parse(cntxt), undefined, {
42
67
  visitorKeys: sourceCode.visitorKeys
43
- }) : (!cntxt.context || cntxt.context === 'any' || _esquery.default.matches(node, _esquery.default.parse(cntxt.context), null, {
68
+ }) : (!cntxt.context || cntxt.context === 'any' || _esquery.default.matches( /** @type {import('../iterateJsdoc.js').Node} */node, _esquery.default.parse(cntxt.context), undefined, {
44
69
  visitorKeys: sourceCode.visitorKeys
45
70
  })) && comment === cntxt.comment;
46
71
  });
47
- const contextStr = typeof foundContext === 'object' ? foundContext.context ?? 'any' : foundContext;
72
+ const contextStr = typeof foundContext === 'object' ? foundContext.context ?? 'any' : String(foundContext);
48
73
  setDefaults(state);
49
- incrementSelector(state, contextStr, comment);
74
+ incrementSelector(state, contextStr, String(comment));
50
75
  }, {
51
76
  contextSelected: true,
52
77
  exit({
@@ -57,6 +82,10 @@ var _default = (0, _iterateJsdoc.default)(({
57
82
  if (!context.options.length && !settings.contexts) {
58
83
  context.report({
59
84
  loc: {
85
+ end: {
86
+ column: 1,
87
+ line: 1
88
+ },
60
89
  start: {
61
90
  column: 1,
62
91
  line: 1
@@ -67,19 +96,25 @@ var _default = (0, _iterateJsdoc.default)(({
67
96
  return;
68
97
  }
69
98
  setDefaults(state);
70
- const {
71
- contexts = settings === null || settings === void 0 ? void 0 : settings.contexts
72
- } = context.options[0] || {};
99
+
100
+ /**
101
+ * @type {Context[]}
102
+ */
103
+ const contexts = (context.options[0] ?? {}).contexts ?? (settings === null || settings === void 0 ? void 0 : settings.contexts);
73
104
 
74
105
  // Report when MISSING
75
106
  contexts.some(cntxt => {
76
107
  const contextStr = typeof cntxt === 'object' ? cntxt.context ?? 'any' : cntxt;
77
- const comment = (cntxt === null || cntxt === void 0 ? void 0 : cntxt.comment) ?? '';
78
- const contextKey = contextStr === 'any' ? undefined : contextStr;
79
- if ((!state.selectorMap[contextKey] || !state.selectorMap[contextKey][comment] || state.selectorMap[contextKey][comment] < ((cntxt === null || cntxt === void 0 ? void 0 : cntxt.minimum) ?? 1)) && (contextStr !== 'any' || Object.values(state.selectorMap).every(cmmnt => {
80
- return !cmmnt[comment] || cmmnt[comment] < ((cntxt === null || cntxt === void 0 ? void 0 : cntxt.minimum) ?? 1);
108
+ const comment = typeof cntxt === 'string' ? '' : cntxt === null || cntxt === void 0 ? void 0 : cntxt.comment;
109
+ const contextKey = contextStr === 'any' ? 'undefined' : contextStr;
110
+ if ((!state.selectorMap[contextKey] || !state.selectorMap[contextKey][comment] || state.selectorMap[contextKey][comment] < (
111
+ // @ts-expect-error comment would need an object, not string
112
+ (cntxt === null || cntxt === void 0 ? void 0 : cntxt.minimum) ?? 1)) && (contextStr !== 'any' || Object.values(state.selectorMap).every(cmmnt => {
113
+ return !cmmnt[comment] || cmmnt[comment] < (
114
+ // @ts-expect-error comment would need an object, not string
115
+ (cntxt === null || cntxt === void 0 ? void 0 : cntxt.minimum) ?? 1);
81
116
  }))) {
82
- const message = (cntxt === null || cntxt === void 0 ? void 0 : cntxt.message) ?? 'Syntax is required: {{context}}' + (comment ? ' with {{comment}}' : '');
117
+ const message = typeof cntxt === 'string' ? 'Syntax is required: {{context}}' : (cntxt === null || cntxt === void 0 ? void 0 : cntxt.message) ?? 'Syntax is required: {{context}}' + (comment ? ' with {{comment}}' : '');
83
118
  context.report({
84
119
  data: {
85
120
  comment,
@@ -87,9 +122,11 @@ var _default = (0, _iterateJsdoc.default)(({
87
122
  },
88
123
  loc: {
89
124
  end: {
125
+ column: 1,
90
126
  line: 1
91
127
  },
92
128
  start: {
129
+ column: 1,
93
130
  line: 1
94
131
  }
95
132
  },
@@ -1 +1 @@
1
- {"version":3,"file":"noMissingSyntax.js","names":["_esquery","_interopRequireDefault","require","_iterateJsdoc","obj","__esModule","default","setDefaults","state","selectorMap","incrementSelector","selector","comment","_default","iterateJsdoc","context","node","info","sourceCode","options","contexts","foundContext","find","cntxt","esquery","matches","parse","visitorKeys","contextStr","contextSelected","exit","settings","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","exports","module"],"sources":["../../src/rules/noMissingSyntax.js"],"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: {\n comment,\n },\n sourceCode,\n state,\n}) => {\n if (!context.options[0]) {\n // Handle error later\n return;\n }\n\n const {\n contexts,\n } = context.options[0];\n\n const foundContext = contexts.find((cntxt) => {\n return typeof cntxt === 'string' ?\n esquery.matches(node, esquery.parse(cntxt), null, {\n visitorKeys: sourceCode.visitorKeys,\n }) :\n (!cntxt.context || cntxt.context === 'any' || esquery.matches(node, esquery.parse(cntxt.context), null, {\n visitorKeys: sourceCode.visitorKeys,\n })) &&\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,\n settings,\n state,\n }) {\n if (!context.options.length && !settings.contexts) {\n context.report({\n loc: {\n start: {\n column: 1,\n line: 1,\n },\n },\n message: 'Rule `no-missing-syntax` is missing a `contexts` option.',\n });\n\n return;\n }\n\n setDefaults(state);\n const {\n contexts = settings?.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: {\n line: 1,\n },\n start: {\n line: 1,\n },\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"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,aAAA,GAAAF,sBAAA,CAAAC,OAAA;AAA2C,SAAAD,uBAAAG,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAE3C,MAAMG,WAAW,GAAIC,KAAK,IAAK;EAC7B,IAAI,CAACA,KAAK,CAACC,WAAW,EAAE;IACtBD,KAAK,CAACC,WAAW,GAAG,CAAC,CAAC;EACxB;AACF,CAAC;AAED,MAAMC,iBAAiB,GAAGA,CAACF,KAAK,EAAEG,QAAQ,EAAEC,OAAO,KAAK;EACtD,IAAI,CAACJ,KAAK,CAACC,WAAW,CAACE,QAAQ,CAAC,EAAE;IAChCH,KAAK,CAACC,WAAW,CAACE,QAAQ,CAAC,GAAG,CAAC,CAAC;EAClC;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;gBACR,CAAC;gBACDlB,OAAO,EAAE;kBACPkB,IAAI,EAAE;gBACR;cACF,CAAC;cACDA,IAAI,EAAE;YACR,CAAC;UAEL,CAAC;UACDA,IAAI,EAAE;QACR;MACF,CAAC;MACDA,IAAI,EAAE;IACR,CAAC,CACF;IACDA,IAAI,EAAE;EACR;AACF,CAAC,CAAC;AAAAC,OAAA,CAAAvD,OAAA,GAAAO,QAAA;AAAAiD,MAAA,CAAAD,OAAA,GAAAA,OAAA,CAAAvD,OAAA"}
1
+ {"version":3,"file":"noMissingSyntax.js","names":["_iterateJsdoc","_interopRequireDefault","require","_esquery","obj","__esModule","default","setDefaults","state","selectorMap","incrementSelector","selector","comment","_default","iterateJsdoc","context","node","info","sourceCode","options","contexts","foundContext","find","cntxt","esquery","matches","parse","undefined","visitorKeys","contextStr","String","contextSelected","exit","settings","length","report","loc","end","column","line","start","message","some","contextKey","minimum","Object","values","every","cmmnt","data","matchContext","meta","docs","description","url","fixable","schema","additionalProperties","properties","items","anyOf","type","exports","module"],"sources":["../../src/rules/noMissingSyntax.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc';\nimport esquery from 'esquery';\n\n/**\n * @typedef {{\n * comment: string,\n * context: string,\n * message: string,\n * minimum: import('../iterateJsdoc.js').Integer\n * }} ContextObject\n */\n\n/**\n * @typedef {string|ContextObject} Context\n */\n\n/**\n * @param {import('../iterateJsdoc.js').StateObject} state\n * @returns {void}\n */\nconst setDefaults = (state) => {\n if (!state.selectorMap) {\n state.selectorMap = {};\n }\n};\n\n/**\n * @param {import('../iterateJsdoc.js').StateObject} state\n * @param {string} selector\n * @param {string} comment\n * @returns {void}\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: {\n comment,\n },\n sourceCode,\n state,\n}) => {\n if (!context.options[0]) {\n // Handle error later\n return;\n }\n\n /**\n * @type {Context[]}\n */\n const contexts = context.options[0].contexts;\n\n const foundContext = contexts.find((cntxt) => {\n return typeof cntxt === 'string' ?\n esquery.matches(\n /** @type {import('../iterateJsdoc.js').Node} */ (node),\n esquery.parse(cntxt),\n undefined,\n {\n visitorKeys: sourceCode.visitorKeys,\n },\n ) :\n (!cntxt.context || cntxt.context === 'any' ||\n esquery.matches(\n /** @type {import('../iterateJsdoc.js').Node} */ (node),\n esquery.parse(cntxt.context),\n undefined,\n {\n visitorKeys: sourceCode.visitorKeys,\n },\n )) && comment === cntxt.comment;\n });\n\n const contextStr = typeof foundContext === 'object' ?\n foundContext.context ?? 'any' :\n String(foundContext);\n\n setDefaults(state);\n\n incrementSelector(state, contextStr, String(comment));\n}, {\n contextSelected: true,\n exit ({\n context,\n settings,\n state,\n }) {\n if (!context.options.length && !settings.contexts) {\n context.report({\n loc: {\n end: {\n column: 1,\n line: 1,\n },\n start: {\n column: 1,\n line: 1,\n },\n },\n message: 'Rule `no-missing-syntax` is missing a `contexts` option.',\n });\n\n return;\n }\n\n setDefaults(state);\n\n /**\n * @type {Context[]}\n */\n const contexts = (context.options[0] ?? {}).contexts ?? settings?.contexts;\n\n // Report when MISSING\n contexts.some((cntxt) => {\n const contextStr = typeof cntxt === 'object' ? cntxt.context ?? 'any' : cntxt;\n const comment = typeof cntxt === 'string' ? '' : 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] < (\n // @ts-expect-error comment would need an object, not string\n cntxt?.minimum ?? 1\n )) &&\n (contextStr !== 'any' || Object.values(state.selectorMap).every((cmmnt) => {\n return !cmmnt[comment] || cmmnt[comment] < (\n // @ts-expect-error comment would need an object, not string\n cntxt?.minimum ?? 1\n );\n }))\n ) {\n const message = typeof cntxt === 'string' ?\n 'Syntax is required: {{context}}' :\n 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: {\n column: 1,\n line: 1,\n },\n start: {\n column: 1,\n line: 1,\n },\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"],"mappings":";;;;;;AAAA,IAAAA,aAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,QAAA,GAAAF,sBAAA,CAAAC,OAAA;AAA8B,SAAAD,uBAAAG,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAE9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA,MAAMG,WAAW,GAAIC,KAAK,IAAK;EAC7B,IAAI,CAACA,KAAK,CAACC,WAAW,EAAE;IACtBD,KAAK,CAACC,WAAW,GAAG,CAAC,CAAC;EACxB;AACF,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,iBAAiB,GAAGA,CAACF,KAAK,EAAEG,QAAQ,EAAEC,OAAO,KAAK;EACtD,IAAI,CAACJ,KAAK,CAACC,WAAW,CAACE,QAAQ,CAAC,EAAE;IAChCH,KAAK,CAACC,WAAW,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MACEC,oBAAoB,EAAE,KAAK;MAC3BC,UAAU,EAAE;QACVtC,QAAQ,EAAE;UACRuC,KAAK,EAAE;YACLC,KAAK,EAAE,CACL;cACEC,IAAI,EAAE;YACR,CAAC,EACD;cACEJ,oBAAoB,EAAE,KAAK;cAC3BC,UAAU,EAAE;gBACV9C,OAAO,EAAE;kBACPiD,IAAI,EAAE;gBACR,CAAC;gBACD9C,OAAO,EAAE;kBACP8C,IAAI,EAAE;gBACR,CAAC;gBACDpB,OAAO,EAAE;kBACPoB,IAAI,EAAE;gBACR,CAAC;gBACDjB,OAAO,EAAE;kBACPiB,IAAI,EAAE;gBACR;cACF,CAAC;cACDA,IAAI,EAAE;YACR,CAAC;UAEL,CAAC;UACDA,IAAI,EAAE;QACR;MACF,CAAC;MACDA,IAAI,EAAE;IACR,CAAC,CACF;IACDA,IAAI,EAAE;EACR;AACF,CAAC,CAAC;AAAAC,OAAA,CAAAxD,OAAA,GAAAO,QAAA;AAAAkD,MAAA,CAAAD,OAAA,GAAAA,OAAA,CAAAxD,OAAA"}
@@ -53,12 +53,7 @@ var _default = (0, _iterateJsdoc.default)(({
53
53
  }
54
54
  const isSingleLineBlock = delimiter === '/**';
55
55
  const delim = isSingleLineBlock ? '*' : delimiter;
56
- let endAsterisks;
57
- if (allowWhitespace) {
58
- endAsterisks = isSingleLineBlock ? endAsterisksSingleLineNoBlockWS : endAsterisksMultipleLineNoBlockWS;
59
- } else {
60
- endAsterisks = isSingleLineBlock ? endAsterisksSingleLineBlockWS : endAsterisksMultipleLineBlockWS;
61
- }
56
+ const endAsterisks = allowWhitespace ? isSingleLineBlock ? endAsterisksSingleLineNoBlockWS : endAsterisksMultipleLineNoBlockWS : isSingleLineBlock ? endAsterisksSingleLineBlockWS : endAsterisksMultipleLineBlockWS;
62
57
  const endingAsterisksAndSpaces = (allowWhitespace ? postDelimiter + description + delim : description + delim).match(endAsterisks);
63
58
  if (!endingAsterisksAndSpaces || !isSingleLineBlock && endingAsterisksAndSpaces[1] && !endingAsterisksAndSpaces[1].trim()) {
64
59
  return false;
@@ -1 +1 @@
1
- {"version":3,"file":"noMultiAsterisks.js","names":["_iterateJsdoc","_interopRequireDefault","require","obj","__esModule","default","middleAsterisksBlockWS","middleAsterisksNoBlockWS","endAsterisksSingleLineBlockWS","endAsterisksMultipleLineBlockWS","endAsterisksSingleLineNoBlockWS","endAsterisksMultipleLineNoBlockWS","_default","iterateJsdoc","context","jsdoc","utils","allowWhitespace","preventAtEnd","preventAtMiddleLines","options","middleAsterisks","source","some","tokens","number","delimiter","tag","name","type","description","end","postDelimiter","test","fix","replace","reportJSDoc","line","isSingleLineBlock","delim","endAsterisks","endingAsterisksAndSpaces","match","trim","endFix","iterateAllJsdocs","meta","docs","url","fixable","schema","additionalProperties","properties","exports","module"],"sources":["../../src/rules/noMultiAsterisks.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc';\n\nconst middleAsterisksBlockWS = /^([\\t ]|\\*(?!\\*))+/u;\nconst middleAsterisksNoBlockWS = /^\\*+/u;\n\nconst endAsterisksSingleLineBlockWS = /\\*((?:\\*|(?: |\\t))*)\\*$/u;\nconst endAsterisksMultipleLineBlockWS = /((?:\\*|(?: |\\t))*)\\*$/u;\n\nconst endAsterisksSingleLineNoBlockWS = /\\*(\\**)\\*$/u;\nconst endAsterisksMultipleLineNoBlockWS = /(\\**)\\*$/u;\n\nexport default iterateJsdoc(({\n context,\n jsdoc,\n utils,\n}) => {\n const {\n allowWhitespace = false,\n preventAtEnd = true,\n preventAtMiddleLines = true,\n } = context.options[0] || {};\n\n const middleAsterisks = allowWhitespace ? middleAsterisksNoBlockWS : middleAsterisksBlockWS;\n\n // eslint-disable-next-line complexity -- Todo\n jsdoc.source.some(({\n tokens,\n number,\n }) => {\n const {\n delimiter,\n tag,\n name,\n type,\n description,\n end,\n postDelimiter,\n } = tokens;\n\n if (\n preventAtMiddleLines &&\n !end && !tag && !type && !name &&\n (\n !allowWhitespace && middleAsterisks.test(description) ||\n allowWhitespace && middleAsterisks.test(postDelimiter + description)\n )\n ) {\n // console.log('description', JSON.stringify(description));\n const fix = () => {\n tokens.description = description.replace(middleAsterisks, '');\n };\n\n utils.reportJSDoc(\n 'Should be no multiple asterisks on middle lines.',\n {\n line: number,\n },\n fix,\n true,\n );\n\n return true;\n }\n\n if (!preventAtEnd || !end) {\n return false;\n }\n\n const isSingleLineBlock = delimiter === '/**';\n const delim = isSingleLineBlock ? '*' : delimiter;\n let endAsterisks;\n if (allowWhitespace) {\n endAsterisks = isSingleLineBlock ? endAsterisksSingleLineNoBlockWS : endAsterisksMultipleLineNoBlockWS;\n } else {\n endAsterisks = isSingleLineBlock ? endAsterisksSingleLineBlockWS : endAsterisksMultipleLineBlockWS;\n }\n\n const endingAsterisksAndSpaces = (\n allowWhitespace ? postDelimiter + description + delim : description + delim\n ).match(\n endAsterisks,\n );\n\n if (\n !endingAsterisksAndSpaces ||\n !isSingleLineBlock && endingAsterisksAndSpaces[1] && !endingAsterisksAndSpaces[1].trim()\n ) {\n return false;\n }\n\n const endFix = () => {\n if (!isSingleLineBlock) {\n tokens.delimiter = '';\n }\n\n tokens.description = (description + delim).replace(endAsterisks, '');\n };\n\n utils.reportJSDoc(\n 'Should be no multiple asterisks on end lines.',\n {\n line: number,\n },\n endFix,\n true,\n );\n\n return true;\n });\n}, {\n iterateAllJsdocs: true,\n meta: {\n docs: {\n description: '',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-no-multi-asterisks',\n },\n fixable: 'code',\n schema: [\n {\n additionalProperties: false,\n properties: {\n allowWhitespace: {\n type: 'boolean',\n },\n preventAtEnd: {\n type: 'boolean',\n },\n preventAtMiddleLines: {\n type: 'boolean',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"mappings":";;;;;;AAAA,IAAAA,aAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA2C,SAAAD,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC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EAAE;IACP,CAAC;IACDC,OAAO,EAAE,MAAM;IACfC,MAAM,EAAE,CACN;MACEC,oBAAoB,EAAE,KAAK;MAC3BC,UAAU,EAAE;QACVnC,eAAe,EAAE;UACfY,IAAI,EAAE;QACR,CAAC;QACDX,YAAY,EAAE;UACZW,IAAI,EAAE;QACR,CAAC;QACDV,oBAAoB,EAAE;UACpBU,IAAI,EAAE;QACR;MACF,CAAC;MACDA,IAAI,EAAE;IACR,CAAC,CACF;IACDA,IAAI,EAAE;EACR;AACF,CAAC,CAAC;AAAAwB,OAAA,CAAAhD,OAAA,GAAAO,QAAA;AAAA0C,MAAA,CAAAD,OAAA,GAAAA,OAAA,CAAAhD,OAAA"}
1
+ {"version":3,"file":"noMultiAsterisks.js","names":["_iterateJsdoc","_interopRequireDefault","require","obj","__esModule","default","middleAsterisksBlockWS","middleAsterisksNoBlockWS","endAsterisksSingleLineBlockWS","endAsterisksMultipleLineBlockWS","endAsterisksSingleLineNoBlockWS","endAsterisksMultipleLineNoBlockWS","_default","iterateJsdoc","context","jsdoc","utils","allowWhitespace","preventAtEnd","preventAtMiddleLines","options","middleAsterisks","source","some","tokens","number","delimiter","tag","name","type","description","end","postDelimiter","test","fix","replace","reportJSDoc","line","isSingleLineBlock","delim","endAsterisks","endingAsterisksAndSpaces","match","trim","endFix","iterateAllJsdocs","meta","docs","url","fixable","schema","additionalProperties","properties","exports","module"],"sources":["../../src/rules/noMultiAsterisks.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc';\n\nconst middleAsterisksBlockWS = /^([\\t ]|\\*(?!\\*))+/u;\nconst middleAsterisksNoBlockWS = /^\\*+/u;\n\nconst endAsterisksSingleLineBlockWS = /\\*((?:\\*|(?: |\\t))*)\\*$/u;\nconst endAsterisksMultipleLineBlockWS = /((?:\\*|(?: |\\t))*)\\*$/u;\n\nconst endAsterisksSingleLineNoBlockWS = /\\*(\\**)\\*$/u;\nconst endAsterisksMultipleLineNoBlockWS = /(\\**)\\*$/u;\n\nexport default iterateJsdoc(({\n context,\n jsdoc,\n utils,\n}) => {\n const {\n allowWhitespace = false,\n preventAtEnd = true,\n preventAtMiddleLines = true,\n } = context.options[0] || {};\n\n const middleAsterisks = allowWhitespace ? middleAsterisksNoBlockWS : middleAsterisksBlockWS;\n\n // eslint-disable-next-line complexity -- Todo\n jsdoc.source.some(({\n tokens,\n number,\n }) => {\n const {\n delimiter,\n tag,\n name,\n type,\n description,\n end,\n postDelimiter,\n } = tokens;\n\n if (\n preventAtMiddleLines &&\n !end && !tag && !type && !name &&\n (\n !allowWhitespace && middleAsterisks.test(description) ||\n allowWhitespace && middleAsterisks.test(postDelimiter + description)\n )\n ) {\n // console.log('description', JSON.stringify(description));\n const fix = () => {\n tokens.description = description.replace(middleAsterisks, '');\n };\n\n utils.reportJSDoc(\n 'Should be no multiple asterisks on middle lines.',\n {\n line: number,\n },\n fix,\n true,\n );\n\n return true;\n }\n\n if (!preventAtEnd || !end) {\n return false;\n }\n\n const isSingleLineBlock = delimiter === '/**';\n const delim = isSingleLineBlock ? '*' : delimiter;\n const endAsterisks = allowWhitespace ?\n (isSingleLineBlock ? endAsterisksSingleLineNoBlockWS : endAsterisksMultipleLineNoBlockWS) :\n (isSingleLineBlock ? endAsterisksSingleLineBlockWS : endAsterisksMultipleLineBlockWS);\n\n const endingAsterisksAndSpaces = (\n allowWhitespace ? postDelimiter + description + delim : description + delim\n ).match(\n endAsterisks,\n );\n\n if (\n !endingAsterisksAndSpaces ||\n !isSingleLineBlock && endingAsterisksAndSpaces[1] && !endingAsterisksAndSpaces[1].trim()\n ) {\n return false;\n }\n\n const endFix = () => {\n if (!isSingleLineBlock) {\n tokens.delimiter = '';\n }\n\n tokens.description = (description + delim).replace(endAsterisks, '');\n };\n\n utils.reportJSDoc(\n 'Should be no multiple asterisks on end lines.',\n {\n line: number,\n },\n endFix,\n true,\n );\n\n return true;\n });\n}, {\n iterateAllJsdocs: true,\n meta: {\n docs: {\n description: '',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-no-multi-asterisks',\n },\n fixable: 'code',\n schema: [\n {\n additionalProperties: false,\n properties: {\n allowWhitespace: {\n type: 'boolean',\n },\n preventAtEnd: {\n type: 'boolean',\n },\n preventAtMiddleLines: {\n type: 'boolean',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"mappings":";;;;;;AAAA,IAAAA,aAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA2C,SAAAD,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAE3C,MAAMG,sBAAsB,GAAG,qBAAqB;AACpD,MAAMC,wBAAwB,GAAG,OAAO;AAExC,MAAMC,6BAA6B,GAAG,0BAA0B;AAChE,MAAMC,+BAA+B,GAAG,wBAAwB;AAEhE,MAAMC,+BAA+B,GAAG,aAAa;AACrD,MAAMC,iCAAiC,GAAG,WAAW;AAAC,IAAAC,QAAA,GAEvC,IAAAC,qBAAY,EAAC,CAAC;EAC3BC,OAAO;EACPC,KAAK;EACLC;AACF,CAAC,KAAK;EACJ,MAAM;IACJC,eAAe,GAAG,KAAK;IACvBC,YAAY,GAAG,IAAI;IACnBC,oBAAoB,GAAG;EACzB,CAAC,GAAGL,OAAO,CAACM,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;EAE5B,MAAMC,eAAe,GAAGJ,eAAe,GAAGV,wBAAwB,GAAGD,sBAAsB;;EAE3F;EACAS,KAAK,CAACO,MAAM,CAACC,IAAI,CAAC,CAAC;IACjBC,MAAM;IACNC;EACF,CAAC,KAAK;IACJ,MAAM;MACJC,SAAS;MACTC,GAAG;MACHC,IAAI;MACJC,IAAI;MACJC,WAAW;MACXC,GAAG;MACHC;IACF,CAAC,GAAGR,MAAM;IAEV,IACEL,oBAAoB,IACpB,CAACY,GAAG,IAAI,CAACJ,GAAG,IAAI,CAACE,IAAI,IAAI,CAACD,IA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AAE,EAAE,CAAC;IACtE,CAAC;IAEDxB,KAAK,CAACoB,WAAW,CACf,+CAA+C,EAC/C;MACEC,IAAI,EAAEZ;IACR,CAAC,EACDmB,MAAM,EACN,IACF,CAAC;IAED,OAAO,IAAI;EACb,CAAC,CAAC;AACJ,CAAC,EAAE;EACDC,gBAAgB,EAAE,IAAI;EACtBC,IAAI,EAAE;IACJC,IAAI,EAAE;MACJjB,WAAW,EAAE,EAAE;MACfkB,GAAG,EAAE;IACP,CAAC;IACDC,OAAO,EAAE,MAAM;IACfC,MAAM,EAAE,CACN;MACEC,oBAAoB,EAAE,KAAK;MAC3BC,UAAU,EAAE;QACVnC,eAAe,EAAE;UACfY,IAAI,EAAE;QACR,CAAC;QACDX,YAAY,EAAE;UACZW,IAAI,EAAE;QACR,CAAC;QACDV,oBAAoB,EAAE;UACpBU,IAAI,EAAE;QACR;MACF,CAAC;MACDA,IAAI,EAAE;IACR,CAAC,CACF;IACDA,IAAI,EAAE;EACR;AACF,CAAC,CAAC;AAAAwB,OAAA,CAAAhD,OAAA,GAAAO,QAAA;AAAA0C,MAAA,CAAAD,OAAA,GAAAA,OAAA,CAAAhD,OAAA"}
@@ -4,8 +4,8 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- var _esquery = _interopRequireDefault(require("esquery"));
8
7
  var _iterateJsdoc = _interopRequireDefault(require("../iterateJsdoc"));
8
+ var _esquery = _interopRequireDefault(require("esquery"));
9
9
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
10
  var _default = (0, _iterateJsdoc.default)(({
11
11
  node,
@@ -23,10 +23,15 @@ var _default = (0, _iterateJsdoc.default)(({
23
23
  const {
24
24
  contexts
25
25
  } = context.options[0];
26
- const foundContext = contexts.find(cntxt => {
27
- return typeof cntxt === 'string' ? _esquery.default.matches(node, _esquery.default.parse(cntxt), null, {
26
+ const foundContext = contexts.find(
27
+ /**
28
+ * @param {string|{context: string, comment: string}} cntxt
29
+ * @returns {boolean}
30
+ */
31
+ cntxt => {
32
+ return typeof cntxt === 'string' ? _esquery.default.matches( /** @type {import('../iterateJsdoc.js').Node} */node, _esquery.default.parse(cntxt), undefined, {
28
33
  visitorKeys: sourceCode.visitorKeys
29
- }) : (!cntxt.context || cntxt.context === 'any' || _esquery.default.matches(node, _esquery.default.parse(cntxt.context), null, {
34
+ }) : (!cntxt.context || cntxt.context === 'any' || _esquery.default.matches( /** @type {import('../iterateJsdoc.js').Node} */node, _esquery.default.parse(cntxt.context), undefined, {
30
35
  visitorKeys: sourceCode.visitorKeys
31
36
  })) && comment === cntxt.comment;
32
37
  });
@@ -38,9 +43,11 @@ var _default = (0, _iterateJsdoc.default)(({
38
43
  }
39
44
  const contextStr = typeof foundContext === 'object' ? foundContext.context ?? 'any' : foundContext;
40
45
  const message = (foundContext === null || foundContext === void 0 ? void 0 : foundContext.message) ?? 'Syntax is restricted: {{context}}' + (comment ? ' with {{comment}}' : '');
41
- report(message, null, null, {
46
+ report(message, null, null, comment ? {
42
47
  comment,
43
48
  context: contextStr
49
+ } : {
50
+ context: contextStr
44
51
  });
45
52
  }, {
46
53
  contextSelected: true,
@@ -1 +1 @@
1
- {"version":3,"file":"noRestrictedSyntax.js","names":["_esquery","_interopRequireDefault","require","_iterateJsdoc","obj","__esModule","default","_default","iterateJsdoc","node","context","info","comment","sourceCode","report","options","length","contexts","foundContext","find","cntxt","esquery","matches","parse","visitorKeys","contextStr","message","contextSelected","meta","docs","description","url","fixable","schema","additionalProperties","properties","items","anyOf","type","required","nonGlobalSettings","exports","module"],"sources":["../../src/rules/noRestrictedSyntax.js"],"sourcesContent":["import esquery from 'esquery';\nimport iterateJsdoc from '../iterateJsdoc';\n\nexport default iterateJsdoc(({\n node,\n context,\n info: {\n comment,\n },\n sourceCode,\n report,\n}) => {\n if (!context.options.length) {\n report('Rule `no-restricted-syntax` is missing a `contexts` option.');\n\n return;\n }\n\n const {\n contexts,\n } = context.options[0];\n\n const foundContext = contexts.find((cntxt) => {\n return typeof cntxt === 'string' ?\n esquery.matches(node, esquery.parse(cntxt), null, {\n visitorKeys: sourceCode.visitorKeys,\n }) :\n (!cntxt.context || cntxt.context === 'any' || esquery.matches(node, esquery.parse(cntxt.context), null, {\n visitorKeys: sourceCode.visitorKeys,\n })) &&\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 (comment ? ' with {{comment}}' : '');\n\n report(message, null, null, {\n comment,\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: [\n 'contexts',\n ],\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n nonGlobalSettings: true,\n});\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,aAAA,GAAAF,sBAAA,CAAAC,OAAA;AAA2C,SAAAD,uBAAAG,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,IAAAG,QAAA,GAE5B,IAAAC,qBAAY,EAAC,CAAC;EAC3BC,IAAI;EACJC,OAAO;EACPC,IAAI,EAAE;IACJC;EACF,CAAC;EACDC,UAAU;EACVC;AACF,CAAC,KAAK;EACJ,IAAI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nEC,GAAG,EAAE;IACP,CAAC;IACDC,OAAO,EAAE,MAAM;IACfC,MAAM,EAAE,CACN;MACEC,oBAAoB,EAAE,KAAK;MAC3BC,UAAU,EAAE;QACVlB,QAAQ,EAAE;UACRmB,KAAK,EAAE;YACLC,KAAK,EAAE,CACL;cACEC,IAAI,EAAE;YACR,CAAC,EACD;cACEJ,oBAAoB,EAAE,KAAK;cAC3BC,UAAU,EAAE;gBACVvB,OAAO,EAAE;kBACP0B,IAAI,EAAE;gBACR,CAAC;gBACD5B,OAAO,EAAE;kBACP4B,IAAI,EAAE;gBACR,CAAC;gBACDZ,OAAO,EAAE;kBACPY,IAAI,EAAE;gBACR;cACF,CAAC;cACDA,IAAI,EAAE;YACR,CAAC;UAEL,CAAC;UACDA,IAAI,EAAE;QACR;MACF,CAAC;MACDC,QAAQ,EAAE,CACR,UAAU,CACX;MACDD,IAAI,EAAE;IACR,CAAC,CACF;IACDA,IAAI,EAAE;EACR,CAAC;EACDE,iBAAiB,EAAE;AACrB,CAAC,CAAC;AAAAC,OAAA,CAAAnC,OAAA,GAAAC,QAAA;AAAAmC,MAAA,CAAAD,OAAA,GAAAA,OAAA,CAAAnC,OAAA"}
1
+ {"version":3,"file":"noRestrictedSyntax.js","names":["_iterateJsdoc","_interopRequireDefault","require","_esquery","obj","__esModule","default","_default","iterateJsdoc","node","context","info","comment","sourceCode","report","options","length","contexts","foundContext","find","cntxt","esquery","matches","parse","undefined","visitorKeys","contextStr","message","contextSelected","meta","docs","description","url","fixable","schema","additionalProperties","properties","items","anyOf","type","required","nonGlobalSettings","exports","module"],"sources":["../../src/rules/noRestrictedSyntax.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc';\nimport esquery from 'esquery';\n\nexport default iterateJsdoc(({\n node,\n context,\n info: {\n comment,\n },\n sourceCode,\n report,\n}) => {\n if (!context.options.length) {\n report('Rule `no-restricted-syntax` is missing a `contexts` option.');\n\n return;\n }\n\n const {\n contexts,\n } = context.options[0];\n\n const foundContext = contexts.find(\n /**\n * @param {string|{context: string, comment: string}} cntxt\n * @returns {boolean}\n */\n (cntxt) => {\n return typeof cntxt === 'string' ?\n esquery.matches(\n /** @type {import('../iterateJsdoc.js').Node} */ (node),\n esquery.parse(cntxt),\n undefined,\n {\n visitorKeys: sourceCode.visitorKeys,\n },\n ) :\n (!cntxt.context || cntxt.context === 'any' ||\n esquery.matches(\n /** @type {import('../iterateJsdoc.js').Node} */ (node),\n esquery.parse(cntxt.context),\n undefined,\n {\n visitorKeys: sourceCode.visitorKeys,\n },\n )) &&\n comment === cntxt.comment;\n },\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 (comment ? ' with {{comment}}' : '');\n\n report(message, null, null, comment ? {\n comment,\n context: contextStr,\n } : {\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: [\n 'contexts',\n ],\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n nonGlobalSettings: true,\n});\n"],"mappings":";;;;;;AAAA,IAAAA,aAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,QAAA,GAAAF,sBAAA,CAAAC,OAAA;AAA8B,SAAAD,uBAAAG,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAA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AAO,EAAE,IAAI,EAAE,IAAI,EAAEf,OAAO,GAAG;IACpCA,OAAO;IACPF,OAAO,EAAEgB;EACX,CAAC,GAAG;IACFhB,OAAO,EAAEgB;EACX,CAAC,CAAC;AACJ,CAAC,EAAE;EACDE,eAAe,EAAE,IAAI;EACrBC,IAAI,EAAE;IACJC,IAAI,EAAE;MACJC,WAAW,EAAE,sDAAsD;MACnEC,GAAG,EAAE;IACP,CAAC;IACDC,OAAO,EAAE,MAAM;IACfC,MAAM,EAAE,CACN;MACEC,oBAAoB,EAAE,KAAK;MAC3BC,UAAU,EAAE;QACVnB,QAAQ,EAAE;UACRoB,KAAK,EAAE;YACLC,KAAK,EAAE,CACL;cACEC,IAAI,EAAE;YACR,CAAC,EACD;cACEJ,oBAAoB,EAAE,KAAK;cAC3BC,UAAU,EAAE;gBACVxB,OAAO,EAAE;kBACP2B,IAAI,EAAE;gBACR,CAAC;gBACD7B,OAAO,EAAE;kBACP6B,IAAI,EAAE;gBACR,CAAC;gBACDZ,OAAO,EAAE;kBACPY,IAAI,EAAE;gBACR;cACF,CAAC;cACDA,IAAI,EAAE;YACR,CAAC;UAEL,CAAC;UACDA,IAAI,EAAE;QACR;MACF,CAAC;MACDC,QAAQ,EAAE,CACR,UAAU,CACX;MACDD,IAAI,EAAE;IACR,CAAC,CACF;IACDA,IAAI,EAAE;EACR,CAAC;EACDE,iBAAiB,EAAE;AACrB,CAAC,CAAC;AAAAC,OAAA,CAAApC,OAAA,GAAAC,QAAA;AAAAoC,MAAA,CAAAD,OAAA,GAAAA,OAAA,CAAApC,OAAA"}
@@ -6,6 +6,9 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.default = void 0;
7
7
  var _iterateJsdoc = _interopRequireDefault(require("../iterateJsdoc"));
8
8
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
9
+ /**
10
+ * @param {import('comment-parser').Line} line
11
+ */
9
12
  const removeType = ({
10
13
  tokens
11
14
  }) => {
@@ -1 +1 @@
1
- {"version":3,"file":"noTypes.js","names":["_iterateJsdoc","_interopRequireDefault","require","obj","__esModule","default","removeType","tokens","postTag","type","_default","iterateJsdoc","utils","isIteratingFunction","isVirtualFunction","tags","getPresentTags","tag","reportJSDoc","source","contextDefaults","meta","docs","description","url","fixable","schema","additionalProperties","properties","contexts","items","anyOf","comment","context","exports","module"],"sources":["../../src/rules/noTypes.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc';\n\nconst removeType = ({\n tokens,\n}) => {\n tokens.postTag = '';\n tokens.type = '';\n};\n\nexport default iterateJsdoc(({\n utils,\n}) => {\n if (!utils.isIteratingFunction() && !utils.isVirtualFunction()) {\n return;\n }\n\n const tags = utils.getPresentTags([\n 'param', 'arg', 'argument', 'returns', 'return',\n ]);\n\n for (const tag of tags) {\n if (tag.type) {\n utils.reportJSDoc(`Types are not permitted on @${tag.tag}.`, tag, () => {\n for (const source of tag.source) {\n removeType(source);\n }\n });\n }\n }\n}, {\n contextDefaults: true,\n meta: {\n docs: {\n description: 'This rule reports types being used on `@param` or `@returns`.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-no-types',\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 },\n type: 'object',\n },\n ],\n },\n type: 'array',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"mappings":";;;;;;AAAA,IAAAA,aAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA2C,SAAAD,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAE3C,MAAMG,UAAU,GAAGA,CAAC;EAClBC;AACF,CAAC,KAAK;EACJA,MAAM,CAACC,OAAO,GAAG,EAAE;EACnBD,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AC,CACF;IACDA,IAAI,EAAE;EACR;AACF,CAAC,CAAC;AAAAyB,OAAA,CAAA7B,OAAA,GAAAK,QAAA;AAAAyB,MAAA,CAAAD,OAAA,GAAAA,OAAA,CAAA7B,OAAA"}
1
+ {"version":3,"file":"noTypes.js","names":["_iterateJsdoc","_interopRequireDefault","require","obj","__esModule","default","removeType","tokens","postTag","type","_default","iterateJsdoc","utils","isIteratingFunction","isVirtualFunction","tags","getPresentTags","tag","reportJSDoc","source","contextDefaults","meta","docs","description","url","fixable","schema","additionalProperties","properties","contexts","items","anyOf","comment","context","exports","module"],"sources":["../../src/rules/noTypes.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc';\n\n/**\n * @param {import('comment-parser').Line} line\n */\nconst removeType = ({\n tokens,\n}) => {\n tokens.postTag = '';\n tokens.type = '';\n};\n\nexport default iterateJsdoc(({\n utils,\n}) => {\n if (!utils.isIteratingFunction() && !utils.isVirtualFunction()) {\n return;\n }\n\n const tags = utils.getPresentTags([\n 'param', 'arg', 'argument', 'returns', 'return',\n ]);\n\n for (const tag of tags) {\n if (tag.type) {\n utils.reportJSDoc(`Types are not permitted on @${tag.tag}.`, tag, () => {\n for (const source of tag.source) {\n removeType(source);\n }\n });\n }\n }\n}, {\n contextDefaults: true,\n meta: {\n docs: {\n description: 'This rule reports types being used on `@param` or `@returns`.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-no-types',\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 },\n type: 'object',\n },\n ],\n },\n type: 'array',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"mappings":";;;;;;AAAA,IAAAA,aAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA2C,SAAAD,uBAAAE,GAAA,WAAAA,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ACPvB,IAAI,EAAE;gBACR,CAAC;gBACDwB,OAAO,EAAE;kBACPxB,IAAI,EAAE;gBACR;cACF,CAAC;cACDA,IAAI,EAAE;YACR,CAAC;UAEL,CAAC;UACDA,IAAI,EAAE;QACR;MACF,CAAC;MACDA,IAAI,EAAE;IACR,CAAC,CACF;IACDA,IAAI,EAAE;EACR;AACF,CAAC,CAAC;AAAAyB,OAAA,CAAA7B,OAAA,GAAAK,QAAA;AAAAyB,MAAA,CAAAD,OAAA,GAAAA,OAAA,CAAA7B,OAAA"}
@@ -4,16 +4,19 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- var _jsdoccomment = require("@es-joy/jsdoccomment");
8
7
  var _iterateJsdoc = _interopRequireWildcard(require("../iterateJsdoc"));
9
- var _jsdocUtils = _interopRequireDefault(require("../jsdocUtils"));
10
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
8
+ var _jsdoccomment = require("@es-joy/jsdoccomment");
11
9
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
12
10
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
13
11
  const extraTypes = ['null', 'undefined', 'void', 'string', 'boolean', 'object', 'function', 'symbol', 'number', 'bigint', 'NaN', 'Infinity', 'any', '*', 'never', 'unknown', 'const', 'this', 'true', 'false', 'Array', 'Object', 'RegExp', 'Date', 'Function'];
14
12
  const typescriptGlobals = [
15
13
  // https://www.typescriptlang.org/docs/handbook/utility-types.html
16
14
  'Partial', 'Required', 'Readonly', 'Record', 'Pick', 'Omit', 'Exclude', 'Extract', 'NonNullable', 'Parameters', 'ConstructorParameters', 'ReturnType', 'InstanceType', 'ThisParameterType', 'OmitThisParameter', 'ThisType', 'Uppercase', 'Lowercase', 'Capitalize', 'Uncapitalize'];
15
+
16
+ /**
17
+ * @param {string|false|undefined} [str]
18
+ * @returns {undefined|string|false}
19
+ */
17
20
  const stripPseudoTypes = str => {
18
21
  return str && str.replace(/(?:\.|<>|\.<>|\[\])$/u, '');
19
22
  };
@@ -29,14 +32,25 @@ var _default = (0, _iterateJsdoc.default)(({
29
32
  const {
30
33
  scopeManager
31
34
  } = sourceCode;
32
- const {
33
- globalScope
34
- } = scopeManager;
35
- const {
35
+
36
+ // When is this ever `null`?
37
+ const globalScope = /** @type {import('eslint').Scope.Scope} */
38
+ scopeManager.globalScope;
39
+ const
40
+ /**
41
+ * @type {{
42
+ * definedTypes: string[],
43
+ * disableReporting: boolean,
44
+ * markVariablesAsUsed: boolean
45
+ * }}
46
+ */
47
+ {
36
48
  definedTypes = [],
37
49
  disableReporting = false,
38
50
  markVariablesAsUsed = true
39
51
  } = context.options[0] || {};
52
+
53
+ /** @type {(string|undefined)[]} */
40
54
  let definedPreferredTypes = [];
41
55
  const {
42
56
  preferredTypes,
@@ -44,7 +58,7 @@ var _default = (0, _iterateJsdoc.default)(({
44
58
  mode
45
59
  } = settings;
46
60
  if (Object.keys(preferredTypes).length) {
47
- definedPreferredTypes = Object.values(preferredTypes).map(preferredType => {
61
+ definedPreferredTypes = /** @type {string[]} */Object.values(preferredTypes).map(preferredType => {
48
62
  if (typeof preferredType === 'string') {
49
63
  // May become an empty string but will be filtered out below
50
64
  return stripPseudoTypes(preferredType);
@@ -56,11 +70,9 @@ var _default = (0, _iterateJsdoc.default)(({
56
70
  utils.reportSettings('Invalid `settings.jsdoc.preferredTypes`. Values must be falsy, a string, or an object.');
57
71
  }
58
72
  return stripPseudoTypes(preferredType.replacement);
59
- }).filter(preferredType => {
60
- return preferredType;
61
- });
73
+ }).filter(Boolean);
62
74
  }
63
- const typedefDeclarations = context.getAllComments().filter(comment => {
75
+ const typedefDeclarations = sourceCode.getAllComments().filter(comment => {
64
76
  return /^\*\s/u.test(comment.value);
65
77
  }).map(commentNode => {
66
78
  return (0, _iterateJsdoc.parseComment)(commentNode, '');
@@ -81,13 +93,18 @@ var _default = (0, _iterateJsdoc.default)(({
81
93
  ancestorNodes.push(currentNode);
82
94
  currentNode = currentNode.parent;
83
95
  }
96
+
97
+ /**
98
+ * @param {import('eslint').Rule.Node} ancestorNode
99
+ * @returns {import('comment-parser').Spec[]}
100
+ */
84
101
  const getTemplateTags = function (ancestorNode) {
85
102
  const commentNode = (0, _jsdoccomment.getJSDocComment)(sourceCode, ancestorNode, settings);
86
103
  if (!commentNode) {
87
104
  return [];
88
105
  }
89
106
  const jsdoc = (0, _iterateJsdoc.parseComment)(commentNode, '');
90
- return _jsdocUtils.default.filterTags(jsdoc.tags, tag => {
107
+ return jsdoc.tags.filter(tag => {
91
108
  return tag.tag === 'template';
92
109
  });
93
110
  };
@@ -96,7 +113,7 @@ var _default = (0, _iterateJsdoc.default)(({
96
113
  // we look to present tags instead
97
114
  const templateTags = ancestorNodes.length ? ancestorNodes.flatMap(ancestorNode => {
98
115
  return getTemplateTags(ancestorNode);
99
- }) : utils.getPresentTags('template');
116
+ }) : utils.getPresentTags(['template']);
100
117
  const closureGenericTypes = templateTags.flatMap(tag => {
101
118
  return utils.parseClosureTemplateTag(tag);
102
119
  });
@@ -119,13 +136,34 @@ var _default = (0, _iterateJsdoc.default)(({
119
136
  name
120
137
  }) => {
121
138
  return name;
122
- }) : []).concat(extraTypes).concat(typedefDeclarations).concat(definedTypes).concat(definedPreferredTypes).concat(settings.mode === 'jsdoc' ? [] : [...(settings.mode === 'typescript' ? typescriptGlobals : []), ...closureGenericTypes]));
139
+ }) : []).concat(extraTypes).concat(typedefDeclarations).concat(definedTypes).concat( /** @type {string[]} */definedPreferredTypes).concat(settings.mode === 'jsdoc' ? [] : [...(settings.mode === 'typescript' ? typescriptGlobals : []), ...closureGenericTypes]));
140
+
141
+ /**
142
+ * @typedef {{
143
+ * parsedType: import('jsdoc-type-pratt-parser').RootResult;
144
+ * tag: import('comment-parser').Spec|import('@es-joy/jsdoccomment').JsdocInlineTagNoType & {
145
+ * line?: import('../iterateJsdoc.js').Integer
146
+ * }
147
+ * }} TypeAndTagInfo
148
+ */
149
+
150
+ /**
151
+ * @param {string} propertyName
152
+ * @returns {(tag: (import('@es-joy/jsdoccomment').JsdocInlineTagNoType & {
153
+ * name?: string,
154
+ * type?: string,
155
+ * line?: import('../iterateJsdoc.js').Integer
156
+ * })|import('comment-parser').Spec & {
157
+ * namepathOrURL?: string
158
+ * }
159
+ * ) => undefined|TypeAndTagInfo}
160
+ */
123
161
  const tagToParsedType = propertyName => {
124
162
  return tag => {
125
163
  try {
126
- const potentialType = tag[propertyName];
164
+ const potentialType = tag[/** @type {"type"|"name"|"namepathOrURL"} */propertyName];
127
165
  return {
128
- parsedType: mode === 'permissive' ? (0, _jsdoccomment.tryParse)(potentialType) : (0, _jsdoccomment.parse)(potentialType, mode),
166
+ parsedType: mode === 'permissive' ? (0, _jsdoccomment.tryParse)( /** @type {string} */potentialType) : (0, _jsdoccomment.parse)( /** @type {string} */potentialType, mode),
129
167
  tag
130
168
  };
131
169
  } catch {
@@ -143,23 +181,23 @@ var _default = (0, _iterateJsdoc.default)(({
143
181
  }) => {
144
182
  return utils.isNamepathReferencingTag(tag);
145
183
  }).map(tagToParsedType('name'));
146
- const namepathOrUrlReferencingTags = utils.filterTags(({
184
+ const namepathOrUrlReferencingTags = utils.filterAllTags(({
147
185
  tag
148
186
  }) => {
149
187
  return utils.isNamepathOrUrlReferencingTag(tag);
150
- }, true).map(tagToParsedType('namepathOrURL'));
151
- const tagsWithTypes = [...typeTags, ...namepathReferencingTags, ...namepathOrUrlReferencingTags].filter(result => {
152
- // Remove types which failed to parse
153
- return result;
154
- });
188
+ }).map(tagToParsedType('namepathOrURL'));
189
+ const tagsWithTypes = /** @type {TypeAndTagInfo[]} */[...typeTags, ...namepathReferencingTags, ...namepathOrUrlReferencingTags
190
+ // Remove types which failed to parse
191
+ ].filter(Boolean);
155
192
  for (const {
156
193
  tag,
157
194
  parsedType
158
195
  } of tagsWithTypes) {
159
- (0, _jsdoccomment.traverse)(parsedType, ({
160
- type,
161
- value
162
- }) => {
196
+ (0, _jsdoccomment.traverse)(parsedType, nde => {
197
+ const {
198
+ type,
199
+ value
200
+ } = /** @type {import('jsdoc-type-pratt-parser').NameResult} */nde;
163
201
  if (type === 'JsdocTypeName') {
164
202
  var _structuredTags$tag$t;
165
203
  const structuredTypes = (_structuredTags$tag$t = structuredTags[tag.tag]) === null || _structuredTags$tag$t === void 0 ? void 0 : _structuredTags$tag$t.type;
@@ -1 +1 @@
1
- {"version":3,"file":"noUndefinedTypes.js","names":["_jsdoccomment","require","_iterateJsdoc","_interopRequireWildcard","_jsdocUtils","_interopRequireDefault","obj","__esModule","default","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","extraTypes","typescriptGlobals","stripPseudoTypes","str","replace","_default","iterateJsdoc","context","node","report","settings","sourceCode","utils","_globalScope$childSco","_globalScope$childSco2","scopeManager","globalScope","definedTypes","disableReporting","markVariablesAsUsed","options","definedPreferredTypes","preferredTypes","structuredTags","mode","keys","length","values","map","preferredType","undefined","reportSettings","replacement","filter","typedefDeclarations","getAllComments","comment","test","value","commentNode","parseComment","flatMap","doc","tags","tag","isNamepathDefiningTag","name","ancestorNodes","currentNode","_currentNode","parent","push","getTemplateTags","ancestorNode","getJSDocComment","jsdoc","jsdocUtils","filterTags","templateTags","getPresentTags","closureGenericTypes","parseClosureTemplateTag","cjsOrESMScope","childScopes","block","type","allDefinedTypes","Set","variables","concat","tagToParsedType","propertyName","potentialType","parsedType","tryParseType","parseType","typeTags","tagMightHaveTypePosition","namepathReferencingTags","isNamepathReferencingTag","namepathOrUrlReferencingTags","isNamepathOrUrlReferencingTag","tagsWithTypes","result","traverse","_structuredTags$tag$t","structuredTypes","Array","isArray","includes","markVariableAsUsed","iterateAllJsdocs","meta","docs","description","url","schema","additionalProperties","properties","items","exports","module"],"sources":["../../src/rules/noUndefinedTypes.js"],"sourcesContent":["import {\n getJSDocComment,\n\n traverse,\n parse as parseType,\n tryParse as tryParseType,\n} from '@es-joy/jsdoccomment';\nimport iterateJsdoc, {\n parseComment,\n} from '../iterateJsdoc';\nimport jsdocUtils from '../jsdocUtils';\n\nconst extraTypes = [\n 'null', 'undefined', 'void', 'string', 'boolean', 'object',\n 'function', 'symbol',\n 'number', 'bigint', 'NaN', 'Infinity',\n 'any', '*', 'never', 'unknown', 'const',\n 'this', 'true', 'false',\n 'Array', 'Object', 'RegExp', 'Date', 'Function',\n];\n\nconst typescriptGlobals = [\n // https://www.typescriptlang.org/docs/handbook/utility-types.html\n 'Partial',\n 'Required',\n 'Readonly',\n 'Record',\n 'Pick',\n 'Omit',\n 'Exclude',\n 'Extract',\n 'NonNullable',\n 'Parameters',\n 'ConstructorParameters',\n 'ReturnType',\n 'InstanceType',\n 'ThisParameterType',\n 'OmitThisParameter',\n 'ThisType',\n 'Uppercase',\n 'Lowercase',\n 'Capitalize',\n 'Uncapitalize',\n];\n\nconst stripPseudoTypes = (str) => {\n return str && str.replace(/(?:\\.|<>|\\.<>|\\[\\])$/u, '');\n};\n\nexport default iterateJsdoc(({\n context,\n node,\n report,\n settings,\n sourceCode,\n utils,\n}) => {\n const {\n scopeManager,\n } = sourceCode;\n const {\n globalScope,\n } = scopeManager;\n\n const {\n definedTypes = [],\n disableReporting = false,\n markVariablesAsUsed = true,\n } = context.options[0] || {};\n\n let definedPreferredTypes = [];\n const {\n preferredTypes,\n structuredTags,\n mode,\n } = settings;\n if (Object.keys(preferredTypes).length) {\n definedPreferredTypes = Object.values(preferredTypes).map((preferredType) => {\n if (typeof preferredType === 'string') {\n // May become an empty string but will be filtered out below\n return stripPseudoTypes(preferredType);\n }\n\n if (!preferredType) {\n return undefined;\n }\n\n if (typeof preferredType !== 'object') {\n utils.reportSettings(\n 'Invalid `settings.jsdoc.preferredTypes`. Values must be falsy, a string, or an object.',\n );\n }\n\n return stripPseudoTypes(preferredType.replacement);\n })\n .filter((preferredType) => {\n return preferredType;\n });\n }\n\n const typedefDeclarations = context.getAllComments()\n .filter((comment) => {\n return (/^\\*\\s/u).test(comment.value);\n })\n .map((commentNode) => {\n return parseComment(commentNode, '');\n })\n .flatMap((doc) => {\n return doc.tags.filter(({\n tag,\n }) => {\n return utils.isNamepathDefiningTag(tag);\n });\n })\n .map((tag) => {\n return tag.name;\n });\n\n const ancestorNodes = [];\n\n let currentNode = node;\n // No need for Program node?\n while (currentNode?.parent) {\n ancestorNodes.push(currentNode);\n currentNode = currentNode.parent;\n }\n\n const getTemplateTags = function (ancestorNode) {\n const commentNode = getJSDocComment(sourceCode, ancestorNode, settings);\n if (!commentNode) {\n return [];\n }\n\n const jsdoc = parseComment(commentNode, '');\n\n return jsdocUtils.filterTags(jsdoc.tags, (tag) => {\n return tag.tag === 'template';\n });\n };\n\n // `currentScope` may be `null` or `Program`, so in such a case,\n // we look to present tags instead\n const templateTags = ancestorNodes.length ?\n ancestorNodes.flatMap((ancestorNode) => {\n return getTemplateTags(ancestorNode);\n }) :\n utils.getPresentTags('template');\n\n const closureGenericTypes = templateTags.flatMap((tag) => {\n return utils.parseClosureTemplateTag(tag);\n });\n\n // In modules, including Node, there is a global scope at top with the\n // Program scope inside\n const cjsOrESMScope = globalScope.childScopes[0]?.block?.type === 'Program';\n\n const allDefinedTypes = new Set(globalScope.variables.map(({\n name,\n }) => {\n return name;\n })\n\n // If the file is a module, concat the variables from the module scope.\n .concat(\n cjsOrESMScope ?\n globalScope.childScopes.flatMap(({\n variables,\n }) => {\n return variables;\n }).map(({\n name,\n }) => {\n return name;\n }) : [],\n )\n .concat(extraTypes)\n .concat(typedefDeclarations)\n .concat(definedTypes)\n .concat(definedPreferredTypes)\n .concat(\n settings.mode === 'jsdoc' ?\n [] :\n [\n ...settings.mode === 'typescript' ? typescriptGlobals : [],\n ...closureGenericTypes,\n ],\n ));\n\n const tagToParsedType = (propertyName) => {\n return (tag) => {\n try {\n const potentialType = tag[propertyName];\n return {\n parsedType: mode === 'permissive' ? tryParseType(potentialType) : parseType(potentialType, mode),\n tag,\n };\n } catch {\n return undefined;\n }\n };\n };\n\n const typeTags = utils.filterTags(({\n tag,\n }) => {\n return utils.tagMightHaveTypePosition(tag) && (tag !== 'suppress' || settings.mode !== 'closure');\n }).map(tagToParsedType('type'));\n\n const namepathReferencingTags = utils.filterTags(({\n tag,\n }) => {\n return utils.isNamepathReferencingTag(tag);\n }).map(tagToParsedType('name'));\n\n const namepathOrUrlReferencingTags = utils.filterTags(({\n tag,\n }) => {\n return utils.isNamepathOrUrlReferencingTag(tag);\n }, true).map(tagToParsedType('namepathOrURL'));\n\n const tagsWithTypes = [\n ...typeTags,\n ...namepathReferencingTags,\n ...namepathOrUrlReferencingTags,\n ].filter((result) => {\n // Remove types which failed to parse\n return result;\n });\n\n for (const {\n tag,\n parsedType,\n } of tagsWithTypes) {\n traverse(parsedType, ({\n type,\n value,\n }) => {\n if (type === 'JsdocTypeName') {\n const structuredTypes = structuredTags[tag.tag]?.type;\n if (!allDefinedTypes.has(value) &&\n (!Array.isArray(structuredTypes) || !structuredTypes.includes(value))\n ) {\n if (!disableReporting) {\n report(`The type '${value}' is undefined.`, null, tag);\n }\n } else if (markVariablesAsUsed && !extraTypes.includes(value)) {\n context.markVariableAsUsed(value);\n }\n }\n });\n }\n}, {\n iterateAllJsdocs: true,\n meta: {\n docs: {\n description: 'Checks that types in jsdoc comments are defined.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-no-undefined-types',\n },\n schema: [\n {\n additionalProperties: false,\n properties: {\n definedTypes: {\n items: {\n type: 'string',\n },\n type: 'array',\n },\n disableReporting: {\n type: 'boolean',\n },\n markVariablesAsUsed: {\n type: 'boolean',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"mappings":";;;;;;AAAA,IAAAA,aAAA,GAAAC,OAAA;AAOA,IAAAC,aAAA,GAAAC,uBAAA,CAAAF,OAAA;AAGA,IAAAG,WAAA,GAAAC,sBAAA,CAAAJ,OAAA;AAAuC,SAAAI,uBAAAC,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,SAAAP,wBAAAG,GAAA,EAAAI,WAAA,SAAAA,WAAA,IAAAJ,GAAA,IAAAA,GAAA,CAAAC,UAAA,WAAAD,GAAA,QAAAA,GAAA,oBAAAA,GAAA,wBAAAA,GAAA,4BAAAE,OAAA,EAAAF,GAAA,UAAAQ,KAAA,GAAAL,wBAAA,CAAAC,WAAA,OAAAI,KAAA,IAAAA,KAAA,CAAAC,GAAA,CAAAT,GAAA,YAAAQ,KAAA,CAAAE,GAAA,CAAAV,GAAA,SAAAW,MAAA,WAAAC,qBAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,GA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I,EAAE;EACR;AACF,CAAC,CAAC;AAAAmC,OAAA,CAAAxH,OAAA,GAAAyB,QAAA;AAAAgG,MAAA,CAAAD,OAAA,GAAAA,OAAA,CAAAxH,OAAA"}
1
+ {"version":3,"file":"noUndefinedTypes.js","names":["_iterateJsdoc","_interopRequireWildcard","require","_jsdoccomment","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","extraTypes","typescriptGlobals","stripPseudoTypes","str","replace","_default","iterateJsdoc","context","node","report","settings","sourceCode","utils","_globalScope$childSco","_globalScope$childSco2","scopeManager","globalScope","definedTypes","disableReporting","markVariablesAsUsed","options","definedPreferredTypes","preferredTypes","structuredTags","mode","keys","length","values","map","preferredType","undefined","reportSettings","replacement","filter","Boolean","typedefDeclarations","getAllComments","comment","test","value","commentNode","parseComment","flatMap","doc","tags","tag","isNamepathDefiningTag","name","ancestorNodes","currentNode","_currentNode","parent","push","getTemplateTags","ancestorNode","getJSDocComment","jsdoc","templateTags","getPresentTags","closureGenericTypes","parseClosureTemplateTag","cjsOrESMScope","childScopes","block","type","allDefinedTypes","Set","variables","concat","tagToParsedType","propertyName","potentialType","parsedType","tryParseType","parseType","typeTags","filterTags","tagMightHaveTypePosition","namepathReferencingTags","isNamepathReferencingTag","namepathOrUrlReferencingTags","filterAllTags","isNamepathOrUrlReferencingTag","tagsWithTypes","traverse","nde","_structuredTags$tag$t","structuredTypes","Array","isArray","includes","markVariableAsUsed","iterateAllJsdocs","meta","docs","description","url","schema","additionalProperties","properties","items","exports","module"],"sources":["../../src/rules/noUndefinedTypes.js"],"sourcesContent":["import iterateJsdoc, {\n parseComment,\n} from '../iterateJsdoc';\nimport {\n getJSDocComment,\n parse as parseType,\n traverse,\n tryParse as tryParseType,\n} from '@es-joy/jsdoccomment';\n\nconst extraTypes = [\n 'null', 'undefined', 'void', 'string', 'boolean', 'object',\n 'function', 'symbol',\n 'number', 'bigint', 'NaN', 'Infinity',\n 'any', '*', 'never', 'unknown', 'const',\n 'this', 'true', 'false',\n 'Array', 'Object', 'RegExp', 'Date', 'Function',\n];\n\nconst typescriptGlobals = [\n // https://www.typescriptlang.org/docs/handbook/utility-types.html\n 'Partial',\n 'Required',\n 'Readonly',\n 'Record',\n 'Pick',\n 'Omit',\n 'Exclude',\n 'Extract',\n 'NonNullable',\n 'Parameters',\n 'ConstructorParameters',\n 'ReturnType',\n 'InstanceType',\n 'ThisParameterType',\n 'OmitThisParameter',\n 'ThisType',\n 'Uppercase',\n 'Lowercase',\n 'Capitalize',\n 'Uncapitalize',\n];\n\n/**\n * @param {string|false|undefined} [str]\n * @returns {undefined|string|false}\n */\nconst stripPseudoTypes = (str) => {\n return str && str.replace(/(?:\\.|<>|\\.<>|\\[\\])$/u, '');\n};\n\nexport default iterateJsdoc(({\n context,\n node,\n report,\n settings,\n sourceCode,\n utils,\n}) => {\n const {\n scopeManager,\n } = sourceCode;\n\n // When is this ever `null`?\n const globalScope = /** @type {import('eslint').Scope.Scope} */ (\n scopeManager.globalScope\n );\n\n const\n /**\n * @type {{\n * definedTypes: string[],\n * disableReporting: boolean,\n * markVariablesAsUsed: boolean\n * }}\n */ {\n definedTypes = [],\n disableReporting = false,\n markVariablesAsUsed = true,\n } = context.options[0] || {};\n\n /** @type {(string|undefined)[]} */\n let definedPreferredTypes = [];\n const {\n preferredTypes,\n structuredTags,\n mode,\n } = settings;\n if (Object.keys(preferredTypes).length) {\n definedPreferredTypes = /** @type {string[]} */ (Object.values(preferredTypes).map((preferredType) => {\n if (typeof preferredType === 'string') {\n // May become an empty string but will be filtered out below\n return stripPseudoTypes(preferredType);\n }\n\n if (!preferredType) {\n return undefined;\n }\n\n if (typeof preferredType !== 'object') {\n utils.reportSettings(\n 'Invalid `settings.jsdoc.preferredTypes`. Values must be falsy, a string, or an object.',\n );\n }\n\n return stripPseudoTypes(preferredType.replacement);\n })\n .filter(Boolean));\n }\n\n const typedefDeclarations = sourceCode.getAllComments()\n .filter((comment) => {\n return (/^\\*\\s/u).test(comment.value);\n })\n .map((commentNode) => {\n return parseComment(commentNode, '');\n })\n .flatMap((doc) => {\n return doc.tags.filter(({\n tag,\n }) => {\n return utils.isNamepathDefiningTag(tag);\n });\n })\n .map((tag) => {\n return tag.name;\n });\n\n const ancestorNodes = [];\n\n let currentNode = node;\n // No need for Program node?\n while (currentNode?.parent) {\n ancestorNodes.push(currentNode);\n currentNode = currentNode.parent;\n }\n\n /**\n * @param {import('eslint').Rule.Node} ancestorNode\n * @returns {import('comment-parser').Spec[]}\n */\n const getTemplateTags = function (ancestorNode) {\n const commentNode = getJSDocComment(sourceCode, ancestorNode, settings);\n if (!commentNode) {\n return [];\n }\n\n const jsdoc = parseComment(commentNode, '');\n\n return jsdoc.tags.filter((tag) => {\n return tag.tag === 'template';\n });\n };\n\n // `currentScope` may be `null` or `Program`, so in such a case,\n // we look to present tags instead\n const templateTags = ancestorNodes.length ?\n ancestorNodes.flatMap((ancestorNode) => {\n return getTemplateTags(ancestorNode);\n }) :\n utils.getPresentTags([\n 'template',\n ]);\n\n const closureGenericTypes = templateTags.flatMap((tag) => {\n return utils.parseClosureTemplateTag(tag);\n });\n\n // In modules, including Node, there is a global scope at top with the\n // Program scope inside\n const cjsOrESMScope = globalScope.childScopes[0]?.block?.type === 'Program';\n\n const allDefinedTypes = new Set(globalScope.variables.map(({\n name,\n }) => {\n return name;\n })\n\n // If the file is a module, concat the variables from the module scope.\n .concat(\n cjsOrESMScope ?\n globalScope.childScopes.flatMap(({\n variables,\n }) => {\n return variables;\n }).map(({\n name,\n }) => {\n return name;\n }) : [],\n )\n .concat(extraTypes)\n .concat(typedefDeclarations)\n .concat(definedTypes)\n .concat(/** @type {string[]} */ (definedPreferredTypes))\n .concat(\n settings.mode === 'jsdoc' ?\n [] :\n [\n ...settings.mode === 'typescript' ? typescriptGlobals : [],\n ...closureGenericTypes,\n ],\n ));\n\n /**\n * @typedef {{\n * parsedType: import('jsdoc-type-pratt-parser').RootResult;\n * tag: import('comment-parser').Spec|import('@es-joy/jsdoccomment').JsdocInlineTagNoType & {\n * line?: import('../iterateJsdoc.js').Integer\n * }\n * }} TypeAndTagInfo\n */\n\n /**\n * @param {string} propertyName\n * @returns {(tag: (import('@es-joy/jsdoccomment').JsdocInlineTagNoType & {\n * name?: string,\n * type?: string,\n * line?: import('../iterateJsdoc.js').Integer\n * })|import('comment-parser').Spec & {\n * namepathOrURL?: string\n * }\n * ) => undefined|TypeAndTagInfo}\n */\n const tagToParsedType = (propertyName) => {\n return (tag) => {\n try {\n const potentialType = tag[\n /** @type {\"type\"|\"name\"|\"namepathOrURL\"} */ (propertyName)\n ];\n return {\n parsedType: mode === 'permissive' ?\n tryParseType(/** @type {string} */ (potentialType)) :\n parseType(/** @type {string} */ (potentialType), mode),\n tag,\n };\n } catch {\n return undefined;\n }\n };\n };\n\n const typeTags = utils.filterTags(({\n tag,\n }) => {\n return utils.tagMightHaveTypePosition(tag) && (tag !== 'suppress' || settings.mode !== 'closure');\n }).map(tagToParsedType('type'));\n\n const namepathReferencingTags = utils.filterTags(({\n tag,\n }) => {\n return utils.isNamepathReferencingTag(tag);\n }).map(tagToParsedType('name'));\n\n const namepathOrUrlReferencingTags = utils.filterAllTags(({\n tag,\n }) => {\n return utils.isNamepathOrUrlReferencingTag(tag);\n }).map(tagToParsedType('namepathOrURL'));\n\n const tagsWithTypes = /** @type {TypeAndTagInfo[]} */ ([\n ...typeTags,\n ...namepathReferencingTags,\n ...namepathOrUrlReferencingTags,\n // Remove types which failed to parse\n ].filter(Boolean));\n\n for (const {\n tag,\n parsedType,\n } of tagsWithTypes) {\n traverse(parsedType, (nde) => {\n const {\n type,\n value,\n } = /** @type {import('jsdoc-type-pratt-parser').NameResult} */ (nde);\n\n if (type === 'JsdocTypeName') {\n const structuredTypes = structuredTags[tag.tag]?.type;\n if (!allDefinedTypes.has(value) &&\n (!Array.isArray(structuredTypes) || !structuredTypes.includes(value))\n ) {\n if (!disableReporting) {\n report(`The type '${value}' is undefined.`, null, tag);\n }\n } else if (markVariablesAsUsed && !extraTypes.includes(value)) {\n context.markVariableAsUsed(value);\n }\n }\n });\n }\n}, {\n iterateAllJsdocs: true,\n meta: {\n docs: {\n description: 'Checks that types in jsdoc comments are defined.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-no-undefined-types',\n },\n schema: [\n {\n additionalProperties: false,\n properties: {\n definedTypes: {\n items: {\n type: 'string',\n },\n type: 'array',\n },\n disableReporting: {\n type: 'boolean',\n },\n markVariablesAsUsed: {\n type: 'boolean',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"mappings":";;;;;;AAAA,IAAAA,aAAA,GAAAC,uBAAA,CAAAC,OAAA;AAGA,IAAAC,aAAA,GAAAD,OAAA;AAK8B,SAAAE,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,SAAAJ,wBAAAQ,GAAA,EAAAJ,WAAA,SAAAA,WAAA,IAAAI,GAAA,IAAAA,GAAA,CAAAC,UAAA,WAAAD,GAAA,QAAAA,GAAA,oBAAAA,GAAA,wBAAAA,GAAA,4BAAAE,OAAA,EAAAF,GAAA,UAAAG,KAAA,GAAAR,wBAAA,CAAAC,WAAA,OAAAO,KAAA,IAAAA,KAAA,CAAAC,GAAA,CAAAJ,GAAA,YAAAG,KAAA,CAAAE,GAAA,CAAAL,GAAA,SAAAM,MAAA,WAAAC,qBAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,GAAA,IAAAX,GAAA,QAAAW,GAAA,kBAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,C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