Skip to content

Commit 6c0273a

Browse files
authored
Disable enforcing JSDoc internals for functions that do not have JSDocs (#3)
From this point on, only functions that _have_ JSDocs will have the remainder of the rules applied. Update eslint-plugin-jsdoc: ^20 --> ^29. Release version 2.1.0.
1 parent b911318 commit 6c0273a

File tree

5 files changed

+57
-44
lines changed

5 files changed

+57
-44
lines changed

demo/example.js

+4
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ no-unused-vars
1818
no-undefined
1919
*/
2020

21+
function functionWithoutJSDocWarningsBecauseTheSectionWasCompletelyExcluded (params) {
22+
}
23+
2124
/**
2225
* @description a somewhat valid description
2326
* @param {hobject} a
@@ -44,6 +47,7 @@ if (window === undefined && window === undefined && true === params) {
4447
const deprecatedImport = require('path/to/legacyModule');
4548
deprecatedImport.execute();
4649
deprecatedFunction();
50+
functionWithoutJSDocWarningsBecauseTheSectionWasCompletelyExcluded();
4751
$.each();
4852
debugger;// Make sure we get in here to set the value correctly
4953
}

demo/test/snapshots/lint-output.js.md

+41-41
Original file line numberDiff line numberDiff line change
@@ -15,47 +15,47 @@ Generated by [AVA](https://ava.li).
1515
10:8 warning it.skip not permitted no-skip-tests/no-skip-tests␊
1616
1717
example.js␊
18-
6:0 warning Inline eslint-disable found bestpractices/no-eslint-disable␊
19-
8:1 warning Unexpected 'FIXME' comment no-warning-comments␊
20-
9:1 warning Unexpected 'TODO' comment no-warning-comments␊
21-
10:1 warning Unexpected 'HACK' comment no-warning-comments␊
22-
11:1 warning Unexpected 'HERE BE DRAGONS' comment no-warning-comments␊
23-
21:1 warning Missing JSDoc block description jsdoc/require-description␊
24-
21:1 warning Missing JSDoc @param "params" declaration jsdoc/require-param␊
25-
21:1 warning JSDoc @returns declaration present but return expression not available in function jsdoc/require-returns-check␊
26-
21:1 warning JSDoc type missing brace valid-jsdoc␊
27-
23:0 warning Expected @param names to be "params". Got "a, b" jsdoc/check-param-names␊
28-
23:0 warning Missing JSDoc @param "a" description jsdoc/require-param-description␊
29-
24:0 warning Missing JSDoc @param "b" description jsdoc/require-param-description␊
30-
24:0 warning Missing JSDoc @param "b" type jsdoc/require-param-type␊
31-
25:0 warning Missing JSDoc @returns description jsdoc/require-returns-description␊
32-
25:0 warning Missing JSDoc @returns type jsdoc/require-returns-type␊
33-
30:5 warning 'myPromise' is never reassigned. Use 'const' instead prefer-const␊
34-
30:17 warning Avoid creating new promises promise/avoid-new␊
35-
32:1 warning Expected catch() or return promise/catch-or-return␊
36-
33:3 warning Each then() should return a value or throw promise/always-return␊
37-
34:5 warning Avoid wrapping return values in Promise.resolve promise/no-return-wrap␊
38-
34:29 error Missing semicolon semi␊
39-
36:5 error 'forgotToReturn' is not defined no-undef␊
40-
36:21 error Missing semicolon semi␊
41-
38:3 error Missing semicolon semi␊
42-
40:5 warning 'variable' is never reassigned. Use 'const' instead prefer-const␊
43-
40:5 error 'variable' is assigned a value but never used no-unused-vars␊
44-
40:16 warning This conditional operation returns the same value whether the condition is "true" or "false" sonarjs/no-all-duplicated-branches␊
45-
40:17 error Unexpected constant condition no-constant-condition␊
46-
40:25 error Unnecessary use of boolean literals in conditional expression no-unneeded-ternary␊
47-
42:5 warning Correct one of the identical sub-expressions on both sides of operator "&&" sonarjs/no-identical-expressions␊
48-
42:16 warning Unexpected use of undefined no-undefined␊
49-
42:40 warning Unexpected use of undefined no-undefined␊
50-
42:53 error Expected literal to be on the right side of === yoda␊
51-
42:62 error 'params' is not defined no-undef␊
52-
43:3 warning This function expects 1 argument, but 2 were provided sonarjs/no-extra-arguments␊
53-
44:28 error Module path/to/legacyModule is deprecated. Use module x instead deprecate/import␊
54-
46:3 error Function deprecatedFunction is deprecated. Use function x from package y instead deprecate/function␊
55-
46:3 error 'deprecatedFunction' is not defined no-undef␊
56-
47:3 error Member expression $.each is deprecated. Use native forEach instead deprecate/member-expression␊
57-
47:3 error '$' is not defined no-undef␊
58-
48:3 error Unexpected 'debugger' statement no-debugger␊
18+
6:0 warning Inline eslint-disable found bestpractices/no-eslint-disable␊
19+
8:1 warning Unexpected 'FIXME' comment no-warning-comments␊
20+
9:1 warning Unexpected 'TODO' comment no-warning-comments␊
21+
10:1 warning Unexpected 'HACK' comment no-warning-comments␊
22+
11:1 warning Unexpected 'HERE BE DRAGONS' comment no-warning-comments␊
23+
24:1 warning Remove the @description tag to leave a plain block description or add additional description text above the @description line jsdoc/require-description␊
24+
24:1 warning Missing JSDoc @param "params" declaration jsdoc/require-param␊
25+
24:1 warning JSDoc @returns declaration present but return expression not available in function jsdoc/require-returns-check␊
26+
24:1 warning JSDoc type missing brace valid-jsdoc␊
27+
26:0 warning Expected @param names to be "params". Got "a, b" jsdoc/check-param-names␊
28+
26:0 warning Missing JSDoc @param "a" description jsdoc/require-param-description␊
29+
27:0 warning Missing JSDoc @param "b" description jsdoc/require-param-description␊
30+
27:0 warning Missing JSDoc @param "b" type jsdoc/require-param-type␊
31+
28:0 warning Missing JSDoc @returns description jsdoc/require-returns-description␊
32+
28:0 warning Missing JSDoc @returns type jsdoc/require-returns-type␊
33+
33:5 warning 'myPromise' is never reassigned. Use 'const' instead prefer-const␊
34+
33:17 warning Avoid creating new promises promise/avoid-new␊
35+
35:1 warning Expected catch() or return promise/catch-or-return␊
36+
36:3 warning Each then() should return a value or throw promise/always-return␊
37+
37:5 warning Avoid wrapping return values in Promise.resolve promise/no-return-wrap␊
38+
37:29 error Missing semicolon semi␊
39+
39:5 error 'forgotToReturn' is not defined no-undef␊
40+
39:21 error Missing semicolon semi␊
41+
41:3 error Missing semicolon semi␊
42+
43:5 warning 'variable' is never reassigned. Use 'const' instead prefer-const␊
43+
43:5 error 'variable' is assigned a value but never used no-unused-vars␊
44+
43:16 warning This conditional operation returns the same value whether the condition is "true" or "false" sonarjs/no-all-duplicated-branches␊
45+
43:17 error Unexpected constant condition no-constant-condition␊
46+
43:25 error Unnecessary use of boolean literals in conditional expression no-unneeded-ternary␊
47+
45:5 warning Correct one of the identical sub-expressions on both sides of operator "&&" sonarjs/no-identical-expressions␊
48+
45:16 warning Unexpected use of undefined no-undefined␊
49+
45:40 warning Unexpected use of undefined no-undefined␊
50+
45:53 error Expected literal to be on the right side of === yoda␊
51+
45:62 error 'params' is not defined no-undef␊
52+
46:3 warning This function expects 1 argument, but 2 were provided sonarjs/no-extra-arguments␊
53+
47:28 error Module path/to/legacyModule is deprecated. Use module x instead deprecate/import␊
54+
49:3 error Function deprecatedFunction is deprecated. Use function x from package y instead deprecate/function␊
55+
49:3 error 'deprecatedFunction' is not defined no-undef␊
56+
51:3 error Member expression $.each is deprecated. Use native forEach instead deprecate/member-expression␊
57+
51:3 error '$' is not defined no-undef␊
58+
52:3 error Unexpected 'debugger' statement no-debugger␊
5959
6060
/Users/clif/sandbox/frontier/common/eslint-config-tree/index.js␊
6161
52:0 warning Invalid JSDoc tag name "note" jsdoc/check-tag-names␊
60 Bytes
Binary file not shown.

index.js

+10-1
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,17 @@ module.exports = {
6767
* @property {object} rules - Tree custom rule and additional linter configuration.
6868
*/
6969
rules: {
70+
'jsdoc/check-access': 'off',
7071
'jsdoc/check-alignment': 'warn',
7172
'jsdoc/check-examples': 'warn',
7273
'jsdoc/check-indentation': 'off',
7374
'jsdoc/check-param-names': 'warn',
75+
'jsdoc/check-property-names': 'warn',
7476
'jsdoc/check-syntax': 'warn',
7577
'jsdoc/check-tag-names': 'warn',
7678
'jsdoc/check-types': 'warn',
79+
'jsdoc/check-values': 'warn',
80+
'jsdoc/empty-tags': 'warn',
7781
'jsdoc/implements-on-classes': 'warn',
7882
'jsdoc/match-description': 'warn',
7983
'jsdoc/newline-after-description': 'off',
@@ -85,15 +89,20 @@ module.exports = {
8589
'jsdoc/require-example': 'off',
8690
'jsdoc/require-file-overview': 'off',
8791
'jsdoc/require-hyphen-before-param-description': 'warn',
88-
'jsdoc/require-jsdoc': 'warn',
92+
'jsdoc/require-jsdoc': 'off',
8993
'jsdoc/require-param-description': 'warn',
9094
'jsdoc/require-param-name': 'warn',
9195
'jsdoc/require-param-type': 'warn',
9296
'jsdoc/require-param': 'warn',
97+
'jsdoc/require-property-description': 'warn',
98+
'jsdoc/require-property-name': 'warn',
99+
'jsdoc/require-property-type': 'warn',
100+
'jsdoc/require-property': 'warn',
93101
'jsdoc/require-returns-check': 'warn',
94102
'jsdoc/require-returns-description': 'warn',
95103
'jsdoc/require-returns-type': 'warn',
96104
'jsdoc/require-returns': 'warn',
105+
'jsdoc/require-throws': 'off',
97106
'jsdoc/valid-types': 'warn',
98107

99108
'json/undefined': 'error',

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "eslint-config-tree",
3-
"version": "2.0.8",
3+
"version": "2.1.0",
44
"description": "Shared Tree configuration that contains overrides and enhancements on top of the base frontier configuration.",
55
"main": "index.js",
66
"repository": {
@@ -30,7 +30,7 @@
3030
"eslint-plugin-deprecate": "^0.5",
3131
"eslint-plugin-html": "^6",
3232
"eslint-plugin-import": "^2",
33-
"eslint-plugin-jsdoc": "^20",
33+
"eslint-plugin-jsdoc": "^29",
3434
"eslint-plugin-json": "^2",
3535
"eslint-plugin-no-only-tests": "^2",
3636
"eslint-plugin-no-skip-tests": "^1",

0 commit comments

Comments
 (0)