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

Commit 120862f

Browse files
author
Christopher Quadflieg
committed
chore: add jsdoc/match-description rule
1 parent 079793e commit 120862f

File tree

3 files changed

+67
-1
lines changed

3 files changed

+67
-1
lines changed

src/rules/index.d.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import type { EslintRules } from './eslint';
2+
import type { JSDocRules } from './jsdoc';
23
import type { RuleConfig } from './rule-config';
34
import type { TypeScriptEslintRules } from './typescript-eslint';
45

@@ -7,4 +8,4 @@ import type { TypeScriptEslintRules } from './typescript-eslint';
78
*
89
* @see [Rules](https://eslint.org/docs/user-guide/configuring/rules)
910
*/
10-
export type Rules = Partial<EslintRules & TypeScriptEslintRules & Record<string, RuleConfig>>;
11+
export type Rules = Partial<EslintRules & TypeScriptEslintRules & JSDocRules & Record<string, RuleConfig>>;

src/rules/jsdoc/index.d.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import type { MatchDescriptionRule } from './match-description';
2+
3+
/**
4+
* All jsdoc rules.
5+
*/
6+
export type JSDocRules = MatchDescriptionRule;
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
import type { RuleConfig } from '../rule-config';
2+
3+
/**
4+
* Option.
5+
*/
6+
export type MatchDescriptionOption = {
7+
/**
8+
* If you wish to override the main function description without changing the default `match-description`, you may use `mainDescription`.
9+
*
10+
* @see [mainDescription](https://github.com/gajus/eslint-plugin-jsdoc#maindescription)
11+
*/
12+
mainDescription?: string;
13+
/**
14+
* You can supply your own expression to override the default, passing a `matchDescription` string on the options object.
15+
*
16+
* @see [matchDescription](https://github.com/gajus/eslint-plugin-jsdoc#matchdescription)
17+
*/
18+
matchDescription?: string;
19+
/**
20+
* 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).
21+
*
22+
* Overrides the default contexts (see below). Set to `"any"` if you want the rule to apply to any jsdoc block throughout your files.
23+
*
24+
* @see [contexts](https://github.com/gajus/eslint-plugin-jsdoc#contexts-1)
25+
*/
26+
contexts?: string[];
27+
/**
28+
* If you want different regular expressions to apply to tags, you may use the `tags` option object.
29+
*
30+
* @see [tags](https://github.com/gajus/eslint-plugin-jsdoc#tags-2)
31+
*/
32+
tags?: Record<string, boolean>;
33+
};
34+
35+
/**
36+
* Options.
37+
*/
38+
export type MatchDescriptionOptions = [MatchDescriptionOption?];
39+
40+
/**
41+
* Enforces a regular expression pattern on descriptions.
42+
*
43+
* @see [match-description](https://github.com/gajus/eslint-plugin-jsdoc#match-description)
44+
*/
45+
export type MatchDescriptionRuleConfig = RuleConfig<MatchDescriptionOptions>;
46+
47+
/**
48+
* Enforces a regular expression pattern on descriptions.
49+
*
50+
* @see [match-description](https://github.com/gajus/eslint-plugin-jsdoc#match-description)
51+
*/
52+
export interface MatchDescriptionRule {
53+
/**
54+
* Enforces a regular expression pattern on descriptions.
55+
*
56+
* @see [match-description](https://github.com/gajus/eslint-plugin-jsdoc#match-description)
57+
*/
58+
'jsdoc/match-description': MatchDescriptionRuleConfig;
59+
}

0 commit comments

Comments
 (0)