Skip to content

Commit 91f1c30

Browse files
authored
fix(extraRuleDefinitions.forbid jsdoc function option): point default link to advanced page (#1502)
Also: - docs: document `url` and fix `description` property
1 parent 33a4529 commit 91f1c30

File tree

4 files changed

+14
-10
lines changed

4 files changed

+14
-10
lines changed

.README/advanced.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,10 @@ then be selectively enabled and optionally disabled on a case-by-case basis.
101101

102102
For each `forbid` key, add the name of the context (this will be appended to
103103
`forbid-` to decide the name of the rule, so with "Any" as the key, the rule
104-
created will be `forbid-Any`). Then provide an optional `description` key
105-
(which will be used for the created rule's `meta.docs.description`) and the
106-
`contexts` array. See the `jsdoc/restricted-syntax` rule for more details.
104+
created will be `forbid-Any`). Then provide an optional `description` and
105+
`url` keys (which will be used for the created rule's `meta.docs`
106+
`description` and `url` properties) and the `contexts` array.
107+
See the `jsdoc/restricted-syntax` rule for more details.
107108

108109
```js
109110
import {jsdoc} from 'eslint-plugin-jsdoc';
@@ -121,7 +122,8 @@ export default [
121122
message: '`any` is not allowed; use a more specific type',
122123
},
123124
],
124-
descriptions: 'Testing here',
125+
description: 'Forbids `any` usage',
126+
url: 'https://example.com/docs-for-my-any-rule/'
125127
},
126128
Function: {
127129
contexts: [

docs/advanced.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,10 @@ then be selectively enabled and optionally disabled on a case-by-case basis.
121121

122122
For each `forbid` key, add the name of the context (this will be appended to
123123
`forbid-` to decide the name of the rule, so with "Any" as the key, the rule
124-
created will be `forbid-Any`). Then provide an optional `description` key
125-
(which will be used for the created rule's `meta.docs.description`) and the
126-
`contexts` array. See the `jsdoc/restricted-syntax` rule for more details.
124+
created will be `forbid-Any`). Then provide an optional `description` and
125+
`url` keys (which will be used for the created rule's `meta.docs`
126+
`description` and `url` properties) and the `contexts` array.
127+
See the `jsdoc/restricted-syntax` rule for more details.
127128

128129
```js
129130
import {jsdoc} from 'eslint-plugin-jsdoc';
@@ -141,7 +142,8 @@ export default [
141142
message: '`any` is not allowed; use a more specific type',
142143
},
143144
],
144-
descriptions: 'Testing here',
145+
description: 'Forbids `any` usage',
146+
url: 'https://example.com/docs-for-my-any-rule/'
145147
},
146148
Function: {
147149
contexts: [

src/index-cjs.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ export const buildForbidRuleDefinition = ({
118118
meta: {
119119
docs: {
120120
description: description ?? contextName ?? 'Reports when certain comment structures are present.',
121-
url: url ?? 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/no-restricted-syntax.md#repos-sticky-header',
121+
url: url ?? 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/advanced.md#user-content-advanced-creating-your-own-rules',
122122
},
123123
fixable: 'code',
124124
schema: [],

src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ export const buildForbidRuleDefinition = ({
124124
meta: {
125125
docs: {
126126
description: description ?? contextName ?? 'Reports when certain comment structures are present.',
127-
url: url ?? 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/no-restricted-syntax.md#repos-sticky-header',
127+
url: url ?? 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/advanced.md#user-content-advanced-creating-your-own-rules',
128128
},
129129
fixable: 'code',
130130
schema: [],

0 commit comments

Comments
 (0)