eslint-plugin-jsdoc 37.2.6 → 37.2.7

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
@@ -8680,6 +8680,14 @@ function quux () {
8680
8680
 
8681
8681
  }
8682
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"}]}]
8683
8691
  ````
8684
8692
 
8685
8693
 
@@ -49,13 +49,7 @@ var _default = (0, _iterateJsdoc.default)(({
49
49
  } = context.options[0];
50
50
  const foundContext = contexts.find(cntxt => {
51
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
- }); // We are not on the *particular* matching context/comment, so don't assume
53
- // we need reporting
54
-
55
- if (!foundContext) {
56
- return;
57
- }
58
-
52
+ });
59
53
  const contextStr = typeof foundContext === 'object' ? (_foundContext$context = foundContext.context) !== null && _foundContext$context !== void 0 ? _foundContext$context : 'any' : foundContext;
60
54
  setDefaults(state);
61
55
  incrementSelector(state, contextStr, comment);
@@ -121,6 +115,7 @@ var _default = (0, _iterateJsdoc.default)(({
121
115
  });
122
116
  },
123
117
 
118
+ matchContext: true,
124
119
  meta: {
125
120
  docs: {
126
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","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","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,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,OAD2B;AAE3BC,EAAAA,IAF2B;AAG3BC,EAAAA,IAAI,EAAE;AAACH,IAAAA;AAAD,GAHqB;AAI3BJ,EAAAA;AAJ2B,CAAD,KAKtB;AAAA;;AACJ,MAAI,CAACK,OAAO,CAACG,OAAR,CAAgB,CAAhB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Content":["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 // 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\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 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,QAAlB,CAAL,EAAkC;AAChCH,IAAAA,KAAK,CAACC,WAAN,CAAkBE,QAAlB,IAA8B,EAA9B;AACD;;AAED,MAAI,CAACH,KAAK,CAACC,WAAN,CAAkBE,Q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O,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"}
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.6"
110
+ "version": "37.2.7"
111
111
  }