Skip to content
This repository was archived by the owner on Mar 7, 2025. It is now read-only.

Commit 9aba2e3

Browse files
committed
Add rule jsdoc/require-param-type
1 parent c4df6d2 commit 9aba2e3

File tree

3 files changed

+46
-2
lines changed

3 files changed

+46
-2
lines changed

src/rules/jsdoc/index.d.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import type { MatchDescriptionRule } from './match-description';
22
import type { NoTypesRule } from './no-types';
33
import type { RequireJsdocRule } from './require-jsdoc';
4+
import type { RequireParamTypeRule } from './require-param-type';
45

56
/**
67
* All jsdoc rules.
78
*/
8-
export type JSDocRules = MatchDescriptionRule & NoTypesRule & RequireJsdocRule;
9+
export type JSDocRules = MatchDescriptionRule & NoTypesRule & RequireJsdocRule & RequireParamTypeRule;

src/rules/jsdoc/match-description.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export type MatchDescriptionOption = {
1919
/**
2020
* Set this to an array of strings representing the AST context where you wish the rule to be applied (e.g., `ClassDeclaration` for ES6 classes).
2121
*
22-
* Overrides the default contexts (see below). Set to `"any"` if you want the rule to apply to any jsdoc block throughout your files.
22+
* Set to `"any"` if you want the rule to apply to any jsdoc block throughout your files.
2323
*
2424
* @see [contexts](https://github.com/gajus/eslint-plugin-jsdoc#contexts-1)
2525
*/
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
import type { RuleConfig } from '../rule-config';
2+
3+
/**
4+
* Option.
5+
*/
6+
export type RequireParamTypeOption = {
7+
/**
8+
* Set this to an array of strings representing the AST context where you wish the rule to be applied.
9+
*
10+
* Set to `"any"` if you want the rule to apply to any jsdoc block throughout your files (as is necessary for finding function blocks not attached to a function declaration or expression, i.e., `@callback` or `@function` (or its aliases `@func` or `@method`) (including those associated with an `@interface`).
11+
*
12+
* See the ["AST and Selectors"](https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-advanced-ast-and-selectors) section of our README for more on the expected format.
13+
*
14+
* @see [contexts](https://github.com/gajus/eslint-plugin-jsdoc#contexts-8)
15+
*/
16+
contexts?: string[];
17+
};
18+
19+
/**
20+
* Options.
21+
*/
22+
export type RequireParamTypeOptions = [RequireParamTypeOption?];
23+
24+
/**
25+
* Requires that each `@param` tag has a `type` value.
26+
*
27+
* @see [require-param-type](https://github.com/gajus/eslint-plugin-jsdoc#require-param-type)
28+
*/
29+
export type RequireParamTypeRuleConfig = RuleConfig<RequireParamTypeOptions>;
30+
31+
/**
32+
* Requires that each `@param` tag has a `type` value.
33+
*
34+
* @see [require-param-type](https://github.com/gajus/eslint-plugin-jsdoc#require-param-type)
35+
*/
36+
export interface RequireParamTypeRule {
37+
/**
38+
* Requires that each `@param` tag has a `type` value.
39+
*
40+
* @see [require-param-type](https://github.com/gajus/eslint-plugin-jsdoc#require-param-type)
41+
*/
42+
'jsdoc/require-param-type': RequireParamTypeRuleConfig;
43+
}

0 commit comments

Comments
 (0)