Skip to content

Commit 78265e0

Browse files
Trottdanielleadams
authored andcommitted
tools: use jsdoc recommended rules
Enable all recommended JSDoc linting rules and disable the ones we don't (yet?) meet. They can be enabled one by one by removing the lines that turn them off. This requires adding --max-warnings to the ESLint invocations in Makefile and vcbuild.bat because the preset enables the recommended rules as warnings and not errors. PR-URL: #41057 Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
1 parent 94d0911 commit 78265e0

File tree

3 files changed

+20
-4
lines changed

3 files changed

+20
-4
lines changed

.eslintrc.js

+17-1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ Module._findPath = (request, paths, isMain) => {
3535

3636
module.exports = {
3737
root: true,
38+
extends: ['plugin:jsdoc/recommended'],
3839
plugins: ['jsdoc', 'markdown', 'node-core'],
3940
parser: '@babel/eslint-parser',
4041
parserOptions: {
@@ -338,7 +339,22 @@ module.exports = {
338339
'valid-typeof': ['error', { requireStringLiterals: true }],
339340

340341
// JSDoc rules
341-
'jsdoc/check-types': 'error',
342+
'jsdoc/require-jsdoc': 'off',
343+
'jsdoc/require-param-description': 'off',
344+
'jsdoc/newline-after-description': 'off',
345+
'jsdoc/require-returns-description': 'off',
346+
'jsdoc/valid-types': 'off',
347+
'jsdoc/no-undefined-types': 'off',
348+
'jsdoc/require-param': 'off',
349+
'jsdoc/check-tag-names': 'off',
350+
'jsdoc/require-returns': 'off',
351+
'jsdoc/require-property-description': 'off',
352+
'jsdoc/check-param-names': 'off',
353+
'jsdoc/tag-lines': 'off',
354+
'jsdoc/require-returns-type': 'off',
355+
'jsdoc/check-alignment': 'off',
356+
'jsdoc/require-returns-check': 'off',
357+
'jsdoc/require-param-name': 'off',
342358

343359
// Custom rules from eslint-plugin-node-core
344360
'node-core/no-unescaped-regexp-dot': 'error',

Makefile

+2-2
Original file line numberDiff line numberDiff line change
@@ -1268,7 +1268,7 @@ format-md:
12681268
LINT_JS_TARGETS = .eslintrc.js benchmark doc lib test tools
12691269

12701270
run-lint-js = tools/node_modules/eslint/bin/eslint.js --cache \
1271-
--report-unused-disable-directives $(LINT_JS_TARGETS)
1271+
--max-warnings=0 --report-unused-disable-directives $(LINT_JS_TARGETS)
12721272
run-lint-js-fix = $(run-lint-js) --fix
12731273

12741274
.PHONY: lint-js-fix
@@ -1292,7 +1292,7 @@ jslint: lint-js
12921292
$(warning Please use lint-js instead of jslint)
12931293

12941294
run-lint-js-ci = tools/node_modules/eslint/bin/eslint.js \
1295-
--report-unused-disable-directives -f tap \
1295+
--max-warnings=0 --report-unused-disable-directives -f tap \
12961296
-o test-eslint.tap $(LINT_JS_TARGETS)
12971297

12981298
.PHONY: lint-js-ci

vcbuild.bat

+1-1
Original file line numberDiff line numberDiff line change
@@ -699,7 +699,7 @@ goto lint-js
699699
if not defined lint_js goto lint-md-build
700700
if not exist tools\node_modules\eslint goto no-lint
701701
echo running lint-js
702-
%node_exe% tools\node_modules\eslint\bin\eslint.js --cache --report-unused-disable-directives --rule "linebreak-style: 0" .eslintrc.js benchmark doc lib test tools
702+
%node_exe% tools\node_modules\eslint\bin\eslint.js --cache --max-warnings=0 --report-unused-disable-directives --rule "linebreak-style: 0" .eslintrc.js benchmark doc lib test tools
703703
goto lint-md-build
704704

705705
:no-lint

0 commit comments

Comments
 (0)