eslint-plugin-jsdoc 55.2.0 → 55.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,289 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _iterateJsdoc = _interopRequireDefault(require("../iterateJsdoc.cjs"));
8
+ var _jsdoccomment = require("@es-joy/jsdoccomment");
9
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
10
+ var _default = exports.default = (0, _iterateJsdoc.default)(({
11
+ context,
12
+ indent,
13
+ jsdoc,
14
+ settings,
15
+ utils
16
+ }) => {
17
+ const {
18
+ arrayBrackets = 'square',
19
+ enableFixer = true,
20
+ genericDot = false,
21
+ objectFieldIndent = '',
22
+ objectFieldQuote = null,
23
+ objectFieldSeparator = null,
24
+ propertyQuotes = null,
25
+ separatorForSingleObjectField = false,
26
+ stringQuotes = 'single'
27
+ } = context.options[0] || {};
28
+ const {
29
+ mode
30
+ } = settings;
31
+
32
+ /**
33
+ * @param {import('@es-joy/jsdoccomment').JsdocTagWithInline} tag
34
+ */
35
+ const checkTypeFormats = tag => {
36
+ const potentialType = tag.type;
37
+ let parsedType;
38
+ try {
39
+ parsedType = mode === 'permissive' ? (0, _jsdoccomment.tryParse)(/** @type {string} */potentialType) : (0, _jsdoccomment.parse)(/** @type {string} */potentialType, mode);
40
+ } catch {
41
+ return;
42
+ }
43
+ const fix = () => {
44
+ const typeLines = (0, _jsdoccomment.stringify)(parsedType).split('\n');
45
+ const firstTypeLine = typeLines.shift();
46
+ const lastTypeLine = typeLines.pop();
47
+ const beginNameOrDescIdx = tag.source.findIndex(({
48
+ tokens
49
+ }) => {
50
+ return tokens.name || tokens.description;
51
+ });
52
+ const nameAndDesc = tag.source.slice(beginNameOrDescIdx);
53
+ const initialNumber = tag.source[0].number;
54
+ const src = [
55
+ // Get inevitably present tag from first `tag.source`
56
+ {
57
+ number: initialNumber,
58
+ source: '',
59
+ tokens: {
60
+ ...tag.source[0].tokens,
61
+ ...(typeLines.length || lastTypeLine ? {
62
+ end: '',
63
+ name: '',
64
+ postName: '',
65
+ postType: ''
66
+ } : {}),
67
+ type: '{' + firstTypeLine + (!typeLines.length && lastTypeLine === undefined ? '}' : '')
68
+ }
69
+ },
70
+ // Get any intervening type lines
71
+ ...(typeLines.length ? typeLines.map((typeLine, idx) => {
72
+ return {
73
+ number: initialNumber + idx + 1,
74
+ source: '',
75
+ tokens: {
76
+ // Grab any delimiter info from first item
77
+ ...tag.source[0].tokens,
78
+ delimiter: tag.source[0].tokens.delimiter === '/**' ? '*' : tag.source[0].tokens.delimiter,
79
+ end: '',
80
+ name: '',
81
+ postName: '',
82
+ postTag: '',
83
+ postType: '',
84
+ start: indent + ' ',
85
+ tag: '',
86
+ type: typeLine
87
+ }
88
+ };
89
+ }) : [])];
90
+
91
+ // Merge any final type line and name and description
92
+ if (
93
+ // Name and description may be already included if present with the tag
94
+ beginNameOrDescIdx > 0) {
95
+ src.push({
96
+ number: src.length + 1,
97
+ source: '',
98
+ tokens: {
99
+ ...nameAndDesc[0].tokens,
100
+ type: lastTypeLine + '}'
101
+ }
102
+ });
103
+ if (
104
+ // Get any remaining description lines
105
+ nameAndDesc.length > 1) {
106
+ src.push(...nameAndDesc.slice(1).map(({
107
+ source,
108
+ tokens
109
+ }, idx) => {
110
+ return {
111
+ number: src.length + idx + 2,
112
+ source,
113
+ tokens
114
+ };
115
+ }));
116
+ }
117
+ } else {
118
+ if (lastTypeLine) {
119
+ src.push({
120
+ number: src.length + 1,
121
+ source: '',
122
+ tokens: {
123
+ ...nameAndDesc[0].tokens,
124
+ delimiter: nameAndDesc[0].tokens.delimiter === '/**' ? '*' : nameAndDesc[0].tokens.delimiter,
125
+ postTag: '',
126
+ start: indent + ' ',
127
+ tag: '',
128
+ type: lastTypeLine + '}'
129
+ }
130
+ });
131
+ }
132
+ if (
133
+ // Get any remaining description lines
134
+ nameAndDesc.length > 1) {
135
+ src.push(...nameAndDesc.slice(1).map(({
136
+ source,
137
+ tokens
138
+ }, idx) => {
139
+ return {
140
+ number: src.length + idx + 2,
141
+ source,
142
+ tokens
143
+ };
144
+ }));
145
+ }
146
+ }
147
+ tag.source = src;
148
+
149
+ // Properly rewire `jsdoc.source`
150
+ const firstTagIdx = jsdoc.source.findIndex(({
151
+ tokens: {
152
+ tag: tg
153
+ }
154
+ }) => {
155
+ return tg;
156
+ });
157
+ jsdoc.source = [...jsdoc.source.slice(0, firstTagIdx), ...jsdoc.tags.flatMap(({
158
+ source
159
+ }) => {
160
+ return source;
161
+ })];
162
+ };
163
+
164
+ /** @type {string[]} */
165
+ const errorMessages = [];
166
+ let needToReport = false;
167
+ (0, _jsdoccomment.traverse)(parsedType, nde => {
168
+ let typeFound = true;
169
+ let errorMessage = '';
170
+ const initialType = (0, _jsdoccomment.stringify)(/** @type {import('jsdoc-type-pratt-parser').RootResult} */nde);
171
+ switch (nde.type) {
172
+ case 'JsdocTypeGeneric':
173
+ {
174
+ const typeNode = /** @type {import('jsdoc-type-pratt-parser').GenericResult} */nde;
175
+ if ('value' in typeNode.left && typeNode.left.value === 'Array') {
176
+ typeNode.meta.brackets = arrayBrackets;
177
+ errorMessage = `Array bracket style should be ${arrayBrackets}`;
178
+ } else {
179
+ typeNode.meta.dot = genericDot;
180
+ errorMessage = `Dot usage should be ${genericDot}`;
181
+ }
182
+ break;
183
+ }
184
+ case 'JsdocTypeObject':
185
+ {
186
+ const typeNode = /** @type {import('jsdoc-type-pratt-parser').ObjectResult} */nde;
187
+ typeNode.meta.separator = objectFieldSeparator ?? undefined;
188
+ typeNode.meta.separatorForSingleObjectField = separatorForSingleObjectField;
189
+ typeNode.meta.propertyIndent = objectFieldIndent;
190
+ errorMessage = `Inconsistent ${objectFieldSeparator} usage`;
191
+ break;
192
+ }
193
+ case 'JsdocTypeObjectField':
194
+ {
195
+ const typeNode = /** @type {import('jsdoc-type-pratt-parser').ObjectFieldResult} */nde;
196
+ if (objectFieldQuote || typeof typeNode.key === 'string' && !/\s/v.test(typeNode.key)) {
197
+ typeNode.meta.quote = objectFieldQuote ?? undefined;
198
+ errorMessage = `Inconsistent object field quotes ${objectFieldQuote}`;
199
+ } else {
200
+ typeFound = false;
201
+ }
202
+ break;
203
+ }
204
+ case 'JsdocTypeProperty':
205
+ {
206
+ const typeNode = /** @type {import('jsdoc-type-pratt-parser').PropertyResult} */nde;
207
+ if (propertyQuotes || typeof typeNode.value === 'string' && !/\s/v.test(typeNode.value)) {
208
+ typeNode.meta.quote = propertyQuotes ?? undefined;
209
+ errorMessage = `Inconsistent ${propertyQuotes} property quotes usage`;
210
+ } else {
211
+ typeFound = false;
212
+ }
213
+ break;
214
+ }
215
+ case 'JsdocTypeStringValue':
216
+ {
217
+ const typeNode = /** @type {import('jsdoc-type-pratt-parser').StringValueResult} */nde;
218
+ typeNode.meta.quote = stringQuotes;
219
+ errorMessage = `Inconsistent ${stringQuotes} string quotes usage`;
220
+ break;
221
+ }
222
+ default:
223
+ typeFound = false;
224
+ break;
225
+ }
226
+ if (typeFound) {
227
+ const convertedType = (0, _jsdoccomment.stringify)(/** @type {import('jsdoc-type-pratt-parser').RootResult} */nde);
228
+ if (initialType !== convertedType) {
229
+ needToReport = true;
230
+ errorMessages.push(errorMessage);
231
+ }
232
+ }
233
+ });
234
+ if (needToReport) {
235
+ for (const errorMessage of errorMessages) {
236
+ utils.reportJSDoc(errorMessage, tag, enableFixer ? fix : null, true);
237
+ }
238
+ }
239
+ };
240
+ const tags = utils.getPresentTags(['param', 'returns']);
241
+ for (const tag of tags) {
242
+ checkTypeFormats(tag);
243
+ }
244
+ }, {
245
+ iterateAllJsdocs: true,
246
+ meta: {
247
+ docs: {
248
+ description: 'Formats JSDoc type values.',
249
+ url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/type-formatting.md#repos-sticky-header'
250
+ },
251
+ fixable: 'code',
252
+ schema: [{
253
+ additionalProperties: false,
254
+ properties: {
255
+ arrayBrackets: {
256
+ enum: ['angle', 'square']
257
+ },
258
+ enableFixer: {
259
+ type: 'boolean'
260
+ },
261
+ genericDot: {
262
+ type: 'boolean'
263
+ },
264
+ objectFieldIndent: {
265
+ type: 'string'
266
+ },
267
+ objectFieldQuote: {
268
+ enum: ['double', 'single', null]
269
+ },
270
+ objectFieldSeparator: {
271
+ enum: ['comma', 'comma-and-linebreak', 'linebreak', 'semicolon', 'semicolon-and-linebreak', null]
272
+ },
273
+ propertyQuotes: {
274
+ enum: ['double', 'single', null]
275
+ },
276
+ separatorForSingleObjectField: {
277
+ type: 'boolean'
278
+ },
279
+ stringQuotes: {
280
+ enum: ['double', 'single']
281
+ }
282
+ },
283
+ type: 'object'
284
+ }],
285
+ type: 'suggestion'
286
+ }
287
+ });
288
+ module.exports = exports.default;
289
+ //# sourceMappingURL=typeFormatting.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typeFormatting.cjs","names":["_iterateJsdoc","_interopRequireDefault","require","_jsdoccomment","e","__esModule","default","_default","exports","iterateJsdoc","context","indent","jsdoc","settings","utils","arrayBrackets","enableFixer","genericDot","objectFieldIndent","objectFieldQuote","objectFieldSeparator","propertyQuotes","separatorForSingleObjectField","stringQuotes","options","mode","checkTypeFormats","tag","potentialType","type","parsedType","tryParseType","parseType","fix","typeLines","stringify","split","firstTypeLine","shift","lastTypeLine","pop","beginNameOrDescIdx","source","findIndex","tokens","name","description","nameAndDesc","slice","initialNumber","number","src","length","end","postName","postType","undefined","map","typeLine","idx","delimiter","postTag","start","push","firstTagIdx","tg","tags","flatMap","errorMessages","needToReport","traverse","nde","typeFound","errorMessage","initialType","typeNode","left","value","meta","brackets","dot","separator","propertyIndent","key","test","quote","convertedType","reportJSDoc","getPresentTags","iterateAllJsdocs","docs","url","fixable","schema","additionalProperties","properties","enum","module"],"sources":["../../src/rules/typeFormatting.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\nimport {\n parse as parseType,\n stringify,\n traverse,\n tryParse as tryParseType,\n} from '@es-joy/jsdoccomment';\n\nexport default iterateJsdoc(({\n context,\n indent,\n jsdoc,\n settings,\n utils,\n}) => {\n const {\n arrayBrackets = 'square',\n enableFixer = true,\n genericDot = false,\n objectFieldIndent = '',\n objectFieldQuote = null,\n objectFieldSeparator = null,\n propertyQuotes = null,\n separatorForSingleObjectField = false,\n stringQuotes = 'single',\n } = context.options[0] || {};\n\n const {\n mode,\n } = settings;\n\n /**\n * @param {import('@es-joy/jsdoccomment').JsdocTagWithInline} tag\n */\n const checkTypeFormats = (tag) => {\n const potentialType = tag.type;\n let parsedType;\n try {\n parsedType = mode === 'permissive' ?\n tryParseType(/** @type {string} */ (potentialType)) :\n parseType(/** @type {string} */ (potentialType), mode);\n } catch {\n return;\n }\n\n const fix = () => {\n const typeLines = stringify(parsedType).split('\\n');\n const firstTypeLine = typeLines.shift();\n const lastTypeLine = typeLines.pop();\n\n const beginNameOrDescIdx = tag.source.findIndex(({\n tokens,\n }) => {\n return tokens.name || tokens.description;\n });\n\n const nameAndDesc = tag.source.slice(beginNameOrDescIdx);\n const initialNumber = tag.source[0].number;\n const src = [\n // Get inevitably present tag from first `tag.source`\n {\n number: initialNumber,\n source: '',\n tokens: {\n ...tag.source[0].tokens,\n ...(typeLines.length || lastTypeLine ? {\n end: '',\n name: '',\n postName: '',\n postType: '',\n } : {}),\n type: '{' + firstTypeLine + (!typeLines.length && lastTypeLine === undefined ? '}' : ''),\n },\n },\n // Get any intervening type lines\n ...(typeLines.length ? typeLines.map((typeLine, idx) => {\n return {\n number: initialNumber + idx + 1,\n source: '',\n tokens: {\n // Grab any delimiter info from first item\n ...tag.source[0].tokens,\n delimiter: tag.source[0].tokens.delimiter === '/**' ? '*' : tag.source[0].tokens.delimiter,\n end: '',\n name: '',\n postName: '',\n postTag: '',\n postType: '',\n start: indent + ' ',\n tag: '',\n type: typeLine,\n },\n };\n }) : []),\n ];\n\n // Merge any final type line and name and description\n if (\n // Name and description may be already included if present with the tag\n beginNameOrDescIdx > 0\n ) {\n src.push({\n number: src.length + 1,\n source: '',\n tokens: {\n ...nameAndDesc[0].tokens,\n type: lastTypeLine + '}',\n },\n });\n\n if (\n // Get any remaining description lines\n nameAndDesc.length > 1\n ) {\n src.push(\n ...nameAndDesc.slice(1).map(({\n source,\n tokens,\n }, idx) => {\n return {\n number: src.length + idx + 2,\n source,\n tokens,\n };\n }),\n );\n }\n } else {\n if (lastTypeLine) {\n src.push({\n number: src.length + 1,\n source: '',\n tokens: {\n ...nameAndDesc[0].tokens,\n delimiter: nameAndDesc[0].tokens.delimiter === '/**' ? '*' : nameAndDesc[0].tokens.delimiter,\n postTag: '',\n start: indent + ' ',\n tag: '',\n type: lastTypeLine + '}',\n },\n });\n }\n\n if (\n // Get any remaining description lines\n nameAndDesc.length > 1\n ) {\n src.push(\n ...nameAndDesc.slice(1).map(({\n source,\n tokens,\n }, idx) => {\n return {\n number: src.length + idx + 2,\n source,\n tokens,\n };\n }),\n );\n }\n }\n\n tag.source = src;\n\n // Properly rewire `jsdoc.source`\n const firstTagIdx = jsdoc.source.findIndex(({\n tokens: {\n tag: tg,\n },\n }) => {\n return tg;\n });\n\n jsdoc.source = [\n ...jsdoc.source.slice(0, firstTagIdx),\n ...jsdoc.tags.flatMap(({\n source,\n }) => {\n return source;\n }),\n ];\n };\n\n /** @type {string[]} */\n const errorMessages = [];\n let needToReport = false;\n traverse(parsedType, (nde) => {\n let typeFound = true;\n let errorMessage = '';\n const initialType = stringify(\n /** @type {import('jsdoc-type-pratt-parser').RootResult} */ (nde),\n );\n switch (nde.type) {\n case 'JsdocTypeGeneric': {\n const typeNode = /** @type {import('jsdoc-type-pratt-parser').GenericResult} */ (nde);\n if ('value' in typeNode.left && typeNode.left.value === 'Array') {\n typeNode.meta.brackets = arrayBrackets;\n errorMessage = `Array bracket style should be ${arrayBrackets}`;\n } else {\n typeNode.meta.dot = genericDot;\n errorMessage = `Dot usage should be ${genericDot}`;\n }\n\n break;\n }\n\n case 'JsdocTypeObject': {\n const typeNode = /** @type {import('jsdoc-type-pratt-parser').ObjectResult} */ (nde);\n typeNode.meta.separator = objectFieldSeparator ?? undefined;\n typeNode.meta.separatorForSingleObjectField = separatorForSingleObjectField;\n typeNode.meta.propertyIndent = objectFieldIndent;\n errorMessage = `Inconsistent ${objectFieldSeparator} usage`;\n break;\n }\n\n case 'JsdocTypeObjectField': {\n const typeNode = /** @type {import('jsdoc-type-pratt-parser').ObjectFieldResult} */ (nde);\n if (objectFieldQuote ||\n (typeof typeNode.key === 'string' && !(/\\s/v).test(typeNode.key))\n ) {\n typeNode.meta.quote = objectFieldQuote ?? undefined;\n errorMessage = `Inconsistent object field quotes ${objectFieldQuote}`;\n } else {\n typeFound = false;\n }\n\n break;\n }\n\n case 'JsdocTypeProperty': {\n const typeNode = /** @type {import('jsdoc-type-pratt-parser').PropertyResult} */ (nde);\n\n if (propertyQuotes ||\n (typeof typeNode.value === 'string' && !(/\\s/v).test(typeNode.value))\n ) {\n typeNode.meta.quote = propertyQuotes ?? undefined;\n errorMessage = `Inconsistent ${propertyQuotes} property quotes usage`;\n } else {\n typeFound = false;\n }\n\n break;\n }\n\n case 'JsdocTypeStringValue': {\n const typeNode = /** @type {import('jsdoc-type-pratt-parser').StringValueResult} */ (nde);\n typeNode.meta.quote = stringQuotes;\n errorMessage = `Inconsistent ${stringQuotes} string quotes usage`;\n break;\n }\n\n default:\n typeFound = false;\n break;\n }\n\n if (typeFound) {\n const convertedType = stringify(/** @type {import('jsdoc-type-pratt-parser').RootResult} */ (nde));\n if (initialType !== convertedType) {\n needToReport = true;\n errorMessages.push(errorMessage);\n }\n }\n });\n\n if (needToReport) {\n for (const errorMessage of errorMessages) {\n utils.reportJSDoc(\n errorMessage, tag, enableFixer ? fix : null, true,\n );\n }\n }\n };\n\n const tags = utils.getPresentTags([\n 'param',\n 'returns',\n ]);\n for (const tag of tags) {\n checkTypeFormats(tag);\n }\n}, {\n iterateAllJsdocs: true,\n meta: {\n docs: {\n description: 'Formats JSDoc type values.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/type-formatting.md#repos-sticky-header',\n },\n fixable: 'code',\n schema: [\n {\n additionalProperties: false,\n properties: {\n arrayBrackets: {\n enum: [\n 'angle',\n 'square',\n ],\n },\n enableFixer: {\n type: 'boolean',\n },\n genericDot: {\n type: 'boolean',\n },\n objectFieldIndent: {\n type: 'string',\n },\n objectFieldQuote: {\n enum: [\n 'double',\n 'single',\n null,\n ],\n },\n objectFieldSeparator: {\n enum: [\n 'comma',\n 'comma-and-linebreak',\n 'linebreak',\n 'semicolon',\n 'semicolon-and-linebreak',\n null,\n ],\n },\n propertyQuotes: {\n enum: [\n 'double',\n 'single',\n null,\n ],\n },\n separatorForSingleObjectField: {\n type: 'boolean',\n },\n stringQuotes: {\n enum: [\n 'double',\n 'single',\n ],\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"mappings":";;;;;;AAAA,IAAAA,aAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AAK8B,SAAAD,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,IAAAG,QAAA,GAAAC,OAAA,CAAAF,OAAA,GAEf,IAAAG,qBAAY,EAAC,CAAC;EAC3BC,OAAO;EACPC,MAAM;EACNC,KAAK;EACLC,QAAQ;EACRC;AACF,CAAC,KAAK;EACJ,MAAM;IACJC,aAAa,GAAG,QAAQ;IACxBC,WAAW,GAAG,IAAI;IAClBC,UAAU,GAAG,KAAK;IAClBC,iBAAiB,GAAG,EAAE;IACtBC,gBAAgB,GAAG,IAAI;IACvBC,oBAAoB,GAAG,IAAI;IAC3BC,cAAc,GAAG,IAAI;IACrBC,6BAA6B,GAAG,KAAK;IACrCC,YAAY,GAAG;EACjB,CAAC,GAAGb,OAAO,CAACc,OAAO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,cAAc,EAAE;UACd2E,IAAI,EAAE,CACJ,QAAQ,EACR,QAAQ,EACR,IAAI;QAER,CAAC;QACD1E,6BAA6B,EAAE;UAC7BO,IAAI,EAAE;QACR,CAAC;QACDN,YAAY,EAAE;UACZyE,IAAI,EAAE,CACJ,QAAQ,EACR,QAAQ;QAEZ;MACF,CAAC;MACDnE,IAAI,EAAE;IACR,CAAC,CACF;IACDA,IAAI,EAAE;EACR;AACF,CAAC,CAAC;AAAAoE,MAAA,CAAAzF,OAAA,GAAAA,OAAA,CAAAF,OAAA","ignoreList":[]}
@@ -0,0 +1,3 @@
1
+ declare const _default: import("eslint").Rule.RuleModule;
2
+ export default _default;
3
+ //# sourceMappingURL=typeFormatting.d.ts.map
package/dist/rules.d.ts CHANGED
@@ -756,6 +756,28 @@ export interface Rules {
756
756
  }
757
757
  ];
758
758
 
759
+ "jsdoc/type-formatting":
760
+ | []
761
+ | [
762
+ {
763
+ arrayBrackets?: "angle" | "square";
764
+ enableFixer?: boolean;
765
+ genericDot?: boolean;
766
+ objectFieldIndent?: string;
767
+ objectFieldQuote?: "double" | "single" | null;
768
+ objectFieldSeparator?:
769
+ | "comma"
770
+ | "comma-and-linebreak"
771
+ | "linebreak"
772
+ | "semicolon"
773
+ | "semicolon-and-linebreak"
774
+ | null;
775
+ propertyQuotes?: "double" | "single" | null;
776
+ separatorForSingleObjectField?: boolean;
777
+ stringQuotes?: "double" | "single";
778
+ }
779
+ ];
780
+
759
781
  "jsdoc/valid-types":
760
782
  | []
761
783
  | [
package/package.json CHANGED
@@ -160,5 +160,5 @@
160
160
  "test-cov": "TIMING=1 c8 --reporter text pnpm run test-no-cov",
161
161
  "test-index": "pnpm run test-no-cov test/rules/index.js"
162
162
  },
163
- "version": "55.2.0"
163
+ "version": "55.3.0"
164
164
  }
package/src/index-cjs.js CHANGED
@@ -57,6 +57,7 @@ import requireYieldsCheck from './rules/requireYieldsCheck.js';
57
57
  import sortTags from './rules/sortTags.js';
58
58
  import tagLines from './rules/tagLines.js';
59
59
  import textEscaping from './rules/textEscaping.js';
60
+ import typeFormatting from './rules/typeFormatting.js';
60
61
  import validTypes from './rules/validTypes.js';
61
62
 
62
63
  /* eslint-disable jsdoc/valid-types -- Bug */
@@ -129,6 +130,7 @@ index.rules = {
129
130
  'sort-tags': sortTags,
130
131
  'tag-lines': tagLines,
131
132
  'text-escaping': textEscaping,
133
+ 'type-formatting': typeFormatting,
132
134
  'valid-types': validTypes,
133
135
  };
134
136
 
@@ -206,6 +208,7 @@ const createRecommendedRuleset = (warnOrError, flatName) => {
206
208
  'jsdoc/sort-tags': 'off',
207
209
  'jsdoc/tag-lines': warnOrError,
208
210
  'jsdoc/text-escaping': 'off',
211
+ 'jsdoc/type-formatting': 'off',
209
212
  'jsdoc/valid-types': warnOrError,
210
213
  },
211
214
  };
package/src/index.js CHANGED
@@ -63,6 +63,7 @@ import requireYieldsCheck from './rules/requireYieldsCheck.js';
63
63
  import sortTags from './rules/sortTags.js';
64
64
  import tagLines from './rules/tagLines.js';
65
65
  import textEscaping from './rules/textEscaping.js';
66
+ import typeFormatting from './rules/typeFormatting.js';
66
67
  import validTypes from './rules/validTypes.js';
67
68
 
68
69
  /* eslint-disable jsdoc/valid-types -- Bug */
@@ -135,6 +136,7 @@ index.rules = {
135
136
  'sort-tags': sortTags,
136
137
  'tag-lines': tagLines,
137
138
  'text-escaping': textEscaping,
139
+ 'type-formatting': typeFormatting,
138
140
  'valid-types': validTypes,
139
141
  };
140
142
 
@@ -212,6 +214,7 @@ const createRecommendedRuleset = (warnOrError, flatName) => {
212
214
  'jsdoc/sort-tags': 'off',
213
215
  'jsdoc/tag-lines': warnOrError,
214
216
  'jsdoc/text-escaping': 'off',
217
+ 'jsdoc/type-formatting': 'off',
215
218
  'jsdoc/valid-types': warnOrError,
216
219
  },
217
220
  };