From 6dae965c2d6aca0be1fc5fb2bd872fc981673298 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Wed, 1 Dec 2021 23:41:26 -0800 Subject: [PATCH 1/3] tools: use jsdoc recommended rules MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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: https://github.com/nodejs/node/pull/41057 Reviewed-By: Michaël Zasso Reviewed-By: James M Snell Reviewed-By: Ruben Bridgewater --- .eslintrc.js | 18 +++++++++++++++++- Makefile | 4 ++-- vcbuild.bat | 2 +- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 7df64d33af7871..6d9ddbf5f41b7b 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -35,6 +35,7 @@ Module._findPath = (request, paths, isMain) => { module.exports = { root: true, + extends: ['plugin:jsdoc/recommended'], plugins: ['jsdoc', 'markdown', 'node-core'], parser: '@babel/eslint-parser', parserOptions: { @@ -338,7 +339,22 @@ module.exports = { 'valid-typeof': ['error', { requireStringLiterals: true }], // JSDoc rules - 'jsdoc/check-types': 'error', + 'jsdoc/require-jsdoc': 'off', + 'jsdoc/require-param-description': 'off', + 'jsdoc/newline-after-description': 'off', + 'jsdoc/require-returns-description': 'off', + 'jsdoc/valid-types': 'off', + 'jsdoc/no-undefined-types': 'off', + 'jsdoc/require-param': 'off', + 'jsdoc/check-tag-names': 'off', + 'jsdoc/require-returns': 'off', + 'jsdoc/require-property-description': 'off', + 'jsdoc/check-param-names': 'off', + 'jsdoc/tag-lines': 'off', + 'jsdoc/require-returns-type': 'off', + 'jsdoc/check-alignment': 'off', + 'jsdoc/require-returns-check': 'off', + 'jsdoc/require-param-name': 'off', // Custom rules from eslint-plugin-node-core 'node-core/no-unescaped-regexp-dot': 'error', diff --git a/Makefile b/Makefile index be131195018fa1..827d401cbfcd26 100644 --- a/Makefile +++ b/Makefile @@ -1268,7 +1268,7 @@ format-md: LINT_JS_TARGETS = .eslintrc.js benchmark doc lib test tools run-lint-js = tools/node_modules/eslint/bin/eslint.js --cache \ - --report-unused-disable-directives $(LINT_JS_TARGETS) + --max-warnings=0 --report-unused-disable-directives $(LINT_JS_TARGETS) run-lint-js-fix = $(run-lint-js) --fix .PHONY: lint-js-fix @@ -1292,7 +1292,7 @@ jslint: lint-js $(warning Please use lint-js instead of jslint) run-lint-js-ci = tools/node_modules/eslint/bin/eslint.js \ - --report-unused-disable-directives -f tap \ + --max-warnings=0 --report-unused-disable-directives -f tap \ -o test-eslint.tap $(LINT_JS_TARGETS) .PHONY: lint-js-ci diff --git a/vcbuild.bat b/vcbuild.bat index 49a05602d6ddc1..d1a9e592551593 100644 --- a/vcbuild.bat +++ b/vcbuild.bat @@ -699,7 +699,7 @@ goto lint-js if not defined lint_js goto lint-md-build if not exist tools\node_modules\eslint goto no-lint echo running lint-js -%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 +%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 goto lint-md-build :no-lint From 87f1311b0ec6400eaf6584f77b903a1b8ce7962f Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Thu, 2 Dec 2021 00:00:53 -0800 Subject: [PATCH 2/3] test: add missing JSDoc parameter name MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/41057 Reviewed-By: Michaël Zasso Reviewed-By: James M Snell Reviewed-By: Ruben Bridgewater --- test/common/wpt.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/common/wpt.js b/test/common/wpt.js index bc6e66d75a4278..b0536f0bcc8a71 100644 --- a/test/common/wpt.js +++ b/test/common/wpt.js @@ -323,7 +323,7 @@ class WPTRunner { /** * Set the scripts modifier for each script. - * @param {(meta: { code: string, filename: string }) => void} + * @param {(meta: { code: string, filename: string }) => void} modifier */ setScriptModifier(modifier) { this.scriptsModifier = modifier; From 147d23b2116394c5ed183217723ee3025f8ef99b Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Thu, 2 Dec 2021 00:01:07 -0800 Subject: [PATCH 3/3] tools: enable jsdoc/require-param-name lint rule MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/41057 Reviewed-By: Michaël Zasso Reviewed-By: James M Snell Reviewed-By: Ruben Bridgewater --- .eslintrc.js | 1 - 1 file changed, 1 deletion(-) diff --git a/.eslintrc.js b/.eslintrc.js index 6d9ddbf5f41b7b..e3e198ab2fa6e0 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -354,7 +354,6 @@ module.exports = { 'jsdoc/require-returns-type': 'off', 'jsdoc/check-alignment': 'off', 'jsdoc/require-returns-check': 'off', - 'jsdoc/require-param-name': 'off', // Custom rules from eslint-plugin-node-core 'node-core/no-unescaped-regexp-dot': 'error',