Skip to content

Commit 1ee3087

Browse files
chore: enable eslint-plugin-jsdoc internally (#8145)
* chore: enable eslint-plugin-jsdoc internally * Disable jsdoc/check-param-names, with link to issue * Sort jsdoc rule disables and add links to issues * Switch typescript-estree-import.ts to line comments
1 parent 958feca commit 1ee3087

34 files changed

+135
-75
lines changed

.eslintrc.js

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ module.exports = {
1010
'eslint-plugin',
1111
'import',
1212
'jest',
13+
'jsdoc',
1314
'simple-import-sort',
1415
'unicorn',
1516
],
@@ -20,6 +21,7 @@ module.exports = {
2021
extends: [
2122
'eslint:recommended',
2223
'plugin:eslint-plugin/recommended',
24+
'plugin:jsdoc/recommended-typescript-error',
2325
'plugin:@typescript-eslint/strict-type-checked',
2426
'plugin:@typescript-eslint/stylistic-type-checked',
2527
],
@@ -140,6 +142,7 @@ module.exports = {
140142
'error',
141143
{ commentPattern: '.*intentional fallthrough.*' },
142144
],
145+
'one-var': ['error', 'never'],
143146

144147
//
145148
// eslint-plugin-eslint-comment
@@ -215,7 +218,24 @@ module.exports = {
215218
// enforce a sort order across the codebase
216219
'simple-import-sort/imports': 'error',
217220

218-
'one-var': ['error', 'never'],
221+
//
222+
// eslint-plugin-jsdoc
223+
//
224+
225+
// We often use @remarks or other ad-hoc tag names
226+
'jsdoc/check-tag-names': 'off',
227+
// https://github.com/gajus/eslint-plugin-jsdoc/issues/1169
228+
'jsdoc/check-param-names': 'off',
229+
// https://github.com/gajus/eslint-plugin-jsdoc/issues/1175
230+
'jsdoc/require-jsdoc': 'off',
231+
'jsdoc/require-param': 'off',
232+
'jsdoc/require-returns': 'off',
233+
'jsdoc/require-yields': 'off',
234+
'jsdoc/tag-lines': 'off',
235+
236+
//
237+
// eslint-plugin-unicorn
238+
//
219239

220240
'unicorn/no-typeof-undefined': 'error',
221241
},

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@
8888
"eslint-plugin-eslint-plugin": "^5.1.0",
8989
"eslint-plugin-import": "^2.27.5",
9090
"eslint-plugin-jest": "^27.2.2",
91+
"eslint-plugin-jsdoc": "^46.9.1",
9192
"eslint-plugin-jsx-a11y": "^6.7.1",
9293
"eslint-plugin-react": "^7.32.2",
9394
"eslint-plugin-react-hooks": "^4.6.0",
Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
1-
/**
2-
* Nx is picking up on the fact that we technically have a circular dependency between ast-spec
3-
* and typescript-estree.
4-
*
5-
* This circular dependency only occurs in the tests/ for ast-spec and not in the main package source.
6-
*
7-
* We could therefore solve this by separating the ast-spec tests out into their own package, but the
8-
* other option is to get Nx to turn a blind eye to the circular dependency by removing
9-
* @typescript-eslint/typescript-estree as an explicit devDependency in the package.json and just doing an import here.
10-
*
11-
* This file is ignored via a root `.nxignore`
12-
*
13-
* This should be the only place in the package that we import from typescript-estree.
14-
*/
1+
// Nx is picking up on the fact that we technically have a circular dependency between ast-spec
2+
// and typescript-estree.
3+
//
4+
// This circular dependency only occurs in the tests/ for ast-spec and not in the main package source.
5+
//
6+
// We could therefore solve this by separating the ast-spec tests out into their own package, but the
7+
// other option is to get Nx to turn a blind eye to the circular dependency by removing
8+
// @typescript-eslint/typescript-estree as an explicit devDependency in the package.json and just doing an import here.
9+
//
10+
// This file is ignored via a root `.nxignore`
11+
//
12+
// This should be the only place in the package that we import from typescript-estree.
1513

1614
// eslint-disable-next-line no-restricted-imports -- the only safe and valid import from typescript-estree in this package
1715
export { parse, TSError } from '@typescript-eslint/typescript-estree';

packages/eslint-plugin/src/rules/adjacent-overload-signatures.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ export default createRule({
129129

130130
/**
131131
* Check the body for overload methods.
132-
* @param {ASTNode} node the body to be inspected.
132+
* @param node the body to be inspected.
133133
*/
134134
function checkBodyForOverloadMethods(node: RuleNode): void {
135135
const members = getMembers(node);

packages/eslint-plugin/src/rules/consistent-type-imports.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,8 @@ export default createRule<Options, MessageIds>({
277277
report.unusedSpecifiers.length === 0 &&
278278
report.node.importKind !== 'type'
279279
) {
280-
/** checks if import has type assertions
280+
/**
281+
* checks if import has type assertions
281282
* ```
282283
* import * as type from 'mod' assert { type: 'json' };
283284
* ```

packages/eslint-plugin/src/rules/func-call-spacing.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,7 @@ export default createRule<Options, MessageIds>({
8282

8383
/**
8484
* Check if open space is present in a function name
85-
* @param {ASTNode} node node to evaluate
86-
* @returns {void}
85+
* @param node node to evaluate
8786
* @private
8887
*/
8988
function checkSpacing(

packages/eslint-plugin/src/rules/member-delimiter-style.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ export default createRule<Options, MessageIds>({
314314

315315
/**
316316
* Check the member separator being used matches the delimiter.
317-
* @param {ASTNode} node the node to be evaluated.
317+
* @param node the node to be evaluated.
318318
*/
319319
function checkMemberSeparatorStyle(
320320
node: TSESTree.TSInterfaceBody | TSESTree.TSTypeLiteral,

packages/eslint-plugin/src/rules/member-ordering.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,6 @@ function getMemberRawName(
438438
* Gets the member name based on the member type.
439439
*
440440
* @param node the node to be evaluated.
441-
* @param sourceCode
442441
*/
443442
function getMemberName(
444443
node: Member,
@@ -801,7 +800,7 @@ export default createRule<Options, MessageIds>({
801800
* Checks if the members are alphabetically sorted.
802801
*
803802
* @param members Members to be validated.
804-
* @param caseSensitive indicates if the alpha ordering is case sensitive or not.
803+
* @param order What order the members should be sorted in.
805804
*
806805
* @return True if all members are correctly sorted.
807806
*/

packages/eslint-plugin/src/rules/no-loop-func.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ export default createRule<Options, MessageIds>({
3535
* - has any references which refers to an unsafe variable.
3636
*
3737
* @param node The AST node to check.
38-
* @returns Whether or not the node is within a loop.
3938
*/
4039
function checkForLoops(
4140
node:

packages/eslint-plugin/src/rules/no-shadow.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -545,7 +545,7 @@ export default createRule<Options, MessageIds>({
545545

546546
/**
547547
* Checks the current context for shadowed variables.
548-
* @param {Scope} scope Fixme
548+
* @param scope Fixme
549549
*/
550550
function checkForShadows(scope: TSESLint.Scope.Scope): void {
551551
// ignore global augmentation

0 commit comments

Comments
 (0)