eslint-plugin-jsdoc 62.7.0 → 62.7.1

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.
@@ -7,6 +7,7 @@ exports.default = void 0;
7
7
  var _iterateJsdoc = _interopRequireDefault(require("../iterateJsdoc.cjs"));
8
8
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
9
9
  var _default = exports.default = (0, _iterateJsdoc.default)(({
10
+ context,
10
11
  utils
11
12
  }) => {
12
13
  const propertyAssociatedTags = utils.filterTags(({
@@ -20,6 +21,22 @@ var _default = exports.default = (0, _iterateJsdoc.default)(({
20
21
  const targetTagName = /** @type {string} */utils.getPreferredTagName({
21
22
  tagName: 'property'
22
23
  });
24
+ if (!targetTagName) {
25
+ context.report({
26
+ loc: {
27
+ end: {
28
+ column: 1,
29
+ line: 1
30
+ },
31
+ start: {
32
+ column: 1,
33
+ line: 1
34
+ }
35
+ },
36
+ message: 'Cannot prohibit `@property` in the `tagNamePreference` setting while using the `require-property` rule.'
37
+ });
38
+ return;
39
+ }
23
40
  if (utils.hasATag([targetTagName])) {
24
41
  return;
25
42
  }
@@ -1 +1 @@
1
- {"version":3,"file":"requireProperty.cjs","names":["_iterateJsdoc","_interopRequireDefault","require","e","__esModule","default","_default","exports","iterateJsdoc","utils","propertyAssociatedTags","filterTags","tag","includes","length","targetTagName","getPreferredTagName","tagName","hasATag","propertyAssociatedTag","type","reportJSDoc","addTag","iterateAllJsdocs","meta","docs","description","url","fixable","module"],"sources":["../../src/rules/requireProperty.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\n\nexport default iterateJsdoc(({\n utils,\n}) => {\n const propertyAssociatedTags = utils.filterTags(({\n tag,\n }) => {\n return [\n 'namespace', 'typedef',\n ].includes(tag);\n });\n if (!propertyAssociatedTags.length) {\n return;\n }\n\n const targetTagName = /** @type {string} */ (utils.getPreferredTagName({\n tagName: 'property',\n }));\n\n if (utils.hasATag([\n targetTagName,\n ])) {\n return;\n }\n\n for (const propertyAssociatedTag of propertyAssociatedTags) {\n if (![\n 'object', 'Object', 'PlainObject',\n ].includes(propertyAssociatedTag.type)) {\n continue;\n }\n\n utils.reportJSDoc(`Missing JSDoc @${targetTagName}.`, null, () => {\n utils.addTag(targetTagName);\n });\n }\n}, {\n iterateAllJsdocs: true,\n meta: {\n docs: {\n description: 'Requires that all `@typedef` and `@namespace` tags have `@property` when their type is a plain `object`, `Object`, or `PlainObject`.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-property.md#repos-sticky-header',\n },\n fixable: 'code',\n type: 'suggestion',\n },\n});\n"],"mappings":";;;;;;AAAA,IAAAA,aAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA8C,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,IAAAG,QAAA,GAAAC,OAAA,CAAAF,OAAA,GAE/B,IAAAG,qBAAY,EAAC,CAAC;EAC3BC;AACF,CAAC,KAAK;EACJ,MAAMC,sBAAsB,GAAGD,KAAK,CAACE,UAAU,CAAC,CAAC;IAC/CC;EACF,CAAC,KAAK;IACJ,OAAO,CACL,WAAW,EAAE,SAAS,CACvB,CAACC,QAAQ,CAACD,GAAG,CAAC;EACjB,CAAC,CAAC;EACF,IAAI,CAACF,sBAAsB,CAACI,MAAM,EAAE;IAClC;EACF;EAEA,MAAMC,aAAa,GAAG,qBAAuBN,KAAK,CAACO,mBAAmB,CAAC;IACrEC,OAAO,EAAE;EACX,CAAC,CAAE;EAEH,IAAIR,KAAK,CAACS,OAAO,CAAC,CAChBH,aAAa,CACd,CAAC,EAAE;IACF;EACF;EAEA,KAAK,MAAMI,qBAAqB,IAAIT,sBAAsB,EAAE;IAC1D,IAAI,CAAC,CACH,QAAQ,EAAE,QAAQ,EAAE,aAAa,CAClC,CAACG,QAAQ,CAACM,qBAAqB,CAACC,IAAI,CAAC,EAAE;MACtC;IACF;IAEAX,KAAK,CAACY,WAAW,CAAC,kBAAkBN,aAAa,GAAG,EAAE,IAAI,EAAE,MAAM;MAChEN,KAAK,CAACa,MAAM,CAACP,aAAa,CAAC;IAC7B,CAAC,CAAC;EACJ;AACF,CAAC,EAAE;EACDQ,gBAAgB,EAAE,IAAI;EACtBC,IAAI,EAAE;IACJC,IAAI,EAAE;MACJC,WAAW,EAAE,sIAAsI;MACnJC,GAAG,EAAE;IACP,CAAC;IACDC,OAAO,EAAE,MAAM;IACfR,IAAI,EAAE;EACR;AACF,CAAC,CAAC;AAAAS,MAAA,CAAAtB,OAAA,GAAAA,OAAA,CAAAF,OAAA","ignoreList":[]}
1
+ {"version":3,"file":"requireProperty.cjs","names":["_iterateJsdoc","_interopRequireDefault","require","e","__esModule","default","_default","exports","iterateJsdoc","context","utils","propertyAssociatedTags","filterTags","tag","includes","length","targetTagName","getPreferredTagName","tagName","report","loc","end","column","line","start","message","hasATag","propertyAssociatedTag","type","reportJSDoc","addTag","iterateAllJsdocs","meta","docs","description","url","fixable","module"],"sources":["../../src/rules/requireProperty.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\n\nexport default iterateJsdoc(({\n context,\n utils,\n}) => {\n const propertyAssociatedTags = utils.filterTags(({\n tag,\n }) => {\n return [\n 'namespace', 'typedef',\n ].includes(tag);\n });\n if (!propertyAssociatedTags.length) {\n return;\n }\n\n const targetTagName = /** @type {string} */ (utils.getPreferredTagName({\n tagName: 'property',\n }));\n\n if (!targetTagName) {\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: 'Cannot prohibit `@property` in the `tagNamePreference` setting while using the `require-property` rule.',\n });\n return;\n }\n\n if (utils.hasATag([\n targetTagName,\n ])) {\n return;\n }\n\n for (const propertyAssociatedTag of propertyAssociatedTags) {\n if (![\n 'object', 'Object', 'PlainObject',\n ].includes(propertyAssociatedTag.type)) {\n continue;\n }\n\n utils.reportJSDoc(`Missing JSDoc @${targetTagName}.`, null, () => {\n utils.addTag(targetTagName);\n });\n }\n}, {\n iterateAllJsdocs: true,\n meta: {\n docs: {\n description: 'Requires that all `@typedef` and `@namespace` tags have `@property` when their type is a plain `object`, `Object`, or `PlainObject`.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-property.md#repos-sticky-header',\n },\n fixable: 'code',\n type: 'suggestion',\n },\n});\n"],"mappings":";;;;;;AAAA,IAAAA,aAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA8C,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,IAAAG,QAAA,GAAAC,OAAA,CAAAF,OAAA,GAE/B,IAAAG,qBAAY,EAAC,CAAC;EAC3BC,OAAO;EACPC;AACF,CAAC,KAAK;EACJ,MAAMC,sBAAsB,GAAGD,KAAK,CAACE,UAAU,CAAC,CAAC;IAC/CC;EACF,CAAC,KAAK;IACJ,OAAO,CACL,WAAW,EAAE,SAAS,CACvB,CAACC,QAAQ,CAACD,GAAG,CAAC;EACjB,CAAC,CAAC;EACF,IAAI,CAACF,sBAAsB,CAACI,MAAM,EAAE;IAClC;EACF;EAEA,MAAMC,aAAa,GAAG,qBAAuBN,KAAK,CAACO,mBAAmB,CAAC;IACrEC,OAAO,EAAE;EACX,CAAC,CAAE;EAEH,IAAI,CAACF,aAAa,EAAE;IAClBP,OAAO,CAACU,MAAM,CAAC;MACbC,GAAG,EAAE;QACHC,GAAG,EAAE;UACHC,MAAM,EAAE,CAAC;UACTC,IAAI,EAAE;QACR,CAAC;QACDC,KAAK,EAAE;UACLF,MAAM,EAAE,CAAC;UACTC,IAAI,EAAE;QACR;MACF,CAAC;MACDE,OAAO,EAAE;IACX,CAAC,CAAC;IACF;EACF;EAEA,IAAIf,KAAK,CAACgB,OAAO,CAAC,CAChBV,aAAa,CACd,CAAC,EAAE;IACF;EACF;EAEA,KAAK,MAAMW,qBAAqB,IAAIhB,sBAAsB,EAAE;IAC1D,IAAI,CAAC,CACH,QAAQ,EAAE,QAAQ,EAAE,aAAa,CAClC,CAACG,QAAQ,CAACa,qBAAqB,CAACC,IAAI,CAAC,EAAE;MACtC;IACF;IAEAlB,KAAK,CAACmB,WAAW,CAAC,kBAAkBb,aAAa,GAAG,EAAE,IAAI,EAAE,MAAM;MAChEN,KAAK,CAACoB,MAAM,CAACd,aAAa,CAAC;IAC7B,CAAC,CAAC;EACJ;AACF,CAAC,EAAE;EACDe,gBAAgB,EAAE,IAAI;EACtBC,IAAI,EAAE;IACJC,IAAI,EAAE;MACJC,WAAW,EAAE,sIAAsI;MACnJC,GAAG,EAAE;IACP,CAAC;IACDC,OAAO,EAAE,MAAM;IACfR,IAAI,EAAE;EACR;AACF,CAAC,CAAC;AAAAS,MAAA,CAAA9B,OAAA,GAAAA,OAAA,CAAAF,OAAA","ignoreList":[]}
package/package.json CHANGED
@@ -192,5 +192,5 @@
192
192
  "test-cov": "TIMING=1 c8 --reporter text pnpm run test-no-cov",
193
193
  "test-index": "pnpm run test-no-cov test/rules/index.js"
194
194
  },
195
- "version": "62.7.0"
195
+ "version": "62.7.1"
196
196
  }
@@ -1,6 +1,7 @@
1
1
  import iterateJsdoc from '../iterateJsdoc.js';
2
2
 
3
3
  export default iterateJsdoc(({
4
+ context,
4
5
  utils,
5
6
  }) => {
6
7
  const propertyAssociatedTags = utils.filterTags(({
@@ -18,6 +19,23 @@ export default iterateJsdoc(({
18
19
  tagName: 'property',
19
20
  }));
20
21
 
22
+ if (!targetTagName) {
23
+ context.report({
24
+ loc: {
25
+ end: {
26
+ column: 1,
27
+ line: 1,
28
+ },
29
+ start: {
30
+ column: 1,
31
+ line: 1,
32
+ },
33
+ },
34
+ message: 'Cannot prohibit `@property` in the `tagNamePreference` setting while using the `require-property` rule.',
35
+ });
36
+ return;
37
+ }
38
+
21
39
  if (utils.hasATag([
22
40
  targetTagName,
23
41
  ])) {